/// <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();
                }
            });
        }
        /// <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);
                }
            });
        }
Exemplo n.º 3
0
 /// <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);
     }
 }
        /// <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);
            }
        }
Exemplo n.º 5
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;

            // 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);
            }
        }
Exemplo n.º 6
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)
        {
            // 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();
        }
Exemplo n.º 7
0
 /// <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";
     }
 }
        /// <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);
        }
Exemplo n.º 9
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 (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);
            }
        }
Exemplo n.º 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);
            }
        }
 /// <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);
 }
Exemplo n.º 12
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);
                        }
                    });
        }
 /// <summary>
 /// The encode completed callback.
 /// </summary>
 /// <param name="eventArgs">
 /// The event Args.
 /// </param>
 public virtual void EncodeCompletedCallback(EncodeCompletedEventArgs eventArgs)
 {
 }
Exemplo n.º 14
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)
        {
            // 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();
        }
Exemplo n.º 15
0
        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;
                    }
                });
        }
Exemplo n.º 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
        }
Exemplo n.º 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);
             }
         });
 }