示例#1
0
        public LoginViewModel()
        {
            var config = RunContext.Get <Configuration>();

            this.RunMode      = config.RunMode;
            this.StartEmbeded = config.ServiceStartMode;
            this.ServerIp     = config.ServerPath;
            var reqPort = config.RequestPort;
            var svrPort = config.ServerPort;

            OkCommand = new RelayCommand(() =>
            {
                StartService(ServerIp, svrPort, ServerIp, reqPort);
                var t = RunContext.Get <Client.Client>().User.Login(new UserModel
                {
                    UserName = this.UserName,
                    Password = this.Password
                });
                t.ContinueWith(i =>
                {
                    this.StatusText = i.Result.Information;
                    if (i.Result.ResultCode == ResultCode.Ok.ToInt())
                    {
                        IsPassOn = true;
                    }
                });
                //t.Start();
            });

            RegisterCommand = new RelayCommand(() =>
            {
                StartService(ServerIp, svrPort, ServerIp, reqPort);
                RunContext.GetNew <RegisterWindow>().Show();
            });
        }