/// <summary> /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private static void SettingsPropertyChanged(object sender, PropertyChangedEventArgs e) { Logging.Log(Logger, String.Format("PropertyChanged : {0}", e.PropertyName)); try { switch (e.PropertyName) { case "CharacterName": Constants.CharacterName = Settings.Default.CharacterName; break; case "GameLanguage": Constants.GameLanguage = Settings.Default.GameLanguage; break; case "UILanguage": if (AppViewModel.Instance.UILanguages.Any(ui => ui.Language == Settings.Default.UILanguage)) { var uiLanguage = AppViewModel.Instance.UILanguages.First(ui => ui.Language == Settings.Default.UILanguage); Constants.CultureInfo = Settings.Default.Culture = uiLanguage.CultureInfo; LocaleHelper.Update(Settings.Default.Culture); } break; case "ServerName": Constants.ServerName = Settings.Default.ServerName; break; case "EnableNLog": Common.Constants.EnableNLog = Constants.EnableNLog = Settings.Default.EnableNLog; break; case "EnableNetworkReading": Common.Constants.EnableNetworkReading = Constants.EnableNetworkReading = Settings.Default.EnableNetworkReading; if (Settings.Default.EnableNetworkReading) { if (!Initializer.NetworkWorking) { Initializer.StartNetworkWorker(); } } else { Initializer.StopNetworkWorker(); } break; case "NetworkUseWinPCap": if (Initializer.NetworkWorking) { Initializer.RefreshNetworkWorker(); } break; case "EnableHelpLabels": Constants.EnableHelpLabels = Settings.Default.EnableHelpLabels; break; case "Theme": Constants.Theme = Settings.Default.Theme; break; case "UIScale": Constants.UIScale = Settings.Default.UIScale; break; case "TopMost": if (ShellView.View != null) { ShellView.View.Topmost = Settings.Default.TopMost; } break; case "DefaultAudioDevice": if (Settings.Default.DefaultAudioDevice == "System Default") { Common.Constants.DefaultAudioDevice = Guid.Empty; } else { foreach (var audioDevice in AvailableAudioDevices.Where(device => device.Guid != Guid.Empty)) { if (audioDevice.Description == Settings.Default.DefaultAudioDevice) { Common.Constants.DefaultAudioDevice = audioDevice.Guid; } } } break; } } catch (Exception ex) { } }
private AppBootstrapper() { if (App.MArgs != null) { foreach (var argument in App.MArgs) { Logging.Log(Logger, String.Format("ArgumentProvided : {0}", argument)); } } Constants.IsOpen = false; Constants.ProcessModel = new ProcessModel(); //initialize application data AppViewModel.Instance.ConfigurationsPath = Common.Constants.ConfigurationsPath; AppViewModel.Instance.LogsPath = Common.Constants.LogsPath; AppViewModel.Instance.SavedLogsDirectoryList = new List <string> { "Say", "Shout", "Party", "Tell", "LS1", "LS2", "LS3", "LS4", "LS5", "LS6", "LS7", "LS8", "FC", "Yell" }; AppViewModel.Instance.ScreenShotsPath = Common.Constants.ScreenShotsPath; AppViewModel.Instance.SoundsPath = Common.Constants.SoundsPath; AppViewModel.Instance.SettingsPath = Common.Constants.SettingsPath; AppViewModel.Instance.PluginsSettingsPath = Common.Constants.PluginsSettingsPath; #region Culture BootStrapping AppViewModel.Instance.UILanguages.Add(new UILanguage { Language = "English", ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/en.png", Title = "English", CultureInfo = new CultureInfo("en") }); AppViewModel.Instance.UILanguages.Add(new UILanguage { Language = "Japanese", ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/ja.png", Title = "日本語", CultureInfo = new CultureInfo("ja") }); AppViewModel.Instance.UILanguages.Add(new UILanguage { Language = "French", ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/fr.png", Title = "Français", CultureInfo = new CultureInfo("fr") }); AppViewModel.Instance.UILanguages.Add(new UILanguage { Language = "German", ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/de.png", Title = "Deutsch", CultureInfo = new CultureInfo("de") }); AppViewModel.Instance.UILanguages.Add(new UILanguage { Language = "Chinese", ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/cn.png", Title = "中國", CultureInfo = new CultureInfo("zh") }); AppViewModel.Instance.UILanguages.Add(new UILanguage { Language = "Russian", ImageURI = "/FFXIVAPP.Client;component/Resources/Media/Icons/ru.png", Title = "Русский", CultureInfo = new CultureInfo("ru") }); #endregion #region Initial BootStrapping Initializer.SetupCurrentUICulture(); Initializer.LoadChatCodes(); Initializer.LoadAutoTranslate(); Initializer.LoadActions(); Initializer.LoadColors(); Initializer.LoadApplicationSettings(); Initializer.LoadAvailableAudioDevices(); Initializer.LoadAvailableNetworkDevices(); Initializer.LoadSoundsIntoCache(); Initializer.LoadPlugins(); #endregion ProcessDetachCheckTimer.Elapsed += ProcessDetachCheckTimerOnElapsed; }
/// <summary> /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private static void SettingsPropertyChanged(object sender, PropertyChangedEventArgs e) { Logging.Log(Logger, String.Format("PropertyChanged : {0}", e.PropertyName)); try { switch (e.PropertyName) { case "CharacterName": Constants.CharacterName = Settings.Default.CharacterName; break; case "FirstName": Initializer.SetCharacter(); break; case "LastName": Initializer.SetCharacter(); break; case "GameLanguage": Constants.GameLanguage = Settings.Default.GameLanguage; var lang = Settings.Default.GameLanguage.ToLower(); var cultureInfo = new CultureInfo("en"); switch (lang) { case "japanese": cultureInfo = new CultureInfo("ja"); break; case "german": cultureInfo = new CultureInfo("de"); break; case "french": cultureInfo = new CultureInfo("fr"); break; } Constants.CultureInfo = Settings.Default.Culture = cultureInfo; LocaleHelper.Update(Settings.Default.Culture); break; case "ServerName": Constants.ServerName = Settings.Default.ServerName; break; case "EnableNLog": Common.Constants.EnableNLog = Constants.EnableNLog = Settings.Default.EnableNLog; break; case "EnableHelpLabels": Constants.EnableHelpLabels = Settings.Default.EnableHelpLabels; break; case "Theme": Constants.Theme = Settings.Default.Theme; break; case "UIScale": Constants.UIScale = Settings.Default.UIScale; break; case "TopMost": if (ShellView.View != null) { ShellView.View.Topmost = Settings.Default.TopMost; } break; case "DefaultAudioDevice": if (Settings.Default.DefaultAudioDevice == "System Default") { Common.Constants.DefaultAudioDevice = Guid.Empty; } else { foreach (var audioDevice in AvailableAudioDevices.Where(device => device.Guid != Guid.Empty)) { if (audioDevice.Description == Settings.Default.DefaultAudioDevice) { Common.Constants.DefaultAudioDevice = audioDevice.Guid; } } } break; } } catch (Exception ex) { } }