public void PingStatus(string name, WebRobotManagementStatus status)
        {
            Action <string, WebRobotManagementStatus> runAction = (x, y) =>
            {
                if (status == WebRobotManagementStatus.STOPPED ||
                    status == WebRobotManagementStatus.ERROR)
                {
                    ChannelFactory <IWebManagementLog> cf = null;
                    try
                    {
                        cf = new ChannelFactory <IWebManagementLog>(new WebHttpBinding(), url);
                        cf.Endpoint.Behaviors.Add(new WebHttpBehavior());
                        var channel = cf.CreateChannel();

                        channel.PingRobotStatus(x, y);
                        cf.Close();
                    }
                    catch (Exception ex)
                    {
                        cf.Abort();
                        Console.WriteLine(ex);
                        // ignore, probably client down
                    }
                }
            };

            runAction.BeginInvoke(name, status, r => { runAction.EndInvoke(r); }, null);
        }
示例#2
0
 public void PingRobotStatus(string name, WebRobotManagementStatus state)
 {
     if (OnWebRobotStatus != null)
     {
         Dispatcher.CurrentDispatcher.BeginInvoke(OnWebRobotStatus, name, state);
     }
 }