public static void ShowTomato(string goalString) { if (TomatoBox.ActiveBox != null) { HelperDialog.ShowWarningDialog($"Уже активна другая задача [{TomatoBox.ActiveBox?.Pomodoro?.Goal}]", "Запущена другая задача!"); return; } TomatoBox box = new TomatoBox(goalString); //Button acceptBtn = new Button(); //acceptBtn.Click += delegate(object sender, EventArgs args) //{ // box.CloseForm(); //}; //Button declineBtn = new Button(); //declineBtn.Click += delegate(object sender, EventArgs args) { box.CloseForm(); }; //box.AcceptButton = acceptBtn; //box.CancelButton = declineBtn; box.ShowInTaskbar = false; TomatoBox.ActiveBox = box; box.ShowDialog(); //box.Show(); }
private void CloseForm() { TomatoBox.ActiveBox = null; this.Close(); this.Dispose(); }