Esempio n. 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());
 }
Esempio n. 2
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());
        }
Esempio n. 3
0
 public static UserPanelController Create(ref DBDelegateBridge.UIMoney uim, ref DBDelegateBridge.UIStockHold uis, ref InfoDelegate.SetWin setWin)
 {
     if (UPC == null)
     {
         UPC = new UserPanelController(ref uim, ref uis, ref setWin);
         return(UPC);
     }
     else
     {
         return(UPC);
     }
 }
Esempio n. 4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            InfoShowTimer = new Timer(ShowBoxCheck, null, 0, 2 * 1000);
            InfoShowTimer.Change(-1, 0);
            infoshow = new InfoShow();
            UserCanvas.Visibility = Visibility.Hidden;
            total.IsEnabled       = false;
            total.Text            = "0";
            now.IsEnabled         = false;
            now.Text = "0";

            //托盘
            notifyIcon.Click += MaxMinMessage;
            notifyIcon.Text   = "股票记录器";
            notifyIcon.Icon   = Properties.Resources.Icon;
            System.Windows.Forms.ContextMenuStrip  cs  = new System.Windows.Forms.ContextMenuStrip();
            System.Windows.Forms.ToolStripMenuItem tsm = new System.Windows.Forms.ToolStripMenuItem();
            tsm.Text   = "关于";
            tsm.Click += ShowAbout;
            cs.Items.Add(tsm);
            notifyIcon.ContextMenuStrip = cs;
            notifyIcon.Visible          = true;

            ShowNotifyMessage("程序初始化中!");

            //程序开始准备
            this.Hide();
            StockStateBoxController.Create(ref StockCanvas);
            UserBoxController.Create(ref UserCanvas);
            DBDelegateBridge.UIMoney     uim    = new DBDelegateBridge.UIMoney(GetDelegateValues);
            DBDelegateBridge.UIStockHold uis    = new DBDelegateBridge.UIStockHold(StockStateBoxController.Handler().GetDelegateValues);
            InfoDelegate.SetWin          setwin = new InfoDelegate.SetWin(setWin);
            UserPanelController          UPC    = UserPanelController.Create(ref uim, ref uis, ref setwin);

            Adapter.ErrorAdapter.Show(NetState.Check("0000001"));
            this.Show();
            //UserPanelController.Create(ref UserPanel);
            //DBSyncController.Handler().SetMoneyDelegate(new DBDataController.ChangeMoney(setPrincipal), new DBDataController.ChangeMoney(setTotal), new DBDataController.ChangeMoney(setNow));
            //MoneyEntity ME;
            //DBSyncController.Handler().MoneyRead(out ME);
            //total.Text = String.Format("{0:F}", ME.total);
            //now.Text = String.Format("{0:F}", ME.now);
            //StockBox();
        }
Esempio n. 5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            InfoShowTimer = new Timer(ShowBoxCheck, null, 0, 2 * 1000);
            InfoShowTimer.Change(-1, 0);
            infoshow = new InfoShow();
            UserCanvas.Visibility = Visibility.Hidden;
            total.IsEnabled = false;
            total.Text = "0";
            now.IsEnabled = false;
            now.Text = "0";

            //托盘
            notifyIcon.Click += MaxMinMessage;
            notifyIcon.Text = "股票记录器";
            notifyIcon.Icon = Properties.Resources.Icon;
            System.Windows.Forms.ContextMenuStrip cs = new System.Windows.Forms.ContextMenuStrip();
            System.Windows.Forms.ToolStripMenuItem tsm = new System.Windows.Forms.ToolStripMenuItem();
            tsm.Text = "关于";
            tsm.Click += ShowAbout;
            cs.Items.Add(tsm);
            notifyIcon.ContextMenuStrip = cs;
            notifyIcon.Visible = true;

            ShowNotifyMessage("程序初始化中!");

            //程序开始准备
            this.Hide();
            StockStateBoxController.Create(ref StockCanvas);
            UserBoxController.Create(ref UserCanvas);
            DBDelegateBridge.UIMoney uim = new DBDelegateBridge.UIMoney(GetDelegateValues);
            DBDelegateBridge.UIStockHold uis = new DBDelegateBridge.UIStockHold(StockStateBoxController.Handler().GetDelegateValues);
            InfoDelegate.SetWin setwin = new InfoDelegate.SetWin(setWin);
            UserPanelController UPC = UserPanelController.Create(ref uim, ref uis, ref setwin);
            Adapter.ErrorAdapter.Show(NetState.Check("0000001"));
            this.Show();
            //UserPanelController.Create(ref UserPanel);
            //DBSyncController.Handler().SetMoneyDelegate(new DBDataController.ChangeMoney(setPrincipal), new DBDataController.ChangeMoney(setTotal), new DBDataController.ChangeMoney(setNow));
            //MoneyEntity ME;
            //DBSyncController.Handler().MoneyRead(out ME);
            //total.Text = String.Format("{0:F}", ME.total);
            //now.Text = String.Format("{0:F}", ME.now);    
            //StockBox();
        }