Beispiel #1
0
 /// <summary>
 /// 处理收到的双工回调(仅报告有变化的Runner)
 /// </summary>
 void executeServiceCallback_OnRunnerStateChange(ExecuteServiceCallback sender, RemoteRunnerInfo remoteRunnerInfo)
 {
     if (OnRunnerStateChange != null)
     {
         this.OnRunnerStateChange(this, remoteRunnerInfo);
     }
     if (remoteRunnerInfo == null)
     {
         if (showWindow != null)
         {
             showWindow.ShowError("Null Data" + "\r\n");
         }
         return;
     }
     if (remoteRunnerInfo.RunnerStateList != null)
     {
         if (showWindow != null)
         {
             showWindow.UpdataRemoteRunnerView(remoteRunnerInfo);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 创建一个【ExecuteServiceClient】实例
        /// </summary>
        /// <returns>【ExecuteServiceClient】实例</returns>
        private ExecuteServiceClient RestartClient()
        {
            if (instanceContext == null)
            {
                //InstanceContext
                ExecuteServiceCallback executeServiceCallback = new ExecuteServiceCallback();
                executeServiceCallback.OnRunnerStateChange += executeServiceCallback_OnRunnerStateChange;
                instanceContext = new InstanceContext(executeServiceCallback);
                //Binding
                System.ServiceModel.Channels.Binding binding = new WSDualHttpBinding();
                ((System.ServiceModel.WSDualHttpBinding)(binding)).Security.Mode = WSDualHttpSecurityMode.None;
                ((System.ServiceModel.WSDualHttpBinding)(binding)).Security.Message.ClientCredentialType = MessageCredentialType.UserName;
                binding.SendTimeout    = new TimeSpan(0, 0, 10);
                binding.OpenTimeout    = new TimeSpan(0, 0, 10);
                binding.ReceiveTimeout = new TimeSpan(0, 0, 10);

                System.ServiceModel.Channels.Binding tcpBinding = new NetTcpBinding();
                ((System.ServiceModel.NetTcpBinding)(tcpBinding)).Security.Mode = SecurityMode.None;
                ((System.ServiceModel.NetTcpBinding)(tcpBinding)).Security.Message.ClientCredentialType = MessageCredentialType.UserName;
                tcpBinding.SendTimeout    = new TimeSpan(0, 0, 10);
                tcpBinding.OpenTimeout    = new TimeSpan(0, 0, 10);
                tcpBinding.ReceiveTimeout = new TimeSpan(0, 0, 10);

                executeServiceClient = new ExecuteServiceClient(instanceContext, binding, myEp);
                //executeServiceClient = new ExecuteServiceClient(instanceContext, new WSDualHttpBinding(), myEp);

                instanceContext.Closed += instanceContext_Closed;
                instanceContext.Opened += instanceContext_Opened;
                return(executeServiceClient);
            }
            else
            {
                instanceContext.Closed -= instanceContext_Closed;
                instanceContext.Opened -= instanceContext_Opened;
                instanceContext         = null;
                return(RestartClient());
            }
        }