private void giveupPlant_Click(object sender, RoutedEventArgs e) { if (curPlant == null) { throw new Exception("pausePlant_Click fail, curPlant is nil."); } if (curPlant.State == TOMATO_PLANT_STATE.Growing) { TomatoMgr.TomatoMgrPuase = true; var result = MessageBox.Show(this, Properties.Resources.GiveupTipCaption, Properties.Resources.GiveupTipContent, MessageBoxButton.YesNo); TomatoMgr.TomatoMgrPuase = false; if (result == MessageBoxResult.Yes) { string reason; var inputResult = InputMessageBox.Show(Properties.Resources.GiveupTipInputCaption, Properties.Resources.GiveupTipInputContent, out reason); curPlant.Giveup(reason); RemoveTomatoPlant(curPlant); this.Close(); } } else { RemoveTomatoPlant(curPlant); this.Close(); } }
private void pausePlant_Click(object sender, RoutedEventArgs e) { if (curPlant == null) { throw new Exception("pausePlant_Click fail, curPlant is nil."); } if (curPlant.State == TOMATO_PLANT_STATE.Growing) { string pauseReason; var result = InputMessageBox.Show(Properties.Resources.PausePlantTipCaption, Properties.Resources.PausePlantTipContent, out pauseReason); if (result.HasValue && result.Value) { curPlant.Pause(pauseReason); SwitchPauseView(); } } }