public void confirmButton_Click(object sender, RoutedEventArgs e)
        {
            bool   isRemoteChecked = RemoteCheckBox.IsChecked.GetValueOrDefault();
            int    whatTime        = Convert.ToInt32(NumberofTimeBox.SelectedValue);
            string stringValue     = TimeBox.SelectedValue.ToString();
            bool   isVistaChecked  = VistaCheckBox.IsChecked.GetValueOrDefault();

            RemoteControlConfigModel model = new RemoteControlConfigModel(isRemoteChecked, whatTime, stringValue, isVistaChecked);

            Serialize.WriteXML(model);

            this.Close();
        }
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         RemoteControlConfigModel savedModel = Serialize.ReadXML();
         RemoteCheckBox.IsChecked      = savedModel.RemoteControlEnabled;
         NumberofTimeBox.SelectedValue = savedModel.TimeOfInvitation;
         TimeBox.SelectedValue         = savedModel.UnitOfTime;
         VistaCheckBox.IsChecked       = savedModel.OnlyVistaOrNewerEnabled;
         InviteGroupBox.IsEnabled      = savedModel.RemoteControlEnabled;
     }
     catch //exception (file not found, unreadable file, etc.)
     {
         TimeBox.SelectedIndex = 1;
         TimeBox_SelectionChanged(null, null);
         InviteGroupBox.IsEnabled = false;
     }
 }