using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Parsing;\r
using HandBrake.ApplicationServices.Services.Interfaces;\r
+ using HandBrake.Interop;\r
+ using HandBrake.Interop.Interfaces;\r
+\r
+ using EncodeCompletedEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs;\r
+ using EncodeProgressEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs;\r
+ using ScanProgressEventArgs = HandBrake.ApplicationServices.EventArgs.ScanProgressEventArgs;\r
\r
/// <summary>\r
/// HandBrake WCF Service\r
/// <summary>\r
/// Start the service\r
/// </summary>\r
+ /// <param name="port">\r
+ /// The port.\r
+ /// </param>\r
public void Start(string port)\r
{\r
using (host = new ServiceHost(typeof(ServerService), new Uri(string.Format("net.tcp://127.0.0.1:{0}", port))))\r
Console.WriteLine("Service Started. Waiting for Clients...");\r
\r
// Setup the services we are going to use.\r
- scanService = new ScanService(new UserSettingService()); // TODO this needs wired up with castle\r
- encodeService = new Encode(new UserSettingService());\r
+ IHandBrakeInstance instance = new HandBrakeInstance();\r
+ scanService = new LibScan(new UserSettingService(), instance); // TODO this needs wired up with castle\r
+ encodeService = new LibEncode(new UserSettingService(), instance);\r
\r
shutdownFlag = new ManualResetEvent(false);\r
shutdownFlag.WaitOne();\r
/// Backing field for the selected mode\r
/// </summary>\r
private int selectedMode;\r
-\r
- /// <summary>\r
- /// Backing field for the log info.\r
- /// </summary>\r
- private string log;\r
-\r
#endregion\r
\r
/// <summary>\r
this.encodeService = encodeService;\r
this.scanService = scanService;\r
this.Title = "Log Viewer";\r
- this.SelectedMode = 0;\r
+\r
+ this.SelectedMode = this.encodeService.IsEncoding ? 0 : 1;\r
}\r
\r
/// <summary>\r
protected override void OnDeactivate(bool close)\r
{\r
this.scanService.ScanStared -= ScanServiceScanStared;\r
+ this.scanService.ScanCompleted -= ScanServiceScanCompleted;\r
this.encodeService.EncodeStarted -= EncodeServiceEncodeStarted;\r
- this.Load();\r
+ this.encodeService.EncodeCompleted -= EncodeServiceEncodeCompleted;\r
+ this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;\r
+ this.scanService.ScanStatusChanged -= this.ScanServiceScanStatusChanged;\r
+\r
base.OnDeactivate(close);\r
}\r
\r
}\r
\r
// Otherwise, perform Santiy Checking then add to the queue and start if everything is ok.\r
- if (this.ScannedSource == null || this.CurrentTask == null)\r
+ if (this.SelectedTitle == null)\r
{\r
this.errorService.ShowMessageBox("You must first scan a source.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);\r
return;\r
<Image Width="16" Source="Images/Queue_Small.png" />\r
</MenuItem.Icon>\r
</MenuItem>\r
- <MenuItem Header="Activity Window" Micro:Message.Attach="[Event Click] = [Action OpenLogWindow]">\r
+ <MenuItem Header="Activity Log" Micro:Message.Attach="[Event Click] = [Action OpenLogWindow]">\r
<MenuItem.Icon>\r
<Image Width="16" Source="Images/Output_Small.png" />\r
</MenuItem.Icon>\r
/>\r
<Label Margin="8,0,0,0"\r
VerticalAlignment="Center"\r
- Content="Activity Window"\r
+ Content="Activity Log"\r
/>\r
</StackPanel>\r
</Button>\r
<Setter Property="VerticalAlignment" Value="Center" />\r
</Style>\r
\r
-\r
-\r
<Style TargetType="TextBlock">\r
<Setter Property="Margin" Value="0,0,5,0" />\r
</Style>\r
<TextBlock Text="These options are for developer testing of features that are currently in progress!!!!" FontWeight="Bold" Margin="0,0,0,10" />\r
\r
<StackPanel Orientation="Vertical" Grid.Column="1" Margin="20,0,0,0">\r
- <CheckBox Content="Enable Process Isolation (Run Scans and Encodes via an intermediate service)" IsChecked="{Binding EnableProcessIsolation}" />\r
- <CheckBox Content="Enable LibHB (uses hb.dll instead of HandBrakeCLI.exe)" Margin="0,5,0,0" IsChecked="{Binding EnableLibHb}" />\r
\r
+ <CheckBox Content="Enable LibHB (uses hb.dll instead of HandBrakeCLI.exe)" Margin="0,5,0,0" IsChecked="{Binding EnableLibHb}" />\r
+ <CheckBox Content="Enable Process Isolation (Run Scans and Encodes via an intermediate service)" Margin="20,10,0,0" IsChecked="{Binding EnableProcessIsolation}" />\r
<StackPanel Orientation="Horizontal" Margin="0,10,0,0" Grid.Column="1">\r
<TextBlock Text="Server Port:" VerticalAlignment="Center" />\r
<TextBox Width="50" MaxLength="5" Text="{Binding ServerPort}" />\r