mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
updates for mac project
This commit is contained in:
parent
9875c3a7e9
commit
cc2d04d5bc
@ -448,45 +448,43 @@ namespace MediaBrowser.Common.Implementations
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
protected virtual Task RegisterResources(IProgress<double> progress)
|
protected virtual Task RegisterResources(IProgress<double> progress)
|
||||||
{
|
{
|
||||||
return Task.Run(() =>
|
RegisterSingleInstance(ConfigurationManager);
|
||||||
{
|
RegisterSingleInstance<IApplicationHost>(this);
|
||||||
RegisterSingleInstance(ConfigurationManager);
|
|
||||||
RegisterSingleInstance<IApplicationHost>(this);
|
|
||||||
|
|
||||||
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
||||||
|
|
||||||
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger);
|
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger);
|
||||||
|
|
||||||
RegisterSingleInstance(JsonSerializer);
|
RegisterSingleInstance(JsonSerializer);
|
||||||
RegisterSingleInstance(XmlSerializer);
|
RegisterSingleInstance(XmlSerializer);
|
||||||
|
|
||||||
RegisterSingleInstance(LogManager);
|
RegisterSingleInstance(LogManager);
|
||||||
RegisterSingleInstance(Logger);
|
RegisterSingleInstance(Logger);
|
||||||
|
|
||||||
RegisterSingleInstance(TaskManager);
|
RegisterSingleInstance(TaskManager);
|
||||||
|
|
||||||
RegisterSingleInstance(FileSystemManager);
|
RegisterSingleInstance(FileSystemManager);
|
||||||
|
|
||||||
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, FileSystemManager, ConfigurationManager);
|
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, FileSystemManager, ConfigurationManager);
|
||||||
RegisterSingleInstance(HttpClient);
|
RegisterSingleInstance(HttpClient);
|
||||||
|
|
||||||
NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
|
NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
|
||||||
RegisterSingleInstance(NetworkManager);
|
RegisterSingleInstance(NetworkManager);
|
||||||
|
|
||||||
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, NetworkManager, LogManager);
|
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, NetworkManager, LogManager);
|
||||||
RegisterSingleInstance(SecurityManager);
|
RegisterSingleInstance(SecurityManager);
|
||||||
|
|
||||||
InstallationManager = new InstallationManager(Logger, this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, NetworkManager, ConfigurationManager);
|
InstallationManager = new InstallationManager(Logger, this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, NetworkManager, ConfigurationManager);
|
||||||
RegisterSingleInstance(InstallationManager);
|
RegisterSingleInstance(InstallationManager);
|
||||||
|
|
||||||
ZipClient = new ZipClient();
|
ZipClient = new ZipClient();
|
||||||
RegisterSingleInstance(ZipClient);
|
RegisterSingleInstance(ZipClient);
|
||||||
|
|
||||||
IsoManager = new IsoManager();
|
IsoManager = new IsoManager();
|
||||||
RegisterSingleInstance(IsoManager);
|
RegisterSingleInstance(IsoManager);
|
||||||
|
|
||||||
RegisterModules();
|
RegisterModules();
|
||||||
});
|
return Task.FromResult (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterModules()
|
private void RegisterModules()
|
||||||
|
@ -12,143 +12,9 @@ namespace MediaBrowser.Server.Mac
|
|||||||
[Register("AppController")]
|
[Register("AppController")]
|
||||||
public partial class AppController : NSObject
|
public partial class AppController : NSObject
|
||||||
{
|
{
|
||||||
private NSMenuItem browseMenuItem;
|
|
||||||
private NSMenuItem configureMenuItem;
|
|
||||||
private NSMenuItem developerMenuItem;
|
|
||||||
private NSMenuItem quitMenuItem;
|
|
||||||
private NSMenuItem githubMenuItem;
|
|
||||||
private NSMenuItem apiMenuItem;
|
|
||||||
private NSMenuItem communityMenuItem;
|
|
||||||
|
|
||||||
public static AppController Instance;
|
|
||||||
|
|
||||||
public AppController()
|
|
||||||
{
|
|
||||||
Instance = this;
|
|
||||||
MainClass.AddDependencies (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void AwakeFromNib()
|
public override void AwakeFromNib()
|
||||||
{
|
{
|
||||||
var statusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(30);
|
|
||||||
statusItem.Menu = statusMenu;
|
|
||||||
statusItem.Image = NSImage.ImageNamed("statusicon");
|
|
||||||
statusItem.HighlightMode = true;
|
|
||||||
|
|
||||||
statusMenu.RemoveAllItems ();
|
|
||||||
|
|
||||||
browseMenuItem = new NSMenuItem ("Browse Media Library", "b", delegate {
|
|
||||||
Browse (this);
|
|
||||||
});
|
|
||||||
statusMenu.AddItem (browseMenuItem);
|
|
||||||
|
|
||||||
configureMenuItem = new NSMenuItem ("Configure Media Browser", "c", delegate {
|
|
||||||
Configure (this);
|
|
||||||
});
|
|
||||||
statusMenu.AddItem (configureMenuItem);
|
|
||||||
|
|
||||||
developerMenuItem = new NSMenuItem ("Developer Resources");
|
|
||||||
statusMenu.AddItem (developerMenuItem);
|
|
||||||
|
|
||||||
var developerMenu = new NSMenu ();
|
|
||||||
developerMenuItem.Submenu = developerMenu;
|
|
||||||
|
|
||||||
apiMenuItem = new NSMenuItem ("Api Documentation", "a", delegate {
|
|
||||||
ApiDocs (this);
|
|
||||||
});
|
|
||||||
developerMenu.AddItem (apiMenuItem);
|
|
||||||
|
|
||||||
githubMenuItem = new NSMenuItem ("Github", "g", delegate {
|
|
||||||
Github (this);
|
|
||||||
});
|
|
||||||
developerMenu.AddItem (githubMenuItem);
|
|
||||||
|
|
||||||
communityMenuItem = new NSMenuItem ("Visit Community", "v", delegate {
|
|
||||||
Community (this);
|
|
||||||
});
|
|
||||||
statusMenu.AddItem (communityMenuItem);
|
|
||||||
|
|
||||||
quitMenuItem = new NSMenuItem ("Quit", "q", delegate {
|
|
||||||
Quit (this);
|
|
||||||
});
|
|
||||||
statusMenu.AddItem (quitMenuItem);
|
|
||||||
|
|
||||||
ConfigurationManager.ConfigurationUpdated -= Instance_ConfigurationUpdated;
|
|
||||||
LocalizeText ();
|
|
||||||
ConfigurationManager.ConfigurationUpdated += Instance_ConfigurationUpdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IServerApplicationHost AppHost{ get; set;}
|
|
||||||
public IServerConfigurationManager ConfigurationManager { get; set;}
|
|
||||||
public ILogger Logger{ get; set;}
|
|
||||||
public ILocalizationManager Localization { get; set;}
|
|
||||||
|
|
||||||
private void Quit(NSObject sender)
|
|
||||||
{
|
|
||||||
AppHost.Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Community(NSObject sender)
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenCommunity(Logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Configure(NSObject sender)
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenDashboard(AppHost, Logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Browse(NSObject sender)
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenWebClient(AppHost, Logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Github(NSObject sender)
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenGithub(Logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApiDocs(NSObject sender)
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenSwagger(AppHost, Logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Terminate()
|
|
||||||
{
|
|
||||||
InvokeOnMainThread (() => NSApplication.SharedApplication.Terminate(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _uiCulture;
|
|
||||||
/// <summary>
|
|
||||||
/// Handles the ConfigurationUpdated event of the Instance control.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender">The source of the event.</param>
|
|
||||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
|
||||||
void Instance_ConfigurationUpdated(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (!string.Equals(ConfigurationManager.Configuration.UICulture, _uiCulture,
|
|
||||||
StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
LocalizeText();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LocalizeText()
|
|
||||||
{
|
|
||||||
_uiCulture = ConfigurationManager.Configuration.UICulture;
|
|
||||||
|
|
||||||
BeginInvokeOnMainThread (LocalizeInternal);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LocalizeInternal() {
|
|
||||||
|
|
||||||
quitMenuItem.Title = Localization.GetLocalizedString("LabelExit");
|
|
||||||
communityMenuItem.Title = Localization.GetLocalizedString("LabelVisitCommunity");
|
|
||||||
githubMenuItem.Title = Localization.GetLocalizedString("LabelGithub");
|
|
||||||
apiMenuItem.Title = Localization.GetLocalizedString("LabelApiDocumentation");
|
|
||||||
developerMenuItem.Title = Localization.GetLocalizedString("LabelDeveloperResources");
|
|
||||||
browseMenuItem.Title = Localization.GetLocalizedString("LabelBrowseLibrary");
|
|
||||||
configureMenuItem.Title = Localization.GetLocalizedString("LabelConfigureMediaBrowser");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Server.Mac
|
|||||||
|
|
||||||
public override void FinishedLaunching (NSObject notification)
|
public override void FinishedLaunching (NSObject notification)
|
||||||
{
|
{
|
||||||
|
new MenuBarIcon ().ShowIcon ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,27 +2,29 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.MediaBrowser.MediaBrowser.Server.Mac</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>Media Browser</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
|
||||||
<string>10.6</string>
|
|
||||||
<key>LSUIElement</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>LSMultipleInstancesProhibited</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>NSMainNibFile</key>
|
|
||||||
<string>MainMenu</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string>NSApplication</string>
|
|
||||||
<key>LSApplicationCategoryType</key>
|
|
||||||
<string>public.app-category.video</string>
|
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>Media Browser</string>
|
<string>Media Browser</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>appicon</string>
|
<string>appicon</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.MediaBrowser.MediaBrowser.Server.Mac</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Media Browser</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>3</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>LSApplicationCategoryType</key>
|
||||||
|
<string>public.app-category.video</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.6</string>
|
||||||
|
<key>LSMultipleInstancesProhibited</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>LSUIElement</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
<key>NSMainNibFile</key>
|
||||||
|
<string>MainMenu</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -18,7 +18,6 @@ using MediaBrowser.Server.Implementations;
|
|||||||
using MediaBrowser.Server.Startup.Common;
|
using MediaBrowser.Server.Startup.Common;
|
||||||
using MediaBrowser.Server.Startup.Common.Browser;
|
using MediaBrowser.Server.Startup.Common.Browser;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Microsoft.Win32;
|
|
||||||
using MonoMac.AppKit;
|
using MonoMac.AppKit;
|
||||||
using MonoMac.Foundation;
|
using MonoMac.Foundation;
|
||||||
using MonoMac.ObjCRuntime;
|
using MonoMac.ObjCRuntime;
|
||||||
@ -57,7 +56,7 @@ namespace MediaBrowser.Server.Mac
|
|||||||
NSApplication.Main (args);
|
NSApplication.Main (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddDependencies(AppController appController){
|
public static void AddDependencies(MenuBarIcon appController){
|
||||||
appController.AppHost = _appHost;
|
appController.AppHost = _appHost;
|
||||||
appController.Logger = _logger;
|
appController.Logger = _logger;
|
||||||
appController.ConfigurationManager = _appHost.ServerConfigurationManager;
|
appController.ConfigurationManager = _appHost.ServerConfigurationManager;
|
||||||
@ -106,13 +105,16 @@ namespace MediaBrowser.Server.Mac
|
|||||||
|
|
||||||
Console.WriteLine ("appHost.Init");
|
Console.WriteLine ("appHost.Init");
|
||||||
|
|
||||||
|
Task.Run (() => StartServer(CancellationToken.None));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async void StartServer(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
var initProgress = new Progress<double>();
|
var initProgress = new Progress<double>();
|
||||||
|
|
||||||
var task = _appHost.Init(initProgress);
|
await _appHost.Init (initProgress).ConfigureAwait (false);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
//await _appHost.RunStartupTasks ().ConfigureAwait (false);
|
||||||
|
|
||||||
Task.Run (() => _appHost.RunStartupTasks());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -139,7 +141,7 @@ namespace MediaBrowser.Server.Mac
|
|||||||
_appHost.Dispose ();
|
_appHost.Dispose ();
|
||||||
|
|
||||||
_logger.Info("AppController.Terminate");
|
_logger.Info("AppController.Terminate");
|
||||||
AppController.Instance.Terminate ();
|
MenuBarIcon.Instance.Terminate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -86,13 +86,14 @@
|
|||||||
<Compile Include="AppController.designer.cs">
|
<Compile Include="AppController.designer.cs">
|
||||||
<DependentUpon>AppController.cs</DependentUpon>
|
<DependentUpon>AppController.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Main.cs" />
|
|
||||||
<Compile Include="Native\NativeApp.cs" />
|
<Compile Include="Native\NativeApp.cs" />
|
||||||
<Compile Include="Native\BaseMonoApp.cs" />
|
<Compile Include="Native\BaseMonoApp.cs" />
|
||||||
<Compile Include="Native\NetworkManager.cs" />
|
<Compile Include="Native\NetworkManager.cs" />
|
||||||
<Compile Include="..\SharedVersion.cs">
|
<Compile Include="..\SharedVersion.cs">
|
||||||
<Link>SharedVersion.cs</Link>
|
<Link>SharedVersion.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Main.cs" />
|
||||||
|
<Compile Include="MenuBarIcon.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<InterfaceDefinition Include="MainMenu.xib" />
|
<InterfaceDefinition Include="MainMenu.xib" />
|
||||||
@ -2960,5 +2961,6 @@
|
|||||||
<Link>Resources\dashboard-ui\thirdparty\swipebox-master\js\jquery.swipebox.min.js</Link>
|
<Link>Resources\dashboard-ui\thirdparty\swipebox-master\js\jquery.swipebox.min.js</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
<BundleResource Include="Resources\appicon.icns" />
|
<BundleResource Include="Resources\appicon.icns" />
|
||||||
|
<BundleResource Include="Resources\MediaBrowser.Server.Mac\Images.xcassets\AppIcon.appiconset\Contents.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
163
MediaBrowser.Server.Mac/MenuBarIcon.cs
Normal file
163
MediaBrowser.Server.Mac/MenuBarIcon.cs
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
using MediaBrowser.Controller;
|
||||||
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Localization;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Server.Startup.Common.Browser;
|
||||||
|
using System;
|
||||||
|
using MonoMac.Foundation;
|
||||||
|
using MonoMac.AppKit;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Mac
|
||||||
|
{
|
||||||
|
public class MenuBarIcon
|
||||||
|
{
|
||||||
|
private NSMenuItem browseMenuItem;
|
||||||
|
private NSMenuItem configureMenuItem;
|
||||||
|
private NSMenuItem developerMenuItem;
|
||||||
|
private NSMenuItem quitMenuItem;
|
||||||
|
private NSMenuItem githubMenuItem;
|
||||||
|
private NSMenuItem apiMenuItem;
|
||||||
|
private NSMenuItem communityMenuItem;
|
||||||
|
|
||||||
|
public static MenuBarIcon Instance;
|
||||||
|
|
||||||
|
public MenuBarIcon ()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
//MainClass.AddDependencies (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowIcon() {
|
||||||
|
|
||||||
|
NSApplication.SharedApplication.BeginInvokeOnMainThread (ShowIconInternal);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowIconInternal() {
|
||||||
|
|
||||||
|
var menu = new NSMenu ();
|
||||||
|
|
||||||
|
var statusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(30);
|
||||||
|
statusItem.Menu = menu;
|
||||||
|
statusItem.Image = NSImage.ImageNamed("statusicon");
|
||||||
|
statusItem.HighlightMode = true;
|
||||||
|
|
||||||
|
menu.RemoveAllItems ();
|
||||||
|
|
||||||
|
browseMenuItem = new NSMenuItem ("Browse Media Library", "b", delegate {
|
||||||
|
Browse (NSApplication.SharedApplication);
|
||||||
|
});
|
||||||
|
menu.AddItem (browseMenuItem);
|
||||||
|
|
||||||
|
configureMenuItem = new NSMenuItem ("Configure Media Browser", "c", delegate {
|
||||||
|
Configure (NSApplication.SharedApplication);
|
||||||
|
});
|
||||||
|
menu.AddItem (configureMenuItem);
|
||||||
|
|
||||||
|
developerMenuItem = new NSMenuItem ("Developer Resources");
|
||||||
|
menu.AddItem (developerMenuItem);
|
||||||
|
|
||||||
|
var developerMenu = new NSMenu ();
|
||||||
|
developerMenuItem.Submenu = developerMenu;
|
||||||
|
|
||||||
|
apiMenuItem = new NSMenuItem ("Api Documentation", "a", delegate {
|
||||||
|
ApiDocs (NSApplication.SharedApplication);
|
||||||
|
});
|
||||||
|
developerMenu.AddItem (apiMenuItem);
|
||||||
|
|
||||||
|
githubMenuItem = new NSMenuItem ("Github", "g", delegate {
|
||||||
|
Github (NSApplication.SharedApplication);
|
||||||
|
});
|
||||||
|
developerMenu.AddItem (githubMenuItem);
|
||||||
|
|
||||||
|
communityMenuItem = new NSMenuItem ("Visit Community", "v", delegate {
|
||||||
|
Community (NSApplication.SharedApplication);
|
||||||
|
});
|
||||||
|
menu.AddItem (communityMenuItem);
|
||||||
|
|
||||||
|
quitMenuItem = new NSMenuItem ("Quit", "q", delegate {
|
||||||
|
Quit (NSApplication.SharedApplication);
|
||||||
|
});
|
||||||
|
menu.AddItem (quitMenuItem);
|
||||||
|
|
||||||
|
NSApplication.SharedApplication.MainMenu = menu;
|
||||||
|
|
||||||
|
//ConfigurationManager.ConfigurationUpdated -= Instance_ConfigurationUpdated;
|
||||||
|
//LocalizeText ();
|
||||||
|
//ConfigurationManager.ConfigurationUpdated += Instance_ConfigurationUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IServerApplicationHost AppHost{ get; set;}
|
||||||
|
public IServerConfigurationManager ConfigurationManager { get; set;}
|
||||||
|
public ILogger Logger{ get; set;}
|
||||||
|
public ILocalizationManager Localization { get; set;}
|
||||||
|
|
||||||
|
private void Quit(NSObject sender)
|
||||||
|
{
|
||||||
|
AppHost.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Community(NSObject sender)
|
||||||
|
{
|
||||||
|
BrowserLauncher.OpenCommunity(Logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Configure(NSObject sender)
|
||||||
|
{
|
||||||
|
BrowserLauncher.OpenDashboard(AppHost, Logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Browse(NSObject sender)
|
||||||
|
{
|
||||||
|
BrowserLauncher.OpenWebClient(AppHost, Logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Github(NSObject sender)
|
||||||
|
{
|
||||||
|
BrowserLauncher.OpenGithub(Logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApiDocs(NSObject sender)
|
||||||
|
{
|
||||||
|
BrowserLauncher.OpenSwagger(AppHost, Logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Terminate()
|
||||||
|
{
|
||||||
|
NSApplication.SharedApplication.InvokeOnMainThread (() => NSApplication.SharedApplication.Terminate(NSApplication.SharedApplication));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _uiCulture;
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the ConfigurationUpdated event of the Instance control.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The source of the event.</param>
|
||||||
|
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||||
|
void Instance_ConfigurationUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.Equals(ConfigurationManager.Configuration.UICulture, _uiCulture,
|
||||||
|
StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
LocalizeText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LocalizeText()
|
||||||
|
{
|
||||||
|
_uiCulture = ConfigurationManager.Configuration.UICulture;
|
||||||
|
|
||||||
|
NSApplication.SharedApplication.BeginInvokeOnMainThread (LocalizeInternal);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LocalizeInternal() {
|
||||||
|
|
||||||
|
quitMenuItem.Title = Localization.GetLocalizedString("LabelExit");
|
||||||
|
communityMenuItem.Title = Localization.GetLocalizedString("LabelVisitCommunity");
|
||||||
|
githubMenuItem.Title = Localization.GetLocalizedString("LabelGithub");
|
||||||
|
apiMenuItem.Title = Localization.GetLocalizedString("LabelApiDocumentation");
|
||||||
|
developerMenuItem.Title = Localization.GetLocalizedString("LabelDeveloperResources");
|
||||||
|
browseMenuItem.Title = Localization.GetLocalizedString("LabelBrowseLibrary");
|
||||||
|
configureMenuItem.Title = Localization.GetLocalizedString("LabelConfigureMediaBrowser");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "16x16"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "16x16"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "32x32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "32x32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "128x128"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "128x128"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "256x256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "256x256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "1x",
|
||||||
|
"size" : "512x512"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
@ -356,7 +356,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
{
|
{
|
||||||
await base.RegisterResources(progress).ConfigureAwait(false);
|
await base.RegisterResources(progress).ConfigureAwait(false);
|
||||||
|
|
||||||
RegisterSingleInstance<IHttpResultFactory>(new HttpResultFactory(LogManager, FileSystemManager, JsonSerializer));
|
RegisterSingleInstance<IHttpResultFactory>(new HttpResultFactory(LogManager, FileSystemManager, JsonSerializer));
|
||||||
|
|
||||||
RegisterSingleInstance<IServerApplicationHost>(this);
|
RegisterSingleInstance<IServerApplicationHost>(this);
|
||||||
RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);
|
RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);
|
||||||
@ -371,7 +371,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
UserDataManager = new UserDataManager(LogManager);
|
UserDataManager = new UserDataManager(LogManager);
|
||||||
RegisterSingleInstance(UserDataManager);
|
RegisterSingleInstance(UserDataManager);
|
||||||
|
|
||||||
UserRepository = await GetUserRepository().ConfigureAwait(false);
|
UserRepository = await GetUserRepository().ConfigureAwait(false);
|
||||||
RegisterSingleInstance(UserRepository);
|
RegisterSingleInstance(UserRepository);
|
||||||
|
|
||||||
DisplayPreferencesRepository = new SqliteDisplayPreferencesRepository(ApplicationPaths, JsonSerializer, LogManager);
|
DisplayPreferencesRepository = new SqliteDisplayPreferencesRepository(ApplicationPaths, JsonSerializer, LogManager);
|
||||||
@ -412,7 +412,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
|
|
||||||
RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LogManager, LibraryManager, UserManager));
|
RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LogManager, LibraryManager, UserManager));
|
||||||
|
|
||||||
HttpServer = ServerFactory.CreateServer(this, LogManager, "Media Browser", WebApplicationName, "dashboard/index.html", _supportsNativeWebSocket);
|
HttpServer = ServerFactory.CreateServer(this, LogManager, "Media Browser", WebApplicationName, "dashboard/index.html", _supportsNativeWebSocket);
|
||||||
RegisterSingleInstance(HttpServer, false);
|
RegisterSingleInstance(HttpServer, false);
|
||||||
progress.Report(10);
|
progress.Report(10);
|
||||||
|
|
||||||
@ -506,13 +506,13 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
RegisterSingleInstance<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
|
RegisterSingleInstance<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
|
||||||
RegisterSingleInstance<IAuthService>(new AuthService(UserManager, authContext, ServerConfigurationManager, ConnectManager, SessionManager));
|
RegisterSingleInstance<IAuthService>(new AuthService(UserManager, authContext, ServerConfigurationManager, ConnectManager, SessionManager));
|
||||||
|
|
||||||
RegisterSingleInstance<ISubtitleEncoder>(new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer));
|
RegisterSingleInstance<ISubtitleEncoder>(new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer));
|
||||||
|
|
||||||
var displayPreferencesTask = Task.Run(async () => await ConfigureDisplayPreferencesRepositories().ConfigureAwait(false));
|
var displayPreferencesTask = Task.Run(async () => await ConfigureDisplayPreferencesRepositories().ConfigureAwait(false));
|
||||||
var itemsTask = Task.Run(async () => await ConfigureItemRepositories().ConfigureAwait(false));
|
var itemsTask = Task.Run(async () => await ConfigureItemRepositories().ConfigureAwait(false));
|
||||||
var userdataTask = Task.Run(async () => await ConfigureUserDataRepositories().ConfigureAwait(false));
|
var userdataTask = Task.Run(async () => await ConfigureUserDataRepositories().ConfigureAwait(false));
|
||||||
|
|
||||||
await ConfigureNotificationsRepository().ConfigureAwait(false);
|
await ConfigureNotificationsRepository().ConfigureAwait(false);
|
||||||
progress.Report(92);
|
progress.Report(92);
|
||||||
|
|
||||||
await Task.WhenAll(itemsTask, displayPreferencesTask, userdataTask).ConfigureAwait(false);
|
await Task.WhenAll(itemsTask, displayPreferencesTask, userdataTask).ConfigureAwait(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user