Exemple #1
0
        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
            {
                AnClient.Init(txtUrl.Text);
                await AnClient.Login(uid, "----------" + pwd,
                                     (code, resp) =>
                {
                    client           = new SessionClient(resp.ssInf);
                    txtRegistry.Text = client.ssInf.ssid;
                });
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Jserv Login Exception");
            }
        }
Exemple #2
0
        AlbumContext login(string uid, string pswd)
        {
            if (LangExt.isblank(photoUser.device, new string[] { "\\.", "/", "\\?", ":" }))
            {
                throw new Exception("Device Id is null.");
            }

            AnClient.Init(jserv + "/" + jdocbase, verbose);

            LoginHandler callback = new LoginHandler();

            AnClient.Login(uid, pswd, photoUser.device, callback, callback);

            /*
             *  (SessionClient client) =>
             *  {
             *      client.closeLink();
             *
             *      tier = new AlbumClientier(clientUri, client, errCtx);
             *
             *      client.openLink(clientUri, onHeartbeat, onLinkBroken, 19900); // 4 times failed in 3 min
             *              state = ConnState.Online;
             *              if (onOk != null)
             *                  onOk.ok(tier);
             *  },
             *  // Design Note: since error context don't have unified error message box,
             *  // error context pattern of React is not applicable.
             *  // errCtx.onError(c, r, (Object)v);
             *  (MsgCode c, string r, object v) => {
             *      state = ConnState.LoginFailed;
             *      if (onErr != null)
             *          onErr.err(c, r, v);
             *  }, photoUser.device);
             */
            return(this);
        }