Exemplo n.º 1
0
        public bool Login(string ip, string port, WCFClientHostType hostType, string user, string pass)
        {
            this.Ip   = ip;
            this.Port = port;
            SignalRClientLib.SignalRAppContext.SetUrl(ip, "8735");
            try
            {
                WCFClientLib.LocationClient client = new WCFClientLib.LocationClient(ip, port, hostType);

                LoginInfo = client.InnerClient.Login(new LoginInfo()
                {
                    UserName = user, Password = pass
                });
                Client = client;
                bool isSuccess = LoginInfo != null && !string.IsNullOrEmpty(LoginInfo.Session);
                if (isSuccess)
                {
                    CallbackClient = new LocationCallbackClient(ip, "8734");
                    CallbackClient.Connect();
                }
                return(isSuccess);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
    public LocationServiceClient GetLocationServiceClient()
    {
        if (client == null)
        {
            string hostName = "localhost";
            string port     = "8733";
            //System.ServiceModel.Channels.Binding wsBinding = new BasicHttpBinding();
            //string url =
            //    string.Format("http://{0}:{1}/LocationServices/Locations/LocationService",
            //        hostName, port);
            //EndpointAddress endpointAddress = new EndpointAddress(url);

            //if (client != null)
            //{
            //    if (client.State == CommunicationState.Opened)
            //    {
            //        client.Close();
            //    }
            //}

            //client = new LocationServiceClient(wsBinding, endpointAddress);

            LocationClient locClient = new LocationClient(hostName, port);
            client = locClient.InnerClient;

            Debug.Log("LocationCallbackClient");
            callBack = new LocationCallbackClient(hostName, "8734");
            callBack.LocAlarmsReceved += CallBack_LocAlarmsReceved;

            bool r = callBack.Connect();
            Debug.Log("Connect:" + r);
            if (r == false)
            {
                Debug.LogError(callBack.Exception.ToString());
            }
            else
            {
            }
        }
        return(client);
    }
Exemplo n.º 3
0
 private void GetLocationCallbacksClient()
 {
     Client2 = new LocationCallbackClient(TbHost.Text, "8734");
     bool r = Client2.Connect();
     //alarmServiceClient = Client2.Client;
 }