/// <summary> /// /// </summary> /// <param name="justSelected">Whether to import only the items that are selected. If false, everything is imported.</param> internal void DoImport(bool justSelected = false) { foreach (SettingDataVM vm in VM.SettingVMs) { if (justSelected) { if (vm.IsChecked) { MyDataFile.Settings.SetValue(vm.M.Name, vm.M.Value); } } else { MyDataFile.Settings.SetValue(vm.M.Name, vm.M.Value); } } if ((bool)CbDeleteExistingClocks.IsChecked) { MyDataFile.ClockVMCollection.VMs.Clear(); } foreach (ClockVM vm in VM.ClockVMs.VMs) { if (justSelected) { if (vm.Checked) { MyDataFile.ClockVMCollection.VMs.Add(vm); } } else { MyDataFile.ClockVMCollection.VMs.Add(vm); } } if (justSelected) { MessageBox.Show(MyImportWindow, "\"Import selected\" operation done. Press OK to close the import window.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); MyImportWindow.Close(); } else { MessageBox.Show(MyImportWindow, "\"Import all\" operation done. Press OK to close the import window.", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information); MyImportWindow.Close(); } }
private void BtnCancel_Click(object sender, RoutedEventArgs e) { MyImportWindow.Close(); }