/// <summary>\r
/// Prevent the system from sleeping\r
/// </summary>\r
- public void PreventSleep()\r
+ public static void PreventSleep()\r
{\r
SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_AWAYMODE_REQUIRED);\r
}\r
/// <summary>\r
/// Allow the system to sleep.\r
/// </summary>\r
- public void AllowSleep()\r
+ public static void AllowSleep()\r
{\r
SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS);\r
}\r
/// <param name="showCliForInGuiEncodeStatus">\r
/// The show cli for in gui encode status.\r
/// </param>\r
+ /// <param name="preventSleep">\r
+ /// Prevent the system from sleeping\r
+ /// </param>\r
public static void SetupSettings(bool cli_minimized, string completionOption, bool disableDvdNav, bool enocdeStatusInGui,\r
bool growlEncode, bool growlQueue, string processPriority, string saveLogPath, bool saveLogToSpecifiedPath,\r
- bool saveLogWithVideo, bool showCliForInGuiEncodeStatus)\r
+ bool saveLogWithVideo, bool showCliForInGuiEncodeStatus, bool preventSleep)\r
{\r
Properties.Settings.Default.cli_minimized = cli_minimized;\r
Properties.Settings.Default.CompletionOption = completionOption;\r
Properties.Settings.Default.saveLogToSpecifiedPath = saveLogToSpecifiedPath;\r
Properties.Settings.Default.saveLogWithVideo = saveLogWithVideo;\r
Properties.Settings.Default.showCliForInGuiEncodeStatus = showCliForInGuiEncodeStatus;\r
+ Properties.Settings.Default.preventSleep = preventSleep;\r
\r
Properties.Settings.Default.Save();\r
}\r
this["growlEncode"] = value;\r
}\r
}\r
+ \r
+ [global::System.Configuration.UserScopedSettingAttribute()]\r
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
+ public bool preventSleep {\r
+ get {\r
+ return ((bool)(this["preventSleep"]));\r
+ }\r
+ set {\r
+ this["preventSleep"] = value;\r
+ }\r
+ }\r
}\r
}\r
<Setting Name="growlEncode" Type="System.Boolean" Scope="User">\r
<Value Profile="(Default)">False</Value>\r
</Setting>\r
+ <Setting Name="preventSleep" Type="System.Boolean" Scope="User">\r
+ <Value Profile="(Default)">False</Value>\r
+ </Setting>\r
</Settings>\r
</SettingsFile>
\ No newline at end of file
this.job = encJob;\r
try\r
{\r
+ if (Properties.Settings.Default.preventSleep)\r
+ {\r
+ Win32.PreventSleep();\r
+ }\r
+\r
ResetLogReader();\r
IsEncoding = true;\r
\r
HbProcess = Process.Start(cliStart);\r
this.processID = Main.GetCliProcess(before);\r
\r
- if (HbProcess != null)\r
- this.processHandle = HbProcess.MainWindowHandle; // Set the process Handle\r
+ this.processHandle = HbProcess.MainWindowHandle; // Set the process Handle\r
\r
// Start the Log Monitor\r
windowTimer = new Timer(new TimerCallback(ReadFile), null, 1000, 1000);\r
{\r
windowsSeven.SetTaskBarProgressToNoProgress();\r
}\r
+\r
+ if (Properties.Settings.Default.preventSleep)\r
+ {\r
+ Win32.AllowSleep();\r
+ }\r
}\r
\r
/// <summary>\r
while (!encode.EndOfStream)\r
encode.ReadEncodeStatus();\r
\r
- // Main.ShowExceptiowWindow("Encode Monitor Stopped", "Stopped");\r
+ // Main.ShowExceptiowWindow("Encode Monitor Stopped", "Stopped");\r
}\r
catch (Exception exc)\r
{\r
<setting name="growlEncode" serializeAs="String">\r
<value>False</value>\r
</setting>\r
+ <setting name="preventSleep" serializeAs="String">\r
+ <value>False</value>\r
+ </setting>\r
</HandBrake.ApplicationServices.Properties.Settings>\r
</userSettings>\r
</configuration>
\ No newline at end of file
Init.SetupSettings(Settings.Default.cli_minimized, Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
Settings.Default.enocdeStatusInGui, Settings.Default.growlEncode, Settings.Default.growlQueue,\r
Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,\r
- Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus);\r
+ Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);\r
}\r
\r
/// <summary>\r
\r
private void encodeStarted(object sender, EventArgs e)\r
{\r
- if (Properties.Settings.Default.preventSleep)\r
- {\r
- Win32.PreventSleep();\r
- } \r
SetEncodeStarted();\r
encodeQueue.EncodeStatusChanged += EncodeQueue_EncodeStatusChanged;\r
}\r
\r
private void encodeEnded(object sender, EventArgs e)\r
{\r
- if (Properties.Settings.Default.preventSleep)\r
- {\r
- Win32.AllowSleep();\r
- }\r
encodeQueue.EncodeStatusChanged -= EncodeQueue_EncodeStatusChanged;\r
SetEncodeFinished();\r
}\r
Init.SetupSettings(Settings.Default.cli_minimized, Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
Settings.Default.enocdeStatusInGui, Settings.Default.growlEncode, Settings.Default.growlQueue,\r
Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,\r
- Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus);\r
+ Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);\r
}\r
}\r
}
\ No newline at end of file