Exemplo n.º 1
0
        /// <summary>
        /// 登录
        /// </summary>
        public void Login()
        {
            DataCenter.LoadData(1);
            Close();
            return;

            int state = DataCenter.Connect();

            if (state == -1)
            {
                m_mainFrame.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_mainFrame.ShowMessageBox("请输入邮箱!", "提示", 0);
                return;
            }
            if (userName.IndexOf("@") == -1)
            {
                m_mainFrame.ShowMessageBox("邮箱格式不符合要求!", "提示", 0);
                return;
            }
            if (passWord.Length == 0)
            {
                m_mainFrame.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;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 重绘背景
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public override void OnPaintBackground(CPaint paint, RECT clipRect)
        {
            int  width    = Width;
            int  height   = Height;
            int  mw       = width / 2;
            int  mh       = height / 2;
            RECT drawRect = new RECT(0, 0, width, height);

            if (m_isClose)
            {
                long lineColor   = CDraw.PCOLORS_LINECOLOR;
                RECT ellipseRect = new RECT(1, 1, width - 2, height - 2);
                paint.FillEllipse(CDraw.PCOLORS_UPCOLOR, ellipseRect);
                paint.DrawLine(lineColor, 2, 0, 4, 4, width - 7, height - 7);
                paint.DrawLine(lineColor, 2, 0, 4, height - 7, width - 7, 3);
            }
            else
            {
                int cornerRadius = 3;
                if (m_arrowType > 0)
                {
                    cornerRadius = 0;
                }
                ControlA parent = Parent;
                if (parent != null)
                {
                    TabControlA tabControl = parent as TabControlA;
                    if (tabControl != null)
                    {
                        cornerRadius = 0;
                    }
                }
                paint.FillGradientRect(CDraw.PCOLORS_BACKCOLOR, CDraw.PCOLORS_BACKCOLOR2, drawRect, cornerRadius, m_angle);
                paint.DrawRoundRect(COLOR.CONTROLBORDER, 1, 0, drawRect, cornerRadius);
            }
            if (m_arrowType > 0)
            {
                POINT[] points = new POINT[3];
                int     dSize  = Math.Min(width, height) / 4;
                switch (m_arrowType)
                {
                //向左
                case 1:
                    points[0] = new POINT(mw - dSize, mh);
                    points[1] = new POINT(mw + dSize, mh - dSize);
                    points[2] = new POINT(mw + dSize, mh + dSize);
                    break;

                //向右
                case 2:
                    points[0] = new POINT(mw + dSize, mh);
                    points[1] = new POINT(mw - dSize, mh - dSize);
                    points[2] = new POINT(mw - dSize, mh + dSize);
                    break;

                //向上
                case 3:
                    points[0] = new POINT(mw, mh - dSize);
                    points[1] = new POINT(mw - dSize, mh + dSize);
                    points[2] = new POINT(mw + dSize, mh + dSize);
                    break;

                //向下
                case 4:
                    points[0] = new POINT(mw, mh + dSize);
                    points[1] = new POINT(mw - dSize, mh - dSize);
                    points[2] = new POINT(mw + dSize, mh - dSize);
                    break;
                }
                paint.FillPolygon(CDraw.PCOLORS_FORECOLOR, points);
            }
            //绘制选中效果
            if (paint.SupportTransparent())
            {
                if (Selected)
                {
                    paint.FillRect(CDraw.PCOLORS_BACKCOLOR8, drawRect);
                }
                else
                {
                    INativeBase native = Native;
                    if (this == native.PushedControl)
                    {
                        paint.FillRect(CDraw.PCOLORS_BACKCOLOR4, drawRect);
                    }
                    else if (this == native.HoveredControl)
                    {
                        paint.FillRect(CDraw.PCOLORS_BACKCOLOR3, drawRect);
                    }
                }
            }
        }