Skip to content

Commit 77f8a8e

Browse files
committed
Use direct property to allow calling onPropertyChanged
Remove default value initialization
1 parent a0011db commit 77f8a8e

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public bool HideNotifyIcon
9797
public bool RememberLastLaunchLocation { get; set; }
9898
public bool IgnoreHotkeysOnFullscreen { get; set; }
9999

100-
public bool AutoHideScrollBar { get; set; } = false;
100+
public bool AutoHideScrollBar { get; set; }
101101

102102
public HttpProxy Proxy { get; set; } = new HttpProxy();
103103

Flow.Launcher/SettingWindow.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
<TabControl Height="auto" SelectedIndex="0">
3838
<TabItem Header="{DynamicResource general}">
39-
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="{Binding Settings.AutoHideScrollBar}" Margin="60,30,0,30">
39+
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="{Binding AutoHideScrollBar, Mode=OneWay}" Margin="60,30,0,30">
4040
<StackPanel Orientation="Vertical">
4141
<ui:ToggleSwitch Margin="10" IsOn="{Binding PortableMode}">
4242
<TextBlock Text="{DynamicResource portableMode}" />
@@ -67,7 +67,7 @@
6767
ToolTip="{DynamicResource ShouldUsePinyinToolTip}">
6868
<TextBlock Text="{DynamicResource ShouldUsePinyin}" />
6969
</CheckBox>
70-
<ui:ToggleSwitch Margin="10" IsOn="{Binding AutoHideScrollBar}"
70+
<ui:ToggleSwitch Margin="10" IsOn="{Binding AutoHideScrollBar, Mode=TwoWay}"
7171
ToolTip="{DynamicResource autoHideScrollBarToolTip}">
7272
<TextBlock Text="{DynamicResource autoHideScrollBar}" />
7373
</ui:ToggleSwitch>
@@ -117,7 +117,7 @@
117117
</TextBlock>
118118
<ListBox SelectedIndex="0" SelectedItem="{Binding SelectedPlugin}"
119119
ItemsSource="{Binding PluginViewModels}"
120-
Margin="10, 0, 10, 10" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ui:ScrollViewerHelper.AutoHideScrollBars="{Binding Settings.AutoHideScrollBar}">
120+
Margin="10, 0, 10, 10" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ui:ScrollViewerHelper.AutoHideScrollBars="{Binding AutoHideScrollBar, Mode=OneWay}">
121121
<ListBox.ItemTemplate>
122122
<DataTemplate>
123123
<StackPanel Orientation="Horizontal" Margin="3">

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,8 @@ public bool AutoUpdates
6363

6464
public bool AutoHideScrollBar
6565
{
66-
get
67-
{
68-
return Settings.AutoHideScrollBar;
69-
}
70-
set
71-
{
72-
Settings.AutoHideScrollBar = value;
73-
}
66+
get => Settings.AutoHideScrollBar;
67+
set => Settings.AutoHideScrollBar = value;
7468
}
7569

7670
// This is only required to set at startup. When portable mode enabled/disabled a restart is always required
@@ -150,11 +144,11 @@ public string Language
150144

151145
public bool ShouldUsePinyin
152146
{
153-
get
147+
get
154148
{
155-
return Settings.ShouldUsePinyin;
149+
return Settings.ShouldUsePinyin;
156150
}
157-
set
151+
set
158152
{
159153
Settings.ShouldUsePinyin = value;
160154
}
@@ -193,7 +187,7 @@ public string TestProxy()
193187
}
194188

195189
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_updater.GitHubRepository);
196-
190+
197191
if (string.IsNullOrEmpty(proxyUserName) || string.IsNullOrEmpty(Settings.Proxy.Password))
198192
{
199193
request.Proxy = new WebProxy(proxyServer, Settings.Proxy.Port);
@@ -237,7 +231,7 @@ public IList<PluginViewModel> PluginViewModels
237231
var metadatas = PluginManager.AllPlugins
238232
.OrderBy(x => x.Metadata.Disabled)
239233
.ThenBy(y => y.Metadata.Name)
240-
.Select(p => new PluginViewModel { PluginPair = p})
234+
.Select(p => new PluginViewModel { PluginPair = p })
241235
.ToList();
242236
return metadatas;
243237
}
@@ -465,7 +459,7 @@ public FamilyTypeface SelectedResultFontFaces
465459
#region about
466460

467461
public string Website => Constant.Website;
468-
public string ReleaseNotes => _updater.GitHubRepository + @"/releases/latest";
462+
public string ReleaseNotes => _updater.GitHubRepository + @"/releases/latest";
469463
public string Documentation => Constant.Documentation;
470464
public static string Version => Constant.Version;
471465
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);

0 commit comments

Comments
 (0)