Exemplo n.º 1
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //unreleased character present
            IsUnreleasedDataPresent = SettingService.Instance.GetOrDefault(Setting.ShowUnreleasedData, false);
            //traveler present
            TravelerElement = SettingService.Instance.GetOrDefault(Setting.PresentTravelerElementType, Element.Anemo, Setting.EnumConverter <Element>);
            foreach (RadioButton radioButton in TravelerOptions.Children)
            {
                if (ElementHelper.GetElement(radioButton) == TravelerElement)
                {
                    radioButton.IsChecked = true;
                }
            }
            //version
            Version v = Assembly.GetExecutingAssembly().GetName().Version;

            VersionString = $"DGP.Genshin - version {v.Major}.{v.Minor}.{v.Build} Build {v.Revision}";
            //theme
            Func <object, ApplicationTheme?> converter = n => { if (n == null)
                                                                {
                                                                    return(null);
                                                                }
                                                                return((ApplicationTheme)Enum.Parse(typeof(ApplicationTheme), n.ToString())); };

            ThemeComboBox.SelectedIndex = (SettingService.Instance.GetOrDefault(Setting.AppTheme, null, converter)) switch
            {
                ApplicationTheme.Light => 0,
                ApplicationTheme.Dark => 1,
                _ => 2,
            };
        }
Exemplo n.º 2
0
 private void TravelerPresentSwitched(object sender, RoutedEventArgs e)
 {
     SettingService.Instance[Setting.PresentTravelerElementType] = ElementHelper.GetElement((RadioButton)sender);
     TravelerPresentService.Instance.SetPresentTraveler();
 }