Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        public static bool?Show(string caption, string tip, out string input)
        {
            TomatoMgr.TomatoMgrPuase = true;

            var inputBox = new InputMessageBox();

            inputBox.Title            = caption;
            inputBox.inputTip.Content = tip;
            var result = inputBox.ShowDialog();

            input = inputBox.InputContent;

            TomatoMgr.TomatoMgrPuase = false;

            return(result);
        }
Exemplo n.º 3
0
        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();
                }
            }
        }