Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Core.Presentation / System / Activities / Core / Presentation / CatchDesigner.xaml.cs / 1305376 / CatchDesigner.xaml.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Core.Presentation { using System; using System.Activities; using System.Activities.Presentation; using System.Activities.Presentation.View; using System.Activities.Presentation.Metadata; using System.Activities.Presentation.Model; using System.Activities.Statements; using System.ComponentModel; using System.Diagnostics; using System.Runtime; using System.Windows; using System.Windows.Input; ////// Interaction logic for CatchDesigner.xaml /// partial class CatchDesigner { string exceptionTypeShortName = null; string exceptionTypeFullName = null; public CatchDesigner() { InitializeComponent(); this.Loaded += (sender, e) => { Selection selection = this.Context.Items.GetValue(); if (selection != null) { ModelItem primarySelection = selection.PrimarySelection; this.ExpandState = TryCatchDesigner.IsDescendantOfCatch(this.ModelItem, primarySelection); if (this.ExpandState) { // If current focus is at another part, we need to focus this designer // to trigger selection changed, then this part will expand and another // expanded part will collapse. Then we focus on the activity it contains // if there is one. Keyboard.Focus((IInputElement)this.ModelItem.View); if (primarySelection.View != null && this.ModelItem != primarySelection) { Keyboard.Focus((IInputElement)primarySelection.View); } } } }; } internal static void RegisterMetadata(AttributeTableBuilder builder) { Type type = typeof(Catch<>); builder.AddCustomAttributes(type, new DesignerAttribute(typeof(CatchDesigner))); builder.AddCustomAttributes(type, type.GetProperty("Action"), BrowsableAttribute.No); builder.AddCustomAttributes(type, new ActivityDesignerOptionsAttribute { AllowDrillIn = false }); } public string ExceptionTypeShortName { get { if (this.exceptionTypeShortName == null) { this.exceptionTypeShortName = TypeNameHelper.GetDisplayName((Type)this.ModelItem.Properties["ExceptionType"].Value.GetCurrentValue(), false); } return this.exceptionTypeShortName; } } public string ExceptionTypeFullName { get { if (this.exceptionTypeFullName == null) { this.exceptionTypeFullName = TypeNameHelper.GetDisplayName((Type)this.ModelItem.Properties["ExceptionType"].Value.GetCurrentValue(), true); } return this.exceptionTypeFullName; } } protected override void OnMouseDown(MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 2) { SwitchTryCatchDesignerHelper.MakeParentRootDesigner (this); e.Handled = true; } else if (e.LeftButton == MouseButtonState.Pressed) { Keyboard.Focus(this); e.Handled = true; } else if (e.RightButton == MouseButtonState.Pressed) { if (this.ShowExpanded) { Keyboard.Focus(this); } e.Handled = true; } } protected override void OnMouseUp(MouseButtonEventArgs e) { // avoid context menu upon right-click when it's collapsed if (!this.ShowExpanded && e.RightButton == MouseButtonState.Released) { e.Handled = true; } } protected override string GetAutomationIdMemberName() { return PropertyNames.ExceptionType; } } } // 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
- SafeFileHandle.cs
- DynamicRenderer.cs
- MailWebEventProvider.cs
- TransactedBatchingElement.cs
- QilInvokeLateBound.cs
- SystemThemeKey.cs
- TabControlCancelEvent.cs
- Utils.cs
- WindowsProgressbar.cs
- CounterSample.cs
- RowVisual.cs
- MatrixAnimationUsingKeyFrames.cs
- PackWebRequest.cs
- categoryentry.cs
- DocumentViewerBaseAutomationPeer.cs
- URIFormatException.cs
- LogEntrySerialization.cs
- OLEDB_Util.cs
- HMACSHA512.cs
- WebConvert.cs
- DataRelationPropertyDescriptor.cs
- AttributeParameterInfo.cs
- SettingsPropertyCollection.cs
- SystemColors.cs
- MultiAsyncResult.cs
- FunctionGenerator.cs
- WindowsNonControl.cs
- PagesChangedEventArgs.cs
- CrossSiteScriptingValidation.cs
- MenuItem.cs
- PackageDigitalSignature.cs
- EntityDataSourceDesignerHelper.cs
- BitmapEffectrendercontext.cs
- VirtualPathData.cs
- FlowNode.cs
- _NativeSSPI.cs
- MouseCaptureWithinProperty.cs
- ClickablePoint.cs
- HelloOperationCD1AsyncResult.cs
- FrameAutomationPeer.cs
- EntityClientCacheEntry.cs
- DataServiceQueryOfT.cs
- TextProviderWrapper.cs
- _AutoWebProxyScriptEngine.cs
- AtlasWeb.Designer.cs
- SrgsSemanticInterpretationTag.cs
- SchemaTypeEmitter.cs
- CodeAccessSecurityEngine.cs
- TcpChannelListener.cs
- WpfPayload.cs
- ReadOnlyDictionary.cs
- PropertyValueUIItem.cs
- XmlTypeAttribute.cs
- NamespaceEmitter.cs
- SimpleHandlerBuildProvider.cs
- UnknownBitmapDecoder.cs
- SqlInternalConnectionTds.cs
- UpDownEvent.cs
- DownloadProgressEventArgs.cs
- ParallelTimeline.cs
- DictionaryChange.cs
- CodeObjectCreateExpression.cs
- Shared.cs
- DataGridHelper.cs
- ToolboxDataAttribute.cs
- SupportsPreviewControlAttribute.cs
- ListView.cs
- GradientSpreadMethodValidation.cs
- DeploymentExceptionMapper.cs
- DataGridViewImageColumn.cs
- TextSerializer.cs
- PathGeometry.cs
- IsolatedStorageFileStream.cs
- EmulateRecognizeCompletedEventArgs.cs
- XmlConverter.cs
- PackagePart.cs
- CfgParser.cs
- DesignerOptionService.cs
- ValidationError.cs
- GeometryHitTestParameters.cs
- XmlSchemaAppInfo.cs
- ImageFormatConverter.cs
- ResourceExpression.cs
- MulticastDelegate.cs
- IndexedString.cs
- ExtensionFile.cs
- DataObject.cs
- XmlCompatibilityReader.cs
- DeploymentSectionCache.cs
- MsmqVerifier.cs
- GeneratedContractType.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- ModifierKeysConverter.cs
- ToolStripGrip.cs
- ChtmlTextWriter.cs
- ImageBrush.cs
- QualificationDataAttribute.cs
- XmlCDATASection.cs
- Rule.cs
- DesignerAdapterUtil.cs