[Samples] applied fix proposal
This commit is contained in:
parent
ed53817b99
commit
ff82c2ab4a
3 changed files with 15 additions and 63 deletions
|
@ -25,51 +25,4 @@
|
|||
<ProjectReference Include="..\Libs\GtkSharp\GtkSharp.csproj" />
|
||||
<ProjectReference Include="..\Libs\PangoSharp\PangoSharp.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Sections\Category.cs">
|
||||
<LogicalName>GtkSharp.Samples.Category.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\ListSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.ListSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\SectionAttribute.cs">
|
||||
<LogicalName>GtkSharp.Samples.SectionAttribute.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Dialogs\AboutDialogSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.AboutDialogSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\ButtonSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.ButtonSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\ColorButtonSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.ColorButtonSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\EntrySection.cs">
|
||||
<LogicalName>GtkSharp.Samples.EntrySection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\LabelSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.LabelSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\LevelBarSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.LevelBarSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\LinkButtonSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.LinkButtonSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\ProgressBarSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.ProgressBarSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\SpinButtonSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.SpinButtonSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\SpinnerSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.SpinnerSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\SwitchSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.SwitchSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Sections\Widgets\ToggleButtonSection.cs">
|
||||
<LogicalName>GtkSharp.Samples.ToggleButtonSection.cs</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -129,27 +129,26 @@ namespace Samples
|
|||
|
||||
// lets override the default match function so we can use the contains mode
|
||||
// instead of the default startswith
|
||||
completion.MatchFunc = EntryCompletionMatchFunc;
|
||||
completion.MatchFunc = (EntryCompletion comp, string key, TreeIter iter) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
return false;
|
||||
|
||||
var o = comp.Model.GetValue(iter, 0);
|
||||
var stringToSearch = o as string;
|
||||
|
||||
if (!string.IsNullOrEmpty(stringToSearch))
|
||||
return stringToSearch.IndexOf(key, System.StringComparison.InvariantCultureIgnoreCase) >= 0;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
completion.TextColumn = 0;
|
||||
|
||||
|
||||
return ("Completion Entry:",entry);
|
||||
}
|
||||
|
||||
private bool EntryCompletionMatchFunc(EntryCompletion completion, string key, TreeIter iter)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
return false;
|
||||
|
||||
var o = completion.Model.GetValue(iter, 0);
|
||||
var stringToSearch = o as string;
|
||||
|
||||
if (!string.IsNullOrEmpty(stringToSearch))
|
||||
return stringToSearch.IndexOf(key, System.StringComparison.InvariantCultureIgnoreCase) >= 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public (string, Widget) CreateInsensitiveEntry()
|
||||
{
|
||||
var entry = new Entry();
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Samples
|
|||
|
||||
public (string, Widget) CreatePulseProgressBar()
|
||||
{
|
||||
// this is used when application cant report progress
|
||||
// this is used when application can't report progress
|
||||
|
||||
var pb = new ProgressBar();
|
||||
|
||||
|
|
Loading…
Reference in a new issue