Ejemplo n.º 1
0
        public General()
        {
            InitializeComponent();

            #region Language

            // List
            Langs.GetLanguages().ForEach(a => LangCombo.Items.Add(new ListBoxItem()
            {
                Content = a["language_display_name"], Tag = a["language_name"]
            }));
            // Value
            LangCombo.SelectedValue = Reference.JsonSettings.Language;
            // Event
            LangCombo.SelectionChanged += delegate {
                Langs.SetLanguage(LangCombo.SelectedValue.ToString());
                Reference.JsonSettings.Language = LangCombo.SelectedValue.ToString();
            };

            // Translation error button
            TranslationErrorBtn.Click += delegate { System.Diagnostics.Process.Start("https://github.com/NaolShow/Wolfy/issues"); };

            #endregion
            #region Themes

            // List
            SkinManager.Themes.ForEach(a => ThemeCombo.Items.Add(new ListBoxItem()
            {
                Content = a.FirstLetterToUpperCase(), Tag = a
            }));
            // Value
            ThemeCombo.SelectedValue = Reference.JsonSettings.Theme;
            // Event
            ThemeCombo.SelectionChanged += delegate { SkinManager.SetTheme(ThemeCombo.SelectedValue.ToString()); };

            #endregion
            #region Colors

            // List
            SkinManager.Colors.ForEach(a => ColorCombo.Items.Add(new ListBoxItem()
            {
                Content = a.FirstLetterToUpperCase(), Tag = a
            }));
            // Value
            ColorCombo.SelectedValue = Reference.JsonSettings.Color;
            // Event
            ColorCombo.SelectionChanged += delegate { SkinManager.SetColor(ColorCombo.SelectedValue.ToString()); };

            #endregion

            #region Profile Startup

            // Value
            Profiles.GetProfiles().ToList().ForEach(a => ProfileStartupCombo.Items.Add(new ListBoxItem()
            {
                Content = Path.GetFileNameWithoutExtension(a)
            }));
            ProfileStartupCombo.SelectedValue = Reference.JsonSettings.Profile_startup;
            ProfileStartupCombo.IsEnabled     = Reference.JsonSettings.Load_profile_startup;

            ProfileStartupCb.IsChecked = Reference.JsonSettings.Load_profile_startup;

            // Event
            ProfileStartupCombo.SelectionChanged += delegate {
                Reference.JsonSettings.Profile_startup = ProfileStartupCombo.SelectedValue.ToString();
            };

            #endregion

            #region Checkboxes

            LaunchStartupCb.IsChecked = Reference.JsonSettings.Launch_startup;
            CheckUpdateCb.IsChecked   = Reference.JsonSettings.Check_for_updates;
            SystemTrayCb.IsChecked    = Reference.JsonSettings.Reduce_system_tray;

            #endregion
        }