Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Statements / If.cs / 1305376 / If.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Statements { using System.Activities; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Runtime; using System.Windows.Markup; [SuppressMessage(FxCop.Category.Naming, FxCop.Rule.IdentifiersShouldNotMatchKeywords, Justification = "Optimizing for XAML naming. VB imperative users will [] qualify (e.g. New [If])")] public sealed class If : NativeActivity { public If() : base() { } public If(Expression> condition) : this() { if (condition == null) { throw FxTrace.Exception.ArgumentNull("condition"); } this.Condition = new InArgument (condition); } public If(Activity condition) : this() { if (condition == null) { throw FxTrace.Exception.ArgumentNull("condition"); } this.Condition = new InArgument (condition); } public If(InArgument condition) : this() { if (condition == null) { throw FxTrace.Exception.ArgumentNull("condition"); } this.Condition = condition; } [RequiredArgument] [DefaultValue(null)] public InArgument Condition { get; set; } [DefaultValue(null)] [DependsOn("Condition")] public Activity Then { get; set; } [DefaultValue(null)] [DependsOn("Then")] public Activity Else { get; set; } protected override void Execute(NativeActivityContext context) { if (Condition.Get(context)) { if (Then != null) { context.ScheduleActivity(Then); } } else if (Else != null) { context.ScheduleActivity(Else); } } protected override void CacheMetadata(NativeActivityMetadata metadata) { RuntimeArgument conditionArgument = new RuntimeArgument("Condition", typeof(bool), ArgumentDirection.In, true); metadata.Bind(this.Condition, conditionArgument); metadata.SetArgumentsCollection(new Collection { conditionArgument }); Collection children = null; if (this.Then != null) { ActivityUtilities.Add(ref children, this.Then); } if (this.Else != null) { ActivityUtilities.Add(ref children, this.Else); } metadata.SetChildrenCollection(children); } } } // 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
- JavaScriptObjectDeserializer.cs
- ScriptingProfileServiceSection.cs
- OdbcRowUpdatingEvent.cs
- AsyncResult.cs
- cookiecollection.cs
- JsonFormatWriterGenerator.cs
- CompilerErrorCollection.cs
- RemotingConfigParser.cs
- SelfIssuedAuthRSACryptoProvider.cs
- Soap.cs
- DecodeHelper.cs
- XamlHttpHandlerFactory.cs
- MailAddressCollection.cs
- DependencyPropertyDescriptor.cs
- CodeDomSerializer.cs
- SmiMetaData.cs
- SessionStateSection.cs
- SystemIcons.cs
- StorageEntityContainerMapping.cs
- PointConverter.cs
- DesignerAutoFormatStyle.cs
- DSACryptoServiceProvider.cs
- SecurityPolicySection.cs
- ObjectConverter.cs
- ObjectConverter.cs
- GestureRecognizer.cs
- UseLicense.cs
- ArraySortHelper.cs
- ProjectionPruner.cs
- ListItemConverter.cs
- CryptoHandle.cs
- ResourceLoader.cs
- DataSourceCacheDurationConverter.cs
- User.cs
- MeasureItemEvent.cs
- StateRuntime.cs
- ThrowOnMultipleAssignment.cs
- SafeNativeMethods.cs
- SizeLimitedCache.cs
- PropagatorResult.cs
- StyleTypedPropertyAttribute.cs
- filewebresponse.cs
- AutomationIdentifier.cs
- PagedControl.cs
- Solver.cs
- ExpressionCopier.cs
- MarkerProperties.cs
- DeploymentSectionCache.cs
- FixedSOMTableRow.cs
- RegisteredExpandoAttribute.cs
- NamespaceEmitter.cs
- Label.cs
- panel.cs
- MessageQueuePermissionEntry.cs
- WindowsMenu.cs
- CodeExpressionCollection.cs
- TransformerInfoCollection.cs
- Comparer.cs
- EntityDataSourceConfigureObjectContext.cs
- Single.cs
- RuntimeConfigurationRecord.cs
- DataMisalignedException.cs
- DebugHandleTracker.cs
- CodeDirectionExpression.cs
- SecureConversationServiceElement.cs
- XhtmlTextWriter.cs
- ParameterElementCollection.cs
- FontNamesConverter.cs
- AssemblyBuilder.cs
- VBIdentifierNameEditor.cs
- CodeEventReferenceExpression.cs
- ValuePattern.cs
- DebuggerAttributes.cs
- FixedSOMTableRow.cs
- ScriptControlManager.cs
- TextEditorThreadLocalStore.cs
- XmlTextWriter.cs
- Quaternion.cs
- WorkflowInlining.cs
- ReceiveCompletedEventArgs.cs
- SafeLocalMemHandle.cs
- InvocationExpression.cs
- Util.cs
- Scripts.cs
- MarkerProperties.cs
- BindingNavigator.cs
- XmlUtilWriter.cs
- Parameter.cs
- AsymmetricAlgorithm.cs
- CodeTypeParameterCollection.cs
- ItemMap.cs
- HtmlAnchor.cs
- TerminatingOperationBehavior.cs
- ProfileGroupSettingsCollection.cs
- MarkupWriter.cs
- BaseUriHelper.cs
- SafeIUnknown.cs
- XomlCompiler.cs
- coordinatorscratchpad.cs
- Input.cs