protected virtual void OnTransactionClosing(DesignerTransactionCloseEventArgs e) { if (TransactionClosing != null) { TransactionClosing(this, e); } }
/// <summary> /// 此事件在关闭事务后发生 /// 在设计器中操作对象后引发,通过属性面板更新对象不会引发此事件 /// 注意:设计器中,添加组件不会进这个事件,只有变更组件,删除组件才会进 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Host_TransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { if (!e.LastTransaction) { return; } #region 提交可撤销的工作单元集合 //提交可撤销的工作单元集合(如果需要),提交之后清空临时可撤销工作单元集合 if (this._undoUnitList.Count > 0) { this._undoUnitList.Clearup(); this._undoEngine.AddUndoUnit(_undoUnitList); this._undoUnitList.Clear(); } #endregion #region 如果执行了添加或删除组件操作,更新属性面板上面下拉框 //如果执行了添加或删除组件操作,更新属性面板上面下拉框 //放在 TransactionClosed 事件里而不是 Add 或 Remove 事件里,是因为在批量剪切粘贴时 //Add 或 Remove 会多次执行,而 TransactionClosed 只会在完成操作时触发 //需判断是否是撤销重做引擎引发的事件,如果是,不在这里更新,在撤销重做引擎的OnTransactionClosed事件中更新 if (ComponentListChanged && !_undoEngine.Working) { UpdatePropertyPadComponentList(); } #endregion #region 步组件属性到实体对象 //这段代码要处理的典型情况是粘贴组件时,同步组件实体对象的坐标属性值 //在 ComponentChanged 事件中同步还不行,ComponentChanged事件中跟不到组件新的位置坐标 //只能跟到组件左上角坐标为15,15的时候 //估计是设计器在使用复制的组件初始化新组件后,不再引发ComponentChanged事件 //初始化完毕后进TransactionClosed ICollection selectedComponents = this._selectionService.GetSelectedComponents(); if (selectedComponents != null) { //ICollection不支持下标访问 object[] selArray = new object[selectedComponents.Count]; selectedComponents.CopyTo(selArray, 0); for (int i = 0; i < selectedComponents.Count; i++) { IShellControlDev shellControlDev = selArray[i] as IShellControlDev; if (shellControlDev != null) { shellControlDev.UpdateEntity(); } } } #endregion }
internal void OnTransactionClosing(DesignerTransactionCloseEventArgs e) { if (this.TransactionClosing != null) { this.TransactionClosing(this, e); } }
private void OnTransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { if (e.LastTransaction && this.NeedRefresh) { this.Refresh(); } }
public void this_OnTransactionClosed(object o, DesignerTransactionCloseEventArgs args) { if (args.TransactionCommitted && this.activated) { System.Threading.Thread serializerThread = new System.Threading.Thread(new System.Threading.ThreadStart(SerializeDocument)); serializerThread.Start(); } }
void TransactionClose(object sender, DesignerTransactionCloseEventArgs e) { if (shouldUpdateSelectableObjects) { SD.MainThread.InvokeAsync(UpdatePropertyPad).FireAndForget(); shouldUpdateSelectableObjects = false; } }
void TransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { if (_ShouldUpdateSelectableObjects) { panel2.BeginInvoke(new MethodInvoker(UpdateComboBox)); _ShouldUpdateSelectableObjects = false; } }
private void TransactionClose(object sender, DesignerTransactionCloseEventArgs e) { if (this.shouldUpdateSelectableObjects) { this.UpdatePropertyPad(); this.shouldUpdateSelectableObjects = false; } }
private void Host_TransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { if (resizing) { resizing = false; ((Control)host.RootComponent).Text = "Resize ended."; } }
public void Ctor_Commit_LastTransaction(bool commit, bool lastTransaction) { #pragma warning disable 0618 var eventArgs = new DesignerTransactionCloseEventArgs(commit, lastTransaction); #pragma warning restore 0618 Assert.Equal(commit, eventArgs.TransactionCommitted); Assert.Equal(lastTransaction, eventArgs.LastTransaction); }
//<Snippet1> // This example method creates a DesignerTransactionCloseEventArgs using the specified argument. // Typically, this type of event args is created by a design mode subsystem. public DesignerTransactionCloseEventArgs CreateDesignerTransactionCloseEventArgs(bool commit) { // Creates a component changed event args with the specified arguments. DesignerTransactionCloseEventArgs args = new DesignerTransactionCloseEventArgs(commit, false); // Whether the transaction has been committed: args.TransactionCommitted return(args); }
void TransactionClose(object sender, DesignerTransactionCloseEventArgs e) { if (shouldUpdateSelectableObjects) { // update the property pad after the transaction is *really* finished // (including updating the selection) SD.MainThread.InvokeAsyncAndForget(UpdatePropertyPad); shouldUpdateSelectableObjects = false; } }
void TransactionClose(object sender, DesignerTransactionCloseEventArgs e) { if (shouldUpdateSelectableObjects) { // update the property pad after the transaction is *really* finished // (including updating the selection) WorkbenchSingleton.SafeThreadAsyncCall(UpdatePropertyPad); shouldUpdateSelectableObjects = false; } }
void TransactionClose(object sender, DesignerTransactionCloseEventArgs e) { if (shouldUpdateSelectableObjects) { // update the property pad after the transaction is *really* finished // (including updating the selection) this.Control.BeginInvoke(new MethodInvoker(UpdatePropertyPad)); shouldUpdateSelectableObjects = false; } }
protected override void OnCancel() { try { var e = new DesignerTransactionCloseEventArgs(false, true); _host.OnTransactionClosing(e); _snapshot?.Restore(); _host.OnTransactionClosed(e); } finally { Dispose(true); } }
private void DesignerTransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { if (e.LastTransaction && (this.relatedComponentTransaction != null)) { this.inTransaction = false; IDesignerHost service = this.serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost; service.TransactionClosed -= new DesignerTransactionCloseEventHandler(this.DesignerTransactionClosed); this.RecreateInternal(this.relatedComponentTransaction); this.relatedComponentTransaction = null; } }
internal void OnTransactionClosing(bool commit) { if (TransactionClosing != null) { DesignerTransactionCloseEventArgs e = new DesignerTransactionCloseEventArgs(commit); try { TransactionClosing(this, e); } catch {} } }
private void OnTransactionClose(object sender, DesignerTransactionCloseEventArgs e) { // Displays transaction close information on the console. if (e.TransactionCommitted) { Console.WriteLine("Transaction has been committed."); } else { Console.WriteLine("Transaction has not yet been committed."); } }
void TransactionClose(object sender, DesignerTransactionCloseEventArgs e) { if (shouldUpdateSelectableObjects) { // update the property pad after the transaction is *really* finished // (including updating the selection) //roman//WorkbenchSingleton.SafeThreadAsyncCall(UpdatePropertyPad); VisualPascalABC.VisualPABCSingleton.MainForm.BeginInvoke((Action)UpdatePropertyPad, new object[0]); //roman// shouldUpdateSelectableObjects = false; } VisualPascalABC.VisualPABCSingleton.MainForm.UpdateUndoRedoEnabled(); }
protected override void OnCommit() { if (this.host != null) { Debug.Assert(this.host.TransactionDescriptions != null, "End batch operation with no desription?!?"); string s = (string)this.host.TransactionDescriptions.Pop(); if (--this.host.TransactionCount == 0) { DesignerTransactionCloseEventArgs dtc = new DesignerTransactionCloseEventArgs(true); this.host.OnTransactionClosing(dtc); this.host.OnTransactionClosed(dtc); } this.host = null; } }
private void InvalidateGlyphOnLastTransaction(object sender, DesignerTransactionCloseEventArgs e) { if (e.LastTransaction) { IDesignerHost host = (this.serviceProvider != null) ? (this.serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost) : null; if (host != null) { host.TransactionClosed -= new DesignerTransactionCloseEventHandler(this.InvalidateGlyphOnLastTransaction); } if (this.relatedGlyphTransaction != null) { this.relatedGlyphTransaction.InvalidateOwnerLocation(); } this.relatedGlyphTransaction = null; } }
void TransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { if (!IsSelectComponents) { return; } --transactionLevel; if (transactionLevel == 0 && undoOperations > 0) { if (selectComponentsUndoAction != null) { selectComponentsUndoAction.SetNewSelection(GetSelectedComponentNames(report)); selectComponentsUndoAction = null; } undoStack.UndoLast(undoOperations + 1); } }
protected override void OnCommit() { if (host != null) { Debug.Assert(host.TransactionDescriptions != null, "End batch operation with no desription?!?"); string s = (string)host.TransactionDescriptions.Pop(); // If this is the last transaction to be closed, have the host raise // closing/closed events. // if (--host.TransactionCount == 0) { DesignerTransactionCloseEventArgs dtc = new DesignerTransactionCloseEventArgs(true); host.OnTransactionClosing(dtc); host.OnTransactionClosed(dtc); } host = null; } }
protected override void OnCancel() { if (report != null) { Debug.Assert(report.TransactionDescriptions != null, "End batch operation with no desription?!?"); // If this is the last transaction to be closed, have the report raise // closing/closed events. // if (--report.TransactionCount == 0) { DesignerTransactionCloseEventArgs dtc = new DesignerTransactionCloseEventArgs(false); report.OnTransactionClosing(dtc); report.OnTransactionClosed(dtc); } string s = (string)report.TransactionDescriptions.Pop(); report = null; } }
private void OnTransactionClosed(object sender, DesignerTransactionCloseEventArgs args) { // Console.WriteLine ("TransactionClosed: Commited: " + args.TransactionCommitted.ToString ()); IDesignerHost host = GetRequiredService(typeof(IDesignerHost)) as IDesignerHost; if (!host.InTransaction) // the "top-most"/last transaction was closed (currentUnit one) { _currentUnit.Close(); if (args.TransactionCommitted) { AddUndoUnit(_currentUnit); } else { _currentUnit.Undo(); DiscardUndoUnit(_currentUnit); } _currentUnit = null; } }
protected override void OnCommit() { try { var e = new DesignerTransactionCloseEventArgs(true, true); _host.OnTransactionClosing(e); try { if (_snapshot != null) { _host.Game.Data.Validate(); } } catch { _snapshot.Restore(); throw; } finally { _host.OnTransactionClosed(e); } } finally { Dispose(true); } }
private void OnDesignerTransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { System.Windows.Forms.MessageBox.Show("A Designer Transaction was completed. (TransactionClosed)"); }
protected virtual void OnTransactionClosed(DesignerTransactionCloseEventArgs e) { InTransaction = false; TransactionDescription = null; TransactionClosed?.Invoke(this, e); }
protected virtual void OnTransactionClosing(DesignerTransactionCloseEventArgs e) { TransactionClosing?.Invoke(this, e); }
/// Called by the designer host when it is entering or leaving a batch /// operation. Here we queue up selection notification and we turn off /// our UI. private void DesignerHost_TransactionClosed(object sender, DesignerTransactionCloseEventArgs e) { batchMode = false; FlushSelectionChanges(); }