public void SwitchToStatisticPage() { if (statisticPage == null) { statisticPage = new StatisticPage(this); } mainFrame.Navigate(statisticPage); }
private void onClickTakeNewCustomDate(object sender, RoutedEventArgs e) { if (CustomDate.Show() == Dialogs.CustomDefaultDialog.DialogResult.Ok) { ItemCustom = Client.Server.ConnectProvider.SendStatInfo( CustomDate.GetStartDate(), CustomDate.GetFinalDate() ); label_CustomDate.Text = $"{ItemCustom.StartDate.ToShortDateString()} - {ItemCustom.FinalDate.ToShortDateString()}"; SetStatInfo(ItemCustom); DeactiveActiveButton(); this.Page = StatisticPage.Custom; ActiveDeactiveButton(); } }
void BtnRedirectEvent(int thisIndex, int lastIndex) { if (optionBtn[thisIndex].Normalcolor != Color.FromArgb(65, 62, 83)) { List <string> pageName = new List <string> { "DashboardPg", "productTypePg", "BillMngPg", "StatisticPg" }; optionBtn[thisIndex].Active = true; optionBtn[thisIndex].Normalcolor = Color.FromArgb(65, 62, 83); optionBtn[lastIndex].Active = false; optionBtn[lastIndex].Normalcolor = Color.FromArgb(11, 7, 17); activeBar.Top = optionBtn[thisIndex].Top; activeBar.BringToFront(); bunifuPages1.PageName = pageName[thisIndex]; switch (thisIndex) { case 0: dasboardTemplate = new DashboardPage(); DashboardPg.Controls.Add(dasboardTemplate); break; case 1: productTypeTemplate = new ProductTypePage(); productTypePg.Controls.Add(productTypeTemplate); break; case 2: billTemplate = new BillPage(); BillMngPg.Controls.Add(billTemplate); break; case 3: statisticTemplate = new StatisticPage(); StatisticPg.Controls.Add(statisticTemplate); break; } switch (lastIndex) { case 0: DashboardPg.Controls.Remove(dasboardTemplate); dasboardTemplate.Dispose(); break; case 1: productTypePg.Controls.Remove(productTypeTemplate); productTypeTemplate.Dispose(); break; case 2: BillMngPg.Controls.Remove(billTemplate); billTemplate.Dispose(); break; case 3: StatisticPg.Controls.Remove(statisticTemplate); statisticTemplate.Dispose(); break; } } }
public void OnStatisticPage(object sender, EventArgs args) { MainPage = new StatisticPage(); }
public void SetStatisticPage(StatisticPage Page) { if (this.Page == Page) { return; } if (Page == StatisticPage.Year) { if (ItemYear == null) { ItemYear = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-365), DateTime.Now); ItemYearUpdate = DateTime.Now; } else { if (DateTime.Now > ItemYearUpdate.AddMinutes(10)) { ItemYear = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-365), DateTime.Now); ItemYearUpdate = DateTime.Now; } } label_YearDate.Text = $"{ItemYear.StartDate.ToShortDateString()} - {ItemYear.FinalDate.ToShortDateString()}"; SetStatInfo(ItemYear); } if (Page == StatisticPage.Month) { if (ItemMonth == null) { ItemMonth = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-30), DateTime.Now); ItemMonthUpdate = DateTime.Now; } else { if (DateTime.Now > ItemMonthUpdate.AddMinutes(10)) { ItemMonth = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-30), DateTime.Now); ItemMonthUpdate = DateTime.Now; } } label_MonthDate.Text = $"{ItemMonth.StartDate.ToShortDateString()} - {ItemMonth.FinalDate.ToShortDateString()}"; SetStatInfo(ItemMonth); } if (Page == StatisticPage.Week) { if (ItemWeek == null) { ItemWeek = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-7), DateTime.Now); ItemWeekUpdate = DateTime.Now; } else { if (DateTime.Now > ItemWeekUpdate.AddMinutes(10)) { ItemWeek = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-7), DateTime.Now); ItemWeekUpdate = DateTime.Now; } } label_WeekDate.Text = $"{ItemWeek.StartDate.ToShortDateString()} - {ItemWeek.FinalDate.ToShortDateString()}"; SetStatInfo(ItemWeek); } if (Page == StatisticPage.Day) { if (ItemDay == null) { ItemDay = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-1), DateTime.Now); ItemDayUpdate = DateTime.Now; } else { if (DateTime.Now > ItemDayUpdate.AddMinutes(10)) { ItemDay = Client.Server.ConnectProvider.SendStatInfo(DateTime.Now.AddDays(-1), DateTime.Now); ItemDayUpdate = DateTime.Now; } } label_DayDate.Text = $"{ItemDay.StartDate.ToShortDateString()} - {ItemDay.FinalDate.ToShortDateString()}"; SetStatInfo(ItemDay); } if (Page == StatisticPage.Custom) { if (ItemCustom == null) { if (CustomDate.Show() == Dialogs.CustomDefaultDialog.DialogResult.Ok) { ItemCustom = Client.Server.ConnectProvider.SendStatInfo( CustomDate.GetStartDate(), CustomDate.GetFinalDate() ); } else { return; } } label_CustomDate.Text = $"{ItemCustom.StartDate.ToShortDateString()} - {ItemCustom.FinalDate.ToShortDateString()}"; SetStatInfo(ItemCustom); } DeactiveActiveButton(); this.Page = Page; ActiveDeactiveButton(); }