示例#1
0
文件: ClientMain.cs 项目: ndong211/bo
        private void init()
        {
            this.WindowState = FormWindowState.Minimized;
            Control.CheckForIllegalCrossThreadCalls = false;
            DataProcessUtil.setAppPath(Application.ExecutablePath);

            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

            bool autoStart;
            string lastUserId;
            int closeoption = 1;
            bool nevernotifyclose = false;
            string preversion;
            List<UserInfo> users = FileUtils.getUsers(out autoStart, out lastUserId, out closeoption, out nevernotifyclose, out preversion);

            bool autologin = false;
            foreach (UserInfo u in users)
            {
                if (u.userNo.Trim() == lastUserId)
                {
                    autologin = u.autoLogin.Equals("true");
                    break;
                }
            }

            if (!preversion.Equals(Constants.currentVersion))
            {
                MessageBox.Show("成功升级到版本:"+Constants.currentVersion);
                FileUtils.setAutoStart(autoStart, closeoption, nevernotifyclose);
            }

            versionlabel.Text += "("+Constants.currentVersion+")";

            LoginForm loginform = LoginForm.getInstance(true);

            if (loginform.BBind())
            {
                loginform.Show();

            }
            else
            {
                FirstNotifyWindow firstNotify = new FirstNotifyWindow();
                firstNotify.setLoginWindow(loginform);
                firstNotify.Show();
            }

            showNotifyIcon();

            if (!autologin)
            {
                startDetectThread();
            }

            this.panel2.HorizontalScroll.Visible = false;
        }
示例#2
0
文件: ClientMain.cs 项目: ndong211/bo
        //图标双击,显示主窗口
        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            LoginForm loginform = LoginForm.getInstance(false);
            loginform.Hide();
            List<UserInfo> users = loginform.getUsers();
            if (users != null && users.Count > 0)
            {
                if (this.WindowState == FormWindowState.Normal)
                {
                   // this.TopMost = true;
                    this.BringToFront();
                    this.Show();
                    msgChanged = true;
                    this.Invoke(new System.EventHandler(panel2_Click), new object[] { null, null });
                }
                else
                {
                    this.TopMost = true;
                    this.Show();
                    msgChanged = true;
                    this.WindowState = FormWindowState.Normal;
                    this.Invoke(new System.EventHandler(panel2_Click), new object[] { null, null });
                }
            }
            else
            {
                loginform.Hide();

                FirstNotifyWindow firstNotify = new FirstNotifyWindow();
                firstNotify.setLoginWindow(loginform);
                firstNotify.TopMost = true;
                firstNotify.Show();
            }
        }
示例#3
0
文件: ClientMain.cs 项目: ndong211/bo
        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripItem item = e.ClickedItem;
            if (item == null) return;

            if (item.Text.Equals("显示主窗口"))
            {
                LoginForm loginform = LoginForm.getInstance(false);
                loginform.Hide();
                List<UserInfo> users = loginform.getUsers();
                if (users != null && users.Count > 0)
                {
                    if (this.WindowState == FormWindowState.Normal)
                    {
                        this.BringToFront();
                        this.Show();
                        msgChanged = true;
                        this.Focus();
                    }
                    else
                    {
                        this.TopMost = true;
                        this.Show();
                        msgChanged = true;
                        this.WindowState = FormWindowState.Normal;
                        this.Focus();
                    }
                }
                else
                {
                    loginform.Hide();

                    FirstNotifyWindow firstNotify = new FirstNotifyWindow();
                    firstNotify.setLoginWindow(loginform);
                    firstNotify.TopMost = true;
                    firstNotify.Show();
                }

            }
            else if (item.Text.Equals("退出"))
            {
                clearPopup();
                forceExit = true;

                if (!exit)
                {
                    exit = true;
                    msgDetectThread.Join();
                }

                Thread.Sleep(100);
                LoginForm.getInstance(false).ForceExit();
                Application.Exit();
            }
            else if (item.Text.Equals("进入一发系统"))
            {
                if (DataProcessUtil.isLogin())
                {
                    if (!URLNavigator.ffOpenURL(Constants.getYiFaHomepage(DataProcessUtil.getUserNo())))
                    {
                        Utils.FFUpdate();
                    }
                }
                else//还没登陆,显示登陆页
                {
                    LoginForm loginform = LoginForm.getInstance(true);
                    loginform.TopMost = true;
                    loginform.Show();
                }
            }
            else if (item.Text.Equals("切换帐号"))
            {
                LoginForm loginform = LoginForm.getInstance(false);
                if (loginform.WindowState == FormWindowState.Minimized)
                {
                    this.TopMost = true;
                    this.Show();
                    this.WindowState = FormWindowState.Normal;
                    this.Hide();
                    DataProcessUtil.logOut();
                    bSwitching = true;
                    loginform.BringToFront();
                    loginform.WindowState = FormWindowState.Normal;
                    loginform.Show();
                }
                else
                {
                    this.TopMost = true;
                    this.Show();
                    this.WindowState = FormWindowState.Normal;
                    this.Hide();
                    DataProcessUtil.logOut();
                    bSwitching = true;
                    loginform.TopMost = true;
                    if (loginform.WindowState == FormWindowState.Minimized)
                    {
                        loginform.Show();
                    }
                    else
                    {
                        loginform.BringToFront();
                        loginform.Show();
                    }
                }
            }
        }