+\r
+ /// <summary>\r
+ /// Create the Preview.\r
+ /// </summary>\r
+ /// <param name="state">\r
+ /// The state.\r
+ /// </param>\r
+ private void CreatePreview(object state)\r
+ {\r
+ // Make sure we are not already encoding and if we are then display an error.\r
+ if (encodeQueue.IsEncoding)\r
+ {\r
+ MessageBox.Show(\r
+ this,\r
+ "Handbrake is already encoding a video!",\r
+ "Warning",\r
+ MessageBoxButtons.OK,\r
+ MessageBoxIcon.Warning);\r
+\r
+ return;\r
+ }\r
+\r
+ encodeQueue.CreatePreviewSample((string)state);\r
+ }\r
+\r
+ #endregion\r
+\r
+ #region Playback\r
+\r
+ /// <summary>\r
+ /// Play the video back in the QuickTime control\r
+ /// </summary>\r
+ private void Play()\r
+ {\r
+ this.player = new Thread(OpenMovie) { IsBackground = true };\r
+ this.player.Start();\r
+ }\r
+\r
+ /// <summary>\r
+ /// Play the video back in an external VLC Player\r
+ /// </summary>\r
+ private void PlayVlc()\r
+ {\r
+ // Launch VLC and Play video.\r
+ if (this.currentlyPlaying != string.Empty)\r
+ {\r
+ if (File.Exists(this.currentlyPlaying))\r
+ {\r
+ // Attempt to find VLC if it doesn't exist in the default set location.\r
+ string vlcPath;\r
+\r
+ if (8 == IntPtr.Size ||\r
+ (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))\r
+ vlcPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");\r
+ else\r
+ vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");\r
+\r
+ vlcPath = vlcPath != null\r
+ ? vlcPath + @"\VideoLAN\VLC\vlc.exe"\r
+ : @"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe";\r
+\r
+ if (!File.Exists(Properties.Settings.Default.VLC_Path))\r
+ {\r
+ if (File.Exists(vlcPath))\r
+ {\r
+ Properties.Settings.Default.VLC_Path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";\r
+ Properties.Settings.Default.Save(); // Save this new path if it does\r
+ }\r
+ else\r
+ {\r
+ MessageBox.Show(this,\r
+ "Unable to detect VLC Player. \nPlease make sure VLC is installed and the directory specified in HandBrake's options is correct. (See: \"Tools Menu > Options > Picture Tab\") ",\r
+ "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ }\r
+ }\r
+\r
+ if (File.Exists(Properties.Settings.Default.VLC_Path))\r
+ {\r
+ string args = "\"" + this.currentlyPlaying + "\"";\r
+ ProcessStartInfo vlc = new ProcessStartInfo(Properties.Settings.Default.VLC_Path, args);\r
+ Process.Start(vlc);\r
+ }\r
+ }\r
+ else\r
+ MessageBox.Show(this,\r
+ "Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.",\r
+ "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// QT control - Open the file\r
+ /// </summary>\r
+ [STAThread]\r
+ private void OpenMovie()\r