コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationService"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode Service.
 /// </param>
 /// <param name="queueProcessor">
 /// The queue Processor.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public NotificationService(IEncodeServiceWrapper encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
 {
     this.userSettingService        = userSettingService;
     encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
     queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
     GrowlCommunicator.Register();
 }
コード例 #2
0
 /// <summary>
 /// The queue processor_ queue completed.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The EventArgs.
 /// </param>
 private void QueueProcessorQueueCompleted(object sender, System.EventArgs e)
 {
     // Growl
     if (userSettingService.GetUserSetting <bool>(UserSettingConstants.GrowlQueue))
     {
         GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");
     }
 }
コード例 #3
0
 /// <summary>
 /// The encode service_ encode completed.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The EncodeCompletedEventArgs.
 /// </param>
 private void EncodeServiceEncodeCompleted(object sender, HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs e)
 {
     // Growl
     if (userSettingService.GetUserSetting <bool>(UserSettingConstants.GrowlEncode))
     {
         GrowlCommunicator.Notify(
             "Encode Completed", "Put down that cocktail...\nyour Handbrake encode is done.");
     }
 }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LibEncode"/> class.
        /// </summary>
        public LibEncode()
        {
            // Setup the HandBrake Instance
            this.instance = ServiceManager.HandBrakeInstance;
            this.instance.EncodeCompleted += this.InstanceEncodeCompleted;
            this.instance.EncodeProgress  += this.InstanceEncodeProgress;

            HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;
            HandBrakeUtils.ErrorLogged   += this.HandBrakeInstanceErrorLogged;

            GrowlCommunicator.Register();
        }
コード例 #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();
            }

            // 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
        /// <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.");
            }

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

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

            // Move onto the next job.
            this.ProcessNextJob();
        }
コード例 #7
0
        /// <summary>
        /// Perform an action after an encode. e.g a shutdown, standby, restart etc.
        /// </summary>
        private static void Finish()
        {
            // Growl
            if (userSettingService.GetUserSetting <bool>(ASUserSettingConstants.GrowlQueue))
            {
                GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");
            }

            // Do something whent he encode ends.
            switch (userSettingService.GetUserSetting <string>(ASUserSettingConstants.WhenCompleteAction))
            {
            case "Shutdown":
                Process.Start("Shutdown", "-s -t 60");
                break;

            case "Log off":
                Win32.ExitWindowsEx(0, 0);
                break;

            case "Suspend":
                Application.SetSuspendState(PowerState.Suspend, true, true);
                break;

            case "Hibernate":
                Application.SetSuspendState(PowerState.Hibernate, true, true);
                break;

            case "Lock System":
                Win32.LockWorkStation();
                break;

            case "Quit HandBrake":
                Application.Exit();
                break;

            default:
                break;
            }
        }
コード例 #8
0
ファイル: Encode.cs プロジェクト: AlexMikas/Handbrake-l
 /// <summary>
 /// Initializes a new instance of the <see cref="Encode"/> class.
 /// </summary>
 public Encode()
 {
     this.EncodeStarted += this.EncodeEncodeStarted;
     GrowlCommunicator.Register();
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Encode"/> class.
 /// </summary>
 public Encode()
 {
     this.EncodeStarted += this.EncodeEncodeStarted;
     this.logBuffer      = new StringBuilder();
     GrowlCommunicator.Register();
 }