Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Common / AuthoringOM / ParameterBinding.cs / 1305376 / ParameterBinding.cs
namespace System.Workflow.ComponentModel
{
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.CodeDom;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Design.Serialization;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
[Browsable(true)]
[DesignerSerializer(typeof(DependencyObjectCodeDomSerializer), typeof(CodeDomSerializer))]
public sealed class WorkflowParameterBinding : DependencyObject
{
public static readonly DependencyProperty ParameterNameProperty = DependencyProperty.Register("ParameterName", typeof(string), typeof(WorkflowParameterBinding), new PropertyMetadata(DependencyPropertyOptions.Metadata));
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(WorkflowParameterBinding));
public WorkflowParameterBinding()
{
}
public WorkflowParameterBinding(string parameterName)
{
SetValue(ParameterNameProperty, parameterName);
}
[DefaultValue(null)]
public object Value
{
get
{
return GetValue(ValueProperty);
}
set
{
SetValue(ValueProperty, value);
}
}
public string ParameterName
{
get
{
return (string)GetValue(ParameterNameProperty);
}
set
{
SetValue(ParameterNameProperty, value);
}
}
}
[Serializable]
public sealed class WorkflowParameterBindingCollection: KeyedCollection
{
private Activity ownerActivity = null;
public WorkflowParameterBindingCollection(Activity ownerActivity)
{
if (ownerActivity == null)
throw new ArgumentNullException("ownerActivity");
this.ownerActivity = ownerActivity;
}
public WorkflowParameterBinding GetItem(string key)
{
return this[key];
}
protected override string GetKeyForItem(WorkflowParameterBinding item)
{
return item.ParameterName;
}
protected override void ClearItems()
{
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
base.ClearItems();
}
protected override void InsertItem(int index, WorkflowParameterBinding item)
{
if (item == null)
throw new ArgumentNullException("item");
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
if (Contains(item.ParameterName))
{
WorkflowParameterBinding oldItem = this[item.ParameterName];
index = this.IndexOf(oldItem);
RemoveItem(index);
}
base.InsertItem(index, item);
}
protected override void RemoveItem(int index)
{
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
base.RemoveItem(index);
}
protected override void SetItem(int index, WorkflowParameterBinding item)
{
if (item == null)
throw new ArgumentNullException("item");
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
base.SetItem(index, item);
}
}
}
// 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.ComponentModel;
using System.ComponentModel.Design;
using System.CodeDom;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Design.Serialization;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
[Browsable(true)]
[DesignerSerializer(typeof(DependencyObjectCodeDomSerializer), typeof(CodeDomSerializer))]
public sealed class WorkflowParameterBinding : DependencyObject
{
public static readonly DependencyProperty ParameterNameProperty = DependencyProperty.Register("ParameterName", typeof(string), typeof(WorkflowParameterBinding), new PropertyMetadata(DependencyPropertyOptions.Metadata));
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(WorkflowParameterBinding));
public WorkflowParameterBinding()
{
}
public WorkflowParameterBinding(string parameterName)
{
SetValue(ParameterNameProperty, parameterName);
}
[DefaultValue(null)]
public object Value
{
get
{
return GetValue(ValueProperty);
}
set
{
SetValue(ValueProperty, value);
}
}
public string ParameterName
{
get
{
return (string)GetValue(ParameterNameProperty);
}
set
{
SetValue(ParameterNameProperty, value);
}
}
}
[Serializable]
public sealed class WorkflowParameterBindingCollection: KeyedCollection
{
private Activity ownerActivity = null;
public WorkflowParameterBindingCollection(Activity ownerActivity)
{
if (ownerActivity == null)
throw new ArgumentNullException("ownerActivity");
this.ownerActivity = ownerActivity;
}
public WorkflowParameterBinding GetItem(string key)
{
return this[key];
}
protected override string GetKeyForItem(WorkflowParameterBinding item)
{
return item.ParameterName;
}
protected override void ClearItems()
{
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
base.ClearItems();
}
protected override void InsertItem(int index, WorkflowParameterBinding item)
{
if (item == null)
throw new ArgumentNullException("item");
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
if (Contains(item.ParameterName))
{
WorkflowParameterBinding oldItem = this[item.ParameterName];
index = this.IndexOf(oldItem);
RemoveItem(index);
}
base.InsertItem(index, item);
}
protected override void RemoveItem(int index)
{
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
base.RemoveItem(index);
}
protected override void SetItem(int index, WorkflowParameterBinding item)
{
if (item == null)
throw new ArgumentNullException("item");
if (!this.ownerActivity.DesignMode)
throw new InvalidOperationException(SR.GetString(SR.Error_CanNotChangeAtRuntime));
base.SetItem(index, item);
}
}
}
// 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
- OracleFactory.cs
- QuaternionIndependentAnimationStorage.cs
- DataGridViewCellEventArgs.cs
- InheritanceContextChangedEventManager.cs
- MediaContextNotificationWindow.cs
- ResourceKey.cs
- CodeCommentStatementCollection.cs
- CodeLabeledStatement.cs
- HwndKeyboardInputProvider.cs
- HttpDictionary.cs
- RawStylusInput.cs
- SafeNativeMethods.cs
- GuidConverter.cs
- LocalizationCodeDomSerializer.cs
- AppDomainUnloadedException.cs
- PolicyLevel.cs
- BamlStream.cs
- Fonts.cs
- HttpCookiesSection.cs
- DayRenderEvent.cs
- MarkupCompilePass1.cs
- WindowsFormsSynchronizationContext.cs
- ResourceCategoryAttribute.cs
- UpdateException.cs
- XmlEntity.cs
- BindableAttribute.cs
- Helpers.cs
- TileModeValidation.cs
- PostBackTrigger.cs
- XmlDocumentType.cs
- ResourceExpressionEditor.cs
- CommandManager.cs
- EventLog.cs
- SqlNotificationRequest.cs
- PerformanceCounterLib.cs
- HelpProvider.cs
- LogicalExpressionTypeConverter.cs
- AddInAdapter.cs
- MessageSecurityVersionConverter.cs
- Context.cs
- CoTaskMemSafeHandle.cs
- StringToken.cs
- TextProviderWrapper.cs
- FlowDocumentView.cs
- NotifyParentPropertyAttribute.cs
- Crypto.cs
- Pair.cs
- RecipientInfo.cs
- Vector3dCollection.cs
- XmlSchemaValidator.cs
- ImageListUtils.cs
- NamedPipeAppDomainProtocolHandler.cs
- DeclarationUpdate.cs
- FlowLayoutPanel.cs
- PlanCompilerUtil.cs
- BitmapMetadata.cs
- BufferedWebEventProvider.cs
- ConfigPathUtility.cs
- ApplicationHost.cs
- Util.cs
- AdPostCacheSubstitution.cs
- WindowsEditBox.cs
- ClientRoleProvider.cs
- LayoutEditorPart.cs
- Popup.cs
- TdsRecordBufferSetter.cs
- ConfigXmlText.cs
- HtmlInputRadioButton.cs
- AsymmetricSignatureDeformatter.cs
- DataKeyCollection.cs
- UserPersonalizationStateInfo.cs
- _WebProxyDataBuilder.cs
- LongTypeConverter.cs
- DataGrid.cs
- HttpCacheVary.cs
- SqlDataSourceSelectingEventArgs.cs
- ToolZone.cs
- SqlEnums.cs
- Vector3dCollection.cs
- Canvas.cs
- InvalidProgramException.cs
- AffineTransform3D.cs
- HttpTransportElement.cs
- SQLSingleStorage.cs
- PtsContext.cs
- ReadOnlyHierarchicalDataSource.cs
- ProfileService.cs
- DataSourceHelper.cs
- BooleanSwitch.cs
- ConnectionStringsExpressionBuilder.cs
- CodeTypeMemberCollection.cs
- XmlSchemaImport.cs
- ReferenceEqualityComparer.cs
- ClipboardProcessor.cs
- SelectedDatesCollection.cs
- CqlIdentifiers.cs
- BindingExpressionBase.cs
- ListBindingHelper.cs
- DataSourceHelper.cs
- Compiler.cs