From aec420bd160f262093da6e81fe9faed35a1216cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20D=C5=82uski?= Date: Tue, 12 Mar 2019 00:11:47 +0100 Subject: [PATCH] adds config for day start hour --- DailyStatus.UI/ViewModel/StatusViewModel.cs | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/DailyStatus.UI/ViewModel/StatusViewModel.cs b/DailyStatus.UI/ViewModel/StatusViewModel.cs index e2e2def..328a95a 100644 --- a/DailyStatus.UI/ViewModel/StatusViewModel.cs +++ b/DailyStatus.UI/ViewModel/StatusViewModel.cs @@ -316,6 +316,24 @@ public List ContextMenu HoursADay = (int)newHoursADayValue; }) }); + items.Add(new MenuItem() + { + Header = "Hour of start: " + cfg.WorkDayStartHour, + Command = new RelayCommand((_) => + { + var prompt = new DecimalPrompt + { + Owner = this.Window, + Value = cfg.WorkDayStartHour, + WindowTitle = "Day starts at", + WindowPrompt = "Day start at x hour: " + }; + + prompt.ShowDialog(); + var newDayStartHour = prompt.Value; + WorkDayStartHour = (int)newDayStartHour; + }) + }); items.Add(new MenuItem() { Header = "Minimize", Command = new RelayCommand((_) => WindowState = WindowState.Minimized) }); items.Add(new MenuItem() { Header = "Close", Command = CloseCommand }); return items; @@ -334,6 +352,18 @@ public WindowState WindowState } public Window Window { get; } + public int WorkDayStartHour + { + get { return cfg.WorkDayStartHour; } + set + { + cfg.WorkDayStartHour = value; + SaveSettings(); + this.NotifyPropertyChanged(nameof(WorkDayStartHour)); + this.NotifyPropertyChanged(nameof(ContextMenu)); + } + } + void Init() {