Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / AnnouncementService.cs / 1305376 / AnnouncementService.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Discovery { using System; using System.Xml; using System.Runtime; using System.ServiceModel.Discovery.Version11; using System.ServiceModel.Discovery.VersionApril2005; using System.ServiceModel.Discovery.VersionCD1; [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] public class AnnouncementService : IAnnouncementContractApril2005, IAnnouncementContract11, IAnnouncementContractCD1, IAnnouncementServiceImplementation { DuplicateDetectorduplicateDetector; public AnnouncementService() : this(DiscoveryDefaults.DuplicateMessageHistoryLength) { } public AnnouncementService(int duplicateMessageHistoryLength) { if (duplicateMessageHistoryLength < 0) { throw FxTrace.Exception.ArgumentOutOfRange( "duplicateMessageHistoryLength", duplicateMessageHistoryLength, SR.DiscoveryNegativeDuplicateMessageHistoryLength); } if (duplicateMessageHistoryLength > 0) { this.duplicateDetector = new DuplicateDetector (duplicateMessageHistoryLength); } } public event EventHandler OnlineAnnouncementReceived; public event EventHandler OfflineAnnouncementReceived; void IAnnouncementContractApril2005.HelloOperation(HelloMessageApril2005 message) { Fx.Assert("The [....] method IAnnouncementContractApril2005.HelloOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IAnnouncementContractApril2005.BeginHelloOperation(HelloMessageApril2005 message, AsyncCallback callback, object state) { return new HelloOperationApril2005AsyncResult(this, message, callback, state); } void IAnnouncementContractApril2005.EndHelloOperation(IAsyncResult result) { HelloOperationApril2005AsyncResult.End(result); } void IAnnouncementContractApril2005.ByeOperation(ByeMessageApril2005 message) { Fx.Assert("The [....] method IAnnouncementContractApril2005.ByeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IAnnouncementContractApril2005.BeginByeOperation(ByeMessageApril2005 message, AsyncCallback callback, object state) { return new ByeOperationApril2005AsyncResult(this, message, callback, state); } void IAnnouncementContractApril2005.EndByeOperation(IAsyncResult result) { ByeOperationApril2005AsyncResult.End(result); } void IAnnouncementContract11.HelloOperation(HelloMessage11 message) { Fx.Assert("The [....] method IAnnouncementContract11.HelloOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IAnnouncementContract11.BeginHelloOperation(HelloMessage11 message, AsyncCallback callback, object state) { return new HelloOperation11AsyncResult(this, message, callback, state); } void IAnnouncementContract11.EndHelloOperation(IAsyncResult result) { HelloOperation11AsyncResult.End(result); } void IAnnouncementContract11.ByeOperation(ByeMessage11 message) { Fx.Assert("The [....] method IAnnouncementContract11.ByeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IAnnouncementContract11.BeginByeOperation(ByeMessage11 message, AsyncCallback callback, object state) { return new ByeOperation11AsyncResult(this, message, callback, state); } void IAnnouncementContract11.EndByeOperation(IAsyncResult result) { ByeOperation11AsyncResult.End(result); } void IAnnouncementContractCD1.HelloOperation(HelloMessageCD1 message) { Fx.Assert("The [....] method IAnnouncementContractCD1.HelloOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IAnnouncementContractCD1.BeginHelloOperation(HelloMessageCD1 message, AsyncCallback callback, object state) { return new HelloOperationCD1AsyncResult(this, message, callback, state); } void IAnnouncementContractCD1.EndHelloOperation(IAsyncResult result) { HelloOperationCD1AsyncResult.End(result); } void IAnnouncementContractCD1.ByeOperation(ByeMessageCD1 message) { Fx.Assert("The [....] method IAnnouncementContractCD1.ByeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IAnnouncementContractCD1.BeginByeOperation(ByeMessageCD1 message, AsyncCallback callback, object state) { return new ByeOperationCD1AsyncResult(this, message, callback, state); } void IAnnouncementContractCD1.EndByeOperation(IAsyncResult result) { ByeOperationCD1AsyncResult.End(result); } bool IAnnouncementServiceImplementation.IsDuplicate(UniqueId messageId) { return (this.duplicateDetector != null) && (!this.duplicateDetector.AddIfNotDuplicate(messageId)); } IAsyncResult IAnnouncementServiceImplementation.OnBeginOnlineAnnouncement( DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state) { return this.OnBeginOnlineAnnouncement(messageSequence, endpointDiscoveryMetadata, callback, state); } void IAnnouncementServiceImplementation.OnEndOnlineAnnouncement(IAsyncResult result) { this.OnEndOnlineAnnouncement(result); } IAsyncResult IAnnouncementServiceImplementation.OnBeginOfflineAnnouncement( DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state) { return this.OnBeginOfflineAnnouncement(messageSequence, endpointDiscoveryMetadata, callback, state); } void IAnnouncementServiceImplementation.OnEndOfflineAnnouncement(IAsyncResult result) { this.OnEndOfflineAnnouncement(result); } protected virtual IAsyncResult OnBeginOnlineAnnouncement( DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state) { EventHandler handler = this.OnlineAnnouncementReceived; if (handler != null) { handler(this, new AnnouncementEventArgs(messageSequence, endpointDiscoveryMetadata)); } return new CompletedAsyncResult(callback, state); } protected virtual void OnEndOnlineAnnouncement(IAsyncResult result) { CompletedAsyncResult.End(result); } protected virtual IAsyncResult OnBeginOfflineAnnouncement( DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state) { EventHandler handler = this.OfflineAnnouncementReceived; if (handler != null) { handler(this, new AnnouncementEventArgs(messageSequence, endpointDiscoveryMetadata)); } return new CompletedAsyncResult(callback, state); } protected virtual void OnEndOfflineAnnouncement(IAsyncResult result) { CompletedAsyncResult.End(result); } } } // 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
- UncommonField.cs
- ListViewAutomationPeer.cs
- GeometryGroup.cs
- DataBindingList.cs
- BinaryUtilClasses.cs
- Color.cs
- XmlDataLoader.cs
- Baml2006ReaderSettings.cs
- AVElementHelper.cs
- DataFormats.cs
- MetadataException.cs
- PermissionListSet.cs
- InheritanceContextChangedEventManager.cs
- Animatable.cs
- ResumeStoryboard.cs
- DesignerListAdapter.cs
- XmlEntity.cs
- TypeBuilder.cs
- TextViewBase.cs
- AsymmetricSignatureFormatter.cs
- NavigationProgressEventArgs.cs
- InvalidAsynchronousStateException.cs
- ControlDesignerState.cs
- XmlSchemaAll.cs
- XpsPackagingException.cs
- GeneralTransform.cs
- BaseDataListPage.cs
- CookielessHelper.cs
- OleDbCommand.cs
- ListViewUpdateEventArgs.cs
- IERequestCache.cs
- ParentUndoUnit.cs
- NonClientArea.cs
- AnonymousIdentificationModule.cs
- CodeConditionStatement.cs
- ProcessModelSection.cs
- RightsManagementEncryptedStream.cs
- AmbientLight.cs
- ItemCheckEvent.cs
- HtmlInputCheckBox.cs
- ScheduleChanges.cs
- PhonemeConverter.cs
- PhysicalOps.cs
- ConnectionStringsExpressionBuilder.cs
- ChangeBlockUndoRecord.cs
- FontStyle.cs
- OdbcParameterCollection.cs
- QueryOutputWriterV1.cs
- XsltSettings.cs
- MenuAdapter.cs
- EmptyEnumerator.cs
- Atom10FormatterFactory.cs
- UInt64Converter.cs
- ToolStripScrollButton.cs
- GeneralTransform3D.cs
- AsymmetricAlgorithm.cs
- Component.cs
- EventPropertyMap.cs
- TypeBuilder.cs
- DataColumnCollection.cs
- ParseChildrenAsPropertiesAttribute.cs
- MatrixAnimationUsingPath.cs
- TableLayoutSettings.cs
- HttpDebugHandler.cs
- NavigationFailedEventArgs.cs
- QueueTransferProtocol.cs
- MembershipSection.cs
- DoubleAnimationUsingPath.cs
- EllipticalNodeOperations.cs
- LockedActivityGlyph.cs
- SizeConverter.cs
- XamlPointCollectionSerializer.cs
- WasAdminWrapper.cs
- DiscoveryClientBindingElement.cs
- ServiceHostFactory.cs
- ListControl.cs
- Binding.cs
- Style.cs
- ColumnWidthChangingEvent.cs
- RuleInfoComparer.cs
- RelationshipDetailsCollection.cs
- IProvider.cs
- Light.cs
- GroupLabel.cs
- XmlDataDocument.cs
- DbgCompiler.cs
- MsmqAppDomainProtocolHandler.cs
- TableLayoutRowStyleCollection.cs
- CacheDependency.cs
- WindowsTitleBar.cs
- UInt32Converter.cs
- RepeaterItemEventArgs.cs
- DataGridViewButtonCell.cs
- WorkflowViewService.cs
- QilPatternFactory.cs
- TypeToken.cs
- PageThemeParser.cs
- SafeRegistryHandle.cs
- FusionWrap.cs
- FontFamilyIdentifier.cs