diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-24 01:19:32 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-24 01:19:32 -0500 |
| commit | 7e4e9d664410e145ded8897bd0deefee3b895cff (patch) | |
| tree | ce3c2d66262192fc44baabe24f830c5861b82908 /MediaBrowser.Server.Mac/AppController.cs | |
| parent | 45d5d3d3572bc5587c8d13ae4f6ed12f6f440b86 (diff) | |
| parent | 5f5fec429e47aab1e00278ce9072c6525bff1da1 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Server.Mac/AppController.cs')
| -rw-r--r-- | MediaBrowser.Server.Mac/AppController.cs | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/MediaBrowser.Server.Mac/AppController.cs b/MediaBrowser.Server.Mac/AppController.cs index d2ef0cd92..1823e2152 100644 --- a/MediaBrowser.Server.Mac/AppController.cs +++ b/MediaBrowser.Server.Mac/AppController.cs @@ -20,9 +20,11 @@ namespace MediaBrowser.Server.Mac private NSMenuItem apiMenuItem; private NSMenuItem communityMenuItem; + public static AppController Instance; + public AppController() { - + Instance = this; } public override void AwakeFromNib() @@ -71,13 +73,14 @@ namespace MediaBrowser.Server.Mac statusItem.Menu.AddItem (quitMenuItem); } - private IServerApplicationHost AppHost{ get; set;} - private ILogger Logger{ get; set;} + 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) { - NSApplication.SharedApplication.Terminate(this); - //AppHost.Shutdown(); + AppHost.Shutdown(); } private void Community(NSObject sender) @@ -104,6 +107,44 @@ namespace MediaBrowser.Server.Mac { 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"); + } } } |
