Skip to content

Commit

Permalink
adds config for day start hour
Browse files Browse the repository at this point in the history
  • Loading branch information
Toumash committed Mar 11, 2019
1 parent a2d5690 commit aec420b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions DailyStatus.UI/ViewModel/StatusViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,24 @@ public List<MenuItem> 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;
Expand All @@ -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()
{
Expand Down

0 comments on commit aec420b

Please sign in to comment.