Ejemplo n.º 1
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)
 {
     if (userSettingService.GetUserSetting<bool>(UserSettingConstants.GrowlEncode))
     {
        // GrowlCommunicator.Notify("Encode Completed", "Put down that cocktail...\nyour Handbrake encode is done.");
     }
 }
        /// <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();
                }
            });
        }
Ejemplo n.º 3
0
 /// <summary>
 /// The Encode Status has changed Handler
 /// </summary>
 /// <param name="sender">
 /// The Sender
 /// </param>
 /// <param name="e">
 /// The Encode Progress Event Args
 /// </param>
 private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
 {
     Execute.OnUIThread(
         () =>
         {
             this.ProgramStatusLabel =
                 string.Format(
                     "{0:00.00}%,  FPS: {1:000.0},  Avg FPS: {2:000.0},  Time Remaining: {3},  Elapsed: {4:hh\\:mm\\:ss},  Pending Jobs {5}",
                     e.PercentComplete,
                     e.CurrentFrameRate,
                     e.AverageFrameRate,
                     e.EstimatedTimeLeft,
                     e.ElapsedTime,
                     this.queueProcessor.QueueManager.Count);
         });
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Handle the Scan Completed Event
        /// </summary>
        /// <param name="sender">
        /// The Sender
        /// </param>
        /// <param name="e">
        /// The EventArgs
        /// </param>
        private void ScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
        {
            Execute.OnUIThread(() =>
                {
                    if (e.Successful)
                    {
                        this.scanService.SouceData.CopyTo(this.ScannedSource);
                        this.NotifyOfPropertyChange("ScannedSource");
                        this.NotifyOfPropertyChange("ScannedSource.Titles");
                        this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle)
                                             ?? this.ScannedSource.Titles.FirstOrDefault();
                        this.JobContextService.CurrentSource = this.ScannedSource;
                        this.JobContextService.CurrentTask = this.CurrentTask;
                        this.SetupTabs();
                        this.ShowStatusWindow = false;
                    }

                    this.SourceLabel = "Scan Completed";
                    this.StatusLabel = "Scan Completed";
                });
        }
Ejemplo n.º 5
0
 /// <summary>
 /// The user setting service_ setting changed.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void UserSettingServiceSettingChanged(object sender, HandBrake.ApplicationServices.EventArgs.SettingChangedEventArgs e)
 {
     if (e.Key == UserSettingConstants.ShowAdvancedTab)
     {
         this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Handle the Encode Status Changed Event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The EncodeProgressEventArgs.
 /// </param>
 private void EncodeService_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
 {
     this.JobStatus = string.Format(
         "Encoding: Pass {0} of {1},  {2:00.00}%, FPS: {3:000.0},  Avg FPS: {4:000.0},  Time Remaining: {5},  Elapsed: {6:hh\\:mm\\:ss}",
         e.Task,
         e.TaskCount,
         e.PercentComplete,
         e.CurrentFrameRate,
         e.AverageFrameRate,
         e.EstimatedTimeLeft,
         e.ElapsedTime);
 }
 /// <summary>
 /// The scan service Scan Completed Event Handler.
 /// Fires CanExecuteChanged
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The ScanCompletedEventArgs.
 /// </param>
 private void ScanServiceWrapperScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
 {
     Caliburn.Micro.Execute.OnUIThread(() => this.CanExecuteChanged(sender, EventArgs.Empty));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Handle the Scan Status Changed Event.
 /// </summary>
 /// <param name="sender">
 /// The Sender
 /// </param>
 /// <param name="e">
 /// The EventArgs
 /// </param>
 private void ScanStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.ScanProgressEventArgs e)
 {
     this.SourceLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage);
     this.StatusLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Handle the Encode Completed Event
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The EncodeCompletedEventArgs.
        /// </param>
        private void encodeService_EncodeCompleted(object sender, HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs e)
        {
            this.Percentage = "0.00%";
            this.PercentageValue = 0;

            this.encodeService.EncodeCompleted -= this.encodeService_EncodeCompleted;
            this.encodeService.EncodeStatusChanged -= this.encodeService_EncodeStatusChanged;

            this.PlayFile();
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Handle Encode Progress Events
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The EncodeProgressEventArgs.
 /// </param>
 private void encodeService_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
 {
     this.Percentage = string.Format("{0} %", e.PercentComplete.ToString(CultureInfo.InvariantCulture));
     this.PercentageValue = e.PercentComplete;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Handle the Scan Completed Event
 /// </summary>
 /// <param name="sender">
 /// The Sender
 /// </param>
 /// <param name="e">
 /// The EventArgs
 /// </param>
 private void ScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
 {
     if (e.Successful)
     {
         this.ScannedSource = this.scanService.SouceData;
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// The Encode Status has changed Handler
 /// </summary>
 /// <param name="sender">
 /// The Sender
 /// </param>
 /// <param name="e">
 /// The Encode Progress Event Args
 /// </param>
 private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
 {
     //
 }
Ejemplo n.º 13
0
        /// <summary>
        /// The vm_ log message received.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void Vm_LogMessageReceived(object sender, HandBrake.ApplicationServices.Services.Logging.EventArgs.LogEventArgs e)
        {
            try
            {
                if (e == null)
                {
                    Caliburn.Micro.Execute.OnUIThread(
                        () =>
                            {
                                LogViewModel vm = this.DataContext as LogViewModel;
                                if (vm != null)
                                {
                                    this.logText.Clear();
                                    this.logText.AppendText(vm.ActivityLog);
                                }
                                else
                                {
                                    Debug.WriteLine("Failed to Reset Log correctly.");
                                }
                            });
                }
                else
                {
                    // This works better than Data Binding because of the scroll.
                    this.logText.AppendText(Environment.NewLine + e.Log.Content);

                    if (this.AutoScroll.IsChecked)
                    {
                        this.logText.ScrollToEnd();
                    }
                }
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// The Encode Status has changed Handler
        /// </summary>
        /// <param name="sender">
        /// The Sender
        /// </param>
        /// <param name="e">
        /// The Encode Progress Event Args
        /// </param>
        private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
        {
            int percent;
            int.TryParse(
                Math.Round(e.PercentComplete).ToString(CultureInfo.InvariantCulture),
                out percent);

            Execute.OnUIThread(
                () =>
                {
                    if (this.queueProcessor.EncodeService.IsEncoding)
                    {
                        string josPending = string.Empty;
                        if (!AppArguments.IsInstantHandBrake)
                        {
                            josPending = ",  Pending Jobs {5}";
                        }

                        this.ProgramStatusLabel =
                            string.Format(
                                "{0:00.00}%,  FPS: {1:000.0},  Avg FPS: {2:000.0},  Time Remaining: {3},  Elapsed: {4:hh\\:mm\\:ss}" + josPending,
                                e.PercentComplete,
                                e.CurrentFrameRate,
                                e.AverageFrameRate,
                                e.EstimatedTimeLeft,
                                e.ElapsedTime,
                                this.queueProcessor.Count);

                        if (lastEncodePercentage != percent && this.windowsSeven.IsWindowsSeven)
                        {
                            this.windowsSeven.SetTaskBarProgress(percent);
                        }

                        lastEncodePercentage = percent;
                        this.ProgressPercentage = percent;
                        this.NotifyOfPropertyChange(() => ProgressPercentage);
                    }
                    else
                    {
                        this.ProgramStatusLabel = "Queue Finished";
                        this.IsEncoding = false;

                        if (this.windowsSeven.IsWindowsSeven)
                        {
                            this.windowsSeven.SetTaskBarProgressToNoProgress();
                        }
                    }
                });
        }
Ejemplo n.º 15
0
 /// <summary>
 /// The scan service scan completed event
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The ScanCompletedEventArgs
 /// </param>
 private void ScanServiceScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
 {
     this.ScanCompleted(sender, e);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Handle the Scan Completed Event
        /// </summary>
        /// <param name="sender">
        /// The Sender
        /// </param>
        /// <param name="e">
        /// The EventArgs
        /// </param>
        private void ScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
        {
            this.scanService.SouceData.CopyTo(this.ScannedSource);
            Execute.OnUIThread(() =>
                {
                    if (e.Successful)
                    {
                        this.NotifyOfPropertyChange(() => this.ScannedSource);
                        this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);
                        this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle)
                                             ?? this.ScannedSource.Titles.FirstOrDefault();
                    }

                    this.ShowStatusWindow = false;
                    if (e.Successful)
                    {
                        this.SourceLabel = this.SourceName;
                        this.StatusLabel = "Scan Completed";
                    }
                    else if (e.Cancelled)
                    {
                        this.SourceLabel = "Scan Cancelled.";
                        this.StatusLabel = "Scan Cancelled.";
                    }
                    else if (e.Exception == null && e.ErrorInformation != null)
                    {
                        this.SourceLabel = "Scan failed: " + e.ErrorInformation;
                        this.StatusLabel = "Scan failed: " + e.ErrorInformation;
                    }
                    else
                    {
                        this.SourceLabel = "Scan Failed... See Activity Log for details."; this.StatusLabel = "Scan Failed... See Activity Log for details.";
                    }
                });
        }
Ejemplo n.º 17
0
 /// <summary>
 /// The scan service scan status changed event
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The ScanProgressEventArgs.
 /// </param>
 private void ScanServiceScanStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.ScanProgressEventArgs e)
 {
     this.ScanStatusChanged(sender, e);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Display the Encode Status
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void EncodeQueue_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EncodeProgessStatus(EncodeQueue_EncodeStatusChanged), new[] { sender, e });
                return;
            }

            lbl_encodeStatus.Text =
                string.Format(
                "Encoding: Pass {0} of {1},  {2:00.00}%, FPS: {3:000.0},  Avg FPS: {4:000.0},  Time Remaining: {5},  Elapsed: {6:hh\\:mm\\:ss}",
                e.Task,
                e.TaskCount,
                e.PercentComplete,
                e.CurrentFrameRate,
                e.AverageFrameRate,
                e.EstimatedTimeLeft,
                e.ElapsedTime);

            UpdateStatusLabel();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Handle the Scan Completed Event
        /// </summary>
        /// <param name="sender">
        /// The Sender
        /// </param>
        /// <param name="e">
        /// The EventArgs
        /// </param>
        private void ScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
        {
            Caliburn.Micro.Execute.OnUIThread(() =>
                {
                    if (e.Successful)
                    {
                        this.scanService.SouceData.CopyTo(this.ScannedSource);
                        this.NotifyOfPropertyChange("ScannedSource");
                        this.NotifyOfPropertyChange("ScannedSource.Titles");
                        this.SelectedTitle = this.ScannedSource.Titles.Where(t => t.MainTitle).FirstOrDefault()
                                             ?? this.ScannedSource.Titles.FirstOrDefault();
                        this.JobContextService.CurrentSource = this.ScannedSource;
                        this.JobContextService.CurrentTask = this.CurrentTask;
                        this.SetupTabs();
                    }

                    this.SourceLabel = "Scan Completed";
                });

            // TODO Re-enable GUI.
        }
Ejemplo n.º 20
0
 private static void HandBrakeUtils_MessageLogged(object sender, HandBrake.ApplicationServices.Interop.EventArgs.MessageLoggedEventArgs e)
 {
 }
Ejemplo n.º 21
0
        /// <summary>
        /// The Encode Status has changed Handler
        /// </summary>
        /// <param name="sender">
        /// The Sender
        /// </param>
        /// <param name="e">
        /// The Encode Progress Event Args
        /// </param>
        private void EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
        {
            int percent;
            int.TryParse(
                Math.Round(e.PercentComplete).ToString(CultureInfo.InvariantCulture),
                out percent);

            Execute.OnUIThread(
                () =>
                {
                    if (this.IsEncoding)
                    {
                        this.ProgramStatusLabel =
                            string.Format(
                                "{0:00.00}%,  FPS: {1:000.0},  Avg FPS: {2:000.0},  Time Remaining: {3},  Elapsed: {4:hh\\:mm\\:ss},  Pending Jobs {5}",
                                e.PercentComplete,
                                e.CurrentFrameRate,
                                e.AverageFrameRate,
                                e.EstimatedTimeLeft,
                                e.ElapsedTime,
                                this.queueProcessor.Count);

                        if (lastEncodePercentage != percent && this.windowsSeven.IsWindowsSeven)
                        {
                            this.windowsSeven.SetTaskBarProgress(percent);
                        }

                        lastEncodePercentage = percent;
                    }
                });
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Handle teh Job Processing Started Event
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The QueueProgressEventArgs.
 /// </param>
 private void queueProcessor_JobProcessingStarted(object sender, HandBrake.ApplicationServices.EventArgs.QueueProgressEventArgs e)
 {
     this.JobStatus = "Queue Started";
     this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.QueueManager.Count);
     this.queueProcessor.EncodeService.EncodeStatusChanged += EncodeService_EncodeStatusChanged;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Encode status has changed
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void EncodeQueueEncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EncodeProgessStatus(this.EncodeQueueEncodeStatusChanged), new[] { sender, e });
                return;
            }

            lbl_progress.Text = e.PercentComplete + "%";
            progressBar.Value = (int)Math.Round(e.PercentComplete);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Handle the Queue Starting Event
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 void QueueProcessorJobProcessingStarted(object sender, HandBrake.ApplicationServices.EventArgs.QueueProgressEventArgs e)
 {
     Execute.OnUIThread(
        () =>
        {
            this.ProgramStatusLabel = "Preparing to encode ...";
            this.IsEncoding = true;
        });
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Display the Encode Status
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void EncodeQueue_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EncodeProgessStatus(EncodeQueue_EncodeStatusChanged), new[] { sender, e });
                return;
            }

            lbl_encodeStatus.Text =
                string.Format(
                "Encoding: Pass {0} of {1}, {2:00.00}% Time Remaining: {3}",
                e.Task,
                e.TaskCount,
                e.PercentComplete,
                e.EstimatedTimeLeft);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Handle the Scan Status Changed Event.
 /// </summary>
 /// <param name="sender">
 /// The Sender
 /// </param>
 /// <param name="e">
 /// The EventArgs
 /// </param>
 private void ScanStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.ScanProgressEventArgs e)
 {
     this.SourceLabel = "Scanning Title " + e.CurrentTitle + " of " + e.Titles;
     this.StatusLabel = "Scanning Title " + e.CurrentTitle + " of " + e.Titles;
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Handle the Scan Completed Event
        /// </summary>
        /// <param name="sender">
        /// The Sender
        /// </param>
        /// <param name="e">
        /// The EventArgs
        /// </param>
        private void ScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
        {
            if (e.Successful)
            {
                this.scanService.SouceData.CopyTo(this.ScannedSource);
                this.NotifyOfPropertyChange("ScannedSource");
                this.NotifyOfPropertyChange("ScannedSource.Titles");
                this.NotifyOfPropertyChange("T");
                this.SelectedTitle = this.ScannedSource.Titles.Where(t => t.MainTitle).FirstOrDefault();
            }

            this.SourceLabel = "Scan Completed";

            // TODO Re-enable GUI.
        }