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
- DbException.cs
- TransactedBatchContext.cs
- CheckBox.cs
- CommandEventArgs.cs
- SecUtil.cs
- SafeMarshalContext.cs
- MSAAEventDispatcher.cs
- XamlLoadErrorInfo.cs
- TiffBitmapDecoder.cs
- TemplateBamlTreeBuilder.cs
- ToolStripRendererSwitcher.cs
- MulticastDelegate.cs
- UserInitiatedNavigationPermission.cs
- BitmapSizeOptions.cs
- ContextProperty.cs
- WindowsFormsHelpers.cs
- HtmlElement.cs
- DBCSCodePageEncoding.cs
- DataGridViewHitTestInfo.cs
- ScaleTransform3D.cs
- HttpNamespaceReservationInstallComponent.cs
- Point3DCollection.cs
- HMACRIPEMD160.cs
- AstNode.cs
- ComponentResourceKey.cs
- ExpandoClass.cs
- SettingsProperty.cs
- TemplatedEditableDesignerRegion.cs
- CacheAxisQuery.cs
- DataRowCollection.cs
- ThreadNeutralSemaphore.cs
- MouseGestureConverter.cs
- DefaultHttpHandler.cs
- SHA512CryptoServiceProvider.cs
- PropertyGridEditorPart.cs
- CodeEntryPointMethod.cs
- DataProviderNameConverter.cs
- WindowsEditBoxRange.cs
- SqlRemoveConstantOrderBy.cs
- LeftCellWrapper.cs
- ResourcesGenerator.cs
- CatalogZone.cs
- BufferedGraphics.cs
- ServiceDescription.cs
- ListViewGroupConverter.cs
- PaperSource.cs
- _SSPIWrapper.cs
- SmiConnection.cs
- InvokeProviderWrapper.cs
- PeerContact.cs
- MexTcpBindingElement.cs
- TextWriterTraceListener.cs
- DataGridColumnReorderingEventArgs.cs
- FormViewActionList.cs
- TextCompositionEventArgs.cs
- Int32AnimationUsingKeyFrames.cs
- ZoneLinkButton.cs
- DependencyObjectType.cs
- AutoGeneratedField.cs
- FillRuleValidation.cs
- ClientConfigurationSystem.cs
- ProcessHostFactoryHelper.cs
- EventDriven.cs
- NetCodeGroup.cs
- ScrollPattern.cs
- BaseProcessor.cs
- Aggregates.cs
- DelegateBodyWriter.cs
- RoutedEventValueSerializer.cs
- BindingValueChangedEventArgs.cs
- ImmComposition.cs
- WindowsAuthenticationEventArgs.cs
- CornerRadius.cs
- TypeToTreeConverter.cs
- ButtonChrome.cs
- AttachInfo.cs
- ConfigurationException.cs
- SqlCommand.cs
- InputLanguageProfileNotifySink.cs
- ToolStripTextBox.cs
- RouteUrlExpressionBuilder.cs
- EventHandlerList.cs
- WindowsFormsSectionHandler.cs
- Converter.cs
- IpcClientChannel.cs
- PartitionResolver.cs
- InputBinder.cs
- MetafileHeaderWmf.cs
- FormsAuthenticationConfiguration.cs
- Duration.cs
- ProtocolImporter.cs
- XmlILAnnotation.cs
- WindowsNonControl.cs
- XmlIlVisitor.cs
- WmfPlaceableFileHeader.cs
- FilterQuery.cs
- WebServiceTypeData.cs
- FixedTextContainer.cs
- RowToFieldTransformer.cs
- PageBreakRecord.cs