public override void EditConditions() { if (SelectedItems.Count == 0) { return; } var dlg = new EditExceptionConditionsDlg(); var vm = new EditExceptionConditionsVM(SortedSelectedItems.First().Settings.Conditions); dlg.DataContext = vm; dlg.Owner = appWindow.MainWindow; var res = dlg.ShowDialog(); if (res != true) { return; } var newConditions = vm.GetConditions(); var newSettings = new DbgExceptionIdAndSettings[SelectedItems.Count]; for (int i = 0; i < newSettings.Length; i++) { var item = SelectedItems[i]; var flags = item.Settings.Flags | DbgExceptionDefinitionFlags.StopFirstChance; var settings = new DbgExceptionSettings(flags, newConditions); newSettings[i] = new DbgExceptionIdAndSettings(item.Definition.Id, settings); } dbgExceptionSettingsService.Value.Modify(newSettings); }
void ToggleBreakWhenThrown(IList <ExceptionVM> exceptions) { bool allSet = exceptions.All(a => a.BreakWhenThrown); var newSettings = new DbgExceptionIdAndSettings[exceptions.Count]; for (int i = 0; i < newSettings.Length; i++) { var vm = exceptions[i]; var flags = vm.Settings.Flags; if (allSet) { flags &= ~DbgExceptionDefinitionFlags.StopFirstChance; } else { flags |= DbgExceptionDefinitionFlags.StopFirstChance; } var settings = new DbgExceptionSettings(flags, vm.Settings.Conditions); newSettings[i] = new DbgExceptionIdAndSettings(vm.Definition.Id, settings); } dbgExceptionSettingsService.Value.Modify(newSettings); }
public override void ToggleBreakWhenThrown() { // Toggling everything seems to be less useful, it's more likely that you'd want // to enable all selected exceptions or disable all of them. bool allSet = SelectedItems.All(a => a.BreakWhenThrown); var newSettings = new DbgExceptionIdAndSettings[SelectedItems.Count]; for (int i = 0; i < newSettings.Length; i++) { var vm = SelectedItems[i]; var flags = vm.Settings.Flags; if (allSet) { flags &= ~DbgExceptionDefinitionFlags.StopFirstChance; } else { flags |= DbgExceptionDefinitionFlags.StopFirstChance; } var settings = new DbgExceptionSettings(flags, vm.Settings.Conditions); newSettings[i] = new DbgExceptionIdAndSettings(vm.Definition.Id, settings); } dbgExceptionSettingsService.Value.Modify(newSettings); }