Ejemplo n.º 1
0
 private void button2_Click(object sender, EventArgs e) =>
 ShutdownProcess.Stop();
Ejemplo n.º 2
0
        /// <summary>
        /// Action button click even handler.
        /// </summary>
        /// <param name="sender">The sender object of the evet.</param>
        /// <param name="e">The even arguments passed in from an action.</param>
        private void BtnActionClick(object sender , RoutedEventArgs e)
        {
            /*
             * Shutting down state is switched. The foreground is the appropriately chosen based on the state.
             * Perform the appropriate actions based on the shutdown state.
             */
            this.IsShuttingDown = !IsShuttingDown;
            this.SetActionButtonForeground();
            if(this.IsShuttingDown) {
                this.ShutdownProcess = new ShutdownProcess {
                    Option = (ShutdownOptions) this.CbShutdownOptions.SelectedItem ,
                    Time = new Time {
                        Hours = short.Parse(this.TbHours.Text) ,
                        Minutes = short.Parse(this.TbMinutes.Text) ,
                        Seconds = short.Parse(this.TbSeconds.Text)
                    }
                };

                this.ShutdownTimer.Start();
                this.ShutdownProcess.Start();
                this.PbShutdown.Maximum = 100;
                this.PbShutdown.Value = 100;
            }
            else { this.Resetvalues(); }
        }