protected override void OnActivated(EventArgs e) { base.OnActivated(e); // Make sure we ONLY run the simulation once.. if (!_simulation_ran) { _simulation_ran = true; _simulation = new HydroSharedAddIn.excel.RoutingSimulation(); _simulation.DoEstablishWorksheetNames(_simulation.SimulationWorksheetNames); // start the simulation... RunAsynch(); } }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); if (!_has_run) { _has_run = true; _simulation = new HydroSharedAddIn.excel.RoutingSimulation(); _simulation.DoEstablishWorksheetNames(_simulation.SimulationWorksheetNames); // start the simulation... this.toolStripStatusLabel1.Text = "begin simulations"; this.buttonOK.Enabled = false; buttonOK.DialogResult = DialogResult.OK; if (true) { Run(); _simulation = null; _workbook = null; GC.Collect(); lock (this) { buttonOK.Enabled = true; currentSimulationLabel1.Text = "Successfully completed all simulations"; toolStripProgressBar1.Value = toolStripProgressBar1.Minimum; toolStripStatusLabel1.Text = "done"; } } else { RunAsynch(); } } }