void _userControlEvent_OnAfterEdit(object sender, CollectionEditEventArgs e) { FormHostingContainer.Instance.ActiveHosting.MakeDirty(); SEUndoUnitEventEdit undoUnit = new SEUndoUnitEventEdit(e); undoUnit.Action = new Action <SEUndoUnitAbstract, SEUndoEngine.Type>( delegate(SEUndoUnitAbstract unit, SEUndoEngine.Type type) { EventBase even = undoUnit.Value as EventBase; if (even == null) { if (undoUnit.Values.Count > 0) { even = undoUnit.Values[0] as EventBase; } } if (even != null) { IEventSupport eventSupport = (IEventSupport)even.HostEntity; eventSupport.EventUpdate(this); } } ); FormHostingContainer.Instance.ActiveHosting.UndoEngine.AddUndoUnit(undoUnit); }
private void _eventTreeView_EventChanged(CollectionEditEventArgs e) { SEUndoUnitEventEdit undoUnit = new SEUndoUnitEventEdit(e); undoUnit.Action = _undounitAction; FormHostingContainer.Instance.ActiveHosting.AddUndoUnit(undoUnit); }
private void _eventTreeView_EventOrderChanged(CollectionEditEventArgs[] e) { SEUndoUnitCollection undoUnitCollection = new SEUndoUnitCollection(); foreach (CollectionEditEventArgs args in e) { SEUndoUnitEventEdit undoUnit = new SEUndoUnitEventEdit(args); undoUnitCollection.Add(undoUnit); } undoUnitCollection.Action = _undounitAction; FormHostingContainer.Instance.ActiveHosting.AddUndoUnit(undoUnitCollection); }
public FormDesignerEventTree(FormHostingContainer container) { InitializeComponent(); _container = container; _container.ActiveHostingChanged += new FormHostingContainer.OnActiveHostingChangedHandler(_container_ActiveHostingChanged); _container.HostingSelectionChanged += new FormHostingContainer.OnHostingSelectionChangedHandler(_container_HostingSelectionChanged); this.Icon = DrawingTool.ImageToIcon(IconsLibrary.Event); this.TabText = Language.Current.FormDesignerEventTree_TabText; Unity.ApplyResource(this); _eventTreeView.AllowDrop = true; _eventTreeView.AfterSelect += new TreeViewEventHandler(_eventTreeView_AfterSelect); _eventTreeView.EventChanged += new EventTreeView.OnEventChangedHandler(_eventTreeView_EventChanged); _eventTreeView.EventOrderChanged += new EventTreeView.OnEventOrderChangedHandler(_eventTreeView_EventOrderChanged); this.Controls.Add(_eventTreeView); InitToolStrip(); this.Controls.Add(_toolStrip.View); _toolStrip.View.UpdateStatus(); _undounitAction = new Action <SEUndoUnitAbstract, SEUndoEngine.Type>( delegate(SEUndoUnitAbstract unit, SEUndoEngine.Type type) { if (unit is SEUndoUnitEventEdit) { SEUndoUnitEventEdit undoUnit = unit as SEUndoUnitEventEdit; if (undoUnit != null && ((EventBase)undoUnit.Value).HostEntity == this._eventTreeView.Entity) { _eventTreeView.ReBuild(); } } else if (unit is SEUndoTransaction) { SEUndoTransaction undoUnit = unit as SEUndoTransaction; if (undoUnit != null && undoUnit.GetAllUnits().Length > 0) { SEUndoUnitEventEdit eventUnit = undoUnit.GetAllUnits()[0] as SEUndoUnitEventEdit; if (eventUnit != null && ((EventBase)eventUnit.Value).HostEntity == this._eventTreeView.Entity) { _eventTreeView.ReBuild(); } } } }); }