Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / Workflow / Activities / Design / ServiceOperationUIEditor.cs / 1305376 / ServiceOperationUIEditor.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Workflow.Activities.Design { using System; using System.Collections.Generic; using System.Text; using System.Drawing.Design; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms.Design; using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Design; using System.Diagnostics; using System.ServiceModel; using System.Windows.Forms; internal class ServiceOperationUIEditor : UITypeEditor { public static bool TryPickOperation(IServiceProvider serviceProvider, Activity activity, OperationInfoBase currentOperation, out OperationInfoBase selectedOperation) { selectedOperation = null; bool isReceiveActivity = activity is ReceiveActivity; try { using (OperationPickerDialog operationPicker = new OperationPickerDialog(serviceProvider, isReceiveActivity)) { Walker activityTreeWalker = new Walker(); Type allowedActivityType = null; if (isReceiveActivity) { allowedActivityType = typeof(ReceiveActivity); } else { allowedActivityType = typeof(SendActivity); } activityTreeWalker.FoundActivity += delegate(Walker walker, WalkerEventArgs eventArgs) { Activity foundActivity = eventArgs.CurrentActivity; if (!(allowedActivityType.IsAssignableFrom(foundActivity.GetType()))) { return; } if (!foundActivity.Enabled) { return; } if (foundActivity is ReceiveActivity) { ReceiveActivity reciveActivity = foundActivity as ReceiveActivity; if (reciveActivity.ServiceOperationInfo != null) { operationPicker.AddServiceOperation(reciveActivity.ServiceOperationInfo, reciveActivity); } } if (foundActivity is SendActivity) { SendActivity sendActivity = foundActivity as SendActivity; if (sendActivity.ServiceOperationInfo != null) { operationPicker.AddServiceOperation(sendActivity.ServiceOperationInfo, sendActivity); } } }; activityTreeWalker.Walk(activity.RootActivity); OperationInfoBase currentServiceOperationInfo = currentOperation as OperationInfoBase; if (currentServiceOperationInfo != null) { operationPicker.SelectedOperation = currentServiceOperationInfo; } DialogResult dialogResult = operationPicker.ShowDialog(); if ((operationPicker.SelectedOperation != null) && (dialogResult == DialogResult.OK) && !operationPicker.SelectedOperation.Equals(currentServiceOperationInfo)) { selectedOperation = operationPicker.SelectedOperation.Clone(); return true; } } } catch (Exception e) { DesignerHelpers.ShowMessage(serviceProvider, e.Message, DR.GetString(DR.WorkflowDesignerTitle), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); throw; } return false; } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if (provider == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("provider"); } OperationInfoBase pickedServiceOperation = null; if (TryPickOperation(provider, (Activity) context.Instance, (OperationInfoBase) value, out pickedServiceOperation)) { return pickedServiceOperation; } else { return base.EditValue(context, provider, value); } } public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DiscoveryDocumentSearchPattern.cs
- EventHandlerList.cs
- TextParaLineResult.cs
- FormsAuthenticationTicket.cs
- RequestQueryParser.cs
- CalendarAutoFormat.cs
- LinkUtilities.cs
- WSDualHttpSecurityElement.cs
- DocumentApplicationJournalEntry.cs
- FunctionGenerator.cs
- FilteredDataSetHelper.cs
- SQlBooleanStorage.cs
- SimpleFileLog.cs
- SystemDropShadowChrome.cs
- SpeechSeg.cs
- SqlTypeSystemProvider.cs
- ZipIOExtraFieldPaddingElement.cs
- XAMLParseException.cs
- ArrayListCollectionBase.cs
- ColumnWidthChangingEvent.cs
- WebServiceParameterData.cs
- UIAgentCrashedException.cs
- IChannel.cs
- MatrixTransform.cs
- SQLInt64.cs
- InfiniteTimeSpanConverter.cs
- WindowsRegion.cs
- Vector3DIndependentAnimationStorage.cs
- ReferencedAssembly.cs
- MouseWheelEventArgs.cs
- HttpChannelHelper.cs
- SynchronizedInputAdaptor.cs
- BitmapEffectInput.cs
- TextServicesHost.cs
- DeobfuscatingStream.cs
- FlowDocumentReaderAutomationPeer.cs
- XmlValidatingReader.cs
- FormViewPageEventArgs.cs
- UseAttributeSetsAction.cs
- SiteMapPath.cs
- FontFamilyValueSerializer.cs
- ConnectionInterfaceCollection.cs
- WebPartConnectionsCloseVerb.cs
- ObjectDataSourceEventArgs.cs
- Fonts.cs
- SmtpNtlmAuthenticationModule.cs
- ISO2022Encoding.cs
- StateItem.cs
- CodeParameterDeclarationExpressionCollection.cs
- DataServiceEntityAttribute.cs
- WebSysDisplayNameAttribute.cs
- DATA_BLOB.cs
- TargetPerspective.cs
- FamilyCollection.cs
- Identifier.cs
- AuthenticationModuleElement.cs
- basevalidator.cs
- ClientConfigPaths.cs
- DoubleKeyFrameCollection.cs
- BufferedStream.cs
- ToolStripItemClickedEventArgs.cs
- MenuScrollingVisibilityConverter.cs
- DbSetClause.cs
- OrderedDictionary.cs
- ContentType.cs
- CookielessHelper.cs
- PageContentAsyncResult.cs
- ViewValidator.cs
- CompiledQueryCacheEntry.cs
- XmlConvert.cs
- Viewport2DVisual3D.cs
- EntityContainerAssociationSetEnd.cs
- PointConverter.cs
- ListBindableAttribute.cs
- _HeaderInfo.cs
- Rect3DValueSerializer.cs
- EmptyQuery.cs
- SchemaNotation.cs
- Hashtable.cs
- TripleDESCryptoServiceProvider.cs
- ChannelBase.cs
- EmptyStringExpandableObjectConverter.cs
- EpmSyndicationContentDeSerializer.cs
- DataMisalignedException.cs
- InstalledVoice.cs
- WindowsTokenRoleProvider.cs
- LoginUtil.cs
- TextEditorDragDrop.cs
- DataControlImageButton.cs
- GeometryConverter.cs
- RoleManagerModule.cs
- Memoizer.cs
- _ChunkParse.cs
- ThreadStartException.cs
- WorkflowInstanceQuery.cs
- ToolStripSeparator.cs
- DetailsViewDeletedEventArgs.cs
- ItemCheckEvent.cs
- FormViewDeleteEventArgs.cs
- RunClient.cs