コード例 #1
0
        } //end of button handler

        /// <summary>
        /// General Event Handler of playing and pause the experiment
        /// </summary>
        /// <param name="currentExpType"></param>
        private void HandlePlayAndPauseExperiment(ExperimentType currentExpType, Button playAndPauseButton)
        {

            //Change the PlayAndPauseButton according to current ExperimentType,
            //pop up the setting form if the experiment is complete
            if (isExperimentComplete)
            {
                //initial TheExperiment and pop up the 
                experimentSettingForm = new FormExperimentSetting(currentExpType);
                experimentSettingForm.setPreviousExperimentSetting(currentExperimentSetting);
                //enable the FormActiveLearningSetting window always on the top
                experimentSettingForm.Owner = this;
                experimentSettingForm.Show();

                //change to the pause icon
                playAndPauseButton.BackgroundImage = global::AcriveCrowdGUI.Properties.Resources.Pause_Hot_icon;

                return;
            }

            isExperimentRunning = !isExperimentRunning;

            //Pause the experiment
            if (isExperimentRunning)
            {
                //change to the pause icon
                playAndPauseButton.BackgroundImage = global::AcriveCrowdGUI.Properties.Resources.Pause_Hot_icon;
         
            }
            else
            {
                //change to the play icon
                playAndPauseButton.BackgroundImage = global::AcriveCrowdGUI.Properties.Resources.Play_1_Normal_icon;

            }
        
        }
コード例 #2
0
        /// <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;
            }
        
        }