diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-04-24 20:40:34 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-04-24 20:40:34 -0400 |
| commit | e02b3f479ef9dbde00cd6ff18510526e3b54e73c (patch) | |
| tree | 4e551363508bd25e8b631fc2b230454f2ed0f164 /MediaBrowser.ServerApplication/Native/WindowsApp.cs | |
| parent | f33b246501f493fcc8ef49e4ae3f9a1b47d804da (diff) | |
| parent | 6b1c6ace222d7b94a3a378b1a88126537349431d (diff) | |
Merge pull request #1681 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.ServerApplication/Native/WindowsApp.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/Native/WindowsApp.cs | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index 146a4372b..10cd59436 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -1,13 +1,17 @@ -using MediaBrowser.Common.Net; +using System; +using MediaBrowser.Common.Net; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Startup.Common; using MediaBrowser.ServerApplication.Networking; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Reflection; +using System.Windows.Forms; using CommonIO; using MediaBrowser.Controller.Power; using MediaBrowser.Server.Startup.Common.FFMpeg; +using OperatingSystem = MediaBrowser.Server.Startup.Common.OperatingSystem; namespace MediaBrowser.ServerApplication.Native { @@ -134,7 +138,12 @@ namespace MediaBrowser.ServerApplication.Native public void PreventSystemStandby() { - Standby.PreventSystemStandby(); + MainStartup.Invoke(Standby.PreventSleep); + } + + public void AllowSystemStandby() + { + MainStartup.Invoke(Standby.AllowSleep); } public IPowerManagement GetPowerManagement() @@ -156,6 +165,42 @@ namespace MediaBrowser.ServerApplication.Native return info; } + public void LaunchUrl(string url) + { + var process = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = url + }, + + EnableRaisingEvents = true, + }; + + process.Exited += ProcessExited; + + try + { + process.Start(); + } + catch (Exception ex) + { + _logger.ErrorException("Error launching url: {0}", ex, url); + + throw; + } + } + + /// <summary> + /// Processes the exited. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> + private static void ProcessExited(object sender, EventArgs e) + { + ((Process)sender).Dispose(); + } + private string[] GetDownloadUrls() { switch (Environment.SystemArchitecture) |
