Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / HelloOperationAsyncResult.cs / 1305376 / HelloOperationAsyncResult.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Discovery { using System.Diagnostics.CodeAnalysis; using System.Runtime; using System.Xml; abstract class HelloOperationAsyncResult: AsyncResult where TMessage : class { static AsyncCompletion onOnOnlineAnnoucementCompletedCallback = new AsyncCompletion(OnOnOnlineAnnouncementCompleted); IAnnouncementServiceImplementation announcementServiceImpl; [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] internal HelloOperationAsyncResult( IAnnouncementServiceImplementation announcementServiceImpl, TMessage message, AsyncCallback callback, object state) : base(callback, state) { this.announcementServiceImpl = announcementServiceImpl; if (this.IsInvalid(message)) { this.Complete(true); return; } IAsyncResult innerAsyncResult = this.announcementServiceImpl.OnBeginOnlineAnnouncement( this.GetMessageSequence(message), this.GetEndpointDiscoveryMetadata(message), this.PrepareAsyncCompletion(onOnOnlineAnnoucementCompletedCallback), this); if (innerAsyncResult.CompletedSynchronously && OnOnOnlineAnnouncementCompleted(innerAsyncResult)) { this.Complete(true); return; } } protected abstract bool ValidateContent(TMessage message); protected abstract DiscoveryMessageSequence GetMessageSequence(TMessage message); protected abstract EndpointDiscoveryMetadata GetEndpointDiscoveryMetadata(TMessage message); static bool OnOnOnlineAnnouncementCompleted(IAsyncResult result) { HelloOperationAsyncResult thisPtr = (HelloOperationAsyncResult )result.AsyncState; thisPtr.announcementServiceImpl.OnEndOnlineAnnouncement(result); return true; } bool IsInvalid(TMessage message) { UniqueId messageId = OperationContext.Current.IncomingMessageHeaders.MessageId; if (messageId == null) { if (TD.DiscoveryMessageWithNullMessageIdIsEnabled()) { TD.DiscoveryMessageWithNullMessageId(ProtocolStrings.TracingStrings.Hello); } return true; } else if (this.announcementServiceImpl.IsDuplicate(messageId)) { if (TD.DuplicateDiscoveryMessageIsEnabled()) { TD.DuplicateDiscoveryMessage(ProtocolStrings.TracingStrings.Hello, messageId.ToString()); } return true; } else if (this.ValidateContent(message)) { return false; } else { if (TD.DiscoveryMessageWithInvalidContentIsEnabled()) { TD.DiscoveryMessageWithInvalidContent(ProtocolStrings.TracingStrings.Hello, messageId.ToString()); } return true; } } } } // 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
- Variable.cs
- TextParagraphCache.cs
- SafeProcessHandle.cs
- StylusPlugInCollection.cs
- LoginView.cs
- SoapInteropTypes.cs
- GradientStopCollection.cs
- TextRangeAdaptor.cs
- SerializerDescriptor.cs
- DocumentPageView.cs
- XmlStreamNodeWriter.cs
- Timer.cs
- Help.cs
- RequestUriProcessor.cs
- SizeChangedEventArgs.cs
- DataBoundControlAdapter.cs
- PeerContact.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- AppDomainCompilerProxy.cs
- OperationAbortedException.cs
- DependencySource.cs
- DataGridViewElement.cs
- PageContent.cs
- Command.cs
- NetSectionGroup.cs
- DecoderFallback.cs
- NativeMethods.cs
- WorkflowWebHostingModule.cs
- ObjectDataSourceView.cs
- Label.cs
- WindowsTooltip.cs
- OpenFileDialog.cs
- Soap.cs
- DbProviderManifest.cs
- SafeCertificateStore.cs
- DependencyProperty.cs
- FileNotFoundException.cs
- DateTimeFormat.cs
- WebSysDisplayNameAttribute.cs
- ReflectionTypeLoadException.cs
- CellParaClient.cs
- XmlSchemaAnnotated.cs
- _NestedSingleAsyncResult.cs
- NamedServiceModelExtensionCollectionElement.cs
- SmiXetterAccessMap.cs
- __ComObject.cs
- Win32MouseDevice.cs
- UniqueID.cs
- ParameterBuilder.cs
- App.cs
- DefaultMemberAttribute.cs
- SqlUnionizer.cs
- Aggregates.cs
- DropShadowEffect.cs
- BindingBase.cs
- XsdDateTime.cs
- AbstractExpressions.cs
- SmtpLoginAuthenticationModule.cs
- NameValuePair.cs
- StyleXamlParser.cs
- Wizard.cs
- DataGridViewAutoSizeModeEventArgs.cs
- OpenTypeLayoutCache.cs
- NamespaceTable.cs
- PixelFormat.cs
- InheritanceService.cs
- OdbcCommandBuilder.cs
- WinFormsComponentEditor.cs
- WebPartConnectionsConnectVerb.cs
- ContextBase.cs
- ObjectContext.cs
- ProfileSettingsCollection.cs
- SmtpNetworkElement.cs
- Evidence.cs
- Win32KeyboardDevice.cs
- RowSpanVector.cs
- WindowsFormsHost.cs
- Rotation3DKeyFrameCollection.cs
- ComboBox.cs
- RectangleHotSpot.cs
- PointAnimation.cs
- BitmapEffectCollection.cs
- FixedTextSelectionProcessor.cs
- cookiecollection.cs
- X500Name.cs
- ValidatorCollection.cs
- TrustLevel.cs
- ToolboxComponentsCreatedEventArgs.cs
- ItemContainerPattern.cs
- IsolatedStorageFileStream.cs
- XmlEventCache.cs
- TableLayout.cs
- PrivilegedConfigurationManager.cs
- SecureEnvironment.cs
- Char.cs
- _SslStream.cs
- BridgeDataRecord.cs
- FileUtil.cs
- CompositeCollectionView.cs
- BooleanToVisibilityConverter.cs