예제 #1
0
        public static RibbonDropDownItem CreateRibbonDropDownItem(this RibbonFactory factory, string label)
        {
            var result = factory.CreateRibbonDropDownItem();

            result.Label = label;
            return(result);
        }
예제 #2
0
        private void btnLoadProjects_Click(object sender, RibbonControlEventArgs e)
        {
            string apiKey = txtApiKey.Text;

            api.ApiKey = apiKey;
            api.LoadHubs();
            var hub = api.Hubs.FirstOrDefault();

            if (hub == null)
            {
                return;
            }

            api.HubId   = hub.Id;
            api.HubName = hub.Name;
            api.LoadProjects();

            foreach (Project p  in api.Projects)
            {
                var item = factory.CreateRibbonDropDownItem();

                item.Label = p.Name;
                drpDwnProjects.Items.Add(item);
            }
        }
예제 #3
0
        // メソッド
        private RibbonDropDown CreateDropDown(RibbonFactory factory, string label, int minItemCount, int maxItemCount)
        {
            var result = factory.CreateRibbonDropDown(label);

            result.SizeString = "nn個";

            // アイテム追加
            for (int i = minItemCount; i <= maxItemCount; i++)
            {
                var item = factory.CreateRibbonDropDownItem($"{i}個");
                item.Tag = i;
                result.Items.Add(item);
            }

            return(result);
        }
예제 #4
0
        private static void LoadDropDownItems(RibbonFactory factory, RibbonDropDown dropDown, IEnumerable <string> itemLabels, string savedItemLabel = null)
        {
            RibbonDropDownItem savedItem = null;

            foreach (var label in itemLabels)
            {
                var item = factory.CreateRibbonDropDownItem();
                item.Label = label;
                if (label == savedItemLabel)
                {
                    savedItem = item;
                }
                dropDown.Items.Add(item);
            }
            if (savedItem != null)
            {
                dropDown.SelectedItem = savedItem;
            }
        }
예제 #5
0
        /// <summary>
        /// 刷新样式列表
        /// 2016-06-23
        /// wuhailong
        /// </summary>
        public void RefreshStyleList()
        {
            try
            {
                cb_style.Items.Clear();
                //下拉框赋值
                List <string> _list   = CommonFunction.GetFileName(PublicVar.StyleDir, "*.json");
                List <string> _listEn = new List <string>();
                List <string> _listCn = new List <string>();
                //_listCn.Add("参考文献样式");
                foreach (string item in _list)
                {
                    if (CommonFunction.IsCnString(item))
                    {
                        _listCn.Add(item);
                        //RibbonFactory rf = Globals.Factory.GetRibbonFactory();
                        //RibbonDropDownItem di = rf.CreateRibbonDropDownItem();
                        //di.Label = item;
                        //comboBox1.Items.Add(di);
                    }
                    else
                    {
                        _listEn.Add(item);
                    }
                }
                _listCn.Sort();
                string _strTemp = _listCn[0];

                int _myCount = 0;
                for (int i = 0; i < _listCn.Count; i++)
                {
                    if (_listCn[i] == "参考文献样式")
                    {
                        _myCount = i;
                        break;
                    }
                }
                _listCn[0]        = "参考文献样式";
                _listCn[_myCount] = _strTemp;
                foreach (string item in _listCn)
                {
                    RibbonFactory      rf = Globals.Factory.GetRibbonFactory();
                    RibbonDropDownItem di = rf.CreateRibbonDropDownItem();
                    di.Label = item;
                    cb_style.Items.Add(di);
                }
                _listEn.Sort();
                foreach (string item in _listEn)
                {
                    RibbonFactory      rf = Globals.Factory.GetRibbonFactory();
                    RibbonDropDownItem di = rf.CreateRibbonDropDownItem();
                    di.Label = item;
                    cb_style.Items.Add(di);
                }
                PublicVar.SetCurrentStyleJObject();
            }
            catch (Exception EX)
            {
                LogHelper.WriteLog(typeof(BIMTRibbon), EX);
            }
        }