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

            this.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())); };

            this.ThemeComboBox.SelectedIndex = LifeCycle.InstanceOf <SettingService>().GetOrDefault(Setting.AppTheme, null, converter) switch
            {
                ApplicationTheme.Light => 0,
                ApplicationTheme.Dark => 1,
                _ => 2,
            };
        }
예제 #2
0
        public void SetPresentTraveler()
        {
            Element element =
                LifeCycle.InstanceOf <SettingService>().GetOrDefault(Setting.PresentTravelerElementType,
                                                                     Element.Anemo,
                                                                     n => (Element)Enum.Parse(typeof(Element), n.ToString()));
            Character TravelerSource = CharacterManager.Instance["Traveler" + element];

            CharacterManager.Instance["TravelerPresent"].ImageUri          = TravelerSource.ImageUri;
            CharacterManager.Instance["TravelerPresent"].Element           = TravelerSource.Element;
            CharacterManager.Instance["TravelerPresent"].AscensionBoss     = TravelerSource.AscensionBoss;
            CharacterManager.Instance["TravelerPresent"].AscensionGemstone = TravelerSource.AscensionGemstone;
            CharacterManager.Instance["TravelerPresent"].AscensionLocal    = TravelerSource.AscensionLocal;
            CharacterManager.Instance["TravelerPresent"].AscensionMonster  = TravelerSource.AscensionMonster;
            CharacterManager.Instance["TravelerPresent"].TalentDaily       = TravelerSource.TalentDaily;
            CharacterManager.Instance["TravelerPresent"].TalentWeekly      = TravelerSource.TalentWeekly;
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="info"></param>
 /// <param name="formatter"></param>
 public static void Log(this object obj, object info, Func <object, string> formatter = null)
 {
     LifeCycle.InstanceOf <Logger>().Log(obj, info, formatter);
 }