public DebuggerEngines ShowSelectDebuggerEngineDialog(DebuggerEngines current) { bool firstTime = current.IsLazy; if (firstTime) { current = new DebuggerEngines( isAutomatic: true, manualSelection: GetAvailableDebuggerEngines()); current.RestoreSelectionFromRegistry(); } var model = new SelectDebuggerEngineDialogModel(current); var window = new SelectDebuggerEngineDialog(model); var result = ShowDialog(window).GetValueOrDefault(); if (firstTime && !result) { // this covers an edge case with the first run, since we restore the last selection from the registry, // if the user cancels out we still want to leave the selected engine to be automatic. current.IsAutomatic = true; } return(result ? model.DebuggerEngines : current); }
public SelectDebuggerEngineDialogModel(DebuggerEngines debuggerEngines) { DebuggerEngines = debuggerEngines?.Clone() ?? throw new ArgumentNullException(nameof(debuggerEngines)); DebuggerEngines.PropertyChanged += DebuggerEngines_PropertyChanged; }