Exemple #1
0
        public int openT6 = -1;//0 社保卡是否正常打开  0正常 非0不正常++++++++++

        #region 加载事件
        private void MainForm_Load(object sender, EventArgs e)
        {
            AppContext.Session.openStatus = false;
            cmd.ShowOpaqueLayer(0f);
            String deptName = "无";

            if (AppContext.Session.deptList.Count > 0)
            {
                deptName = AppContext.Session.deptList[0].name;
            }
            labBottomLeft.Text = deptName + " | " + AppContext.Session.name + " | " + System.DateTime.Now.ToString();
            this.timer1.Start();

            tmHeartbeat.Enabled = true;

            //获取父级为1的菜单
            List <MenuEntity> menuList = new List <MenuEntity>();

            for (int i = 0; i < AppContext.Session.menuList.Count(); i++)
            {
                MenuEntity menu = AppContext.Session.menuList[i];
                if (menu.parentId.Equals("1"))
                {
                    menuList.Add(menu);
                }
            }
            //排序菜单
            menuList = menuList.OrderBy(x => x.sort).ToList();
            //循环添加菜单
            panMenuBar.Controls.Clear();
            foreach (MenuEntity menu in menuList)
            {
                AddContextMenu(menu.id, menu.name, menu.href, panMenuBar);
            }
            cmd.ShowOpaqueLayer(0f, "初始化读卡器...");
            this.DoWorkAsync(500, (o) => //耗时逻辑处理(此处不能操作UI控件,因为是在异步中)
            {
                //Thread.Sleep(1000);
                //初始化T6 有线程延迟
                openT6 = HardwareInitialClass.OpenDevice();
                if (openT6 != 0)
                {
                    LogClass.WriteLog("社保读卡器初始化失败:");
                }
                else
                {
                    LogClass.WriteLog("社保读卡器初始化成功");
                }
                return(null);
            }, null, (data) => //显示结果(此处用于对上面结果的处理,比如显示到界面上)
            {
                //显示欢迎页
                WelcomeForm form = new WelcomeForm();
                AaddUserControl(form, "Welcome", "欢迎页");
                cmd.HideOpaqueLayer();
            });
            //AppContext.Session.waitControl = xtraTabControl1;
        }
Exemple #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            AppContext.Session.openStatus = false;
            cmd.ShowOpaqueLayer(0f);
            var deptName = "无";

            if (AppContext.Session.deptList.Count > 0)
            {
                deptName = AppContext.Session.deptList[0].name;
            }
            labBottomLeft.Text = deptName + " | " + AppContext.Session.name + " | " + System.DateTime.Now.ToString();
            timer1.Start();

            tmHeartbeat.Enabled = true;

            var menuList = new List <MenuEntity>();

            for (var i = 0; i < AppContext.Session.menuList.Count(); i++)
            {
                var menu = AppContext.Session.menuList[i];
                if (menu.parentId.Equals("1"))
                {
                    menuList.Add(menu);
                }
            }
            menuList = menuList.OrderBy(x => x.sort).ToList();
            panMenuBar.Controls.Clear();
            foreach (MenuEntity menu in menuList)
            {
                AddContextMenu(menu.id, menu.name, menu.href, panMenuBar);
            }
            cmd.ShowOpaqueLayer(0f, "初始化读卡器...");
            DoWorkAsync(500, (o) =>
            {
                openT6 = HardwareInitialClass.OpenDevice();
                if (openT6 != 0)
                {
                    Xr.Log4net.LogHelper.Info("社保读卡器初始化失败:");
                }
                else
                {
                    Xr.Log4net.LogHelper.Info("社保读卡器初始化成功");
                }
                return(null);
            }, null, (data) =>
            {
                var form = new WelcomeForm();
                AaddUserControl(form, "Welcome", "欢迎页");
                cmd.HideOpaqueLayer();
            });
        }