当前位置: 首页>>代码示例>>C#>>正文


C# CommunicationState类代码示例

本文整理汇总了C#中CommunicationState的典型用法代码示例。如果您正苦于以下问题:C# CommunicationState类的具体用法?C# CommunicationState怎么用?C# CommunicationState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommunicationState类属于命名空间,在下文中一共展示了CommunicationState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetState

 protected virtual void SetState(CommunicationState state)
 {
     State = state;
     switch (state)
     {
         case CommunicationState.Created:
             break;
         case CommunicationState.Opening:
             Opening?.Invoke(this, new EventArgs());
             break;
         case CommunicationState.Opened:
             Opened?.Invoke(this, new EventArgs());
             break;
         case CommunicationState.Closing:
             Closing?.Invoke(this, new EventArgs());
             break;
         case CommunicationState.Closed:
             Closed?.Invoke(this, new EventArgs());
             break;
         case CommunicationState.Faulted:
             Faulted?.Invoke(this, new EventArgs());
             break;
         default:
             throw new ArgumentOutOfRangeException(nameof(state), state, null);
     }
     StateChanged?.Invoke(this, new EventArgs());
 }
开发者ID:caesay,项目名称:NearSight,代码行数:27,代码来源:CommunicationObject.cs

示例2: Close

 public override void Close(TimeSpan timeout)
 {
     lock (thisLock)
     {
         this.state = CommunicationState.Closed;
     }
 }
开发者ID:dmetzgar,项目名称:custom-transport-channel,代码行数:7,代码来源:FileRequestContext.cs

示例3: ConnectionState

 public ConnectionState(int instanceId, ProxyState proxyState, CommunicationState commState, string proxyType)
 {
     this.InstanceId = instanceId;
     this.ProxyState = proxyState;
     this.CommState = commState;
     this.ProxyType = proxyType;
 }
开发者ID:willr,项目名称:WcfMonitoringProxy,代码行数:7,代码来源:ConnectionState.cs

示例4: GetStateTest

 public void GetStateTest()
 {
     SGServiceHost target = new SGServiceHost(); // TODO: Initialize to an appropriate value
     CommunicationState expected = new CommunicationState(); // TODO: Initialize to an appropriate value
     CommunicationState actual;
     actual = target.GetState();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
开发者ID:boskomijin,项目名称:SGApp,代码行数:9,代码来源:SGServiceHostTest.cs

示例5: FileRequestContext

 public FileRequestContext(Message message, FileReplyChannel parent)
 {
     this.aborted = false;
     this.message = message;
     this.parent = parent;
     this.state = CommunicationState.Opened;
     this.thisLock = new object();
     this.writeLock = new object();
 }
开发者ID:dmetzgar,项目名称:custom-transport-channel,代码行数:9,代码来源:FileRequestContext.cs

示例6: ReInitialize

 public void ReInitialize(Message requestMessage)
 {
     this.state = CommunicationState.Opened;
     this.requestMessageException = null;
     this.replySent = false;
     this.replyInitiated = false;
     this.aborted = false;
     this.requestMessage = requestMessage;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:9,代码来源:RequestContextBase.cs

示例7: ToGameClient

        public ToGameClient(SilverSocket socket)
        {
            _socket = socket;
            {
                socket.OnDataArrivalEvent += DataArrival;
                socket.OnSocketClosedEvent += OnSocketClosed;
            }

            _communicationState = CommunicationState.VerifyGame;
        }
开发者ID:Ryuuke,项目名称:SilverDofus,代码行数:10,代码来源:ToGameClient.cs

示例8: SharedConnectionListener

 internal SharedConnectionListener(BaseUriWithWildcard baseAddress, int queueId, Guid token, Func<Uri, int> onDuplicatedViaCallback)
 {
     this.baseAddress = baseAddress;
     this.queueId = queueId;
     this.token = token;
     this.onDuplicatedViaCallback = onDuplicatedViaCallback;
     this.connectionQueue = TraceUtility.CreateInputQueue<DuplicateConnectionAsyncResult>();
     this.state = CommunicationState.Created;
     this.reconnectEvent = new ManualResetEvent(true);
     this.StartListen(false);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:SharedConnectionListener.cs

示例9: Abort

 public override void Abort()
 {
     lock (thisLock)
     {
         if (this.aborted)
         {
             return;
         }
         this.aborted = true;
         this.state = CommunicationState.Faulted;
     }
 }
开发者ID:dmetzgar,项目名称:custom-transport-channel,代码行数:12,代码来源:FileRequestContext.cs

示例10: Abort

 public override void Abort()
 {
     lock (_aLock)
     {
         if (_aborted)
         {
             return;
         }
         _aborted = true;
         _state = CommunicationState.Faulted;
     }
 }
开发者ID:shaunxu,项目名称:roma,代码行数:12,代码来源:MessageBusRequestContext.cs

示例11: Open

        public void Open()
        {
            lock (this.thisLock)
            {
                if (this.currentState != CommunicationState.Created)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CommunicationObjectCannotBeModified, this.GetType().ToString())));
                }

                this.currentState = CommunicationState.Opened;
                this.ScheduleRetryTimerIfNotSet();
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:MsmqBindingMonitor.cs

示例12: MessageBusRequestContext

        public MessageBusRequestContext(
            Message message, MessageBusReplyChannel parent,
            EndpointAddress address,
            IBus bus,
            string relatedTo)
        {
            _aborted = false;
            _parent = parent;
            _message = message;
            _address = address;
            _busMessageId = relatedTo;
            _bus = bus;

            _aLock = new object();
            _state = CommunicationState.Opened;
        }
开发者ID:shaunxu,项目名称:roma,代码行数:16,代码来源:MessageBusRequestContext.cs

示例13: AppDomainHost

      protected AppDomainHost(Type serviceType,AppDomain appDomain,PermissionSet permissions,Uri[] baseAddresses)
      {
         State = CommunicationState.Faulted;

         //Cannot grant service permissions the host does not have
         permissions.Demand();

         string assemblyName = Assembly.GetAssembly(typeof(ServiceHostActivator)).FullName;
         m_ServiceHostActivator = appDomain.CreateInstanceAndUnwrap(assemblyName,typeof(ServiceHostActivator).ToString()) as ServiceHostActivator;

         appDomain.SetPermissionsSet(permissions);

         m_ServiceHostActivator.CreateHost(serviceType,baseAddresses);

         State = CommunicationState.Created;
      }      
开发者ID:knunery,项目名称:wcf-perf-test,代码行数:16,代码来源:AppDomainHost.cs

示例14: AbortAsync

        /// <summary>
        /// Causes a communication object to transition immediately from its current state into the closing state.
        /// </summary>
        /// <param name="token">The <see cref="T:ConverterSystems.Threading.CancellationToken" /> that notifies when the task should be canceled.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public async Task AbortAsync(CancellationToken token = default(CancellationToken))
        {
            await this.semaphore.WaitAsync(token).ConfigureAwait(false);
            try
            {
                if (this.aborted || this.State == CommunicationState.Closed)
                {
                    return;
                }

                this.aborted = true;
                this.State = CommunicationState.Closing;
            }
            finally
            {
                this.semaphore.Release();
            }

            bool flag2 = true;
            try
            {
                await this.OnClosingAsync(token).ConfigureAwait(false);
                if (!this.onClosingCalled)
                {
                    throw new InvalidOperationException($"{this.GetType().Name}.OnClosingAsync did not call await base.OnClosingAsync");
                }

                await this.OnAbortAsync(token).ConfigureAwait(false);
                await this.OnClosedAsync(token).ConfigureAwait(false);
                if (!this.onClosedCalled)
                {
                    throw new InvalidOperationException($"{this.GetType().Name}.OnClosedAsync did not call await base.OnClosedAsync");
                }

                flag2 = false;
            }
            finally
            {
                if (flag2)
                {
                    Log.Warn($"{this.GetType().Name}.AbortAsync failed.");
                }
            }
        }
开发者ID:yuriik83,项目名称:workstation-uaclient,代码行数:49,代码来源:CommunicationObject.cs

示例15: Close

 private void Close()
 {
     lock (this.ThisLock)
     {
         if (this.state == CommunicationState.Closed)
         {
             return;
         }
         this.state = CommunicationState.Closed;
     }
     if (this.connectionQueue != null)
     {
         this.connectionQueue.Close();
     }
     if (this.reconnectEvent != null)
     {
         this.reconnectEvent.Close();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:SharedConnectionListener.cs


注:本文中的CommunicationState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。