public void RunDialog_Activated(object sender, System.EventArgs a) { if (!_hasRun) { statusTextBox.Text = ""; // let's run the model in a seperate thread so UI can update... ProcessAllDelegate processAll = new ProcessAllDelegate(ProcessAll); processAll.BeginInvoke(null, null); _hasRun = true; } }
void RunAsynch() { // let's run the model in a seperate thread so UI can update... _processAsync = new ProcessAllDelegate(ProcessAll); //_asyncResult = _processAsync.BeginInvoke(null, null); _asyncResult = _processAsync.BeginInvoke(new AsyncCallback(AsyncCallback), _processAsync); //_waitForComplete = new WatchForCompleteDelegate(WatchForComplete); //_waitResult = _waitForComplete.BeginInvoke(null, null); }
void RunAsynch() { // let's run the model in a seperate thread so UI can update... _processAsync = new ProcessAllDelegate(ProcessAll); _asyncResult = _processAsync.BeginInvoke(_workbook, null, null); //ProcessAllDelegate processAll = new ProcessAllDelegate(ProcessAll); //processAll.BeginInvoke(_workbook, null, null); }
void AsyncCallback(IAsyncResult ar) { //MessageBox.Show("received asycn callback" + Environment.NewLine + "will now terminate process thread..."); // Simulation has completed _processAsync.EndInvoke(_asyncResult); //MessageBox.Show("async process has ended."); _processAsync = null; _simulation = null; //_workbook = null; GC.Collect(); lock (this) { buttonOK.Enabled = true; currentSimulationLabel1.Text = "Successfully completed all simulations"; toolStripProgressBar1.Value = toolStripProgressBar1.Minimum; toolStripStatusLabel1.Text = "done"; } }
void RoutingSimulation_OnRunCompleted() { _processAsync.EndInvoke(_asyncResult); _processAsync = null; GC.Collect(); }