private void _download_Finish(Download sender) { if (isError) { return; } Status = TaskStatus.Completed; this.Dispatcher.Invoke(new Action(() => { this.status.Content = "已完成"; this.progress.Value = 100; openButtons.Visibility = Visibility.Visible; _finish.Invoke(this); })); }
public void StartSimulation() { SimulationStart = DateTime.Now; TickSecond = new Timer(new TimerCallback(Second), null, 1000, 2000); TickFiveSecond = new Timer(new TimerCallback(OnceADay), null, 6000, 6000); while (hospital.GetCountOfPatient() != 0 || IVADept.GetCountOfPatient() != 0 || sanatoriumDept.GetCountOfPatient() != 0) { Thread.Sleep(1000); } TickSecond.Dispose(); Thread.Sleep(4000); TickFiveSecond.Dispose(); AssignValueToFinished(); FinishEventHandler?.Invoke(this, finishedInfo); }
protected virtual void OnFinished(IntPtr converter, int success) { if (_log.IsTraceEnabled) { _log.Trace("T:" + Thread.CurrentThread.Name + " Conversion Finished: " + (success != 0 ? "Succeede" : "Failed")); } FinishEventHandler handler = Finished; try { handler?.Invoke(this, success != 0); } catch (Exception e) { _log.Warn("T:" + Thread.CurrentThread.Name + " Exception in Finish event handler", e); } }