aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication
diff options
context:
space:
mode:
authorhatharry <hatharry@hotmail.com>2016-08-29 01:27:43 +1200
committerhatharry <hatharry@hotmail.com>2016-08-29 01:27:43 +1200
commitcabf2cdc1be4c06714ac6bcf835a19d2f652a6e2 (patch)
treed375b8a41e9fd40a2569ceea6b02e4f8237db797 /MediaBrowser.ServerApplication
parente564b54686029a90595e1bb4277f87490763e183 (diff)
parentc974641a352685b2e6595dd7b291843c8e6364ac (diff)
Merge branch 'dev' of https://github.com/hatharry/Emby.git
Diffstat (limited to 'MediaBrowser.ServerApplication')
-rw-r--r--MediaBrowser.ServerApplication/App.config2
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs9
-rw-r--r--MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj2
-rw-r--r--MediaBrowser.ServerApplication/Native/DbConnector.cs4
-rw-r--r--MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs3
-rw-r--r--MediaBrowser.ServerApplication/Native/WindowsApp.cs1
-rw-r--r--MediaBrowser.ServerApplication/ServerNotifyIcon.cs65
7 files changed, 28 insertions, 58 deletions
diff --git a/MediaBrowser.ServerApplication/App.config b/MediaBrowser.ServerApplication/App.config
index 6d840c191..fa7bc9f89 100644
--- a/MediaBrowser.ServerApplication/App.config
+++ b/MediaBrowser.ServerApplication/App.config
@@ -17,7 +17,7 @@
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<startup useLegacyV2RuntimeActivationPolicy="true">
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
<runtime>
<gcAllowVeryLargeObjects enabled="true"/>
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 8d26f6a14..d56558c72 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -19,7 +19,6 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using CommonIO.Windows;
-using Emby.Drawing.ImageMagick;
using ImageMagickSharp;
using MediaBrowser.Common.Net;
using MediaBrowser.Server.Implementations.Logging;
@@ -166,7 +165,7 @@ namespace MediaBrowser.ServerApplication
{
_logger.Info("Found a duplicate process. Giving it time to exit.");
- if (!duplicate.WaitForExit(15000))
+ if (!duplicate.WaitForExit(20000))
{
_logger.Info("The duplicate process did not exit.");
return true;
@@ -639,6 +638,12 @@ namespace MediaBrowser.ServerApplication
private static void ShutdownWindowsApplication()
{
+ if (_serverNotifyIcon != null)
+ {
+ _serverNotifyIcon.Dispose();
+ _serverNotifyIcon = null;
+ }
+
//_logger.Info("Calling Application.Exit");
//Application.Exit();
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index b01d8c43f..9c5470358 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MediaBrowser.ServerApplication</RootNamespace>
<AssemblyName>MediaBrowser.ServerApplication</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<TargetFrameworkProfile />
diff --git a/MediaBrowser.ServerApplication/Native/DbConnector.cs b/MediaBrowser.ServerApplication/Native/DbConnector.cs
index 9aaa96a80..f403ce2ce 100644
--- a/MediaBrowser.ServerApplication/Native/DbConnector.cs
+++ b/MediaBrowser.ServerApplication/Native/DbConnector.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Data;
-using System.Data.SQLite;
+using System.Data;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Implementations.Persistence;
diff --git a/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs
index 67d2e83f0..dc1e3c79b 100644
--- a/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs
+++ b/MediaBrowser.ServerApplication/Native/LnkShortcutHandler.cs
@@ -1,11 +1,8 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
-using System.Threading.Tasks;
using CommonIO;
namespace MediaBrowser.ServerApplication.Native
diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs
index d8b2720c2..3c9c04acb 100644
--- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs
+++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs
@@ -7,7 +7,6 @@ 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.Model.System;
diff --git a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs
index 27816db5a..d04128a18 100644
--- a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs
+++ b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs
@@ -4,14 +4,13 @@ using MediaBrowser.Controller.Localization;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Startup.Common.Browser;
using System;
+using System.ComponentModel;
using System.Windows.Forms;
namespace MediaBrowser.ServerApplication
{
public class ServerNotifyIcon : IDisposable
{
- bool IsDisposing = false;
-
private NotifyIcon notifyIcon1;
private ContextMenuStrip contextMenuStrip1;
private ToolStripMenuItem cmdExit;
@@ -21,25 +20,13 @@ namespace MediaBrowser.ServerApplication
private ToolStripMenuItem cmdRestart;
private ToolStripSeparator toolStripSeparator1;
private ToolStripMenuItem cmdCommunity;
+ private Container components;
private readonly ILogger _logger;
private readonly IServerApplicationHost _appHost;
private readonly IServerConfigurationManager _configurationManager;
private readonly ILocalizationManager _localization;
- public bool Visible
- {
- get
- {
- return notifyIcon1.Visible;
- }
- set
- {
- Action act = () => notifyIcon1.Visible = false;
- Invoke(act);
- }
- }
-
public void Invoke(Action action)
{
contextMenuStrip1.Invoke(action);
@@ -55,7 +42,7 @@ namespace MediaBrowser.ServerApplication
_appHost = appHost;
_configurationManager = configurationManager;
- var components = new System.ComponentModel.Container();
+ components = new System.ComponentModel.Container();
var resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
contextMenuStrip1 = new ContextMenuStrip(components);
@@ -138,32 +125,6 @@ namespace MediaBrowser.ServerApplication
LocalizeText();
notifyIcon1.DoubleClick += notifyIcon1_DoubleClick;
- Application.ThreadExit += Application_ThreadExit;
- Application.ApplicationExit += Application_ApplicationExit;
- }
-
- void Application_ThreadExit(object sender, EventArgs e)
- {
- try
- {
- notifyIcon1.Visible = false;
- }
- catch
- {
-
- }
- }
-
- void Application_ApplicationExit(object sender, EventArgs e)
- {
- try
- {
- notifyIcon1.Visible = false;
- }
- catch
- {
-
- }
}
void notifyIcon1_DoubleClick(object sender, EventArgs e)
@@ -222,16 +183,26 @@ namespace MediaBrowser.ServerApplication
_appHost.Shutdown();
}
- ~ServerNotifyIcon()
+ public void Dispose()
{
- Dispose();
+ Dispose(true);
}
- public void Dispose()
+ protected virtual void Dispose(bool disposing)
{
- if (!IsDisposing)
+ if (disposing)
{
- IsDisposing = true;
+ if (notifyIcon1 != null)
+ {
+ notifyIcon1.Visible = false;
+ notifyIcon1.Dispose();
+ notifyIcon1 = null;
+ }
+
+ if (components != null)
+ {
+ components.Dispose();
+ }
}
}
}