Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Validation / AssertValidation.cs / 1305376 / AssertValidation.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Validation { using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime; using System.ComponentModel; public sealed class AssertValidation : NativeActivity { public AssertValidation() { } public InArgumentAssertion { get; set; } public InArgument Message { get; set; } [DefaultValue(null)] public InArgument IsWarning { get; set; } [DefaultValue(null)] public InArgument PropertyName { get; set; } protected override void CacheMetadata(NativeActivityMetadata metadata) { Collection arguments = new Collection (); RuntimeArgument assertionArgument = new RuntimeArgument("Assertion", typeof(bool), ArgumentDirection.In); metadata.Bind(this.Assertion, assertionArgument); arguments.Add(assertionArgument); RuntimeArgument messageArgument = new RuntimeArgument("Message", typeof(string), ArgumentDirection.In); metadata.Bind(this.Message, messageArgument); arguments.Add(messageArgument); RuntimeArgument isWarningArgument = new RuntimeArgument("IsWarning", typeof(bool), ArgumentDirection.In, false); metadata.Bind(this.IsWarning, isWarningArgument); arguments.Add(isWarningArgument); RuntimeArgument propertyNameArgument = new RuntimeArgument("PropertyName", typeof(string), ArgumentDirection.In, false); metadata.Bind(this.PropertyName, propertyNameArgument); arguments.Add(propertyNameArgument); metadata.SetArgumentsCollection(arguments); } protected override void Execute(NativeActivityContext context) { if (!this.Assertion.Get(context)) { bool isWarning = false; string propertyName = string.Empty; string errorCode = string.Empty; if (this.IsWarning != null) { isWarning = this.IsWarning.Get(context); } if (this.PropertyName != null) { propertyName = this.PropertyName.Get(context); } Constraint.AddValidationError(context, new ValidationError(this.Message.Get(context), isWarning, propertyName)); } } } } // 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
- SimpleTextLine.cs
- KeyNotFoundException.cs
- WindowsToolbarAsMenu.cs
- DeclarativeCatalogPart.cs
- KeyGestureValueSerializer.cs
- xmlformatgeneratorstatics.cs
- Int32Rect.cs
- ThreadAttributes.cs
- ArgumentNullException.cs
- BinHexDecoder.cs
- TemplateEditingFrame.cs
- LineBreak.cs
- SqlNode.cs
- EditCommandColumn.cs
- Serializer.cs
- LessThanOrEqual.cs
- ReadOnlyHierarchicalDataSource.cs
- TextViewBase.cs
- DerivedKeyCachingSecurityTokenSerializer.cs
- DataGridViewCellEventArgs.cs
- BasePropertyDescriptor.cs
- ColorDialog.cs
- WmlPageAdapter.cs
- IList.cs
- WorkflowOwnershipException.cs
- WebPartEditVerb.cs
- TablePattern.cs
- HitTestWithPointDrawingContextWalker.cs
- ScriptReferenceEventArgs.cs
- BindingMAnagerBase.cs
- Grant.cs
- SqlAggregateChecker.cs
- CalendarDay.cs
- LocatorPartList.cs
- DrawingServices.cs
- EdmProperty.cs
- CqlLexerHelpers.cs
- ApplicationServiceHelper.cs
- ProgramPublisher.cs
- CryptoHelper.cs
- Transform3DGroup.cs
- BamlRecords.cs
- Compiler.cs
- XmlSchemaAll.cs
- ToolStripRenderEventArgs.cs
- _LocalDataStore.cs
- DataConnectionHelper.cs
- ClientConfigPaths.cs
- AutomationPatternInfo.cs
- GridViewSelectEventArgs.cs
- HwndSourceKeyboardInputSite.cs
- MimeImporter.cs
- SnapshotChangeTrackingStrategy.cs
- VirtualizingStackPanel.cs
- TextDpi.cs
- OutputScope.cs
- ConfigXmlComment.cs
- SqlSupersetValidator.cs
- RealProxy.cs
- WebResponse.cs
- CommandManager.cs
- DataControlImageButton.cs
- ModifiableIteratorCollection.cs
- BaseCollection.cs
- PTProvider.cs
- XmlObjectSerializerReadContextComplexJson.cs
- TraceContextRecord.cs
- VirtualDirectoryMapping.cs
- FileLogRecordEnumerator.cs
- PropertyDescriptorCollection.cs
- BamlRecordReader.cs
- METAHEADER.cs
- ByteArrayHelperWithString.cs
- DataGridViewCellEventArgs.cs
- DataObject.cs
- DictionarySectionHandler.cs
- Soap12ProtocolImporter.cs
- Native.cs
- MemberJoinTreeNode.cs
- CacheEntry.cs
- ListMarkerSourceInfo.cs
- LinearKeyFrames.cs
- DataGridViewButtonColumn.cs
- RootBrowserWindowProxy.cs
- LateBoundBitmapDecoder.cs
- SecurityPolicySection.cs
- SineEase.cs
- FixedBufferAttribute.cs
- ToolStripDropTargetManager.cs
- HttpResponseBase.cs
- RotateTransform.cs
- TextRunProperties.cs
- PowerEase.cs
- XmlEnumAttribute.cs
- AnonymousIdentificationModule.cs
- EventMappingSettings.cs
- StateMachineWorkflow.cs
- XmlRawWriter.cs
- FormatConvertedBitmap.cs