private void ApplyButton_Click(object sender, RoutedEventArgs e) { // save the configuration commonSet.SaveConfiguration(); // apply the autostart setting commonSet.ApplyAutoStartSetting(AutoStartCheckBox.IsChecked.Value); // save the time of next printing commonSet.ComputeNextTime(); commonSet.SaveNextTime(); MessageBox.Show("Configuration saved"); // update scheduled time commonSet.LoadNextTime(); ScheduledTimeTextBlock.Text = commonSet.loadedNextPrintingTime.ToString(); }
private void InitUIElement() { // Show the message to tell the user the command is loading LoadingMessage lm = new LoadingMessage(); lm.Show(); commonSet.LoadConfiguration(); lm.Close(); // set language if (commonSet.loadedLanguage.ToLower().Equals("english")) { LanguageComboBox.SelectedIndex = ENGLISH_INDEX; } // set autostart if (commonSet.loadedAutoStart.ToLower().Equals("true")) { AutoStartCheckBox.IsChecked = true; } else { AutoStartCheckBox.IsChecked = false; } // set auto disable if (commonSet.loadedAutoDisableAll.ToLower().Equals("true")) { AutoDisableAllCheckBox.IsChecked = true; } else { AutoDisableAllCheckBox.IsChecked = false; } if (commonSet.loadedAutoDisableMouse.ToLower().Equals("true")) { AutoDisableMouseCheckBox.IsChecked = true; } else { AutoDisableMouseCheckBox.IsChecked = false; } if (commonSet.loadedAutoDisableKeyboard.ToLower().Equals("true")) { AutoDisableKeyboardCheckBox.IsChecked = true; } else { AutoDisableKeyboardCheckBox.IsChecked = false; } // set auto show window if (commonSet.loadedAutoShowWindow.ToLower().Equals("true")) { ShowWindowCheckBox.IsChecked = true; } else { ShowWindowCheckBox.IsChecked = false; } // put the value into variable commonSet.language = commonSet.loadedLanguage; commonSet.autoStart = commonSet.loadedAutoStart; commonSet.autoDisableAll = commonSet.loadedAutoDisableAll; commonSet.autoDisableMouse = commonSet.loadedAutoDisableMouse; commonSet.autoDisableKeyboard = commonSet.loadedAutoDisableKeyboard; commonSet.autoShowWindow = commonSet.loadedAutoShowWindow; commonSet.SaveConfiguration(); }