Esempio n. 1
0
        private void startButton_Click(object sender , EventArgs e)
        {
            this.ShutdownProcess = this.CreateProcess();

            if(this.ShutdownProcess != null) {

                ShutdownProcess.Start();
                this.LblTimeLeft.Text = this.ShutdownProcess.Time.ToString();

                tmrShutdown.Enabled = true;
                tmrShutdown.Start();

                this.BtnAbort.Enabled = true;
                this.BtnStart.Enabled = false;
            }
            else this.TbSetTimeText.Text = DEFAULT_TIME;
        }
Esempio n. 2
0
        private ShutdownProcess CreateProcess()
        {
            ShutdownProcess process = null;

            try {
                process = new ShutdownProcess() {

                    Option = this.CheckBoxHybrid.Checked ? ShutdownOptions.Hybrid : (ShutdownOptions) this.ComboBoxOptions.SelectedIndex ,
                    TimeUnit = (TimeUnits) this.ComboBoxTime.SelectedIndex ,
                    Time = Convert.ToDouble(this.TbSetTimeText.Text)
                };
            }
            catch(Exception) {
                MessageBox.Show("Could not create shutdown process.");
            }

            return process != null ? process : null;
        }