private void BtnDefault_Click(object sender, EventArgs e) { var result = MessageBox.Show($"Вы уверены, что хотите сбросить программу?\nВся ваша статистика будет утеряна!", "Вы уверены?", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { FileManagement.ResetProgram(); } }
private void BtnAccept_Click(object sender, EventArgs e) { string sleepHrBegin = FormatLines.ShortFormatTime(MTBSleepBegin.Text); string sleepHrEnd = FormatLines.ShortFormatTime(MTBSleepEnd.Text); string motivHints = ChBMotivHints.Checked == true ? "1" : "0"; string closeGames = ChBCloseGames.Checked == true ? "1" : "0"; string hrsToCloseGame = TBHrsToStopGms.Text; FileManagement.FillCommonFile(TBGetStatsHrs.Text, TBFunHrsPerWeek.Text, sleepHrBegin, sleepHrEnd, TBHrsToRest.Text, //обновление настроек TBHrsToWork.Text, motivHints, closeGames, hrsToCloseGame); BtnBack_Click(null, null); }
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(); } }
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(); }