Ejemplo 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);
            }
        }
        private void BtnLogin_OnClick(object sender, RoutedEventArgs e)
        {
            int type = CbHostType.SelectedIndex;
            WCFClientHostType hostType = (WCFClientHostType)type;
            string            port     = CbPort.Text;
            string            ip       = TbIp.Text;
            string            user     = TbUser.Text;
            string            pass     = TbPass.Text;

            if (AppContext.Instance.Login(ip, port, hostType, user, pass))
            {
                ClientWindow clientWindow = new ClientWindow();
                clientWindow.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("登录失败");
            }
        }
Ejemplo n.º 3
0
 public LocationClient(string host, string port, WCFClientHostType hostType) : base(host, port, hostType)
 {
     SetConnectInfo();
 }
Ejemplo n.º 4
0
 public WCFClient(string host, string port, WCFClientHostType hostType)
 {
     Host     = host;
     Port     = port;
     HostType = hostType;
 }