|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Diagnostics; |
| 4 | +using System.Text; |
| 5 | +using System.Windows; |
| 6 | +using System.Windows.Controls; |
| 7 | +using System.Windows.Data; |
| 8 | +using System.Windows.Documents; |
| 9 | +using System.Windows.Input; |
| 10 | +using System.Windows.Media; |
| 11 | +using System.Windows.Media.Imaging; |
| 12 | +using System.Windows.Shapes; |
| 13 | + |
| 14 | +namespace NCX_Installer |
| 15 | +{ |
| 16 | + /// <summary> |
| 17 | + /// Interaction logic for FirstTime2.xaml |
| 18 | + /// </summary> |
| 19 | + public partial class FirstTime2 : Window |
| 20 | + { |
| 21 | + public FirstTime2() |
| 22 | + { |
| 23 | + InitializeComponent(); |
| 24 | + InitializeComponent(); |
| 25 | + textBox1.Text = Settings1.Default.name; |
| 26 | + checkBox1.IsChecked = Settings1.Default.oldVer; |
| 27 | + checkBox2.IsChecked = Settings1.Default.betaVer; |
| 28 | + checkBox3.IsChecked = Settings1.Default.arch; |
| 29 | + if (Settings1.Default.firstTime == false) |
| 30 | + { |
| 31 | + btn2.Visibility = Visibility.Visible; |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + private void btn1_Click(object sender, RoutedEventArgs e) |
| 36 | + { |
| 37 | + Settings1.Default.firstTime = false; |
| 38 | + Settings1.Default.name = textBox1.Text; |
| 39 | + Settings1.Default.oldVer = (bool)checkBox1.IsChecked; |
| 40 | + Settings1.Default.betaVer = (bool)checkBox2.IsChecked; |
| 41 | + Settings1.Default.arch = (bool)checkBox3.IsChecked; |
| 42 | + Settings1.Default.Save(); |
| 43 | + btn1.Visibility = Visibility.Hidden; |
| 44 | + |
| 45 | + string message = "It is recommended that you restart the program after initial setup. Would you like to restart now?"; |
| 46 | + string caption = "Restart Recommended"; |
| 47 | + MessageBoxButton buttons = MessageBoxButton.YesNo; |
| 48 | + MessageBoxImage icon = MessageBoxImage.Information; |
| 49 | + if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.Yes) |
| 50 | + { |
| 51 | + Process.Start(Application.ResourceAssembly.Location); |
| 52 | + Application.Current.Shutdown(); |
| 53 | + } |
| 54 | + else if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.No) |
| 55 | + { |
| 56 | + string message2 = "Some changes may not take effect until you restart the program."; |
| 57 | + string caption2 = "Restart Recommended"; |
| 58 | + MessageBoxButton buttons2 = MessageBoxButton.OK; |
| 59 | + MessageBoxImage icon2 = MessageBoxImage.Exclamation; |
| 60 | + if (MessageBox.Show(message2, caption2, buttons2, icon2) == MessageBoxResult.OK) |
| 61 | + { |
| 62 | + this.Close(); |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + private void btn3_Click(object sender, RoutedEventArgs e) |
| 68 | + { |
| 69 | + string message = "Are you sure you want to reset your settings? This will restart the program and go through setup again."; |
| 70 | + string caption = "Reset settings?"; |
| 71 | + MessageBoxButton buttons = MessageBoxButton.YesNo; |
| 72 | + MessageBoxImage icon = MessageBoxImage.Exclamation; |
| 73 | + if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.Yes) |
| 74 | + { |
| 75 | + Settings1.Default.firstTime = true; |
| 76 | + Settings1.Default.name = ""; |
| 77 | + Settings1.Default.oldVer = false; |
| 78 | + Settings1.Default.betaVer = false; |
| 79 | + Settings1.Default.arch = false; |
| 80 | + Settings1.Default.Save(); |
| 81 | + Process.Start(Application.ResourceAssembly.Location); |
| 82 | + Application.Current.Shutdown(); |
| 83 | + } |
| 84 | + else if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.No) |
| 85 | + { |
| 86 | + this.Close(); |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | +} |
0 commit comments