Skip to content

Commit 8159b6e

Browse files
auto update value string in index setter
1 parent a70b9fc commit 8159b6e

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
5555
// TODO: CurrentCulture may equal to settings.language when this is constructed
5656
TimeFormatDisplayList = TimeFormatList.Select(x => DateTime.Now.ToString(x, CultureInfo.CurrentCulture)).ToList();
5757
DateFormatDisplayList = DateFormatList.Select(x => DateTime.Now.ToString(x, CultureInfo.CurrentCulture)).ToList();
58-
UpdateSettingsDateTimeFormat(); // just in case something wrong
58+
//UpdateSettingsDateTimeFormat(); // just in case something wrong
5959
}
6060

6161
public Settings Settings { get; set; }
@@ -64,7 +64,7 @@ public async void UpdateApp()
6464
{
6565
await _updater.UpdateAppAsync(App.API, false);
6666
}
67-
67+
6868
public bool AutoUpdates
6969
{
7070
get => Settings.AutoUpdates;
@@ -310,11 +310,11 @@ public IList<PluginStoreItemViewModel> ExternalPlugins
310310
}
311311
}
312312

313-
private IList<PluginStoreItemViewModel> LabelMaker(IList<UserPlugin> list)
313+
private IList<PluginStoreItemViewModel> LabelMaker(IList<UserPlugin> list)
314314
{
315-
return list.Select(p=>new PluginStoreItemViewModel(p))
315+
return list.Select(p => new PluginStoreItemViewModel(p))
316316
.OrderByDescending(p => p.Category == PluginStoreItemViewModel.NewRelease)
317-
.ThenByDescending(p=>p.Category == PluginStoreItemViewModel.RecentlyUpdated)
317+
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.RecentlyUpdated)
318318
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.None)
319319
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.Installed)
320320
.ToList();
@@ -348,10 +348,10 @@ private async Task RefreshExternalPluginsAsync()
348348

349349
internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0)
350350
{
351-
var actionKeyword = plugin.Metadata.ActionKeywords.Count == 0
352-
? string.Empty
351+
var actionKeyword = plugin.Metadata.ActionKeywords.Count == 0
352+
? string.Empty
353353
: plugin.Metadata.ActionKeywords[actionKeywordPosition];
354-
354+
355355
App.API.ChangeQuery($"{actionKeyword} {queryToDisplay}");
356356
App.API.ShowMainWindow();
357357
}
@@ -476,9 +476,27 @@ public List<SearchWindowPosition> SearchWindowPositions
476476
"dd', 'MMMM"
477477
};
478478

479-
public int TimeFormatIndex { get; set; } = 0;
479+
private int timeFormatIndex = 0;
480+
public int TimeFormatIndex
481+
{
482+
get => timeFormatIndex;
483+
set
484+
{
485+
timeFormatIndex = value;
486+
Settings.TimeFormat = TimeFormatList[TimeFormatIndex];
487+
}
488+
}
480489

481-
public int DateFormatIndex { get; set; } = 0;
490+
private int dateFormatIndex = 0;
491+
public int DateFormatIndex
492+
{
493+
get => dateFormatIndex;
494+
set
495+
{
496+
dateFormatIndex = value;
497+
Settings.DateFormat = DateFormatList[DateFormatIndex];
498+
}
499+
}
482500

483501
public List<string> TimeFormatDisplayList { get; set; } = null;
484502

@@ -505,7 +523,7 @@ public void UpdateDateTimeDisplayList(int dateIndex, int timeIndex)
505523
DateFormatDisplayList[i] = DateTime.Now.ToString(DateFormatList[i], CultureInfo.CurrentCulture);
506524
}
507525

508-
UpdateSettingsDateTimeFormat();
526+
//UpdateSettingsDateTimeFormat();
509527
}
510528

511529
public double WindowWidthSize
@@ -815,15 +833,15 @@ public string Version
815833
}
816834
}
817835
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
818-
836+
819837
public string CheckLogFolder
820838
{
821-
get
839+
get
822840
{
823841
var dirInfo = new DirectoryInfo(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version));
824842
long size = dirInfo.EnumerateFiles("*", SearchOption.AllDirectories).Sum(file => file.Length);
825-
826-
return _translater.GetTranslation("clearlogfolder") + " (" + FormatBytes(size) + ")" ;
843+
844+
return _translater.GetTranslation("clearlogfolder") + " (" + FormatBytes(size) + ")";
827845
}
828846
}
829847

0 commit comments

Comments
 (0)