コード例 #1
0
 /// <summary>
 /// The timer has ticked. Update the progress bar.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnTimerTick(object sender, EventArgs e)
 {
     // One job will be the simulations object we added above. We don't want
     // to count this in the list of simulations being run, hence the -1 below.
     if (jobManager.JobCount > 1)
     {
         int    numSimulationsRun = numSimulationsToRun - jobManager.JobCount;
         double percent           = numSimulationsRun * 1.0 / numSimulationsToRun * 100.0;
         explorerPresenter.ShowProgress(Convert.ToInt32(percent));
         if (jobManager.JobCount == 0)
         {
             timer.Stop();
         }
     }
 }
コード例 #2
0
ファイル: RunCommand.cs プロジェクト: pre078/ApsimX
        /// <summary>
        /// The timer has ticked. Update the progress bar.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTimerTick(object sender, ElapsedEventArgs e)
        {
            int numSimulationsRun   = jobManager.CompletedJobs.Count;
            int numSimulationsToRun = jobManager.JobCount + numSimulationsRun;

            // One job will be the simulations object we added above. We don't want
            // to count this in the list of simulations being run, hence the -1 below.
            if (numSimulationsToRun > 1)
            {
                if (showNumberRunning)
                {
                    showNumberRunning = false;
                    explorerPresenter.ShowMessage(modelClicked.Name + " running (" + numSimulationsToRun + ")", Models.DataStore.ErrorLevel.Information);
                }

                double percent = numSimulationsRun * 1.0 / numSimulationsToRun * 100.0;
                explorerPresenter.ShowProgress(Convert.ToInt32(percent));
                if (jobManager.JobCount == 0)
                {
                    timer.Stop();
                }
            }
        }