private async void btnLogin_Click(object sender, EventArgs e) { uid = txtUser.Text; string pwd = pswd.Text; if (string.IsNullOrEmpty(uid) || string.IsNullOrEmpty(pwd) || uid.Length != 5 || pwd.Length != 6) { MessageBox.Show("login", "user/password invalid!"); return; } try { Clients.Init(txtUrl.Text); await Clients.Login(uid, "----------" + pwd, (code, resp) => { client = new AnsonClient(resp.ssInf); txtRegistry.Text = client.ssInf.ssid; }); } catch (Exception x) { MessageBox.Show(x.Message, "Jserv Login Exception"); } }
public static void UploadUi(AnsonClient client, string busic, string uid, List <string> fullpaths, Action <SemanticObject> onOk = null) { // upload to a_attaches if (client == null) { MessageBox.Show("Please connect first.", "Upload With UI"); } else { client.AttachFiles(fullpaths, busic ?? "a_users", uid, (c, d) => { SemanticObject resulved = (SemanticObject)((AnsonResp)d).Map("resulved"); if (onOk != null) { onOk(resulved); } }); } }
private async void onLogin(object sender, EventArgs e) { string uid = txtUser.Text; string pwd = pswd.Text; if (string.IsNullOrEmpty(uid) || string.IsNullOrEmpty(pwd) || uid.Length != 5 || pwd.Length != 6) { MessageBox.Show("user/password invalid!", "login"); return; } Clients.Init(txtUrl.Text);// + "/login.serv11"); await Clients.Login(uid, "----------" + pwd, (code, resp) => { client = new AnsonClient(resp.ssInf); txtRegistry.Text = client.ssInf.ssid; }); }