Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / VersionCD1 / AnnouncementInnerClientCD1.cs / 1305376 / AnnouncementInnerClientCD1.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Discovery.VersionCD1 { using System.ComponentModel; using System.Runtime; using System.ServiceModel.Description; using System.Threading; class AnnouncementInnerClientCD1 : ClientBase, IAnnouncementInnerClient { DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator; BeginOperationDelegate onBeginHelloOperationDelegate; EndOperationDelegate onEndHelloOperationDelegate; SendOrPostCallback onHelloOperationCompletedDelegate; BeginOperationDelegate onBeginByeOperationDelegate; EndOperationDelegate onEndByeOperationDelegate; SendOrPostCallback onByeOperationCompletedDelegate; public AnnouncementInnerClientCD1(AnnouncementEndpoint announcementEndpoint) : base(announcementEndpoint) { this.discoveryMessageSequenceGenerator = new DiscoveryMessageSequenceGenerator(); } event EventHandler HelloOperationCompletedEventHandler; event EventHandler ByeOperationCompletedEventHandler; event EventHandler IAnnouncementInnerClient.HelloOperationCompleted { add { this.HelloOperationCompletedEventHandler += value; } remove { this.HelloOperationCompletedEventHandler -= value; } } event EventHandler IAnnouncementInnerClient.ByeOperationCompleted { add { this.ByeOperationCompletedEventHandler += value; } remove { this.ByeOperationCompletedEventHandler -= value; } } public DiscoveryMessageSequenceGenerator DiscoveryMessageSequenceGenerator { get { return this.discoveryMessageSequenceGenerator; } set { this.discoveryMessageSequenceGenerator = value; } } public new ChannelFactory ChannelFactory { get { return base.ChannelFactory; } } public new IClientChannel InnerChannel { get { return base.InnerChannel; } } public new ServiceEndpoint Endpoint { get { return base.Endpoint; } } public ICommunicationObject InnerCommunicationObject { get { return this as ICommunicationObject; } } public void HelloOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata) { HelloMessageCD1 message = HelloMessageCD1.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata); base.Channel.HelloOperation(message); } public void ByeOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata) { ByeMessageCD1 message = ByeMessageCD1.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata); base.Channel.ByeOperation(message); } public IAsyncResult BeginHelloOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state) { HelloMessageCD1 message = HelloMessageCD1.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata); return base.Channel.BeginHelloOperation(message, callback, state); } public void EndHelloOperation(IAsyncResult result) { base.Channel.EndHelloOperation(result); } public IAsyncResult BeginByeOperation(EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state) { ByeMessageCD1 message = ByeMessageCD1.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata); return base.Channel.BeginByeOperation(message, callback, state); } public void EndByeOperation(IAsyncResult result) { base.Channel.EndByeOperation(result); } public void HelloOperationAsync(EndpointDiscoveryMetadata endpointDiscoveryMetadata, object userState) { HelloMessageCD1 message = HelloMessageCD1.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata); if ((this.onBeginHelloOperationDelegate == null)) { this.onBeginHelloOperationDelegate = new BeginOperationDelegate(this.OnBeginHelloOperation); } if ((this.onEndHelloOperationDelegate == null)) { this.onEndHelloOperationDelegate = new EndOperationDelegate(this.OnEndHelloOperation); } if ((this.onHelloOperationCompletedDelegate == null)) { this.onHelloOperationCompletedDelegate = Fx.ThunkCallback(new SendOrPostCallback(this.OnHelloOperationCompleted)); } base.InvokeAsync( this.onBeginHelloOperationDelegate, new object[] { message }, this.onEndHelloOperationDelegate, this.onHelloOperationCompletedDelegate, userState); } public void ByeOperationAsync(EndpointDiscoveryMetadata endpointDiscoveryMetadata, object userState) { ByeMessageCD1 message = ByeMessageCD1.Create(DiscoveryMessageSequenceGenerator.Next(), endpointDiscoveryMetadata); if (this.onBeginByeOperationDelegate == null) { this.onBeginByeOperationDelegate = new BeginOperationDelegate(this.OnBeginByeOperation); } if ((this.onEndByeOperationDelegate == null)) { this.onEndByeOperationDelegate = new EndOperationDelegate(this.OnEndByeOperation); } if ((this.onByeOperationCompletedDelegate == null)) { this.onByeOperationCompletedDelegate = Fx.ThunkCallback(new SendOrPostCallback(this.OnByeOperationCompleted)); } base.InvokeAsync( this.onBeginByeOperationDelegate, new object[] { message }, this.onEndByeOperationDelegate, this.onByeOperationCompletedDelegate, userState); } IAsyncResult BeginHelloOperation(HelloMessageCD1 message, AsyncCallback callback, object state) { return base.Channel.BeginHelloOperation(message, callback, state); } IAsyncResult BeginByeOperation(ByeMessageCD1 message, AsyncCallback callback, object state) { return base.Channel.BeginByeOperation(message, callback, state); } IAsyncResult OnBeginHelloOperation(object[] inValues, System.AsyncCallback callback, object asyncState) { HelloMessageCD1 message = ((HelloMessageCD1)(inValues[0])); return this.BeginHelloOperation(message, callback, asyncState); } object[] OnEndHelloOperation(System.IAsyncResult result) { this.EndHelloOperation(result); return null; } void OnHelloOperationCompleted(object state) { if ((this.HelloOperationCompletedEventHandler != null)) { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state)); this.HelloOperationCompletedEventHandler(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState)); } } IAsyncResult OnBeginByeOperation(object[] inValues, System.AsyncCallback callback, object asyncState) { ByeMessageCD1 message = ((ByeMessageCD1)(inValues[0])); return this.BeginByeOperation(message, callback, asyncState); } object[] OnEndByeOperation(System.IAsyncResult result) { this.EndByeOperation(result); return null; } void OnByeOperationCompleted(object state) { if (this.ByeOperationCompletedEventHandler != null) { InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state)); this.ByeOperationCompletedEventHandler(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState)); } } } } // 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
- WaitingCursor.cs
- FlowDocument.cs
- HelpKeywordAttribute.cs
- Connector.cs
- QueryCacheEntry.cs
- FtpWebRequest.cs
- PropertyManager.cs
- HttpApplication.cs
- FormatterConverter.cs
- URLAttribute.cs
- HtmlEncodedRawTextWriter.cs
- ControlAdapter.cs
- ThicknessConverter.cs
- ConfigurationSectionGroup.cs
- RenderDataDrawingContext.cs
- DbConnectionInternal.cs
- XamlRtfConverter.cs
- DataBindingExpressionBuilder.cs
- OneOfTypeConst.cs
- DataExchangeServiceBinder.cs
- DataGridViewCell.cs
- Oid.cs
- XamlWriter.cs
- AudioStateChangedEventArgs.cs
- ProvidePropertyAttribute.cs
- AttachedPropertiesService.cs
- SecurityDescriptor.cs
- XmlBinaryReader.cs
- EventWaitHandleSecurity.cs
- DialogWindow.cs
- SapiRecoContext.cs
- MailMessageEventArgs.cs
- TextTreeText.cs
- TransactionsSectionGroup.cs
- RegexFCD.cs
- clipboard.cs
- MemberDescriptor.cs
- DesigntimeLicenseContext.cs
- OdbcHandle.cs
- VirtualStackFrame.cs
- Matrix3DValueSerializer.cs
- RowTypeElement.cs
- DataGridPageChangedEventArgs.cs
- XmlProcessingInstruction.cs
- OptimalBreakSession.cs
- LinkLabel.cs
- ConfigurationSettings.cs
- StringValidatorAttribute.cs
- PostBackTrigger.cs
- XamlInt32CollectionSerializer.cs
- SqlDependencyListener.cs
- BitVector32.cs
- FindProgressChangedEventArgs.cs
- Int16Converter.cs
- SvcMapFileSerializer.cs
- EntityDataSourceDataSelectionPanel.cs
- StorageEntitySetMapping.cs
- StreamMarshaler.cs
- GridItemProviderWrapper.cs
- WebPartConnectionsConfigureVerb.cs
- IRCollection.cs
- SystemUnicastIPAddressInformation.cs
- x509store.cs
- ButtonAutomationPeer.cs
- PerfCounters.cs
- DbProviderFactoriesConfigurationHandler.cs
- QueryAccessibilityHelpEvent.cs
- User.cs
- Metadata.cs
- ClientConfigurationSystem.cs
- SaveRecipientRequest.cs
- BindingMemberInfo.cs
- ActivityDesignerResources.cs
- MediaScriptCommandRoutedEventArgs.cs
- ControlParameter.cs
- TreeNodeStyleCollection.cs
- CoreSwitches.cs
- TextViewSelectionProcessor.cs
- BooleanExpr.cs
- ReflectEventDescriptor.cs
- PageVisual.cs
- ListViewCommandEventArgs.cs
- FigureParaClient.cs
- DecimalConverter.cs
- CodeTypeDeclarationCollection.cs
- DataGridViewCellStyle.cs
- DataGridViewComboBoxEditingControl.cs
- ResourceCodeDomSerializer.cs
- DateTimeConverter2.cs
- AssemblyCache.cs
- SqlRecordBuffer.cs
- DisplayNameAttribute.cs
- TextBoxBase.cs
- CssClassPropertyAttribute.cs
- ReaderWriterLockSlim.cs
- HexParser.cs
- MonitoringDescriptionAttribute.cs
- HtmlProps.cs
- EncryptedXml.cs
- BulletDecorator.cs