private void InitTimes(List <DateTime> startEnd) { StackPanel.Children.Clear(); double totalHours = TimeServer.DecToQuarter(DataBaseManager.Instance.HoursInRange(startEnd[0], startEnd[1]).TotalHours); if (DateTimeFormatInfo.CurrentInfo != null) { WpfWeekViewBar weekViewBar = new WpfWeekViewBar(startEnd[0], totalHours); weekViewBar.DeleteWeekEvent += OnDeleteWeek; weekViewBar.EmailWeekEvent += HtmlTimeReporter.OnEmailWeek; weekViewBar.PreviewWeekEvent += HtmlTimeReporter.OnPreviewWeek; StackPanel.Children.Add(weekViewBar); } Day prev = new Day(new DateTime(2001, 1, 1)); foreach (Day day in DataBaseManager.Instance.DaysInRange(startEnd[0], startEnd[1])) { WpfDayViewBar datevViewBar = new WpfDayViewBar(day); datevViewBar.DayClickEvent += OnDateViewClick; datevViewBar.DeleteDayEvent += OnDeleteDayClick; StackPanel.Children.Add(datevViewBar); foreach (Time time in day.Times) { WpfTimeViewBar timeView = new WpfTimeViewBar(time, _24Hour); timeView.TimeDeleteEvent += TimeDeleteTime; timeView.TimeClickEvent += TimeViewTimeClick; StackPanel.Children.Add(timeView); } prev = day; } TotalTime.Content = totalHours; }
private void TimeViewTimeClick(WpfTimeViewBar viewBar) { string prevKey = viewBar.GetKey(); WpfTimeEdit timeEdit = new WpfTimeEdit(viewBar.GetTime()); var result = timeEdit.ShowDialog(); if (result.HasValue && result.Value) { DataBaseManager.Instance.UpdateTime(prevKey, timeEdit.Time); } InitTimes(TimeServer.StartEndWeek(_baseDate)); }