/// <summary> /// Prevents a default instance of the <see cref="SettingsViewModel"/> class from being created. /// </summary> private SettingsViewModel() : base("Settings") { this.ContentId = SettingsViewModel.ToolContentId; // Subscribe async to avoid a deadlock situation DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="ScriptEditorViewModel" /> class. /// </summary> private ScriptEditorViewModel() : base("Script Editor") { this.UpdateScriptCommand = new RelayCommand <String>((script) => this.UpdateScript(script), (script) => true); this.SaveScriptCommand = new RelayCommand <String>((script) => this.SaveScript(script), (script) => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="PropertyViewerViewModel" /> class from being created. /// </summary> private PropertyViewerViewModel() : base("Property Viewer") { this.ObserverLock = new Object(); this.PropertyViewerObservers = new List <IPropertyViewerObserver>(); // Use reflection to set all propertygrid colors to dark, since some are otherwise not publically accessible PropertyInfo[] allProperties = this.propertyGrid.GetType().GetProperties(); IEnumerable <PropertyInfo> colorProperties = allProperties.Select(x => x).Where(x => x.PropertyType == typeof(Color)); colorProperties.ForEach(x => x.SetValue(this.propertyGrid, DarkBrushes.SqualrColorPanel, null)); this.propertyGrid.BackColor = DarkBrushes.SqualrColorPanel; this.propertyGrid.CommandsBackColor = DarkBrushes.SqualrColorPanel; this.propertyGrid.HelpBackColor = DarkBrushes.SqualrColorPanel; this.propertyGrid.SelectedItemWithFocusBackColor = DarkBrushes.SqualrColorPanel; this.propertyGrid.ViewBackColor = DarkBrushes.SqualrColorPanel; this.propertyGrid.CommandsActiveLinkColor = DarkBrushes.SqualrColorPanel; this.propertyGrid.CommandsDisabledLinkColor = DarkBrushes.SqualrColorPanel; this.propertyGrid.CategorySplitterColor = DarkBrushes.SqualrColorWhite; this.propertyGrid.CommandsBorderColor = DarkBrushes.SqualrColorFrame; this.propertyGrid.HelpBorderColor = DarkBrushes.SqualrColorFrame; this.propertyGrid.ViewBorderColor = DarkBrushes.SqualrColorFrame; this.propertyGrid.CategoryForeColor = DarkBrushes.SqualrColorWhite; this.propertyGrid.CommandsForeColor = DarkBrushes.SqualrColorWhite; this.propertyGrid.DisabledItemForeColor = DarkBrushes.SqualrColorWhite; this.propertyGrid.HelpForeColor = DarkBrushes.SqualrColorWhite; this.propertyGrid.SelectedItemWithFocusForeColor = DarkBrushes.SqualrColorWhite; this.propertyGrid.ViewForeColor = DarkBrushes.SqualrColorWhite; DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="ProjectExplorerViewModel" /> class from being created. /// </summary> private ProjectExplorerViewModel() : base("Project Explorer") { this.ObserverLock = new Object(); this.ProjectItemStorage = new ProjectItemStorage(); // Commands to manipulate project items may not be async due to multi-threading issues when modifying collections this.OpenProjectCommand = new RelayCommand(() => this.ProjectItemStorage.OpenProject(), () => true); this.ImportProjectCommand = new RelayCommand(() => this.ProjectItemStorage.ImportProject(), () => true); this.ExportProjectCommand = new RelayCommand(() => this.ProjectItemStorage.ExportProject(), () => true); this.ImportSpecificProjectCommand = new RelayCommand <String>((filename) => this.ProjectItemStorage.ImportProject(false, filename), (filename) => true); this.SaveProjectCommand = new RelayCommand(() => this.ProjectItemStorage.SaveProject(), () => true); this.SelectProjectItemCommand = new RelayCommand <Object>((selectedItems) => this.SelectedProjectItems = (selectedItems as IList)?.Cast <ProjectItem>(), (selectedItems) => true); this.EditProjectItemCommand = new RelayCommand <ProjectItem>((projectItem) => this.EditProjectItem(projectItem), (projectItem) => true); this.AddNewAddressItemCommand = new RelayCommand(() => this.AddNewProjectItem(typeof(PointerItem)), () => true); this.AddNewScriptItemCommand = new RelayCommand(() => this.AddNewProjectItem(typeof(ScriptItem)), () => true); this.AddNewInstructionItemCommand = new RelayCommand(() => this.AddNewProjectItem(typeof(InstructionItem)), () => true); this.ToggleSelectionActivationCommand = new RelayCommand(() => this.ToggleSelectionActivation(), () => true); this.DeleteSelectionCommand = new RelayCommand(() => this.DeleteSelection(), () => true); this.CopySelectionCommand = new RelayCommand(() => this.CopySelection(), () => true); this.PasteSelectionCommand = new RelayCommand(() => this.PasteSelection(), () => true); this.CutSelectionCommand = new RelayCommand(() => this.CutSelection(), () => true); this.ProjectItems = new FullyObservableCollection <ProjectItem>(); this.Update(); Task.Run(() => DockingViewModel.GetInstance().RegisterViewModel(this)); }
/// <summary> /// Prevents a default instance of the <see cref="ManualScannerViewModel" /> class from being created. /// </summary> private ManualScannerViewModel() : base("Manual Scanner") { this.StartScanCommand = new RelayCommand(() => this.StartScan(), () => true); // Note: Not async to avoid updates slower than the perception threshold this.UpdateActiveValueCommand = new RelayCommand <Object>((newValue) => this.UpdateActiveValue(newValue), (newValue) => true); this.SelectChangedCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.Changed), () => true); this.SelectDecreasedCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.Decreased), () => true); this.SelectDecreasedByXCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.DecreasedByX), () => true); this.SelectEqualCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.Equal), () => true); this.SelectGreaterThanCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.GreaterThan), () => true); this.SelectGreaterThanOrEqualCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.GreaterThanOrEqual), () => true); this.SelectIncreasedCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.Increased), () => true); this.SelectIncreasedByXCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.IncreasedByX), () => true); this.SelectLessThanCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.LessThan), () => true); this.SelectLessThanOrEqualCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.LessThanOrEqual), () => true); this.SelectNotEqualCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.NotEqual), () => true); this.SelectUnchangedCommand = new RelayCommand(() => this.ChangeScanConstraintSelection(ScanConstraint.ConstraintType.Unchanged), () => true); // Note: Constraint modifying commands cannot be async since they modify the observable collection, which must be done on the same thread as the GUI this.AddCurrentConstraintCommand = new RelayCommand(() => this.AddCurrentConstraint(), () => true); this.RemoveConstraintCommand = new RelayCommand <ScanConstraint>((ScanConstraint) => this.RemoveConstraint(ScanConstraint), (ScanConstraint) => true); this.EditConstraintCommand = new RelayCommand <ScanConstraint>((ScanConstraint) => this.EditConstraint(ScanConstraint), (ScanConstraint) => true); this.ClearConstraintsCommand = new RelayCommand(() => this.ClearConstraints(), () => true); this.ActiveConstraint = new ScanConstraint(ScanConstraint.ConstraintType.Equal); Task.Run(() => ScanResultsViewModel.GetInstance().Subscribe(this)); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="PropertyViewerViewModel" /> class from being created. /// </summary> private PropertyViewerViewModel() : base("Property Viewer") { this.ObserverLock = new Object(); this.PropertyViewerObservers = new List <IPropertyViewerObserver>(); Task.Run(() => DockingViewModel.GetInstance().RegisterViewModel(this)); }
/// <summary> /// Prevents a default instance of the <see cref="HotkeyEditorViewModel" /> class. /// </summary> private HotkeyEditorViewModel() : base("Hotkey Editor") { this.ClearHotkeysCommand = new RelayCommand(() => this.ClearActiveHotkey(), () => true); this.AccessLock = new Object(); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="TextEditorViewModel" /> class. /// </summary> private TextEditorViewModel() : base("Text Editor") { this.UpdateTextCommand = new RelayCommand <String>((text) => this.UpdateText(text), (text) => true); this.SaveTextCommand = new RelayCommand <String>((text) => this.SaveText(text), (text) => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="ScriptEditorViewModel" /> class. /// </summary> private ScriptEditorViewModel() : base("Script Editor") { this.ContentId = ScriptEditorViewModel.ToolContentId; this.UpdateScriptCommand = new RelayCommand <String>((script) => this.UpdateScript(script), (script) => true); this.SaveScriptCommand = new RelayCommand <String>((script) => this.SaveScript(script), (script) => true); Task.Run(() => DockingViewModel.GetInstance().RegisterViewModel(this)); }
/// <summary> /// Prevents a default instance of the <see cref="DotNetExplorerViewModel" /> class from being created. /// </summary> private DotNetExplorerViewModel() : base(".Net Explorer") { this.dotNetObjects = new ReadOnlyCollection <DotNetObjectViewModel>(new List <DotNetObjectViewModel>()); this.RefreshObjectsCommand = new RelayCommand(() => this.RefreshObjects(), () => true); this.AddDotNetObjectCommand = new RelayCommand <DotNetObjectViewModel>((dotNetObjectViewModel) => this.AddDotNetObject(dotNetObjectViewModel), (dotNetObjectViewModel) => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="ChangeCounterViewModel" /> class from being created. /// </summary> private ChangeCounterViewModel() : base("Change Counter") { this.StartScanCommand = new RelayCommand(() => Task.Run(() => this.StartScan()), () => true); this.StopScanCommand = new RelayCommand(() => Task.Run(() => this.StopScan()), () => true); this.ChangeCounterScan = new ChangeCounter(this.ScanCountUpdated); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="TwitchLoginViewModel" /> class from being created. /// </summary> private TwitchLoginViewModel() : base("Twitch Login") { // Note: Cannot be async, navigation must take place on the same thread as GUI this.DisplayTwitchLoginCommand = new RelayCommand(() => this.DisplayTwitchLogin(), () => true); this.NavigateHomeCommand = new RelayCommand <WebBrowser>((browser) => this.NavigateHome(browser), (browser) => true); this.PerformLoginCommand = new RelayCommand <String>((code) => this.PerformLogin(code), (code) => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="StoreViewModel" /> class from being created. /// </summary> private StoreViewModel() : base("Store") { this.LockedCheatList = new FullyObservableCollection <Cheat>(); this.UnlockedCheatList = new FullyObservableCollection <Cheat>(); this.UnlockCheatCommand = new RelayCommand <Cheat>((cheat) => this.UnlockCheat(cheat), (cheat) => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="OutputViewModel" /> class from being created. /// </summary> private OutputViewModel() : base("Output") { this.AccessLock = new Object(); this.logText = new StringBuilder(OutputViewModel.LogCapacity); this.ClearOutputCommand = new RelayCommand(() => this.ClearOutput(), () => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="SnapshotManagerViewModel"/> class from being created. /// </summary> private SnapshotManagerViewModel() : base("Snapshot Manager") { // Note: Not async to avoid updates slower than the perception threshold this.ClearSnapshotsCommand = new RelayCommand(() => SnapshotManager.ClearSnapshots(), () => true); this.UndoSnapshotCommand = new RelayCommand(() => SnapshotManager.UndoSnapshot(), () => true); this.RedoSnapshotCommand = new RelayCommand(() => SnapshotManager.RedoSnapshot(), () => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="InputCorrelatorViewModel" /> class from being created. /// </summary> private InputCorrelatorViewModel() : base("Input Correlator") { this.NewHotkeyCommand = new RelayCommand(() => this.NewHotkey(), () => true); this.RemoveHotkeyCommand = new RelayCommand <Hotkey>((hotkey) => this.RemoveHotkey(hotkey), (hotkey) => true); this.StartScanCommand = new RelayCommand(() => Task.Run(() => this.StartScan()), () => true); this.StopScanCommand = new RelayCommand(() => Task.Run(() => this.StopScan()), () => true); this.InputCorrelator = new InputCorrelator(this.ScanCountUpdated); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="LabelThresholderViewModel" /> class from being created. /// </summary> private LabelThresholderViewModel() : base("Label Thresholder") { this.LabelThresholder = new LabelThresholder(this.OnUpdateHistogram); this.LowerThreshold = 0; this.UpperThreshold = 100; this.ApplyThresholdCommand = new RelayCommand(() => Task.Run(() => this.ApplyThreshold()), () => true); this.InvertSelectionCommand = new RelayCommand(() => Task.Run(() => this.InvertSelection()), () => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="DisassemblyViewModel" /> class from being created. /// </summary> private DisassemblyViewModel() : base("Disassembly") { this.Instructions = new FullyObservableCollection <InstructionItem>(); this.SelectInstructionsCommand = new RelayCommand <Object>((selectedItems) => this.SelectedInstructions = (selectedItems as IList)?.Cast <InstructionItem>(), (selectedItems) => true); this.AddInstructionCommand = new RelayCommand <InstructionItem>((instruction) => Task.Run(() => this.AddInstruction(instruction)), (scanResult) => true); this.AddInstructionsCommand = new RelayCommand <Object>((selectedItems) => Task.Run(() => this.AddInstructions(this.SelectedInstructions)), (selectedItems) => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="StreamConfigViewModel" /> class from being created. /// </summary> private StreamConfigViewModel() : base("Stream Config") { this.VoteLock = new Object(); this.IsConnected = true; StreamVotePollTask streamVotePollTask = new StreamVotePollTask(this.OnUpdate); this.ToggleConnectionCommand = new RelayCommand(() => this.ToggleConnection(), () => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="OutputViewModel" /> class from being created. /// </summary> private OutputViewModel() : base("Output") { this.OutputMasks = new List <OutputMask>(); this.AccessLock = new Object(); this.ContentId = OutputViewModel.ToolContentId; this.logText = new StringBuilder(OutputViewModel.LogCapacity); this.ClearOutputCommand = new RelayCommand(() => this.ClearOutput(), () => true); Task.Run(() => DockingViewModel.GetInstance().RegisterViewModel(this)); }
/// <summary> /// Prevents a default instance of the <see cref="ProcessSelectorViewModel" /> class from being created. /// </summary> private ProcessSelectorViewModel() : base("Process Selector") { this.IconSource = Images.SelectProcess; this.RefreshProcessListCommand = new RelayCommand(() => Task.Run(() => this.RefreshProcessList()), () => true); this.SelectProcessCommand = new RelayCommand <Process>((process) => Task.Run(() => this.SelectProcess(process)), (process) => true); this.detachProcess = null; this.StartAutomaticProcessListRefresh(); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="SnapshotManagerViewModel"/> class from being created. /// </summary> private SnapshotManagerViewModel() : base("Snapshot Manager") { this.ContentId = SnapshotManagerViewModel.ToolContentId; // Note: Not async to avoid updates slower than the perception threshold this.ClearSnapshotsCommand = new RelayCommand(() => this.ClearSnapshots(), () => true); this.UndoSnapshotCommand = new RelayCommand(() => this.UndoSnapshot(), () => true); this.RedoSnapshotCommand = new RelayCommand(() => this.RedoSnapshot(), () => true); Task.Run(() => DockingViewModel.GetInstance().RegisterViewModel(this)); Task.Run(() => SnapshotManager.GetInstance().Subscribe(this)); }
/// <summary> /// Prevents a default instance of the <see cref="StreamIconEditorViewModel" /> class. /// </summary> private StreamIconEditorViewModel() : base("Stream Icon Editor") { this.SetIconCommand = new RelayCommand <StreamIcon>((streamIcon) => this.UpdateStreamIconPath(streamIcon), (streamIcon) => true); this.SelectIconCommand = new RelayCommand <StreamIcon>((streamIcon) => this.ChangeSelectedIcon(streamIcon), (streamIcon) => true); this.ObserverLock = new Object(); this.IsStreamIconListLoading = true; this.IconsLoadedObservers = new List <IStreamIconsLoadedObserver>(); this.LoadIcons(); Task.Run(() => DockingViewModel.GetInstance().RegisterViewModel(this)); }
/// <summary> /// Prevents a default instance of the <see cref="PointerScannerViewModel" /> class from being created. /// </summary> private PointerScannerViewModel() : base("Pointer Scanner") { this.StartPointerRetargetScanCommand = new RelayCommand <UInt64>((newValue) => this.StartPointerRetargetScan(), (newValue) => true); this.StartPointerRebaseCommand = new RelayCommand(() => Task.Run(() => this.StartPointerRebase()), () => true); this.StartScanCommand = new RelayCommand(() => Task.Run(() => this.StartScan()), () => true); this.SetPointerScanAddressCommand = new RelayCommand <UInt64>((newValue) => this.TargetAddress = newValue, (newValue) => true); this.SetPointerRetargetScanAddressCommand = new RelayCommand <UInt64>((newValue) => this.RetargetAddress = newValue, (newValue) => true); this.SetDepthCommand = new RelayCommand <Int32>((newValue) => this.PointerDepth = newValue, (newValue) => true); this.SetPointerRadiusCommand = new RelayCommand <Int32>((newValue) => this.PointerRadius = newValue, (newValue) => true); DockingViewModel.GetInstance().RegisterViewModel(this); }
/// <summary> /// Prevents a default instance of the <see cref="PointerScanResultsViewModel" /> class from being created. /// </summary> private PointerScanResultsViewModel() : base("Pointer Scan Results") { this.ExtractPointerCommand = new RelayCommand <Int32>((levelIndex) => this.ExtractPointer(levelIndex), (levelIndex) => true); this.SelectScanResultsCommand = new RelayCommand <Object>((selectedItems) => this.SelectedScanResults = (selectedItems as IList)?.Cast <PointerItem>(), (selectedItems) => true); this.ChangeTypeCommand = new RelayCommand <DataTypeBase>((type) => Task.Run(() => this.ChangeType(type)), (type) => true); this.NewPointerScanCommand = new RelayCommand(() => Task.Run(() => this.DiscoveredPointers = null), () => true); this.ActiveType = DataTypeBase.Int32; this.pointers = new FullyObservableCollection <PointerItem>(); DockingViewModel.GetInstance().RegisterViewModel(this); }
private ProjectExplorerViewModel() : base("Project Explorer") { this.SetProjectRootCommand = new RelayCommand(() => this.SetProjectRoot()); this.SelectProjectCommand = new RelayCommand(() => this.SelectProject()); this.SelectProjectItemCommand = new RelayCommand <Object>((selectedItem) => this.SelectedProjectItem = selectedItem as ProjectItemView, (selectedItem) => true); this.EditProjectItemCommand = new RelayCommand <ProjectItemView>((projectItem) => this.EditProjectItem(projectItem), (projectItem) => true); this.AddNewAddressItemCommand = new RelayCommand(() => this.AddNewProjectItem(typeof(PointerItem)), () => true); this.AddNewScriptItemCommand = new RelayCommand(() => this.AddNewProjectItem(typeof(ScriptItem)), () => true); this.AddNewInstructionItemCommand = new RelayCommand(() => this.AddNewProjectItem(typeof(InstructionItem)), () => true); this.OpenFileExplorerCommand = new RelayCommand <ProjectItemView>((projectItem) => this.OpenFileExplorer(projectItem), (projectItem) => true); DockingViewModel.GetInstance().RegisterViewModel(this); this.Update(); }
/// <summary> /// Prevents a default instance of the <see cref="CodeTracerViewModel" /> class from being created. /// </summary> private CodeTracerViewModel() : base("Code Tracer") { DockingViewModel.GetInstance().RegisterViewModel(this); this.Results = new FullyObservableCollection <CodeTraceResult>(); this.FindWhatWritesCommand = new RelayCommand <ProjectItemView>((projectItem) => this.FindWhatWrites(projectItem)); this.FindWhatReadsCommand = new RelayCommand <ProjectItemView>((projectItem) => this.FindWhatReads(projectItem)); this.FindWhatAccessesCommand = new RelayCommand <ProjectItemView>((projectItem) => this.FindWhatAccesses(projectItem)); this.StopTraceCommand = new RelayCommand(() => this.CancelTrace()); this.SelectInstructionCommand = new RelayCommand <Object>((selectedItems) => this.SelectedCodeTraceResults = (selectedItems as IList)?.Cast <CodeTraceResult>(), (selectedItems) => true); this.AddInstructionCommand = new RelayCommand <CodeTraceResult>((codeTraceResult) => this.AddCodeTraceResult(codeTraceResult)); this.AddInstructionsCommand = new RelayCommand <Object>((selectedItems) => this.AddCodeTraceResults(this.SelectedCodeTraceResults)); }
/// <summary> /// Prevents a default instance of the <see cref="ProcessSelectorViewModel" /> class from being created. /// </summary> private ProcessSelectorViewModel() : base("Process Selector") { this.IconSource = Images.SelectProcess; this.RefreshProcessListCommand = new RelayCommand(() => Task.Run(() => this.RefreshProcessList()), () => true); this.SelectProcessCommand = new RelayCommand <ProcessDecorator>((process) => Task.Run(() => this.SelectProcess(process)), (process) => true); this.detachProcess = new ProcessDecorator("-- Detach from Process --"); this.StartAutomaticProcessListRefresh(); DockingViewModel.GetInstance().RegisterViewModel(this); // Subscribe to process events Processes.Default.Subscribe(this); }
/// <summary> /// Prevents a default instance of the <see cref="SnapshotManagerViewModel"/> class from being created. /// </summary> private SnapshotManagerViewModel() : base("Snapshot Manager") { this.AccessLock = new Object(); this.ObserverLock = new Object(); this.Snapshots = new Stack <Snapshot>(); this.DeletedSnapshots = new Stack <Snapshot>(); this.SnapshotObservers = new List <ISnapshotObserver>(); // Note: Not async to avoid updates slower than the perception threshold this.ClearSnapshotsCommand = new RelayCommand(() => this.ClearSnapshots(), () => true); this.UndoSnapshotCommand = new RelayCommand(() => this.UndoSnapshot(), () => true); this.RedoSnapshotCommand = new RelayCommand(() => this.RedoSnapshot(), () => true); Task.Run(() => DockingViewModel.GetInstance().RegisterViewModel(this)); }
/// <summary> /// Prevents a default instance of the <see cref="ProcessSelectorViewModel" /> class from being created. /// </summary> private ProcessSelectorViewModel() : base("Process Selector") { this.IconSource = Images.SelectProcess; this.RefreshProcessListCommand = new RelayCommand(() => Task.Run(() => this.RefreshProcessList()), () => true); this.SelectProcessCommand = new RelayCommand <NormalizedProcess>((process) => Task.Run(() => this.SelectProcess(process)), (process) => true); this.detachProcess = new NormalizedProcess(0, "-- Detach from Process --", DateTime.Now, isSystemProcess: false, hasWindow: false, icon: null); ProcessSelectorTask processSelectorTask = new ProcessSelectorTask(this.RefreshProcessList); // Subscribe async to avoid a deadlock situation Task.Run(() => { DockingViewModel.GetInstance().RegisterViewModel(this); }); // Subscribe to process events (async call as to avoid locking on GetInstance() if engine is being constructed) Task.Run(() => { EngineCore.GetInstance().Processes.Subscribe(this); }); }