/// <summary> /// Restart the experiment /// </summary> /// <param name="currentExperimentType"></param> /// <param name="playAndPauseButton"></param> /// <param name="currentProgressBar"></param> private void HandleRestartExperiment(ExperimentType currentExperimentType, Button playAndPauseButton, KryptonProgressBar currentProgressBar ) { DialogResult messageBoxResult = MessageBox.Show("Are you sure to restart the simulation?", "Restart Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); // Confirm before stopping the experiment if (messageBoxResult == DialogResult.Yes) { isExperimentComplete = true; isExperimentRunning = false; // Cancel the asynchronous operation. //Stop backgroundWorkers if (currentExperimentType == ExperimentType.ActiveLearning) { this.backgroundWorkerForSimulation.CancelAsync(); this.backgroundWorkerForAccuracyGraph.CancelAsync(); ActiveLearning.isExperimentCompleted = true; } else if (currentExperimentType == ExperimentType.BatchRunning) { this.backgroundWorkerBatchRunning.CancelAsync(); } //Show Stopped message on the progress bar currentProgressBar.DisplayText = "Simulation Stopped"; //initialTheExperiment and pop up the experimentSettingForm = new FormExperimentSetting(currentExperimentType); experimentSettingForm.setPreviousExperimentSetting(currentExperimentSetting); //enable the FormActiveLearningSetting window always on the top experimentSettingForm.Owner = this; experimentSettingForm.Show(); resetDataGridView(); return; } }
/// <summary> /// Handle Stop Button Event /// </summary> /// <param name="currentExperimentType"></param> /// <param name="playAndPauseButton"></param> /// <param name="currentProgressBar"></param> private void HandleStopButton(ExperimentType currentExperimentType, Button playAndPauseButton, KryptonProgressBar currentProgressBar ) { DialogResult messageBoxResult = MessageBox.Show("Are you sure? The simulation will be stopped.", "Stop Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); // Confirm before stopping the experiment if (messageBoxResult == DialogResult.Yes) { isExperimentComplete = true; isExperimentRunning = false; // Cancel the asynchronous operation. //Stop backgroundWorkers if it is the ActiveLearning Experiment if (currentExperimentType == ExperimentType.ActiveLearning) { this.backgroundWorkerForSimulation.CancelAsync(); this.backgroundWorkerForAccuracyGraph.CancelAsync(); ActiveLearning.isExperimentCompleted = true; }// when it is the BatchRunning Experiment else if(currentExperimentType == ExperimentType.BatchRunning) { this.backgroundWorkerBatchRunning.CancelAsync(); } //change the progress bar status currentProgressBar.DisplayText = "Simulation Stopped"; //change to the play icon playAndPauseButton.BackgroundImage = global::AcriveCrowdGUI.Properties.Resources.Play_1_Normal_icon; } //End if confirm to stop the experiment } //End HandleStopButton
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.kpnlProgressBar = new Krypton.Toolkit.KryptonPanel(); this.kpProgress = new Krypton.Toolkit.Suite.Extended.Base.KryptonProgressBar(); this.kpContent = new Krypton.Toolkit.KryptonPanel(); this.cbApplicationIconCircular = new Krypton.Toolkit.Suite.Extended.Base.CircularPictureBox(); this.pbxApplicationIconStandard = new System.Windows.Forms.PictureBox(); this.kmlblExtraText = new Krypton.Toolkit.Suite.Extended.Base.KryptonMarqueeLabel(); this.klblApplicationName = new Krypton.Toolkit.KryptonLabel(); ((System.ComponentModel.ISupportInitialize)(this.kpnlProgressBar)).BeginInit(); this.kpnlProgressBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.kpContent)).BeginInit(); this.kpContent.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbApplicationIconCircular)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxApplicationIconStandard)).BeginInit(); this.SuspendLayout(); // // kpnlProgressBar // this.kpnlProgressBar.Controls.Add(this.kpProgress); this.kpnlProgressBar.Dock = System.Windows.Forms.DockStyle.Bottom; this.kpnlProgressBar.Location = new System.Drawing.Point(0, 341); this.kpnlProgressBar.Name = "kpnlProgressBar"; this.kpnlProgressBar.Size = new System.Drawing.Size(725, 32); this.kpnlProgressBar.TabIndex = 0; // // kpProgress // this.kpProgress.BackColor = System.Drawing.Color.Transparent; this.kpProgress.BackgroundColour = System.Drawing.Color.Transparent; this.kpProgress.Dock = System.Windows.Forms.DockStyle.Bottom; this.kpProgress.EndColour = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(224)))), ((int)(((byte)(135))))); this.kpProgress.Font = new System.Drawing.Font("Segoe UI", 9F); this.kpProgress.ForeColour = System.Drawing.Color.Empty; this.kpProgress.Location = new System.Drawing.Point(0, 0); this.kpProgress.Name = "kpProgress"; this.kpProgress.Size = new System.Drawing.Size(725, 32); this.kpProgress.StartColour = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(224)))), ((int)(((byte)(135))))); this.kpProgress.TabIndex = 1; // // kpContent // this.kpContent.Controls.Add(this.cbApplicationIconCircular); this.kpContent.Controls.Add(this.pbxApplicationIconStandard); this.kpContent.Controls.Add(this.kmlblExtraText); this.kpContent.Controls.Add(this.klblApplicationName); this.kpContent.Dock = System.Windows.Forms.DockStyle.Fill; this.kpContent.Location = new System.Drawing.Point(0, 0); this.kpContent.Name = "kpContent"; this.kpContent.Size = new System.Drawing.Size(725, 341); this.kpContent.TabIndex = 1; // // cbApplicationIconCircular // this.cbApplicationIconCircular.BackColor = System.Drawing.Color.Transparent; this.cbApplicationIconCircular.Location = new System.Drawing.Point(234, 59); this.cbApplicationIconCircular.Name = "cbApplicationIconCircular"; this.cbApplicationIconCircular.Size = new System.Drawing.Size(256, 256); this.cbApplicationIconCircular.TabIndex = 5; this.cbApplicationIconCircular.TabStop = false; this.cbApplicationIconCircular.ToolTipValues = null; // // pbxApplicationIconStandard // this.pbxApplicationIconStandard.BackColor = System.Drawing.Color.Transparent; this.pbxApplicationIconStandard.Location = new System.Drawing.Point(234, 59); this.pbxApplicationIconStandard.Name = "pbxApplicationIconStandard"; this.pbxApplicationIconStandard.Size = new System.Drawing.Size(256, 256); this.pbxApplicationIconStandard.TabIndex = 4; this.pbxApplicationIconStandard.TabStop = false; // // kmlblExtraText // this.kmlblExtraText.Dock = System.Windows.Forms.DockStyle.Bottom; this.kmlblExtraText.Location = new System.Drawing.Point(0, 321); this.kmlblExtraText.Name = "kmlblExtraText"; this.kmlblExtraText.Size = new System.Drawing.Size(725, 20); this.kmlblExtraText.Speed = 1; this.kmlblExtraText.TabIndex = 3; this.kmlblExtraText.Values.Text = "<##SOME-TEXT##>"; this.kmlblExtraText.YOffset = 0; // // klblApplicationName // this.klblApplicationName.AutoSize = false; this.klblApplicationName.Location = new System.Drawing.Point(12, 12); this.klblApplicationName.Name = "klblApplicationName"; this.klblApplicationName.Size = new System.Drawing.Size(701, 41); this.klblApplicationName.StateCommon.ShortText.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.klblApplicationName.StateCommon.ShortText.TextH = Krypton.Toolkit.PaletteRelativeAlign.Center; this.klblApplicationName.TabIndex = 2; this.klblApplicationName.Values.Text = "<##APPLICATION-NAME##>"; // // KryptonSplashWindow // this.ClientSize = new System.Drawing.Size(725, 373); this.ControlBox = false; this.Controls.Add(this.kpContent); this.Controls.Add(this.kpnlProgressBar); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "KryptonSplashWindow"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.KryptonSplashWindow_FormClosing); this.Load += new System.EventHandler(this.KryptonSplashWindow_Load); ((System.ComponentModel.ISupportInitialize)(this.kpnlProgressBar)).EndInit(); this.kpnlProgressBar.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.kpContent)).EndInit(); this.kpContent.ResumeLayout(false); this.kpContent.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbApplicationIconCircular)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxApplicationIconStandard)).EndInit(); this.ResumeLayout(false); }