/// <summary> /// Shows settings menu /// </summary> static void mnuSettings_Click(object sender, EventArgs e) { Task task = new Task(() => { // frmInput LoginDialog = new frmInput(); LoginDialog.ShowDialog(); ReadFile(); frmMain form = new frmMain(); (form.Hours, form.Minutes) = stoper.GetTimeSeparate(); (form.Login, form.Password, form.ConfirmPassword) = stoper.GetLoginAndPassword(); if (LoginDialog.DialogResult == DialogResult.OK && LoginDialog.Login == stoper.Login && LoginDialog.Password == stoper.Password) { form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { if (form.Password == form.ConfirmPassword) { stoper.Parse((int)form.Hours, (int)form.Minutes); stoper.Login = form.Login; stoper.Password = form.Password; SaveFile(); } } } }); task.Start(); }
static void mnuStart_Click(object sender, EventArgs e) { ReadFile(); frmInput LoginDialog = new frmInput(); if (LoginDialog.ShowDialog() == DialogResult.OK && LoginDialog.Login == stoper.Login && LoginDialog.Password == stoper.Password) { timer = new System.Threading.Timer(TimerCallbackFunc, null, 0, 60000); } }
static void mnuExit_Click(object sender, EventArgs e) { Task task = new Task(() => { frmInput LoginDialog = new frmInput(); LoginDialog.ShowDialog(); if (LoginDialog.DialogResult == DialogResult.OK && LoginDialog.Login == stoper.Login && LoginDialog.Password == stoper.Password) { Application.Exit(); } }); task.Start(); }