コード例 #1
0
        /// <summary>
        /// The encode service_ encode completed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void EncodeService_EncodeCompleted(object sender, HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs e)
        {
            // Send the file to the users requested applicaiton
            if (e.Successful)
            {
                this.SendToApplication(e.FileName);
            }

            // Allow the system to sleep again.
            Execute.OnUIThread(() =>
            {
                if (this.userSettingService.GetUserSetting <bool>(UserSettingConstants.PreventSleep))
                {
                    Win32.AllowSleep();
                }
            });
        }
コード例 #2
0
        /// <summary>
        /// The encode service_ encode completed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            encodeService.EncodeCompleted     -= this.EncodeServiceEncodeCompleted;
            encodeService.EncodeStarted       -= this.encodeService_EncodeStarted;
            encodeService.EncodeStatusChanged -= this.encodeService_EncodeStatusChanged;

            Subscribers.ForEach(
                delegate(IHbServiceCallback callback)
            {
                if (((ICommunicationObject)callback).State == CommunicationState.Opened)
                {
                    Console.WriteLine("Encode Completed Callback");
                    callback.EncodeCompletedCallback(e);
                }
                else
                {
                    Subscribers.Remove(callback);
                }
            });
        }
コード例 #3
0
ファイル: EncodeBase.cs プロジェクト: evolver56k/HandBrake
 /// <summary>
 /// Invoke the Encode Completed Event
 /// </summary>
 /// <param name="e">
 /// The EncodeCompletedEventArgs.
 /// </param>
 public void Invoke_encodeCompleted(EncodeCompletedEventArgs e)
 {
     EncodeCompletedStatus handler = this.EncodeCompleted;
     if (handler != null)
     {
         handler(this, e);
     }
 }
コード例 #4
0
        /// <summary>
        /// After an encode is complete, move onto the next job.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            this.QueueManager.LastProcessedJob.Status = QueueItemStatus.Completed;

            // Growl
            if (Properties.Settings.Default.GrowlEncode)
                GrowlCommunicator.Notify("Encode Completed",
                                         "Put down that cocktail...\nyour Handbrake encode is done.");

            if (!e.Successful)
            {
                this.QueueManager.LastProcessedJob.Status = QueueItemStatus.Error;
                this.Pause();
                throw new GeneralApplicationException(e.ErrorInformation, e.Exception.Message, e.Exception);
            }

            // Handling Log Data
            this.EncodeService.ProcessLogs(this.QueueManager.LastProcessedJob.Destination);

            // Post-Processing
            if (e.Successful)
            {
                SendToApplication(this.QueueManager.LastProcessedJob.Destination);
            }

            // Move onto the next job.
            if (this.IsProcessing)
            {
                this.ProcessNextJob();
            }
            else
            {
                this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
                this.InvokeQueueCompleted(EventArgs.Empty);
                this.QueueManager.BackupQueue(string.Empty);
            }
        }
コード例 #5
0
ファイル: QueueProcessor.cs プロジェクト: kolanos/HandBrake
        /// <summary>
        /// After an encode is complete, move onto the next job.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            this.QueueManager.LastProcessedJob.Status = QueueItemStatus.Completed;

            // Clear the completed item of the queue if the setting is set.
            if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ClearCompletedFromQueue))
            {
                this.QueueManager.ClearCompleted();
            }

            // Growl
            if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.GrowlEncode))
                GrowlCommunicator.Notify("Encode Completed",
                                         "Put down that cocktail...\nyour Handbrake encode is done.");

            if (!e.Successful)
            {
                this.QueueManager.LastProcessedJob.Status = QueueItemStatus.Error;
                this.Pause();
                if (e.Exception.GetType() == typeof(GeneralApplicationException))
                {
                    throw e.Exception;
                }
                throw new GeneralApplicationException(e.ErrorInformation, e.Exception.Message, e.Exception);
            }

            // Handling Log Data
            this.EncodeService.ProcessLogs(this.QueueManager.LastProcessedJob.Task.Destination);

            // Post-Processing
            if (e.Successful)
            {
                SendToApplication(this.QueueManager.LastProcessedJob.Task.Destination);
            }

            // Move onto the next job.
            if (this.IsProcessing)
            {
                this.ProcessNextJob();
            }
            else
            {
                this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
                this.InvokeQueueCompleted(EventArgs.Empty);
                this.QueueManager.BackupQueue(string.Empty);
            }
        }
コード例 #6
0
ファイル: QueueProcessor.cs プロジェクト: vandhanaa/Handbrake
        /// <summary>
        /// After an encode is complete, move onto the next job.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            // Growl
            if (Properties.Settings.Default.GrowlEncode)
                GrowlCommunicator.Notify("Encode Completed",
                                         "Put down that cocktail...\nyour Handbrake encode is done.");

            if (!e.Successful)
            {
                this.Pause();
                MessageBox.Show(e.Exception + e.ErrorInformation);
            }

            // Post-Processing
            SendToApplication(this.QueueManager.LastProcessedJob.Destination);

            // Handling Log Data 
            this.EncodeService.ProcessLogs(this.QueueManager.LastProcessedJob.Destination);

            // Move onto the next job.
            this.ProcessNextJob();
        }
コード例 #7
0
ファイル: QueueViewModel.cs プロジェクト: kevleyski/HandBrake
 /// <summary>
 /// The encode service_ encode completed.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void EncodeService_EncodeCompleted(object sender, EncodeCompletedEventArgs e)
 {
     if (!this.queueProcessor.IsProcessing)
     {
         this.JobStatus = "Last Queued Job Finished";
     }
 }
コード例 #8
0
        /// <summary>
        /// The encode completed callback.
        /// </summary>
        /// <param name="eventArgs">
        /// The event args.
        /// </param>
        public override void EncodeCompletedCallback(EncodeCompletedEventArgs eventArgs)
        {
            if (this.EncodeCompleted != null)
            {
                ThreadPool.QueueUserWorkItem(delegate { this.EncodeCompleted(this, eventArgs); });
            }

            base.EncodeCompletedCallback(eventArgs);
        }
コード例 #9
0
ファイル: QueueProcessor.cs プロジェクト: prat0088/HandBrake
        /// <summary>
        /// After an encode is complete, move onto the next job.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            this.LastProcessedJob.Status = QueueItemStatus.Completed;

            // Clear the completed item of the queue if the setting is set.
            if (clearCompleted)
            {
                this.ClearCompleted();
            }

            if (!e.Successful)
            {
                this.LastProcessedJob.Status = QueueItemStatus.Error;
                this.Pause();
            }

            // Handling Log Data
            this.EncodeService.ProcessLogs(this.LastProcessedJob.Task.Destination, this.LastProcessedJob.Configuration);

            // Move onto the next job.
            if (this.IsProcessing)
            {
                this.ProcessNextJob();
            }
            else
            {
                this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
                this.OnQueueCompleted(new QueueCompletedEventArgs(true));
                this.BackupQueue(string.Empty);
            }
        }
コード例 #10
0
        /// <summary>
        /// After an encode is complete, move onto the next job.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            this.LastProcessedJob.Status = QueueItemStatus.Completed;

            // Clear the completed item of the queue if the setting is set.
            if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ClearCompletedFromQueue))
            {
                this.ClearCompleted();
            }

            if (!e.Successful)
            {
                this.LastProcessedJob.Status = QueueItemStatus.Error;
                this.Pause();
            }

            // Handling Log Data
            this.EncodeService.ProcessLogs(this.LastProcessedJob.Task.Destination);

            // Post-Processing
            if (e.Successful)
            {
                this.SendToApplication(this.LastProcessedJob.Task.Destination);
            }

            // Move onto the next job.
            if (this.IsProcessing)
            {
                this.ProcessNextJob();
            }
            else
            {
                this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
                this.InvokeQueueCompleted(EventArgs.Empty);
                this.BackupQueue(string.Empty);
            }
        }
コード例 #11
0
 /// <summary>
 /// Encode Completed Event Handler.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
 {
     this.NotifyOfPropertyChange(() => this.EncodeLog);
 }
コード例 #12
0
ファイル: ServerService.cs プロジェクト: evolver56k/HandBrake
        /// <summary>
        /// The encode service_ encode completed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            encodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
            encodeService.EncodeStarted -= this.encodeService_EncodeStarted;
            encodeService.EncodeStatusChanged -= this.encodeService_EncodeStatusChanged;

            Subscribers.ForEach(
                delegate(IHbServiceCallback callback)
                    {
                        if (((ICommunicationObject)callback).State == CommunicationState.Opened)
                        {
                            Console.WriteLine("Encode Completed Callback");
                            callback.EncodeCompletedCallback(e);
                        }
                        else
                        {
                            Subscribers.Remove(callback);
                        }
                    });
        }
コード例 #13
0
 /// <summary>
 /// The encode completed callback.
 /// </summary>
 /// <param name="eventArgs">
 /// The event Args.
 /// </param>
 public virtual void EncodeCompletedCallback(EncodeCompletedEventArgs eventArgs)
 {
 }
コード例 #14
0
ファイル: QueueProcessor.cs プロジェクト: griff/HandBrake
        /// <summary>
        /// After an encode is complete, move onto the next job.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
        {
            // Growl
            if (Init.GrowlEncode)
                GrowlCommunicator.Notify("Encode Completed",
                                         "Put down that cocktail...\nyour Handbrake encode is done.");

            // Handling Log Data
            this.EncodeService.ProcessLogs(this.QueueManager.LastProcessedJob.Destination);

            // Move onto the next job.
            this.ProcessNextJob();
        }
コード例 #15
0
ファイル: EncodeInfo.cs プロジェクト: DeCarabas/EBrake
        void OnEncodeEnded(object sender, EncodeCompletedEventArgs e)
        {
            Dispatcher.BeginInvoke(() =>
                {
                    // TODO: How do I detect errors?
                    this.encodeIndex++;
                    if (this.encodeIndex < this.jobQueue.Count)
                    {
                        this.encodingQueue.Start(this.jobQueue[this.encodeIndex], true);

                        TotalPercentComplete = Math.Round(
                            ((double)this.encodeIndex / (double)this.jobQueue.Count) * 100.0);
                    }
                    else
                    {
                        IsEncoding = this.encodingQueue.IsEncoding;
                        ETA = "Complete";
                        PercentComplete = 100;
                        TotalPercentComplete = 100;
                    }
                });
        }
コード例 #16
0
        /// <summary>
        /// Invoke the Encode Completed Event
        /// </summary>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        public void InvokeEncodeCompleted(EncodeCompletedEventArgs e)
        {
            EncodeCompletedStatus handler = this.EncodeCompleted;
            if (handler != null)
            {
                handler(this, e);
            }

            this.LogIndex = 0; // Reset
        }
コード例 #17
0
 /// <summary>
 /// Invoke the Encode Completed Event
 /// </summary>
 /// <param name="e">
 /// The EncodeCompletedEventArgs.
 /// </param>
 public void InvokeEncodeCompleted(EncodeCompletedEventArgs e)
 {
     Execute.OnUIThread(
         () =>
         {
             EncodeCompletedStatus handler = this.EncodeCompleted;
             if (handler != null)
             {
                 handler(this, e);
             }
         });
 }