/// <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(); } }); }
/// <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); }); }
/// <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"; }); }
/// <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); } }
/// <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)); }
/// <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); }
/// <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(); }
/// <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; }
/// <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; } }
/// <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) { // }
/// <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); } }
/// <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(); } } }); }
/// <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); }
/// <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."; } }); }
/// <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); }
/// <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(); }
/// <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. }
private static void HandBrakeUtils_MessageLogged(object sender, HandBrake.ApplicationServices.Interop.EventArgs.MessageLoggedEventArgs e) { }
/// <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; } }); }
/// <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; }
/// <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); }
/// <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; }); }
/// <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); }
/// <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; }
/// <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. }