Пример #1
0
        private void add_button_Click(object sender, RoutedEventArgs e)
        {
            int new_profile = ToolkitProfiles.AddProfile();

            profile_select.Items.Add(ToolkitProfiles.GetProfile(new_profile).profile_name);
            profile_select.SelectedIndex = new_profile;
            setting_profile = false;
        }
 public PathSettings(bool isFirstInit = false)
 {
     InitializeComponent();
     IsFirstInit             = isFirstInit;
     first_launch.Visibility = IsFirstInit ? Visibility.Visible : Visibility.Collapsed;
     if (ToolkitProfiles.SettingsList.Count == 0)
     {
         ToolkitProfiles.AddProfile();
     }
     foreach (var settings in ToolkitProfiles.SettingsList)
     {
         profile_select.Items.Add(settings.profile_name);
     }
     UpdateUI();
     startup_finished = true;
 }
        public MainWindow()
        {
#if !DEBUG
            Application.Current.DispatcherUnhandledException += App_DispatcherUnhandledException;
#endif

            // load profiles
            if (!ToolkitProfiles.Load())
            {
                MessageBox.Show("Settings file was corrupted or had unexpected data. Generating new file.", "Invalid Settings File", MessageBoxButton.OK);
            }

            // upgrade old settings
            if (Settings.Default.settings_update)
            {
                Settings.Default.Upgrade();
                Settings.Default.settings_update = false;
                Settings.Default.Save();
            }

            if (Settings.Default.first_run)
            {
                var dialog = new PathSettings(isFirstInit: true);
                dialog.ShowDialog();
                Settings.Default.first_run = false;
                Settings.Default.Save();
            }

            InitializeComponent();
            UpdateToolkitStatus();
            int default_index = 0;
            if (Settings.Default.set_profile >= 0)
            {
                default_index = Settings.Default.set_profile;
            }
            toolkit_selection.SelectedIndex = default_index;
        }
 private void save_button_Click(object sender, RoutedEventArgs e)
 {
     ToolkitProfiles.Save();
     this.Close();
 }