Exemplo n.º 1
0
        private void SaveProfileAs(string name)
        {
            var pro = new LEProfile(name,
                                    Guid.NewGuid().ToString(),
                                    cbShowInMainMenu.IsChecked != null && (bool)cbShowInMainMenu.IsChecked,
                                    String.Empty,
                                    _cultureInfos[cbLocation.SelectedIndex].Name,
                                    _timezones[cbTimezone.SelectedIndex].Id,
                                    cbStartAsAdmin.IsChecked != null && (bool)cbStartAsAdmin.IsChecked,
                                    cbRedirectRegistry.IsChecked != null && (bool)cbRedirectRegistry.IsChecked,
                                    cbStartAsSuspend.IsChecked != null && (bool)cbStartAsSuspend.IsChecked);

            _profiles.Add(pro);

            LEConfig.SaveGlobalConfigFile(_profiles.ToArray());

            // Update cbGlobalProfiles.
            cbGlobalProfiles.ItemsSource = _profiles.Select(p => p.Name);
        }
Exemplo n.º 2
0
        private void bSaveGlobalSetting_Click(object sender, RoutedEventArgs e)
        {
            if (cbGlobalProfiles.Items.Count == 0)
            {
                return;
            }

            LEProfile crt = _profiles[cbGlobalProfiles.SelectedIndex];

            crt.DefaultFont    = cbDefaultFont.Text;
            crt.Location       = _cultureInfos[cbLocation.SelectedIndex].Name;
            crt.Timezone       = _timezones[cbTimezone.SelectedIndex].Id;
            crt.ShowInMainMenu = cbShowInMainMenu.IsChecked != null && (bool)cbShowInMainMenu.IsChecked;
            crt.RunWithSuspend = cbStartAsSuspend.IsChecked != null && (bool)cbStartAsSuspend.IsChecked;

            _profiles[cbGlobalProfiles.SelectedIndex] = crt;

            LEConfig.SaveGlobalConfigFile(_profiles.ToArray());
        }
Exemplo n.º 3
0
        private void bDeleteGlobalSetting_Click(object sender, RoutedEventArgs e)
        {
            if (cbGlobalProfiles.SelectedIndex == -1)
            {
                return;
            }

            if (MessageBoxResult.No == MessageBox.Show(I18n.GetString("ConfirmDel"), "", MessageBoxButton.YesNo))
            {
                return;
            }

            _profiles.RemoveAt(cbGlobalProfiles.SelectedIndex);

            LEConfig.SaveGlobalConfigFile(_profiles.ToArray());

            // Update cbGlobalProfiles.
            cbGlobalProfiles.ItemsSource   = _profiles.Select(p => p.Name);
            cbGlobalProfiles.SelectedIndex = 0;
        }