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
- CodeValidator.cs
- ResXResourceReader.cs
- TextEvent.cs
- xdrvalidator.cs
- BindingWorker.cs
- Form.cs
- CodeArgumentReferenceExpression.cs
- ImageIndexConverter.cs
- PlacementWorkspace.cs
- Clipboard.cs
- DiffuseMaterial.cs
- AuthorizationRule.cs
- ClientFormsIdentity.cs
- CompressedStack.cs
- SafeBitVector32.cs
- RealizationDrawingContextWalker.cs
- XmlUTF8TextWriter.cs
- Content.cs
- ChangeNode.cs
- UnsafeNativeMethods.cs
- HostSecurityManager.cs
- XmlSortKey.cs
- MimeTypeMapper.cs
- XamlWriter.cs
- xmlsaver.cs
- HitTestParameters.cs
- HttpModuleActionCollection.cs
- GenericIdentity.cs
- EventListener.cs
- CustomValidator.cs
- EntityCommandCompilationException.cs
- __Filters.cs
- DigitShape.cs
- TraceLevelStore.cs
- TextCharacters.cs
- SuppressMergeCheckAttribute.cs
- RegexFCD.cs
- NonClientArea.cs
- DataPagerFieldCollection.cs
- Floater.cs
- AnimationException.cs
- DesignerOptionService.cs
- ItemCollection.cs
- PropertyGrid.cs
- ContextInformation.cs
- MediaContextNotificationWindow.cs
- _FtpControlStream.cs
- DataTableTypeConverter.cs
- EUCJPEncoding.cs
- InstanceKeyCollisionException.cs
- HttpChannelBindingToken.cs
- DetailsViewModeEventArgs.cs
- QueryHandler.cs
- SafeFindHandle.cs
- XmlText.cs
- DbDeleteCommandTree.cs
- CodeCommentStatement.cs
- DocumentGridPage.cs
- TreeNodeConverter.cs
- InfoCardXmlSerializer.cs
- SqlVisitor.cs
- HiddenField.cs
- MarkupExtensionParser.cs
- DataGridViewColumnTypeEditor.cs
- TextTreeTextNode.cs
- GZipStream.cs
- PerfService.cs
- SchemaDeclBase.cs
- RecoverInstanceLocksCommand.cs
- StreamUpgradeAcceptor.cs
- MembershipUser.cs
- ConsoleCancelEventArgs.cs
- Comparer.cs
- MouseEventArgs.cs
- GraphicsContext.cs
- XDeferredAxisSource.cs
- SqlCaseSimplifier.cs
- AddingNewEventArgs.cs
- Renderer.cs
- UITypeEditors.cs
- XmlBindingWorker.cs
- TextBox.cs
- FrameworkElementAutomationPeer.cs
- LinqDataSourceDisposeEventArgs.cs
- OptimalBreakSession.cs
- MaterializeFromAtom.cs
- LassoHelper.cs
- DiscoveryClientChannelBase.cs
- WindowsTreeView.cs
- DbProviderServices.cs
- SettingsPropertyCollection.cs
- AuthenticationSection.cs
- StatusBar.cs
- NamespaceEmitter.cs
- PageAdapter.cs
- DocumentScope.cs
- cache.cs
- FlowDocument.cs
- WebHttpSecurityElement.cs
- ErrorFormatterPage.cs