Пример #1
0
 public void SRBarDonationHeader(BarHeaderItem sb)
 {
     sb.ItemClick += (object sender, ItemClickEventArgs e) =>
     {
         System.Diagnostics.Process.Start(Properties.Settings.Default.DonorboxLink);
     };
 }
        private void bsEvents_GetItemData(object sender, EventArgs e)
        {
            if (this.bsEvents.ItemLinks.Count > 0 || Visual == null)
            {
                return;
            }
            List <StrategyDataItemInfo> aItems = Visual.DataItemInfos.Where(i => i.ChartType == ChartType.Annotation).ToList();

            foreach (StrategyDataItemInfo info in aItems)
            {
                PropertyInfo            pInfo        = Visual.Items[0].GetType().GetProperty(info.FieldName, BindingFlags.Instance | BindingFlags.Public);
                List <AnnotationFilter> filterValues = new List <AnnotationFilter>();
                FilterValues = filterValues;
                for (int i = 0; i < Visual.Items.Count; i++)
                {
                    object value = pInfo.GetValue(Visual.Items[i]);
                    if (value == null)
                    {
                        continue;
                    }

                    if (info.Type == DataType.ListInString && value is string)
                    {
                        string   list  = (string)value;
                        string[] items = list.Split(',');
                        foreach (string item in items)
                        {
                            string timmed = item.Trim();
                            if (filterValues.FirstOrDefault(f => object.Equals(f.Value, timmed)) == null)
                            {
                                filterValues.Add(new AnnotationFilter()
                                {
                                    Value = timmed, Property = pInfo, StringListItem = true, Checked = true
                                });
                            }
                        }
                    }
                    else
                    {
                        if (filterValues.FirstOrDefault(f => object.Equals(f.Value, value)) == null)
                        {
                            filterValues.Add(new AnnotationFilter()
                            {
                                Value = value, Property = pInfo, Checked = true
                            });
                        }
                    }
                }
                if (filterValues.Count == 0)
                {
                    continue;
                }

                BarHeaderItem subMenu = new BarHeaderItem();
                this.barManager1.Items.Add(subMenu);
                subMenu.Caption = info.FieldName;
                this.bsEvents.ItemLinks.Add(subMenu);

                foreach (AnnotationFilter value in filterValues)
                {
                    BarCheckItem ch = new BarCheckItem(this.barManager1)
                    {
                        Caption = Convert.ToString(value.Value), Checked = true
                    };
                    ch.AllowStubGlyph      = DefaultBoolean.False;
                    ch.CloseSubMenuOnClick = false;
                    ch.Tag             = value;
                    ch.CheckedChanged += AnnotationFilterItemChecked;
                    this.bsEvents.ItemLinks.Add(ch);
                }
            }
        }
Пример #3
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);
        }