예제 #1
0
        /// <summary>
        /// </summary>
        /// <param name="sender"> </param>
        /// <param name="e"> </param>
        private static void SettingsPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Logging.Log(Logger, $"PropertyChanged : {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))
                    {
                        UILanguage 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 && Constants.IsOpen)
                        {
                            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 (DirectSoundDeviceInfo audioDevice in AvailableAudioDevices.Where(device => device.Guid != Guid.Empty))
                        {
                            if (audioDevice.Description == Settings.Default.DefaultAudioDevice)
                            {
                                Common.Constants.DefaultAudioDevice = audioDevice.Guid;
                            }
                        }
                    }

                    break;
                }
            }
            catch (Exception ex) {
                Logging.Log(Logger, new LogItem(ex, true));
            }
        }
예제 #2
0
파일: App.cs 프로젝트: ciel712/ffxivapp
        /// <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)
            {
            }
        }