/// <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> /// Redoes the most recent snapshot. /// </summary> private void RedoSnapshot() { SnapshotManager.GetInstance().RedoSnapshot(); }
/// <summary> /// Undoes the most recent snapshot. /// </summary> private void UndoSnapshot() { SnapshotManager.GetInstance().UndoSnapshot(); }
/// <summary> /// Clears all snapshots. /// </summary> private void ClearSnapshots() { SnapshotManager.GetInstance().ClearSnapshots(); }
/// <summary> /// Reads all memory for every region contained in this snapshot. TODO: This is not parallel, nor does it track progress. /// </summary> public void ReadAllMemory() { this.TimeSinceLastUpdate = DateTime.Now; this.Intersect(SnapshotManager.GetInstance().CreateSnapshotFromSettings()); this.SnapshotRegions?.ForEach(x => x.ReadAllMemory(keepValues: true, readSuccess: out _)); }
/// <summary> /// Unconditionally expands all regions in this snapshot by the specified size. /// </summary> /// <param name="expandSize">The size by which to expand the snapshot regions.</param> public void ExpandAllRegions(UInt64 expandSize) { this.SnapshotRegions?.ForEach(x => x.Expand(expandSize)); this.Intersect(SnapshotManager.GetInstance().CreateSnapshotFromSettings()); }