Example #1
0
 private UserPanelController(ref DBDelegateBridge.UIMoney uim, ref DBDelegateBridge.UIStockHold uis, ref InfoDelegate.SetWin setWin)
 {
     this.uim = uim;
     this.uis = uis;
     this.setWin = setWin;
     usersController = new UsersController();
     DB_ERROR DBE = usersController.GetLastError();
     if (DBE == DB_ERROR.DB_DATA_NOT_EXISTS)
     {
         InputMoney dlg = new InputMoney();
         dlg.ShowDialog();
         if (dlg.m == 0)
         {
             Application.Current.Shutdown();
             return;
         }
         usersController.AddNewUser(dlg.n, dlg.m);
     }
     else if (DBE != DB_ERROR.DB_OK)
     {
         Adapter.ErrorAdapter.Show(DBE);
         Application.Current.Shutdown();
         return;
     }
     List<string> users = usersController.GetUserList();
     UserBoxController.Handler().setEventHandler(UserChange);
     foreach (string name in users)
     {
         //选择
         UserBoxController.Handler().Add(name, usersController.GetUserControler(name).PrincipalRead());
     }
     UserChange(users.First());
 }
Example #2
0
        private void UserChange(object sender, EventArgs e)
        {
            UserBox ub   = (UserBox)sender;
            string  name = ub.name.Content.ToString();

            if (this.name == name)
            {
                return;
            }
            if (name == "添加账户")
            {
                InputMoney dlg = new InputMoney();
                dlg.ShowDialog();
                if (dlg.m == 0)
                {
                    return;
                }
                name = dlg.n;
                if (usersController.GetUserControler(name) == null)
                {
                    UserPanelController.Handler().AddUser(dlg.n, dlg.m);
                    MainWindow.ShowNotifyMessage("成功添加新账户\n账户名:" + dlg.n + "本金:" + dlg.m);
                }
                else
                {
                    MessageBox.Show("账户名已存在");
                    return;
                }
            }
            UserChange(name);
        }
Example #3
0
        private UserPanelController(ref DBDelegateBridge.UIMoney uim, ref DBDelegateBridge.UIStockHold uis, ref InfoDelegate.SetWin setWin)
        {
            this.uim        = uim;
            this.uis        = uis;
            this.setWin     = setWin;
            usersController = new UsersController();
            DB_ERROR DBE = usersController.GetLastError();

            if (DBE == DB_ERROR.DB_DATA_NOT_EXISTS)
            {
                InputMoney dlg = new InputMoney();
                dlg.ShowDialog();
                if (dlg.m == 0)
                {
                    Application.Current.Shutdown();
                    return;
                }
                usersController.AddNewUser(dlg.n, dlg.m);
            }
            else if (DBE != DB_ERROR.DB_OK)
            {
                Adapter.ErrorAdapter.Show(DBE);
                Application.Current.Shutdown();
                return;
            }
            List <string> users = usersController.GetUserList();

            UserBoxController.Handler().setEventHandler(UserChange);
            foreach (string name in users)
            {
                //选择
                UserBoxController.Handler().Add(name, usersController.GetUserControler(name).PrincipalRead());
            }
            UserChange(users.First());
        }
        void ReleaseDesignerOutlets()
        {
            if (InputMoney != null)
            {
                InputMoney.Dispose();
                InputMoney = null;
            }

            if (ViewSetMoney != null)
            {
                ViewSetMoney.Dispose();
                ViewSetMoney = null;
            }

            if (WebView1 != null)
            {
                WebView1.Dispose();
                WebView1 = null;
            }
        }
Example #5
0
 private void UserChange(object sender, EventArgs e)
 {
     UserBox ub = (UserBox)sender;
     string name = ub.name.Content.ToString();
     if (this.name == name)
         return;
     if (name == "添加账户")
     {
         InputMoney dlg = new InputMoney();
         dlg.ShowDialog();
         if (dlg.m == 0)
         {
             return;
         }
         name = dlg.n;
         if (usersController.GetUserControler(name) == null)
         {
             UserPanelController.Handler().AddUser(dlg.n, dlg.m);
             MainWindow.ShowNotifyMessage("成功添加新账户\n账户名:" + dlg.n + "本金:" + dlg.m);
         }
         else
         {
             MessageBox.Show("账户名已存在");
             return;
         }
     }
     UserChange(name);
 }