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
- DataObjectFieldAttribute.cs
- SecurityElement.cs
- ResourceProviderFactory.cs
- ProtocolsSection.cs
- _TimerThread.cs
- ThreadAttributes.cs
- RequestQueue.cs
- WindowsSpinner.cs
- DecimalFormatter.cs
- Point3DValueSerializer.cs
- DirectoryGroupQuery.cs
- BinHexDecoder.cs
- DoubleSumAggregationOperator.cs
- IndexedString.cs
- NavigatorOutput.cs
- SimpleType.cs
- AnnotationHelper.cs
- ParentQuery.cs
- AnimatedTypeHelpers.cs
- BitmapEffectGeneralTransform.cs
- XPathNodeInfoAtom.cs
- SafeProcessHandle.cs
- OracleInternalConnection.cs
- InvalidDataException.cs
- PresentationAppDomainManager.cs
- DbConnectionOptions.cs
- SystemMulticastIPAddressInformation.cs
- AuthenticationModuleElementCollection.cs
- TypedLocationWrapper.cs
- RemotingConfiguration.cs
- ChangeTracker.cs
- DataListCommandEventArgs.cs
- ObjectItemCollection.cs
- AnnouncementSendsAsyncResult.cs
- XmlAttributeProperties.cs
- CryptoKeySecurity.cs
- LinkUtilities.cs
- TreeViewCancelEvent.cs
- ProgressBarRenderer.cs
- HttpException.cs
- ComponentEditorPage.cs
- TranslateTransform3D.cs
- Authorization.cs
- ListView.cs
- ExplicitDiscriminatorMap.cs
- QilList.cs
- Size3DConverter.cs
- PreDigestedSignedInfo.cs
- ImageListStreamer.cs
- FontConverter.cs
- FilteredXmlReader.cs
- AccessorTable.cs
- ItemCollection.cs
- WindowsSpinner.cs
- WebRequestModuleElement.cs
- ScriptHandlerFactory.cs
- XmlComplianceUtil.cs
- MessageSecurityOverHttp.cs
- _NegoState.cs
- ScriptingWebServicesSectionGroup.cs
- OrderByBuilder.cs
- WebCodeGenerator.cs
- DataBoundControlHelper.cs
- __ComObject.cs
- FontDifferentiator.cs
- SparseMemoryStream.cs
- KeyBinding.cs
- CustomValidator.cs
- DataColumnCollection.cs
- PenLineJoinValidation.cs
- ExpressionBuilderCollection.cs
- AutomationAttributeInfo.cs
- CodeExporter.cs
- PackWebRequest.cs
- XPathEmptyIterator.cs
- TypeConverter.cs
- ScriptMethodAttribute.cs
- SecurityException.cs
- TraceAsyncResult.cs
- PhonemeConverter.cs
- RootBuilder.cs
- DesigntimeLicenseContext.cs
- RoleManagerModule.cs
- BooleanFunctions.cs
- CultureInfoConverter.cs
- RelatedPropertyManager.cs
- Message.cs
- AttributeCollection.cs
- XpsFontSubsetter.cs
- Calendar.cs
- XPathNode.cs
- SystemEvents.cs
- WebZone.cs
- TaiwanCalendar.cs
- Errors.cs
- ListBoxChrome.cs
- UserControlAutomationPeer.cs
- PerformanceCounterNameAttribute.cs
- LayoutTableCell.cs
- ServiceContractViewControl.cs