Beispiel #1
0
        /// <summary>
        /// 登录
        /// </summary>
        public void Login()
        {
            int state = DataCenter.Connect();

            if (state == -1)
            {
                m_chart.ShowMessageBox("无法连接服务器!", "提示", 0);
                return;
            }
            TabControlA tabLogin        = GetTabControl("tabLogin");
            TabPageA    selectedTabpage = tabLogin.SelectedTabPage;
            TextBoxA    txtUserName     = GetTextBox("txtUserName");
            TextBoxA    txtPassword     = GetTextBox("txtPassword");
            String      userName        = txtUserName.Text;
            String      passWord        = txtPassword.Text;

            if (userName.Length == 0)
            {
                m_chart.ShowMessageBox("请输入邮箱!", "提示", 0);
                return;
            }
            if (userName.IndexOf("@") == -1)
            {
                m_chart.ShowMessageBox("邮箱格式不符合要求!", "提示", 0);
                return;
            }
            if (passWord.Length == 0)
            {
                m_chart.ShowMessageBox("请输入密码!", "提示", 0);
                return;
            }
            int ret = m_loginService.Login(userName, passWord, m_loginRequestID);

            if (ret != -1)
            {
                UserCookieService cookieService = DataCenter.UserCookieService;
                UserCookie        cookie        = new UserCookie();
                cookie.m_key   = "LOGININFO";
                cookie.m_value = userName + "," + passWord;
                cookieService.AddCookie(cookie);
                m_window.Enabled = false;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 显示
        /// </summary>
        public override void Show()
        {
            UserCookieService cookieService = DataCenter.UserCookieService;
            UserCookie        cookie        = new UserCookie();

            if (cookieService.GetCookie("LOGININFO", ref cookie) > 0)
            {
                String[] strs = cookie.m_value.Split(',');
                if (strs.Length >= 2)
                {
                    TextBoxA txtUserName = GetTextBox("txtUserName");
                    TextBoxA txtPassword = GetTextBox("txtPassword");
                    txtUserName.Text = strs[0];
                    txtPassword.Text = strs[1];
                }
            }
            m_window.Location = new POINT(-m_window.Width, -m_window.Height);
            m_window.AnimateShow(true);
            m_window.Invalidate();
            m_sky      = new Sky();
            m_sky.Size = new SIZE(m_window.Width, 200);
            m_window.Frame.AddControl(m_sky);
            m_window.RegisterEvent(new ControlEvent(WindowLocationChanged), EVENTID.LOCATIONCHANGED);
        }