Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / Behaviors / WorkflowTransactionOptions.cs / 1305376 / WorkflowTransactionOptions.cs
namespace System.Workflow.ComponentModel { using System; using System.Xml; using System.Collections.Generic; using System.Text; using System.Globalization; using System.ComponentModel; using System.Transactions; using System.Reflection; using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Design; using System.ComponentModel.Design.Serialization; using System.Collections; using System.CodeDom; using System.Collections.Specialized; using System.Workflow.ComponentModel.Compiler; using System.Workflow.ComponentModel.Serialization; [Browsable(true)] [DesignerSerializer(typeof(DependencyObjectCodeDomSerializer), typeof(CodeDomSerializer))] public sealed class WorkflowTransactionOptions : DependencyObject { public static readonly DependencyProperty TimeoutDurationProperty = DependencyProperty.Register("TimeoutDuration", typeof(TimeSpan), typeof(WorkflowTransactionOptions), new PropertyMetadata(new TimeSpan(0,0,30), DependencyPropertyOptions.Metadata)); public static readonly DependencyProperty IsolationLevelProperty = DependencyProperty.Register("IsolationLevel", typeof(IsolationLevel), typeof(WorkflowTransactionOptions), new PropertyMetadata(IsolationLevel.Serializable,DependencyPropertyOptions.Metadata)); [SRDescription(SR.TimeoutDescr)] [SRCategory(SR.Activity)] [MergableProperty(false)] [DefaultValue(typeof(TimeSpan), "0:0:30")] [TypeConverter(typeof(TimeoutDurationConverter))] public TimeSpan TimeoutDuration { get { return (TimeSpan)base.GetValue(TimeoutDurationProperty); } set { base.SetValue(TimeoutDurationProperty, value); } } [SRDescription(SR.IsolationLevelDescr)] [SRCategory(SR.Activity)] [MergableProperty(false)] public IsolationLevel IsolationLevel { get { return (IsolationLevel)base.GetValue(IsolationLevelProperty); } set { base.SetValue(IsolationLevelProperty, value); } } } internal sealed class TimeoutDurationConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(string)) return true; return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value is TimeSpan) { TimeSpan timespan = (TimeSpan)value; return timespan.ToString(); } return base.ConvertTo(context, culture, value, destinationType); } public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) return true; return base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { TimeSpan parsedTimespan = TimeSpan.Zero; string timeSpan = value as string; if (!String.IsNullOrEmpty(timeSpan)) { //If this fails then an exception is thrown and the property set would fail try { parsedTimespan = TimeSpan.Parse(timeSpan, CultureInfo.InvariantCulture); } catch { } if (parsedTimespan.Ticks < 0) { throw new Exception(string.Format(System.Globalization.CultureInfo.CurrentCulture, SR.GetString(SR.Error_NegativeValue), value.ToString(), "TimeoutDuration")); } } return parsedTimespan; } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { ArrayList standardValuesCollection = new ArrayList(); standardValuesCollection.Add(new TimeSpan(0, 0, 0)); standardValuesCollection.Add(new TimeSpan(0, 0, 15)); standardValuesCollection.Add(new TimeSpan(0, 1, 0)); return new StandardValuesCollection(standardValuesCollection); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Workflow.ComponentModel { using System; using System.Xml; using System.Collections.Generic; using System.Text; using System.Globalization; using System.ComponentModel; using System.Transactions; using System.Reflection; using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Design; using System.ComponentModel.Design.Serialization; using System.Collections; using System.CodeDom; using System.Collections.Specialized; using System.Workflow.ComponentModel.Compiler; using System.Workflow.ComponentModel.Serialization; [Browsable(true)] [DesignerSerializer(typeof(DependencyObjectCodeDomSerializer), typeof(CodeDomSerializer))] public sealed class WorkflowTransactionOptions : DependencyObject { public static readonly DependencyProperty TimeoutDurationProperty = DependencyProperty.Register("TimeoutDuration", typeof(TimeSpan), typeof(WorkflowTransactionOptions), new PropertyMetadata(new TimeSpan(0,0,30), DependencyPropertyOptions.Metadata)); public static readonly DependencyProperty IsolationLevelProperty = DependencyProperty.Register("IsolationLevel", typeof(IsolationLevel), typeof(WorkflowTransactionOptions), new PropertyMetadata(IsolationLevel.Serializable,DependencyPropertyOptions.Metadata)); [SRDescription(SR.TimeoutDescr)] [SRCategory(SR.Activity)] [MergableProperty(false)] [DefaultValue(typeof(TimeSpan), "0:0:30")] [TypeConverter(typeof(TimeoutDurationConverter))] public TimeSpan TimeoutDuration { get { return (TimeSpan)base.GetValue(TimeoutDurationProperty); } set { base.SetValue(TimeoutDurationProperty, value); } } [SRDescription(SR.IsolationLevelDescr)] [SRCategory(SR.Activity)] [MergableProperty(false)] public IsolationLevel IsolationLevel { get { return (IsolationLevel)base.GetValue(IsolationLevelProperty); } set { base.SetValue(IsolationLevelProperty, value); } } } internal sealed class TimeoutDurationConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(string)) return true; return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value is TimeSpan) { TimeSpan timespan = (TimeSpan)value; return timespan.ToString(); } return base.ConvertTo(context, culture, value, destinationType); } public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) return true; return base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { TimeSpan parsedTimespan = TimeSpan.Zero; string timeSpan = value as string; if (!String.IsNullOrEmpty(timeSpan)) { //If this fails then an exception is thrown and the property set would fail try { parsedTimespan = TimeSpan.Parse(timeSpan, CultureInfo.InvariantCulture); } catch { } if (parsedTimespan.Ticks < 0) { throw new Exception(string.Format(System.Globalization.CultureInfo.CurrentCulture, SR.GetString(SR.Error_NegativeValue), value.ToString(), "TimeoutDuration")); } } return parsedTimespan; } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { ArrayList standardValuesCollection = new ArrayList(); standardValuesCollection.Add(new TimeSpan(0, 0, 0)); standardValuesCollection.Add(new TimeSpan(0, 0, 15)); standardValuesCollection.Add(new TimeSpan(0, 1, 0)); return new StandardValuesCollection(standardValuesCollection); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Compiler.cs
- ParameterCollection.cs
- FileIOPermission.cs
- JapaneseCalendar.cs
- StructuralType.cs
- DataGridViewCellCollection.cs
- SqlDataReader.cs
- AttributeSetAction.cs
- ContractMapping.cs
- WindowShowOrOpenTracker.cs
- XmlSchemaComplexContent.cs
- ServiceThrottle.cs
- Parameter.cs
- JsonFormatGeneratorStatics.cs
- ContextDataSourceView.cs
- StylusPointPropertyUnit.cs
- InternalSafeNativeMethods.cs
- PointF.cs
- SrgsSemanticInterpretationTag.cs
- ZoomingMessageFilter.cs
- MDIWindowDialog.cs
- TextContainerChangedEventArgs.cs
- ImportCatalogPart.cs
- ComponentCommands.cs
- SqlSupersetValidator.cs
- ResourceContainer.cs
- DataKey.cs
- Types.cs
- OracleException.cs
- DataTableNewRowEvent.cs
- MonitorWrapper.cs
- ContentPosition.cs
- WSHttpBindingElement.cs
- ArgumentOutOfRangeException.cs
- HttpGetClientProtocol.cs
- GZipStream.cs
- FontEmbeddingManager.cs
- LocatorBase.cs
- X509CertificateStore.cs
- SettingsSection.cs
- ChangePassword.cs
- cookiecollection.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- CqlBlock.cs
- EventLogLink.cs
- SelectionChangedEventArgs.cs
- DataReceivedEventArgs.cs
- ValueTypeFixupInfo.cs
- ControlDesignerState.cs
- FontCacheLogic.cs
- MemberInfoSerializationHolder.cs
- LoginDesigner.cs
- Polyline.cs
- SQLDateTimeStorage.cs
- RightsManagementInformation.cs
- MouseGestureValueSerializer.cs
- ThreadWorkerController.cs
- SplineKeyFrames.cs
- WebPartUserCapability.cs
- SortAction.cs
- RuntimeCompatibilityAttribute.cs
- DataGridViewCellFormattingEventArgs.cs
- PerformanceCounters.cs
- HttpWebRequestElement.cs
- SystemColors.cs
- ListBase.cs
- SamlSubject.cs
- MemberDescriptor.cs
- DocobjHost.cs
- DurableDispatcherAddressingFault.cs
- StructuredProperty.cs
- Int64Storage.cs
- DrawingBrush.cs
- ValidationContext.cs
- FormsAuthenticationUser.cs
- DiagnosticSection.cs
- RuntimeConfigLKG.cs
- ExpressionVisitor.cs
- GridViewDeletedEventArgs.cs
- ComponentEditorForm.cs
- SpellerInterop.cs
- HttpContextWrapper.cs
- AcceptorSessionSymmetricTransportSecurityProtocol.cs
- SHA384Managed.cs
- ConsoleKeyInfo.cs
- CodeTypeOfExpression.cs
- DbCommandDefinition.cs
- ISCIIEncoding.cs
- _OverlappedAsyncResult.cs
- XmlCompatibilityReader.cs
- InnerItemCollectionView.cs
- XmlSerializerFactory.cs
- XmlWrappingWriter.cs
- DataGridParentRows.cs
- Vector3DKeyFrameCollection.cs
- CustomCredentialPolicy.cs
- StreamingContext.cs
- WorkflowQueuingService.cs
- InfiniteTimeSpanConverter.cs
- ThrowHelper.cs