From 13cef31b4f52ff61595bd2e4a12e217b022a2705 Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 25 Nov 2014 23:27:55 -0500 Subject: update mac project --- MediaBrowser.Server.Mac/AppController.cs | 1 + MediaBrowser.Server.Mac/Main.cs | 22 +++++++++------------- .../MediaBrowser.Server.Mac.csproj | 4 +++- MediaBrowser.Server.Mac/Native/NativeApp.cs | 20 ++++++++++++++++++++ 4 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 MediaBrowser.Server.Mac/Native/NativeApp.cs (limited to 'MediaBrowser.Server.Mac') diff --git a/MediaBrowser.Server.Mac/AppController.cs b/MediaBrowser.Server.Mac/AppController.cs index 1823e21528..c500084e24 100644 --- a/MediaBrowser.Server.Mac/AppController.cs +++ b/MediaBrowser.Server.Mac/AppController.cs @@ -25,6 +25,7 @@ namespace MediaBrowser.Server.Mac public AppController() { Instance = this; + MainClass.AddDependencies (this); } public override void AwakeFromNib() diff --git a/MediaBrowser.Server.Mac/Main.cs b/MediaBrowser.Server.Mac/Main.cs index 88b9497ead..6b76a63f1b 100644 --- a/MediaBrowser.Server.Mac/Main.cs +++ b/MediaBrowser.Server.Mac/Main.cs @@ -15,7 +15,6 @@ using MediaBrowser.Common.Implementations.IO; using MediaBrowser.Common.Implementations.Logging; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Implementations; -using MediaBrowser.Server.Mono.Native; using MediaBrowser.Server.Startup.Common; using MediaBrowser.Server.Startup.Common.Browser; using Microsoft.Win32; @@ -54,26 +53,23 @@ namespace MediaBrowser.Server.Mac AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; StartApplication(appPaths, logManager, options); - RunNSApp (args); - } - - private static void RunNSApp(string[] args) { - NSApplication.Init (); - - AppController.Instance.AppHost = _appHost; - AppController.Instance.Logger = _logger; - AppController.Instance.ConfigurationManager = _appHost.ServerConfigurationManager; - AppController.Instance.Localization = _appHost.LocalizationManager; - NSApplication.Main (args); + var b = true; + } + + public static void AddDependencies(AppController appController){ + appController.AppHost = _appHost; + appController.Logger = _logger; + appController.ConfigurationManager = _appHost.ServerConfigurationManager; + appController.Localization = _appHost.LocalizationManager; } private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, string programDataPath) { if (string.IsNullOrEmpty(programDataPath)) { - return new ServerApplicationPaths(applicationPath); + programDataPath = Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "mediabrowser"); } return new ServerApplicationPaths(programDataPath, applicationPath); diff --git a/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj b/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj index 2f67874882..648bdca050 100644 --- a/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj +++ b/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj @@ -72,9 +72,9 @@ + - AppDelegate.cs @@ -83,6 +83,8 @@ AppController.cs + + diff --git a/MediaBrowser.Server.Mac/Native/NativeApp.cs b/MediaBrowser.Server.Mac/Native/NativeApp.cs new file mode 100644 index 0000000000..aedce3d667 --- /dev/null +++ b/MediaBrowser.Server.Mac/Native/NativeApp.cs @@ -0,0 +1,20 @@ +using System; +using MediaBrowser.Server.Mono.Native; + +namespace MediaBrowser.Server.Mac +{ + /// + /// Class NativeApp + /// + public class NativeApp : BaseMonoApp + { + /// + /// Shutdowns this instance. + /// + public override void Shutdown() + { + MainClass.Shutdown(); + } + } +} + -- cgit v1.2.3