示例#1
0
        public override bool Init()
        {
            List <string> lst = new List <string>();

            lst.Add("A");
            lst.Add("C");

            rir = new RemoteInfoReceiver(lst, SynCallbackInfo);
            return(base.Init());
        }
示例#2
0
        /// <summary>
        ///  系统初始化处理
        /// </summary>
        public bool Init()
        {
            if (EmpInfo.Id <= 0)
            {
                this.Close();
                return(false);
            }

            //  人员基本信息
            LogHelper.Info(this, "系统初始化 --- 设置人员有关信息");
            this.bsiOper.Caption         = EmpInfo.Name + "(" + EmpInfo.BizDeptName + ")";
            this.bsiIP.Caption           = EnvInfo.ComputerIp;
            this.bsiUser.Caption         = EnvInfo.UserName;
            this.bbiChangeChoice.Caption = (EmpInfo.InputChoice == "1") ? "首拼" : "五笔";
            LinkMacAddress.Caption       = "未识别";
            for (int i = 0; i < EnvInfo.ComputerMacIpList.Count; i++)
            {
                if (i == 0)
                {
                    LinkMacAddress.Caption = EnvInfo.ComputerMacIpList[i].Mac;
                }
                else
                {
                    var item = new BarHeaderItem {
                        Caption = EnvInfo.ComputerMacIpList[i].Mac, AllowRightClickInMenu = false
                    };
                    LinkMacAddress.LinksPersistInfo.Add(new LinkPersistInfo(item));
                }
            }
            //初始化子系统
            LogHelper.Info(this, "系统初始化 --- 子系统初始化");
            string open_menu_code = InitSubSystem();

            //初始化主菜单
            LogHelper.Info(this, "系统初始化 --- 生成主菜单");
            InitMainMenu(open_menu_code);

            //  加入可切换的子系统
            BarSubItem bsiSystem = new DevExpress.XtraBars.BarSubItem();

            bsiSystem.Caption = "系统切换";
            bsiSystem.Id      = this.ribbon.Items.Count;
            bsiSystem.Name    = "bsiSystem";
            this.ribbon.Items.Add(bsiSystem);
            this.rbPageGroupTools.ItemLinks.Insert(0, bsiSystem);
            foreach (BDictSystem system in EmpInfo.CanUseSystemList)
            {
                if (system.Code != EnvInfo.SystemCode)
                {
                    BarButtonItem bbi = new BarButtonItem();
                    bbi.Caption     = system.Name;
                    bbi.Id          = this.ribbon.Items.Count;
                    bbi.Name        = "bbiSystem" + system.Code;
                    bbi.Tag         = system.Code;
                    bbi.ItemClick  += new ItemClickEventHandler(this.bbiSystem_ItemClick);
                    bbi.RibbonStyle = RibbonItemStyles.Default;

                    if (!string.IsNullOrEmpty(system.Ico))
                    {
                        bbi.ImageOptions.Image = BmpHelper.GetIco(system.Ico);
                    }
                    this.ribbon.Items.Add(bbi);
                    bsiSystem.LinksPersistInfo.Add(new LinkPersistInfo(bbi));
                }
            }

            //  v9.2以后不加入会出现下拉菜单不能出来!!!
            ((System.ComponentModel.ISupportInitialize)(this.ribbon)).EndInit();

            //初始化外部信息对象, 危机值、关注项由通知
            List <string> infoRemoteCodeList = new List <string>();

            //  TODO:  ???
            infoRemoteCodeList.Add("foo1");             //  危机值信息
            infoRemoteCodeList.Add("foo2");             //  关注项信息

            infoRemoteAction = new RemoteInfoReceiver(infoRemoteCodeList, SynCallbackInfo);
            //RemoteInfoHelper.Subscribe("foo1,foo2");

            //初始化内部信息对象
            List <string> infoLocalCodeList = new List <string>();

            infoLocalCodeList.Add(LocalInfoHelper.OpenForm);                //  打开Form
            infoLocalCodeList.Add(LocalInfoHelper.AddNotice);               //  接受通知
            infoLocalCodeList.Add(LocalInfoHelper.DelNotice);               //  撤销通知
            infoLocalAction = new LocalInfoReceiver(infoLocalCodeList, CallbackInfo);

            for (int index = 0; index < ribbon.Pages.Count; index++)
            {
                var item = ribbon.Pages[index];
                item.Appearance.Font = new Font(SystemFonts.DefaultFont.Name, SystemFonts.DefaultFont.Size);
            }
            for (int index = 0; index < ribbon.Items.Count; index++)
            {
                var item = ribbon.Items[index];
                item.ItemAppearance.SetFont(new Font(SystemFonts.DefaultFont.Name, SystemFonts.DefaultFont.Size));
            }

            LogHelper.Info(this, "系统初始化 --- 启动定时器");
            timer1.Start();
            DisplayHelper.Close();
            return(true);
        }