Ejemplo n.º 1
0
 public MainFrame(User user)
 {
     User = user;
     Data = new SgllData(user);
     SgController = new SgllController(Data);
     MultipleUserCtl.RegisterController(user.GetMultiCtrlKey(), SgController);
     InitializeComponent();
 }
Ejemplo n.º 2
0
        private void newtab(User user)
        {
            // check if repeat login
            for (int i = 1; i < tabControl1.TabCount; i++)
            {
                if (!(tabControl1.TabPages[i].Controls[0] is MainFrame))
                    continue;
                MainFrame mf = tabControl1.TabPages[i].Controls[0] as MainFrame;
                if (mf.User.GetMultiCtrlKey() == user.GetMultiCtrlKey())
                {
                    textLog.AppendText(string.Format("[{0}][{1}] {2}{3}",
                        DateTime.Now.ToString(),
                        "Info",
                        "重复登录" + user.GetMultiCtrlKey(),
                        Environment.NewLine));
                    return;
                }
            }

            TabPage tp = new TabPage();
            MainFrame uc1 = new MainFrame(user);
            uc1.TP = tp;
            uc1.Dock = DockStyle.Fill;
            tp.Controls.Add(uc1);
            tabControl1.TabPages.Add(tp);
            tabControl1.SelectTab(tp);
            uc1.Login();
        }