コード例 #1
0
        private void bDeleteAppSetting_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBoxResult.No == MessageBox.Show(I18n.GetString("ConfirmDel"), "", MessageBoxButton.YesNo))
            {
                return;
            }

            if (File.Exists(App.StandaloneFilePath))
            {
                File.Delete(App.StandaloneFilePath);
            }

            Application.Current.Shutdown();
        }
コード例 #2
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;
        }
コード例 #3
0
        private void bSaveGlobalSettingAs_Click(object sender, RoutedEventArgs e)
        {
            mainGrid.Effect = new BlurEffect();

            var ib = new InputBox
            {
                Owner = this,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Instruction           = I18n.GetString("SaveAsInstruction"),
                OkText     = I18n.GetString("Save"),
                CancelText = I18n.GetString("Cancel")
            };

            if (ib.ShowDialog() == true && !String.IsNullOrEmpty(ib.Text))
            {
                SaveProfileAs(ib.Text);

                cbGlobalProfiles.SelectedIndex = _profiles.Count - 1;
            }

            mainGrid.Effect = null;
        }
コード例 #4
0
        private void bSaveAppSetting_Click(object sender, RoutedEventArgs e)
        {
            var crt = new LEProfile
            {
                Name           = Path.GetFileName(App.StandaloneFilePath),
                Guid           = Guid.NewGuid().ToString(),
                ShowInMainMenu = false,
                Parameter      =
                    I18n.GetString("EnterArgument") == tbAppParameter.Text ? String.Empty : tbAppParameter.Text,
                DefaultFont    = cbDefaultFont.Text,
                Location       = _cultureInfos[cbLocation.SelectedIndex].Name,
                Timezone       = _timezones[cbTimezone.SelectedIndex].Id,
                RunWithSuspend = cbStartAsSuspend.IsChecked != null && (bool)cbStartAsSuspend.IsChecked
            };

            LEConfig.SaveApplicationConfigFile(App.StandaloneFilePath, crt);

            //Run the application.
            Process.Start(
                Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEProc.exe"),
                string.Format("-run \"{0}\"", App.StandaloneFilePath.Replace(".le.config", "")));

            Application.Current.Shutdown();
        }