Esempio n. 1
0
        private void TimerHour_Tick(object sender, EventArgs e)
        {
            const int interval60Mins = 60 * 60 * 1000;

            TimerHour.Interval = interval60Mins;
            tray.ScheduleBeginMessage();

            FileManagement.CheckAllFiles();
            CurrentDateInfo.CheckWeekRelevance();
            if (StatsManagement.CheckIsHourAvailable())
            {
                ShowQuest();
            }
            if (UserSettings.StopGames == true)
            {
                UserSettings.CloseGame();
            }
            if (DateTime.Now.Hour <= 1)
            {
                achiveNoFunAllDay.CheckCondition();
                achiveNoRestWholeDay.CheckCondition();
            }
        }
Esempio n. 2
0
        private void MainMenu_Load(object sender, EventArgs e)
        {
            const int miliseconds = 1000;
            const int minutes     = 60;
            int       interval;

            FileManagement.CheckAllFiles();
            CurrentDateInfo.CheckWeekRelevance();
            StatsManagement.WriteHoursFromSchedule();
            MenuManagement.AreAllFormsClosed = false;
            tray = new Tray(this.TrayIcon);

            tray.ProductiveMessage();
            _mainMenu = this;

            FillDaysOfWeek();
            DataGridDayOfWeek_CellClick(null, null);
            DataGridBusiness.CurrentCell = DataGridBusiness[DateTime.Now.Hour - 1, 0];
            DataGridBusiness_CellClick(null, null);

            DateTime dateTime1 = new DateTime();   //"будильник" на вызов формы в ближайшие "00" минут

            dateTime1 = DateTime.Now;
            dateTime1 = dateTime1.AddHours(1).AddMinutes(-dateTime1.Minute);
            interval  = dateTime1.Subtract(DateTime.Now).Minutes *minutes *miliseconds;

            TimerHour.Interval = interval == 0 ? 1 : interval;
            if (StatsManagement.CheckIsHourAvailable())
            {
                ShowQuest();
            }

            achiveNoFunAllDay.CheckCondition();
            achiveNoRestWholeDay.CheckCondition();
            SetFormDesign();
        }