Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / EditingScopeUndoUnit.cs / 1305376 / EditingScopeUndoUnit.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation { using System; using System.Collections.Generic; using System.Text; using System.Activities.Presentation.View; using System.Activities.Presentation.Model; class EditingScopeUndoUnit : UndoUnit { ModelTreeManager modelTreeManager; EditingScope editingScope; WorkflowDesigner workflowDesigner; public EditingScopeUndoUnit(WorkflowDesigner workflowDesigner, ModelTreeManager modelTreeManager, EditingScope editingScope) : base(workflowDesigner.Context) { this.workflowDesigner = workflowDesigner; this.modelTreeManager = modelTreeManager; this.editingScope = editingScope; this.Description = this.editingScope.Description; SaveGlobalState(); } public override void Redo() { this.modelTreeManager.StopTracking(); EditingScope redoEditingScope = this.modelTreeManager.CreateEditingScope(this.editingScope.Description); redoEditingScope.Changes.AddRange(editingScope.Changes); redoEditingScope.Complete(); this.modelTreeManager.StartTracking(); ApplyGlobalState(); } public override void Undo() { this.modelTreeManager.StopTracking(); EditingScope undoEditingScope = this.modelTreeManager.CreateEditingScope(this.editingScope.Description); foreach (Change change in editingScope.Changes) { Change inverseChange = change.GetInverse(); if (inverseChange != null) { undoEditingScope.Changes.Add(inverseChange); } } undoEditingScope.Changes.Reverse(); undoEditingScope.Complete(); this.modelTreeManager.StartTracking(); ApplyGlobalState(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation { using System; using System.Collections.Generic; using System.Text; using System.Activities.Presentation.View; using System.Activities.Presentation.Model; class EditingScopeUndoUnit : UndoUnit { ModelTreeManager modelTreeManager; EditingScope editingScope; WorkflowDesigner workflowDesigner; public EditingScopeUndoUnit(WorkflowDesigner workflowDesigner, ModelTreeManager modelTreeManager, EditingScope editingScope) : base(workflowDesigner.Context) { this.workflowDesigner = workflowDesigner; this.modelTreeManager = modelTreeManager; this.editingScope = editingScope; this.Description = this.editingScope.Description; SaveGlobalState(); } public override void Redo() { this.modelTreeManager.StopTracking(); EditingScope redoEditingScope = this.modelTreeManager.CreateEditingScope(this.editingScope.Description); redoEditingScope.Changes.AddRange(editingScope.Changes); redoEditingScope.Complete(); this.modelTreeManager.StartTracking(); ApplyGlobalState(); } public override void Undo() { this.modelTreeManager.StopTracking(); EditingScope undoEditingScope = this.modelTreeManager.CreateEditingScope(this.editingScope.Description); foreach (Change change in editingScope.Changes) { Change inverseChange = change.GetInverse(); if (inverseChange != null) { undoEditingScope.Changes.Add(inverseChange); } } undoEditingScope.Changes.Reverse(); undoEditingScope.Complete(); this.modelTreeManager.StartTracking(); ApplyGlobalState(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlAnyAttributeAttribute.cs
- ConnectionOrientedTransportManager.cs
- XmlQueryOutput.cs
- ToolStripSystemRenderer.cs
- ComplexLine.cs
- SourceLineInfo.cs
- StorageSetMapping.cs
- ImageAnimator.cs
- RadioButtonFlatAdapter.cs
- ExtractedStateEntry.cs
- SocketException.cs
- ViewBox.cs
- ProbeMatches11.cs
- NativeMethods.cs
- JsonReader.cs
- HMACRIPEMD160.cs
- DbException.cs
- VisualProxy.cs
- SortFieldComparer.cs
- sqlser.cs
- MenuStrip.cs
- XmlSchemaSimpleContentExtension.cs
- ArglessEventHandlerProxy.cs
- XNodeValidator.cs
- EncoderFallback.cs
- VSWCFServiceContractGenerator.cs
- GridView.cs
- ProfileElement.cs
- WebZone.cs
- ViewCellRelation.cs
- XmlSchemaObjectTable.cs
- RightNameExpirationInfoPair.cs
- XsdBuildProvider.cs
- FontDriver.cs
- ToolboxDataAttribute.cs
- SqlRowUpdatedEvent.cs
- HuffCodec.cs
- CngProperty.cs
- SingleTagSectionHandler.cs
- FunctionMappingTranslator.cs
- StringInfo.cs
- Socket.cs
- FillBehavior.cs
- XPathCompiler.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- State.cs
- ItemAutomationPeer.cs
- CheckBox.cs
- ZipIOLocalFileBlock.cs
- SqlProfileProvider.cs
- QuaternionAnimationUsingKeyFrames.cs
- DataProtection.cs
- Mappings.cs
- DataContractSerializer.cs
- HttpCapabilitiesSectionHandler.cs
- GridViewSortEventArgs.cs
- TableAutomationPeer.cs
- ListItemCollection.cs
- OperationPickerDialog.cs
- Command.cs
- ExtensionWindowHeader.cs
- PageCache.cs
- NumberSubstitution.cs
- UdpTransportSettings.cs
- MetabaseServerConfig.cs
- SafeProcessHandle.cs
- StreamWriter.cs
- ActivityInterfaces.cs
- ListViewHitTestInfo.cs
- DataGridColumnCollection.cs
- PtsHelper.cs
- ScriptResourceInfo.cs
- StringToken.cs
- Sentence.cs
- DrawingAttributeSerializer.cs
- CodeGenerator.cs
- XmlSchemaDatatype.cs
- querybuilder.cs
- Rect3D.cs
- ValidationRule.cs
- DataGridCommandEventArgs.cs
- XmlObjectSerializerReadContextComplexJson.cs
- CriticalHandle.cs
- ZipIOExtraFieldPaddingElement.cs
- ButtonField.cs
- LogEntrySerializer.cs
- CurrencyWrapper.cs
- XmlEncodedRawTextWriter.cs
- ComboBoxRenderer.cs
- PersonalizationProvider.cs
- MenuItemStyleCollectionEditor.cs
- SamlAuthorizationDecisionStatement.cs
- ExtentCqlBlock.cs
- QueueProcessor.cs
- EncodingTable.cs
- FileFormatException.cs
- EntityModelBuildProvider.cs
- PrimaryKeyTypeConverter.cs
- UpdateExpressionVisitor.cs
- Attributes.cs