// Apply the editor's action to a photo. public void Apply() { try { ProcessingStarted?.Invoke(Label, State.Items.Length); TryApply(); } finally { ProcessingFinished?.Invoke(); } }
public CrawlingQueueItem ChangeStatus(CrawlingStatuses status) { if (Status != status) { Status = status; switch (status) { case CrawlingStatuses.InProxyQueue: QueuedInProxyQueue?.Invoke(); break; case CrawlingStatuses.InLocalQueue: QueuedInLocalQueue?.Invoke(); break; case CrawlingStatuses.Downloading: DownloadStarted?.Invoke(); break; case CrawlingStatuses.Downloaded: DownloadCompleted?.Invoke(); break; case CrawlingStatuses.Processing: ProcessingStarted?.Invoke(); break; case CrawlingStatuses.Processed: ProcessingCompleted?.Invoke(); break; default: throw new NotSupportedException(); } } return(this); }
private void Run() { try { ProcessingStarted?.Invoke(); for (int i = 0; i < 100; ++i) { _tokenSource.Token.ThrowIfCancellationRequested(); Thread.Sleep(TimeSpan.FromSeconds(1.0)); _progress.Report(i); } } catch { } finally { _progress.Report(100); lock (_guard) { _isRunning = false; } ProcessingFinished?.Invoke(); } }
/// <summary> Raises the processing started event. </summary> protected void OnProcessingStarted() { ProcessingStarted?.Invoke(this, null); }