OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / frmQueue.cs
1 /*  frmQueue.cs $\r
2     This file is part of the HandBrake source code.\r
3     Homepage: <http://handbrake.fr>.\r
4     It may be used under the terms of the GNU General Public License. */\r
5 \r
6 namespace Handbrake\r
7 {\r
8     using System;\r
9     using System.Collections.Generic;\r
10     using System.Collections.ObjectModel;\r
11     using System.ComponentModel;\r
12     using System.IO;\r
13     using System.Windows.Forms;\r
14     using Functions;\r
15 \r
16     using HandBrake.ApplicationServices.Model;\r
17     using HandBrake.ApplicationServices.Model.Encoding;\r
18     using HandBrake.ApplicationServices.Services;\r
19     using HandBrake.ApplicationServices.Services.Interfaces;\r
20 \r
21     using Model;\r
22 \r
23     /// <summary>\r
24     /// The Queue Window\r
25     /// </summary>\r
26     public partial class frmQueue : Form\r
27     {\r
28         /// <summary>\r
29         /// Update Handler Delegate\r
30         /// </summary>\r
31         private delegate void UpdateHandler();\r
32 \r
33         /// <summary>\r
34         /// An instance of the Queue service\r
35         /// </summary>\r
36         private readonly IQueue queue;\r
37 \r
38         /// <summary>\r
39         /// A reference to the main application window\r
40         /// </summary>\r
41         private readonly frmMain mainWindow;\r
42 \r
43         /// <summary>\r
44         /// Initializes a new instance of the <see cref="frmQueue"/> class.\r
45         /// </summary>\r
46         /// <param name="q">\r
47         /// An instance of the queue service.\r
48         /// </param>\r
49         /// <param name="mw">\r
50         /// The main window.\r
51         /// </param>\r
52         public frmQueue(IQueue q, frmMain mw)\r
53         {\r
54             InitializeComponent();\r
55 \r
56             this.mainWindow = mw;\r
57 \r
58             this.queue = q;\r
59             queue.EncodeStarted += new EventHandler(QueueOnEncodeStart);\r
60             queue.QueueCompleted += new EventHandler(QueueOnQueueFinished);\r
61             queue.QueuePauseRequested += new EventHandler(QueueOnPaused);\r
62             queue.QueueListChanged += new EventHandler(queue_QueueListChanged);\r
63 \r
64             queue.EncodeStarted += new EventHandler(queue_EncodeStarted);\r
65             queue.EncodeCompleted += queue_EncodeEnded;\r
66 \r
67             drp_completeOption.Text = Properties.Settings.Default.CompletionOption;\r
68         }\r
69 \r
70         /// <summary>\r
71         /// Queue Changed\r
72         /// </summary>\r
73         /// <param name="sender">\r
74         /// The sender.\r
75         /// </param>\r
76         /// <param name="e">\r
77         /// The e.\r
78         /// </param>\r
79         private void queue_QueueListChanged(object sender, EventArgs e)\r
80         {\r
81             UpdateUiElementsOnQueueChange();\r
82         }\r
83 \r
84         /// <summary>\r
85         /// Encode Ended\r
86         /// </summary>\r
87         /// <param name="sender">\r
88         /// The sender.\r
89         /// </param>\r
90         /// <param name="e">\r
91         /// The e.\r
92         /// </param>\r
93         private void queue_EncodeEnded(object sender, EventArgs e)\r
94         {\r
95             queue.EncodeStatusChanged -= EncodeQueue_EncodeStatusChanged;\r
96             ResetEncodeText();\r
97         }\r
98 \r
99         /// <summary>\r
100         /// Queue Started\r
101         /// </summary>\r
102         /// <param name="sender">\r
103         /// The sender.\r
104         /// </param>\r
105         /// <param name="e">\r
106         /// The e.\r
107         /// </param>\r
108         private void queue_EncodeStarted(object sender, EventArgs e)\r
109         {\r
110             this.SetCurrentEncodeInformation();\r
111             queue.EncodeStatusChanged += EncodeQueue_EncodeStatusChanged;        \r
112         }\r
113 \r
114         /// <summary>\r
115         /// Display the Encode Status\r
116         /// </summary>\r
117         /// <param name="sender">\r
118         /// The sender.\r
119         /// </param>\r
120         /// <param name="e">\r
121         /// The e.\r
122         /// </param>\r
123         private void EncodeQueue_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)\r
124         {\r
125             if (this.InvokeRequired)\r
126             {\r
127                 this.BeginInvoke(new EncodeProgessStatus(EncodeQueue_EncodeStatusChanged), new[] { sender, e });\r
128                 return;\r
129             }\r
130 \r
131             lbl_encodeStatus.Text =\r
132                 string.Format(\r
133                 "Encoding: Pass {0} of {1}, {2:00.00}% Time Remaining: {3}",\r
134                 e.Task,\r
135                 e.TaskCount,\r
136                 e.PercentComplete,\r
137                 e.EstimatedTimeLeft);\r
138         }\r
139 \r
140         /// <summary>\r
141         /// Handle the Queue Paused event\r
142         /// </summary>\r
143         /// <param name="sender">\r
144         /// The sender.\r
145         /// </param>\r
146         /// <param name="e">\r
147         /// The EventArgs.\r
148         /// </param>\r
149         private void QueueOnPaused(object sender, EventArgs e)\r
150         {\r
151             SetUiEncodeFinished();\r
152             UpdateUiElementsOnQueueChange();\r
153         }\r
154 \r
155         /// <summary>\r
156         /// Handle the Queue Finished event.\r
157         /// </summary>\r
158         /// <param name="sender">\r
159         /// The sender.\r
160         /// </param>\r
161         /// <param name="e">\r
162         /// The EventArgs.\r
163         /// </param>\r
164         private void QueueOnQueueFinished(object sender, EventArgs e)\r
165         {\r
166             SetUiEncodeFinished();\r
167             ResetQueue(); // Reset the Queue Window\r
168         }\r
169 \r
170         /// <summary>\r
171         /// Handle the Encode Started event\r
172         /// </summary>\r
173         /// <param name="sender">\r
174         /// The sender.\r
175         /// </param>\r
176         /// <param name="e">\r
177         /// The e.\r
178         /// </param>\r
179         private void QueueOnEncodeStart(object sender, EventArgs e)\r
180         {\r
181             SetUiEncodeStarted(); // make sure the UI is set correctly\r
182             UpdateUiElementsOnQueueChange(); // Redraw the Queue, a new encode has started.\r
183         }\r
184 \r
185         /// <summary>\r
186         /// Initializes the Queue list with the Arraylist from the Queue class\r
187         /// </summary>\r
188         public void SetQueue()\r
189         {\r
190             UpdateUiElementsOnQueueChange();\r
191         }\r
192 \r
193         /// <summary>\r
194         /// Initializes the Queue list, then shows and activates the window\r
195         /// </summary>\r
196         public new void Show()\r
197         {\r
198             Show(true);\r
199         }\r
200 \r
201         /// <summary>\r
202         /// Initializes the Queue list only if doSetQueue is true, then shows and activates the window\r
203         /// </summary>\r
204         /// <param name="doSetQueue">Indicates whether to call setQueue() before showing the window</param>\r
205         public void Show(bool doSetQueue)\r
206         {\r
207             if (doSetQueue) SetQueue();\r
208             base.Show();\r
209         }\r
210 \r
211         /// <summary>\r
212         /// Handle the Encode button Click event\r
213         /// </summary>\r
214         /// <param name="sender">The sender</param>\r
215         /// <param name="e">the EventArgs</param>\r
216         private void BtnEncodeClick(object sender, EventArgs e)\r
217         {\r
218             if (queue.Paused)\r
219             {\r
220                 SetUiEncodeStarted();\r
221             }\r
222 \r
223             lbl_encodeStatus.Text = "Encoding ...";\r
224             queue.Start();\r
225         }\r
226 \r
227         /// <summary>\r
228         /// Handle the Pause button click event.\r
229         /// </summary>\r
230         /// <param name="sender">\r
231         /// The sender.\r
232         /// </param>\r
233         /// <param name="e">\r
234         /// The EventArgs.\r
235         /// </param>\r
236         private void BtnPauseClick(object sender, EventArgs e)\r
237         {\r
238             queue.Pause();\r
239             MessageBox.Show(\r
240                 "No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode' when you wish to continue encoding the queue.",\r
241                 "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
242         }\r
243 \r
244         // UI Work\r
245 \r
246         /// <summary>\r
247         /// Setup the UI to show that an encode has started\r
248         /// </summary>\r
249         private void SetUiEncodeStarted()\r
250         {\r
251             if (InvokeRequired)\r
252             {\r
253                 BeginInvoke(new UpdateHandler(SetUiEncodeStarted));\r
254                 return;\r
255             }\r
256             btn_encode.Enabled = false;\r
257             btn_pause.Visible = true;\r
258         }\r
259 \r
260         /// <summary>\r
261         /// Setup the UI to indicate that an encode has finished.\r
262         /// </summary>\r
263         private void SetUiEncodeFinished()\r
264         {\r
265             if (InvokeRequired)\r
266             {\r
267                 BeginInvoke(new UpdateHandler(SetUiEncodeFinished));\r
268                 return;\r
269             }\r
270             btn_pause.Visible = false;\r
271             btn_encode.Enabled = true;\r
272         }\r
273 \r
274         /// <summary>\r
275         /// Reset the Queue Window display\r
276         /// </summary>\r
277         private void ResetQueue()\r
278         {\r
279             if (InvokeRequired)\r
280             {\r
281                 BeginInvoke(new UpdateHandler(ResetQueue));\r
282                 return;\r
283             }\r
284             btn_pause.Visible = false;\r
285             btn_encode.Enabled = true;\r
286 \r
287             ResetEncodeText();\r
288         }\r
289 \r
290         /// <summary>\r
291         /// Reset the current job text\r
292         /// </summary>\r
293         private void ResetEncodeText()\r
294         {\r
295             if (InvokeRequired)\r
296             {\r
297                 BeginInvoke(new UpdateHandler(ResetEncodeText));\r
298                 return;\r
299             }\r
300             lbl_encodeStatus.Text = "Ready";\r
301 \r
302             lbl_source.Text = "-";\r
303             lbl_dest.Text = "-";\r
304             lbl_encodeOptions.Text = "-";\r
305 \r
306             lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";\r
307         }\r
308 \r
309         /// <summary>\r
310         /// Redraw the Queue window with the latest information about HandBrakes status\r
311         /// </summary>\r
312         private void RedrawQueue()\r
313         {\r
314             if (InvokeRequired)\r
315             {\r
316                 BeginInvoke(new UpdateHandler(RedrawQueue));\r
317                 return;\r
318             }\r
319 \r
320             list_queue.Items.Clear();\r
321             ReadOnlyCollection<QueueTask> theQueue = queue.CurrentQueue;\r
322             foreach (QueueTask queueItem in theQueue)\r
323             {\r
324                 string qItem = queueItem.Query;\r
325                 QueryParser parsed = Functions.QueryParser.Parse(qItem);\r
326 \r
327                 // Get the DVD Title\r
328                 string title = parsed.Title == 0 ? "Auto" : parsed.Title.ToString();\r
329 \r
330                 // Get the DVD Chapters\r
331                 string chapters;\r
332                 if (parsed.ChapterStart == 0)\r
333                     chapters = "Auto";\r
334                 else\r
335                 {\r
336                     chapters = parsed.ChapterStart.ToString();\r
337                     if (parsed.ChapterFinish != 0)\r
338                         chapters = chapters + " - " + parsed.ChapterFinish;\r
339                 }\r
340 \r
341                 ListViewItem item = new ListViewItem();\r
342                 item.Text = title; // Title\r
343                 item.SubItems.Add(chapters); // Chapters\r
344                 item.SubItems.Add(queueItem.Source); // Source\r
345                 item.SubItems.Add(queueItem.Destination); // Destination\r
346                 item.SubItems.Add(parsed.VideoEncoder); // Video\r
347 \r
348                 // Display The Audio Track Information\r
349                 string audio = string.Empty;\r
350                 foreach (AudioTrack track in parsed.AudioInformation)\r
351                 {\r
352                     if (audio != string.Empty)\r
353                         audio += ", " + track.Encoder;\r
354                     else\r
355                         audio = track.Encoder;\r
356                 }\r
357                 item.SubItems.Add(audio); // Audio\r
358 \r
359                 list_queue.Items.Add(item);\r
360             }\r
361         }\r
362 \r
363         /// <summary>\r
364         /// Update the UI elements\r
365         /// </summary>\r
366         private void UpdateUiElementsOnQueueChange()\r
367         {\r
368             if (InvokeRequired)\r
369             {\r
370                 BeginInvoke(new UpdateHandler(UpdateUiElementsOnQueueChange));\r
371                 return;\r
372             }\r
373 \r
374             RedrawQueue();\r
375             lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";\r
376         }\r
377 \r
378         /// <summary>\r
379         /// Set the window up with the current encode information\r
380         /// </summary>\r
381         private void SetCurrentEncodeInformation()\r
382         {\r
383             try\r
384             {\r
385                 if (InvokeRequired)\r
386                 {\r
387                     BeginInvoke(new UpdateHandler(SetCurrentEncodeInformation));\r
388                 }\r
389 \r
390                 QueryParser parsed = QueryParser.Parse(queue.LastEncode.Query);\r
391 \r
392                 // Get title and chapters\r
393                 string title = parsed.Title == 0 ? "Auto" : parsed.Title.ToString();\r
394                 string chapterlbl;\r
395                 if (Equals(parsed.ChapterStart, 0))\r
396                     chapterlbl = "Auto";\r
397                 else\r
398                 {\r
399                     string chapters = parsed.ChapterStart.ToString();\r
400                     if (parsed.ChapterFinish != 0)\r
401                         chapters = chapters + " - " + parsed.ChapterFinish;\r
402                     chapterlbl = chapters;\r
403                 }\r
404 \r
405                 // Get audio information\r
406                 string audio = string.Empty;\r
407                 foreach (AudioTrack track in parsed.AudioInformation)\r
408                 {\r
409                     if (audio != string.Empty) \r
410                         audio += ", " + track.Encoder;\r
411                     else\r
412                         audio = track.Encoder;\r
413                 }\r
414 \r
415                 // found query is a global varible        \r
416                 lbl_encodeStatus.Text = "Encoding ...";\r
417                 lbl_source.Text = queue.LastEncode.Source + "(Title: " + title + " Chapters: " + chapterlbl + ")";\r
418                 lbl_dest.Text = queue.LastEncode.Destination;\r
419                 lbl_encodeOptions.Text = "Video: " + parsed.VideoEncoder + " Audio: " + audio + Environment.NewLine +\r
420                                     "x264 Options: " + parsed.H264Query;\r
421                }\r
422             catch (Exception)\r
423             {\r
424                 // Do Nothing\r
425             }\r
426         }\r
427 \r
428         /* Right Click Menu */\r
429 \r
430         /// <summary>\r
431         /// Handle the Move Up Menu Item\r
432         /// </summary>\r
433         /// <param name="sender">\r
434         /// The sender.\r
435         /// </param>\r
436         /// <param name="e">\r
437         /// The e.\r
438         /// </param>\r
439         private void MnuUpClick(object sender, EventArgs e)\r
440         {\r
441             MoveUp();\r
442         }\r
443 \r
444         /// <summary>\r
445         /// Handle the Move down Menu Item\r
446         /// </summary>\r
447         /// <param name="sender">\r
448         /// The sender.\r
449         /// </param>\r
450         /// <param name="e">\r
451         /// The e.\r
452         /// </param>\r
453         private void MnuDownClick(object sender, EventArgs e)\r
454         {\r
455             MoveDown();\r
456         }\r
457 \r
458         /// <summary>\r
459         /// Edit a job\r
460         /// </summary>\r
461         /// <param name="sender">\r
462         /// The sender.\r
463         /// </param>\r
464         /// <param name="e">\r
465         /// The e.\r
466         /// </param>\r
467         private void MnuEditClick(object sender, EventArgs e)\r
468         {\r
469             if (list_queue.SelectedIndices != null && list_queue.SelectedIndices.Count != 0)\r
470             {\r
471                 lock (queue)\r
472                 {\r
473                     lock (list_queue)\r
474                     {\r
475                         int index = list_queue.SelectedIndices[0];\r
476                         mainWindow.RecievingJob(queue.GetJob(index));\r
477                         queue.Remove(index);\r
478                         RedrawQueue();\r
479                     }\r
480                 }\r
481             }\r
482         }\r
483 \r
484         /// <summary>\r
485         /// Handle the delete Menu Item\r
486         /// </summary>\r
487         /// <param name="sender">\r
488         /// The sender.\r
489         /// </param>\r
490         /// <param name="e">\r
491         /// The e.\r
492         /// </param>\r
493         private void MnuDeleteClick(object sender, EventArgs e)\r
494         {\r
495             DeleteSelectedItems();\r
496         }\r
497 \r
498         /* Keyboard Shortcuts */\r
499 \r
500         /// <summary>\r
501         /// Handle the delete keyboard press\r
502         /// </summary>\r
503         /// <param name="sender">\r
504         /// The sender.\r
505         /// </param>\r
506         /// <param name="e">\r
507         /// The e.\r
508         /// </param>\r
509         private void ListQueueDeleteKey(object sender, KeyEventArgs e)\r
510         {\r
511             if (e.KeyCode == Keys.Delete && e.Modifiers == Keys.None)\r
512                 DeleteSelectedItems();\r
513         }\r
514 \r
515         /* Queue Management */\r
516 \r
517         /// <summary>\r
518         /// Move items up in the queue\r
519         /// </summary>\r
520         private void MoveUp()\r
521         {\r
522             // If there are selected items and the first item is not selected\r
523             if (list_queue.SelectedIndices.Count > 0 && !list_queue.SelectedIndices.Contains(0))\r
524             {\r
525                 // Copy the selected indices to preserve them during the movement\r
526                 List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);\r
527                 foreach (int selectedIndex in list_queue.SelectedIndices)\r
528                     selectedIndices.Add(selectedIndex);\r
529 \r
530                 // Move up each selected item\r
531                 foreach (int selectedIndex in selectedIndices)\r
532                     queue.MoveUp(selectedIndex);\r
533 \r
534                 // Keep the selected item(s) selected, now moved up one index\r
535                 foreach (int selectedIndex in selectedIndices)\r
536                     if (selectedIndex - 1 > -1) // Defensive programming: ensure index is good\r
537                         list_queue.Items[selectedIndex - 1].Selected = true;\r
538             }\r
539 \r
540             list_queue.Select(); // Activate the control to show the selected items\r
541         }\r
542 \r
543         /// <summary>\r
544         /// Move items down in the queue\r
545         /// </summary>\r
546         private void MoveDown()\r
547         {\r
548             // If there are selected items and the last item is not selected\r
549             if (list_queue.SelectedIndices.Count > 0 &&\r
550                 !list_queue.SelectedIndices.Contains(list_queue.Items[list_queue.Items.Count - 1].Index))\r
551             {\r
552                 // Copy the selected indices to preserve them during the movement\r
553                 List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);\r
554                 foreach (int selectedIndex in list_queue.SelectedIndices)\r
555                     selectedIndices.Add(selectedIndex);\r
556 \r
557                 // Reverse the indices to move the items down from last to first (preserves indices)\r
558                 selectedIndices.Reverse();\r
559 \r
560                 // Move down each selected item\r
561                 foreach (int selectedIndex in selectedIndices)\r
562                     queue.MoveDown(selectedIndex);\r
563 \r
564                 // Keep the selected item(s) selected, now moved down one index\r
565                 foreach (int selectedIndex in selectedIndices)\r
566                     if (selectedIndex + 1 < list_queue.Items.Count) // Defensive programming: ensure index is good\r
567                         list_queue.Items[selectedIndex + 1].Selected = true;\r
568             }\r
569 \r
570             list_queue.Select(); // Activate the control to show the selected items\r
571         }\r
572 \r
573         /// <summary>\r
574         /// Delete the currently selected items on the queue\r
575         /// </summary>\r
576         private void DeleteSelectedItems()\r
577         {\r
578             // If there are selected items\r
579             if (list_queue.SelectedIndices.Count > 0)\r
580             {\r
581                 // Save the selected indices to select them after the move\r
582                 List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);\r
583                 foreach (int selectedIndex in list_queue.SelectedIndices)\r
584                     selectedIndices.Add(selectedIndex);\r
585 \r
586                 int firstSelectedIndex = selectedIndices[0];\r
587 \r
588                 // Reverse the list to delete the items from last to first (preserves indices)\r
589                 selectedIndices.Reverse();\r
590 \r
591                 // Remove each selected item\r
592                 foreach (int selectedIndex in selectedIndices)\r
593                     queue.Remove(selectedIndex);\r
594 \r
595                 // Select the item where the first deleted item was previously\r
596                 if (firstSelectedIndex < list_queue.Items.Count)\r
597                     list_queue.Items[firstSelectedIndex].Selected = true;\r
598             }\r
599 \r
600             list_queue.Select(); // Activate the control to show the selected items\r
601         }\r
602 \r
603         /* Queue Import / Export features */\r
604 \r
605         /// <summary>\r
606         /// Create a batch script\r
607         /// </summary>\r
608         /// <param name="sender">\r
609         /// The sender.\r
610         /// </param>\r
611         /// <param name="e">\r
612         /// The e.\r
613         /// </param>\r
614         private void MnuBatchClick(object sender, EventArgs e)\r
615         {\r
616             SaveFile.FileName = string.Empty;\r
617             SaveFile.Filter = "Batch|.bat";\r
618             SaveFile.ShowDialog();\r
619             if (SaveFile.FileName != String.Empty)\r
620                 queue.WriteBatchScriptToFile(SaveFile.FileName);\r
621         }\r
622 \r
623         /// <summary>\r
624         /// Export Queue\r
625         /// </summary>\r
626         /// <param name="sender">\r
627         /// The sender.\r
628         /// </param>\r
629         /// <param name="e">\r
630         /// The e.\r
631         /// </param>\r
632         private void MnuExportClick(object sender, EventArgs e)\r
633         {\r
634             SaveFile.FileName = string.Empty;\r
635             SaveFile.Filter = "HandBrake Queue|*.queue";\r
636             SaveFile.ShowDialog();\r
637             if (SaveFile.FileName != String.Empty)\r
638                 queue.WriteQueueStateToFile(SaveFile.FileName);\r
639         }\r
640 \r
641         /// <summary>\r
642         /// Import Queue\r
643         /// </summary>\r
644         /// <param name="sender">\r
645         /// The sender.\r
646         /// </param>\r
647         /// <param name="e">\r
648         /// The e.\r
649         /// </param>\r
650         private void MnuImportClick(object sender, EventArgs e)\r
651         {\r
652             OpenFile.FileName = string.Empty;\r
653             OpenFile.ShowDialog();\r
654             if (OpenFile.FileName != String.Empty)\r
655                 queue.LoadQueueFromFile(OpenFile.FileName);\r
656         }\r
657 \r
658         /// <summary>\r
659         /// Readd current job to queue\r
660         /// </summary>\r
661         /// <param name="sender">\r
662         /// The sender.\r
663         /// </param>\r
664         /// <param name="e">\r
665         /// The e.\r
666         /// </param>\r
667         private void MnuReaddClick(object sender, EventArgs e)\r
668         {\r
669             if (queue.LastEncode != null && !queue.LastEncode.IsEmpty)\r
670             {\r
671                 queue.Add(\r
672                     queue.LastEncode.Query, \r
673                     queue.LastEncode.Title, \r
674                     queue.LastEncode.Source,\r
675                     queue.LastEncode.Destination,\r
676                     queue.LastEncode.CustomQuery);\r
677             }\r
678         }\r
679 \r
680         /* Overrides */\r
681 \r
682         /// <summary>\r
683         /// Hide's the window when the user tries to "x" out of the window instead of closing it.\r
684         /// </summary>\r
685         /// <param name="e">\r
686         /// The e.\r
687         /// </param>\r
688         protected override void OnClosing(CancelEventArgs e)\r
689         {\r
690             e.Cancel = true;\r
691             this.Hide();\r
692             base.OnClosing(e);\r
693         }\r
694 \r
695         /// <summary>\r
696         /// Change the OnComplete option setting.\r
697         /// </summary>\r
698         /// <param name="sender">\r
699         /// The sender.\r
700         /// </param>\r
701         /// <param name="e">\r
702         /// The EventArgs.\r
703         /// </param>\r
704         private void CompleteOptionChanged(object sender, EventArgs e)\r
705         {\r
706             Properties.Settings.Default.CompletionOption = drp_completeOption.Text;\r
707             HandBrake.ApplicationServices.Init.CompletionOption = drp_completeOption.Text;\r
708             Properties.Settings.Default.Save();\r
709         }\r
710     }\r
711 }