private void InitualizeView() { StackPanel.Children.Clear(); var a = TimeServer.StartEndWeek(_currentDate)[0]; var b = TimeServer.StartEndWeek(_currentDate)[1]; double hoursInWeek = DataBaseManager.Instance.HoursInRange(a, b).TotalHours; WpfWeekViewBar weekViewBar = new WpfWeekViewBar(a, TimeServer.DecToQuarter(hoursInWeek)) { Deletable = false }; weekViewBar.EmailWeekEvent += HtmlTimeReporter.OnEmailWeek; weekViewBar.PreviewWeekEvent += HtmlTimeReporter.OnPreviewWeek; StackPanel.Children.Add(weekViewBar); foreach (Day day in DataBaseManager.Instance.DaysInRange(a, b)) { WpfDayViewBar datevViewBar = new WpfDayViewBar(day) { Deletable = false }; datevViewBar.DayClickEvent += OnDateViewDayClick; StackPanel.Children.Add(datevViewBar); } ScrollViewer.ScrollToBottom(); btn_SelectedUser.Content = TimeServer.SqlCurrentUser; }
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; }