public PropsGuiGroupMovieRectangle(IUndoRedoService undoRedo, IAssetService assetService, IWindowQueryService windowQueryService, IMovieUrlLoader movieUrlLoader) { this.undoRedo = undoRedo; this.assetService = assetService; this.windowQueryService = windowQueryService; this.movieUrlLoader = movieUrlLoader; movieOpenFileDialog = new OpenFileDialog(); movieOpenFileDialog.Filters.Add(new FileDialogFilter("Video Files", ".mkv", ".mp4", ".avi", ".mov", ".flv")); cFile = new Button { Text = "File" }; cFile.Click += OnFileClicked; cLink = new Button { Text = "Link" }; cLink.Click += OnLinkClicked; var layout = new TableLayout( new TableRow(cFile), new TableRow(cLink)) { Padding = new Padding(5), Spacing = new Size(5, 5), }; GroupBox = new GroupBox { Text = "Movie", Content = layout }; }
internal Property(IUndoRedoService undoRedoService, INotifyPropertyChanged propertyOwnerObj, PropertyInfo propertyInfo, RecordedElement initialPropertyValue, IsRecordableAttribute isRecordableAttribute) { if (undoRedoService == null) { throw new ArgumentNullException("undoRedoService"); } if (propertyOwnerObj == null) { throw new ArgumentNullException("propertyOwnerObj"); } if (propertyInfo == null) { throw new ArgumentNullException("propertyInfo"); } if (initialPropertyValue == null) { throw new ArgumentNullException("initialPropertyValue"); } if (isRecordableAttribute == null) { throw new ArgumentNullException("isRecordableAttribute"); } _undoRedoService = undoRedoService; _propertyOwnerObj = propertyOwnerObj; _propertyInfo = propertyInfo; _value = initialPropertyValue; _isRecordableAttribute = isRecordableAttribute; }
internal NotifyPropertyChangedRecordedElement(IUndoRedoService undoRedoService, INotifyPropertyChanged objAsNotifyPropertyChanged) : base(objAsNotifyPropertyChanged) { if (undoRedoService == null) { throw new ArgumentNullException("undoRedoService"); } if (objAsNotifyPropertyChanged == null) { throw new ArgumentNullException("objAsNotifyPropertyChanged"); } _objAsNotifyPropertyChanged = objAsNotifyPropertyChanged; _objAsNotifyPropertyChanged.PropertyChanged += OnPropertyChanged; foreach (var propertyInfo in objAsNotifyPropertyChanged.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) { var getMethod = propertyInfo.GetGetMethod(); if (getMethod != null && getMethod.GetParameters().Any()) { continue; } var attributes = propertyInfo.GetCustomAttributes(typeof(IsRecordableAttribute), true); if (attributes.Length <= 0) { continue; } var property = PropertyFactory.Create(undoRedoService, objAsNotifyPropertyChanged, (IsRecordableAttribute)attributes[0], propertyInfo); _properties.Add(property.Name, property); } }
public PropsGui(IViewService viewService, IUndoRedoService undoRedo, IAssetService assetService, IWorldTreeService worldTreeService, IReadOnlyList <IStoryLayout> storyLayouts, IStoryService storyService, IEmbeddedResources embeddedResources, IWindowQueryService windowQueryService, IMovieUrlLoader movieUrlLoader) { this.viewService = viewService; PropsPanel = new Panel { Content = new TableLayout(), Width = 250, Height = 300 }; groups = new IPropsGuiGroup[] { new PropsGuiGroupCommon(undoRedo), new PropsGuiGroupFluidSimulation(undoRedo), new PropsGuiGroupStoryComponent(undoRedo, storyLayouts, worldTreeService, storyService), new PropsGuiGroupMovieRectangle(undoRedo, assetService, windowQueryService, movieUrlLoader), new PropsGuiGroupHighlightOnMouse(undoRedo), new PropsGuiGroupComponents(undoRedo), }; viewService.Update += OnViewServiceUpdate; }
private static void ClearNode(IUndoRedoService actionService, AssetViewModel asset, ItemToReload itemToReload) { // Get the node we want to change var index = itemToReload.GraphPathIndex; var node = itemToReload.GraphPath.GetNode(); var oldValue = node.Retrieve(index); // Apply the change // TODO: Share this code with ContentValueChangeOperation? // TODO: How to better detect CollectionAdd vs ValueChange? ContentChangeType operationType; if (index != NodeIndex.Empty) { if (CollectionItemIdHelper.TryGetCollectionItemIds(node.Retrieve(), out CollectionItemIdentifiers ids)) { itemToReload.ItemId = ids[index.Value]; } operationType = ContentChangeType.CollectionRemove; ((IObjectNode)node).Remove(oldValue, index); } else { operationType = ContentChangeType.ValueChange; ((IMemberNode)node).Update(null); } // Save the change on the stack var operation = new ContentValueChangeOperation(node, operationType, index, oldValue, null, Enumerable.Empty <IDirtiable>()); actionService.PushOperation(operation); string operationName = $"Unload object {oldValue.GetType().Name} in asset {asset.Url}"; actionService.SetName(operation, operationName); }
public PresentationGuiCommands(Lazy <IViewService> viewServiceLazy, IToolService toolService, IToolFactory toolFactory, IUndoRedoService undoRedoService, IAmDiBasedObjectFactory objectFactory) { this.toolService = toolService; this.toolFactory = toolFactory; this.undoRedoService = undoRedoService; this.objectFactory = objectFactory; this.viewServiceLazy = viewServiceLazy; //LayoutHere = GuiCommandsHelper.Create("Layout Here", ExecLayoutHere); Move = new GuiCommand("Move", KeyModifiers.Control, Key.T, ExecMove); Move3D = new GuiCommand("Move3D", KeyModifiers.Control | KeyModifiers.Shift, Key.T, ExecMove3D); Rotate = new GuiCommand("Rotate", KeyModifiers.Control, Key.R, ExecRotate); Scale = new GuiCommand("Scale", KeyModifiers.Control, Key.E, ExecScale); Cut = new GuiCommand("Cut", KeyModifiers.Control, Key.X, ExecCut); Copy = new GuiCommand("Copy", KeyModifiers.Control, Key.C, ExecCopy); Paste = new GuiCommand("Paste", KeyModifiers.Control, Key.V, ExecPaste); Duplicate = new GuiCommand("Duplicate", KeyModifiers.Control, Key.D, ExecDuplicate); Delete = new GuiCommand("Delete", Key.Delete, ExecDelete); FocusView = new GuiCommand("Focus View", KeyModifiers.Control, Key.Enter, ExecFocusView); AddNewAdaptiveLayout = new GuiCommand("Adaptive Layout", ExecNewAdaptiveLayout); MoveUp = new GuiCommand("Move Up", KeyModifiers.Control, Key.Up, ExecMoveUp); MoveDown = new GuiCommand("Move Down", KeyModifiers.Control, Key.Down, ExecMoveDown); SetBorderCurve = new GuiCommand("Set Border Curve", ExecSetBorderCurve); MakeScenePortal = new GuiCommand("Make Scene Portal", ExecMakeScenePortal); }
/// <summary> /// </summary> /// <param name="undoRedoService">The Undo/Redo service in which property changes will be added</param> /// <param name="instance">The object for which the property will be updated</param> /// <param name="propertyInfo">The property owned by the provided object</param> public UndoRedoDelayedExecutedRevertibleCommandAppender(IUndoRedoService undoRedoService, object instance, PropertyInfo propertyInfo) { if (undoRedoService == null) { throw new ArgumentNullException("undoRedoService"); } if (instance == null) { throw new ArgumentNullException("instance"); } if (propertyInfo == null) { throw new ArgumentNullException("propertyInfo"); } _undoRedoService = undoRedoService; _instance = instance; _propertyInfo = propertyInfo; IsFlushPending = false; _timer.Stop(); _timer.AutoReset = false; _timer.Enabled = true; _timer.Elapsed += OnTimerElapsed; _undoRedoService.BeforeUndoRedoCommandExecuted += OnBeforeUndoRedoCommandExecuted; }
public RotateEntityTool(ISceneNode entity, IToolService toolService, IUndoRedoService undoRedo) { this.entity = entity; this.toolService = toolService; this.undoRedo = undoRedo; initialLocalTransform = entity.Transform; }
private static void ReplaceNode(IUndoRedoService actionService, AssetViewModel asset, ItemToReload itemToReload) { // Get the node we want to change var graphPath = itemToReload.GraphPath; var index = itemToReload.GraphPathIndex; var node = graphPath.GetNode(); // Apply the change // TODO: Share this code with ContentValueChangeOperation? // TODO: How to better detect CollectionAdd vs ValueChange? ContentChangeType operationType; if (index != NodeIndex.Empty) { operationType = ContentChangeType.CollectionAdd; ((IAssetObjectNode)node).Restore(itemToReload.UpdatedObject, index, itemToReload.ItemId); } else { operationType = ContentChangeType.ValueChange; ((IMemberNode)node).Update(itemToReload.UpdatedObject); } // Save the change on the stack var operation = new ContentValueChangeOperation(node, operationType, index, null, itemToReload.UpdatedObject, asset.Dirtiables); actionService.PushOperation(operation); string operationName = $"Reload object {itemToReload.UpdatedObject.GetType().Name} in asset {asset.Url}"; actionService.SetName(operation, operationName); }
internal NotifyPropertyChangedRecordedElement(IUndoRedoService undoRedoService, INotifyPropertyChanged objAsNotifyPropertyChanged) : base(objAsNotifyPropertyChanged) { if (undoRedoService == null) { throw new ArgumentNullException("undoRedoService"); } if (objAsNotifyPropertyChanged == null) { throw new ArgumentNullException("objAsNotifyPropertyChanged"); } _objAsNotifyPropertyChanged = objAsNotifyPropertyChanged; _objAsNotifyPropertyChanged.PropertyChanged += OnPropertyChanged; foreach (var propertyInfo in objAsNotifyPropertyChanged.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) { var getMethod = propertyInfo.GetGetMethod(); if (getMethod != null && getMethod.GetParameters().Any()) { continue; } var attributes = propertyInfo.GetCustomAttributes(typeof(IsRecordableAttribute), true); if (attributes.Length <= 0) { continue; } var property = PropertyFactory.Create(undoRedoService, objAsNotifyPropertyChanged, (IsRecordableAttribute)attributes[0], propertyInfo); _properties.Add(property.Name, property); } }
public DragRectangleInputLock(IUndoRedoService undoRedo, IRectangleComponent nodeRectAspect, IPlacementSurface space, Vector2 anchorPointOnRect) { this.undoRedo = undoRedo; this.nodeRectAspect = nodeRectAspect; this.space = space; this.anchorPointOnRect = anchorPointOnRect; originalRect = nodeRectAspect.Rectangle; }
public RichTextEditInteractionElement(IRichTextComponent cText, IInputHandler inputHandler, IUndoRedoService undoRedo, IClipboard clipboard) { this.cText = cText; this.undoRedo = undoRedo; this.clipboard = clipboard; this.inputHandler = inputHandler; }
public ResizeRectangleInputLock(IRectangleComponent nodeRectAspect, IUndoRedoService undoRedo, IPlacementSurface space, ResizeRectangleGizmoPlace place) { this.nodeRectAspect = nodeRectAspect; this.undoRedo = undoRedo; this.space = space; this.place = place; originalRect = nodeRectAspect.Rectangle; }
public ScaleEntityTool(ISceneNode entity, IToolService toolService, IUndoRedoService undoRedo) { this.entity = entity; this.toolService = toolService; this.undoRedo = undoRedo; cTransformable = entity.GetComponent <ITransformable3DComponent>(); initialLocalTransform = entity.Transform; }
internal GraphNodeBinding(string propertyName, PropertyChangeDelegate propertyChanging, PropertyChangeDelegate propertyChanged, [NotNull] Func <TTargetType, TContentType> converter, IUndoRedoService actionService, bool notifyChangesOnly = true) { PropertyName = propertyName; this.propertyChanging = propertyChanging; this.propertyChanged = propertyChanged; Converter = converter ?? throw new ArgumentNullException(nameof(converter)); ActionService = actionService; this.notifyChangesOnly = notifyChangesOnly; }
internal FilteredChangeRecordProperty(IUndoRedoService undoRedoService, INotifyPropertyChanged propertyOwnerObj, PropertyInfo propertyInfo, RecordedElement initialPropertyValue, IsRecordableWithFilterAttribute isRecordableWithFilterAttribute) : base(undoRedoService, propertyOwnerObj, propertyInfo, initialPropertyValue, isRecordableWithFilterAttribute) { _undoRedoDelayedExecutedRevertibleCommandAppender = new UndoRedoDelayedExecutedRevertibleCommandAppender <object>(undoRedoService, _propertyOwnerObj, propertyInfo) { DelayMs = isRecordableWithFilterAttribute.FilterTimeMs, CommandDescription = _isRecordableAttribute.Description, }; }
public MoveEntityTool(ISceneNode entity, bool isNew, IToolService toolService, IUndoRedoService undoRedo) { this.entity = entity; this.isNew = isNew; initialLocalTransform = entity.Transform; this.toolService = toolService; this.undoRedo = undoRedo; done = false; }
public DragRectangleInteractionElement(TMaster master, Func <TMaster, IRectangleComponent> getRectAspect, Func <TMaster, IPlacementSurface> getSpace, IInputHandler inputHandler, IUndoRedoService undoRedo) { this.master = master; this.inputHandler = inputHandler; this.undoRedo = undoRedo; this.getRectAspect = getRectAspect; this.getSpace = getSpace; }
protected DragRectangleGizmoComponent(IInputHandler inputHandler, IUndoRedoService undoRedo) { hittable = new RectangleHittable <DragRectangleGizmoComponent>( this, Transform.Identity, x => x.GetRectComponent()?.Rectangle ?? DefaultRect, x => - 1f / (1 << 18)); interactionElement = new DragRectangleInteractionElement <DragRectangleGizmoComponent>(this, x => x.GetRectComponent(), x => x.GetChildSpace(), inputHandler, undoRedo); }
public DebugUndoRedoViewModel(IViewModelServiceProvider serviceProvider, IUndoRedoService undoRedo) : base(serviceProvider) { this.undoRedo = undoRedo; ClearDiscardedItemsCommand = new AnonymousCommand(ServiceProvider, () => DiscardedTransactions.Clear()); undoRedo.Done += TransactionAdded; undoRedo.TransactionDiscarded -= TransactionDiscarded; undoRedo.Cleared += UndoStackCleared; Transactions.AddRange(undoRedo.RetrieveAllTransactions().Select(x => new OperationViewModel(ServiceProvider, undoRedo, (Operation)x))); }
/// <summary> /// Initializes a new instance of the <see cref="ActionHistoryViewModel"/> class. /// </summary> /// <param name="session">The session this view model belongs to.</param> public ActionHistoryViewModel(SessionViewModel session) : base(session.SafeArgument(nameof(session)).ServiceProvider) { this.session = session; service = ServiceProvider.Get <IUndoRedoService>(); Transactions.CollectionChanged += (sender, e) => RefreshUndoRedoStatus(); UndoCommand = new AnonymousCommand(ServiceProvider, () => { service.Undo(); session.CheckConsistency(); RefreshUndoRedoStatus(); }); RedoCommand = new AnonymousCommand(ServiceProvider, () => { service.Redo(); session.CheckConsistency(); RefreshUndoRedoStatus(); }); RefreshUndoRedoStatus(); }
public PropsGuiGroupStoryComponent(IUndoRedoService undoRedo, IReadOnlyList <IStoryLayout> storyLayouts, IWorldTreeService worldTreeService, IStoryService storyService) { this.undoRedo = undoRedo; this.storyService = storyService; this.worldTreeService = worldTreeService; cDefaultAdaptiveStyle = new DropDown(); typeDict = storyLayouts.ToDictionary(x => x.UserFriendlyName, x => x.Type); typeDict.Add("none", null); cDefaultAdaptiveStyle.DataStore = typeDict.Keys; cDefaultAdaptiveStyle.SelectedValueChanged += OnDefaultAdaptiveStyleChanged; cShowAux1 = new CheckBox { Text = "Aux1" }; cShowAux2 = new CheckBox { Text = "Aux2" }; cShowAux1.CheckedChanged += OnShowAux1Changed; cShowAux2.CheckedChanged += OnShowAux2Changed; cExplicitConnections = new GroupBox { Text = "Explicit Connections" }; var cRedecorate = new Button { Text = "Redecorate" }; cRedecorate.Click += (s, a) => { storyService.OnBeginTransaction(this); storyService.OnEndTransaction(this); }; var layout = new TableLayout( new TableRow(new Label { Text = "Default Adaptive Style" }, cDefaultAdaptiveStyle), new TableRow(cShowAux1, cShowAux2), new TableRow(cExplicitConnections), new TableRow(cRedecorate)) { Padding = new Padding(5), Spacing = new Size(5, 5), }; GroupBox = new GroupBox { Text = "Story", Content = layout }; }
public DrawBorderCurveTool(ISceneNode entity, IUndoRedoService undoRedo) { this.undoRedo = undoRedo; this.entity = entity; richTextAspect = entity.GetComponent <IRichTextComponent>(); rectangleAspect = entity.GetComponent <IRectangleComponent>(); richTextAspect.BorderComplete = false; richTextAspect.VisualBorderCurve = new List <Vector2>(); curve = richTextAspect.VisualBorderCurve; state = State.Ready; }
public OperationViewModel(IViewModelServiceProvider serviceProvider, IUndoRedoService undoRedo, Operation operation) : base(serviceProvider) { UndoRedo = undoRedo; Operation = operation; var transaction = operation as IReadOnlyTransaction; if (transaction != null) { Children.AddRange(transaction.Operations.Select(x => new OperationViewModel(ServiceProvider, UndoRedo, x))); } }
public PropsGuiGroupFluidSimulation(IUndoRedoService undoRedo) { this.undoRedo = undoRedo; widthControl = new NumericUpDown(); heightControl = new NumericUpDown(); levelSetScaleControl = new NumericUpDown(); cellSizeControl = new NumericUpDown(); surfaceTypeDropDown = new DropDown { Width = 120, DataStore = new[] { FluidSurfaceType.Hybrid, FluidSurfaceType.Particles, FluidSurfaceType.LevelSet }.Select(x => (object)x) }; widthControl.ValueChanged += OnChanged; heightControl.ValueChanged += OnChanged; levelSetScaleControl.ValueChanged += OnChanged; cellSizeControl.ValueChanged += OnChanged; surfaceTypeDropDown.SelectedValueChanged += OnChanged; var layout = new TableLayout( new TableRow(new Label { Text = "Width" }, widthControl), new TableRow(new Label { Text = "Height" }, heightControl), new TableRow(new Label { Text = "LSScale" }, levelSetScaleControl), new TableRow(new Label { Text = "CellSize" }, cellSizeControl), new TableRow(new Label { Text = "Type" }, surfaceTypeDropDown) ) { Padding = new Padding(5), Spacing = new Size(5, 5), }; GroupBox = new GroupBox { Text = "Fluid", Content = layout }; }
public PropsGuiGroupCommon(IUndoRedoService undoRedo) { this.undoRedo = undoRedo; cId = new Label(); cName = new TextBox(); cName.TextChanged += OnNameTextChanged; cScale = new TextBox { Width = 50 }; cOffsetX = new TextBox { Width = 50 }; cOffsetY = new TextBox { Width = 50 }; cOffsetZ = new TextBox { Width = 50 }; cScale.TextChanged += OnTransformChanged; cOffsetX.TextChanged += OnTransformChanged; cOffsetY.TextChanged += OnTransformChanged; cOffsetZ.TextChanged += OnTransformChanged; var layout = new TableLayout( new TableLayout( new TableRow(new Label { Text = "ID" }, cId), new TableRow(new Label { Text = "Name" }, cName)) { Padding = new Padding(5), Spacing = new Size(5, 5) }, new TableLayout(new TableRow( cScale, cOffsetX, cOffsetY, cOffsetZ, new TableCell())) { Padding = new Padding(5), Spacing = new Size(5, 5) } ); GroupBox = new GroupBox { Text = "Common", Content = layout }; }
public void Record(IUndoRedoService undoRedoService, object objToRecord) { if (undoRedoService == null) { throw new ArgumentNullException("undoRedoService"); } if (objToRecord == null) { throw new ArgumentNullException("objToRecord"); } this.UndoRedoService = undoRedoService; _recordedElement = RecordedElementFactory.Create(undoRedoService, objToRecord); }
public void Record(IUndoRedoService undoRedoService, object objToRecord) { if (undoRedoService == null) { throw new ArgumentNullException("undoRedoService"); } if (objToRecord == null) { throw new ArgumentNullException("objToRecord"); } this.UndoRedoService = undoRedoService; _recordedElement = RecordedElementFactory.Create(undoRedoService, objToRecord); }
/// <summary> /// Setter for the virtual node's value. /// </summary> /// <param name="undoRedoService"></param> /// <param name="propertyContainerNode">The node containing the property.</param> /// <param name="propertyIndex">The index of the property in the node.</param> /// <param name="value">The value to set.</param> private static void Setter(IUndoRedoService undoRedoService, [NotNull] IObjectNode propertyContainerNode, NodeIndex propertyIndex, object value) { using (undoRedoService?.CreateTransaction()) { if (!propertyContainerNode.Indices.Contains(propertyIndex)) { // Note: update would probably work, but we want to remove the property when Undo propertyContainerNode.Add(value, propertyIndex); } else { propertyContainerNode.Update(value, propertyIndex); } } }
internal static Property Create(IUndoRedoService undoRedoService, INotifyPropertyChanged objAsNotifyPropertyChanged, IsRecordableAttribute isRecordableAttribute, PropertyInfo propertyInfo) { var recordableWithFilterAttribute = isRecordableAttribute as IsRecordableWithFilterAttribute; Property property; if (recordableWithFilterAttribute != null) { property = new FilteredChangeRecordProperty(undoRedoService, objAsNotifyPropertyChanged, propertyInfo, RecordedElementFactory.Create(undoRedoService, propertyInfo.GetValue(objAsNotifyPropertyChanged, null)), recordableWithFilterAttribute); } else { property = new EveryChangeRecordProperty(undoRedoService, objAsNotifyPropertyChanged, propertyInfo, RecordedElementFactory.Create(undoRedoService, propertyInfo.GetValue(objAsNotifyPropertyChanged, null)), isRecordableAttribute); } return(property); }
public static IDebugPage CreateUndoRedoDebugPage(IUndoRedoService service, string title, bool register = true) { var dispatcher = SessionViewModel.Instance.ServiceProvider.Get <IDispatcherService>(); dispatcher.EnsureAccess(); var page = new DebugUndoRedoUserControl(SessionViewModel.Instance.ServiceProvider, service) { Title = title }; if (register) { RegisterDebugPage(page); } return(page); }
public CollectionChangedRecordedElement(IUndoRedoService undoRedoService, IList objAsIList, INotifyCollectionChanged objAsNotifyCollectionChanged) : base(objAsNotifyCollectionChanged) { if (!ReferenceEquals(objAsIList, objAsNotifyCollectionChanged)) { throw new ArgumentException("Arguments should have the same references"); } _undoRedoService = undoRedoService; _objAsIList = objAsIList; _listAsNotifyCollectionChanged = objAsNotifyCollectionChanged; _listAsNotifyCollectionChanged.CollectionChanged += OnCollectionChanged; foreach (var item in _objAsIList) { _recordedElementItems.Add(RecordedElementFactory.Create(undoRedoService, item)); } }
public CollectionChangedRecordedElement(IUndoRedoService undoRedoService, IList objAsIList, INotifyCollectionChanged objAsNotifyCollectionChanged) : base(objAsNotifyCollectionChanged) { if (!ReferenceEquals(objAsIList, objAsNotifyCollectionChanged)) { throw new ArgumentException("Arguments should have the same references"); } _undoRedoService = undoRedoService; _objAsIList = objAsIList; _listAsNotifyCollectionChanged = objAsNotifyCollectionChanged; _listAsNotifyCollectionChanged.CollectionChanged += OnCollectionChanged; foreach (var item in _objAsIList) { _recordedElementItems.Add(RecordedElementFactory.Create(undoRedoService, item)); } }
internal EveryChangeRecordProperty(IUndoRedoService undoRedoService, INotifyPropertyChanged propertyOwnerObj, PropertyInfo propertyInfo, RecordedElement initialPropertyValue, IsRecordableAttribute isRecordableAttribute) : base(undoRedoService, propertyOwnerObj, propertyInfo, initialPropertyValue, isRecordableAttribute) { }
internal static Property Create(IUndoRedoService undoRedoService, INotifyPropertyChanged objAsNotifyPropertyChanged, IsRecordableAttribute isRecordableAttribute, PropertyInfo propertyInfo) { var recordableWithFilterAttribute = isRecordableAttribute as IsRecordableWithFilterAttribute; Property property; if (recordableWithFilterAttribute != null) { property = new FilteredChangeRecordProperty(undoRedoService, objAsNotifyPropertyChanged, propertyInfo, RecordedElementFactory.Create(undoRedoService, propertyInfo.GetValue(objAsNotifyPropertyChanged, null)), recordableWithFilterAttribute); } else { property = new EveryChangeRecordProperty(undoRedoService, objAsNotifyPropertyChanged, propertyInfo, RecordedElementFactory.Create(undoRedoService, propertyInfo.GetValue(objAsNotifyPropertyChanged, null)), isRecordableAttribute); } return property; }
internal Property(IUndoRedoService undoRedoService, INotifyPropertyChanged propertyOwnerObj, PropertyInfo propertyInfo, RecordedElement initialPropertyValue, IsRecordableAttribute isRecordableAttribute) { if (undoRedoService == null) { throw new ArgumentNullException("undoRedoService"); } if (propertyOwnerObj == null) { throw new ArgumentNullException("propertyOwnerObj"); } if (propertyInfo == null) { throw new ArgumentNullException("propertyInfo"); } if (initialPropertyValue == null) { throw new ArgumentNullException("initialPropertyValue"); } if (isRecordableAttribute == null) { throw new ArgumentNullException("isRecordableAttribute"); } _undoRedoService = undoRedoService; _propertyOwnerObj = propertyOwnerObj; _propertyInfo = propertyInfo; _value = initialPropertyValue; _isRecordableAttribute = isRecordableAttribute; }
internal FilteredChangeRecordProperty(IUndoRedoService undoRedoService, INotifyPropertyChanged propertyOwnerObj, PropertyInfo propertyInfo, RecordedElement initialPropertyValue, IsRecordableWithFilterAttribute isRecordableWithFilterAttribute) : base(undoRedoService, propertyOwnerObj, propertyInfo, initialPropertyValue, isRecordableWithFilterAttribute) { _undoRedoDelayedExecutedRevertibleCommandAppender = new UndoRedoDelayedExecutedRevertibleCommandAppender<object>(undoRedoService, _propertyOwnerObj, propertyInfo) { DelayMs = isRecordableWithFilterAttribute.FilterTimeMs, CommandDescription = _isRecordableAttribute.Description, }; }