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(); }); }
public QueryViewModel() { _client = RunContext.Get <Client.Client>(); this.PropertyChanged += QueryViewModel_PropertyChanged; this._titles = this._modelDict.Keys.ToList(); _titles.ForEach(i => _data.Columns.Add(i, typeof(string))); this.SetStatus("查询!"); }
public QueriesViewModel() { this.Pages.Add(new Function { Name = "查询", ViewId = "Query" }); this.Pages.Add(new Function { Name = "导入", ViewId = "ItemsImport" }); RunContext.Get <StatusManager>().SetTarget(this); }
public void StartService(string serverPath, int serverPort, string requestPath, int requestPort) { switch (RunMode) { case 1: RunContext.TryAdd(() => new Client.Client(requestPath, requestPort)); break; case 2: RunContext.TryAdd(() => new ServiceAfter(StartEmbeded, serverPath, serverPort)); RunContext.Get <ServiceAfter>().Run(); break; case 3: RunContext.TryAdd(() => new Client.Client(requestPath, requestPort)); RunContext.TryAdd(() => new ServiceAfter(StartEmbeded, serverPath, serverPort)); RunContext.Get <ServiceAfter>().Run(); break; } }