コード例 #1
0
ファイル: Editor.cs プロジェクト: f-spot/f-spot-xplat
 // Apply the editor's action to a photo.
 public void Apply()
 {
     try {
         ProcessingStarted?.Invoke(Label, State.Items.Length);
         TryApply();
     } finally {
         ProcessingFinished?.Invoke();
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
 /// <summary> Raises the processing started event. </summary>
 protected void OnProcessingStarted()
 {
     ProcessingStarted?.Invoke(this, null);
 }