コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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();
        }