Пример #1
0
        private void btn_apply_style_Click(object sender, RibbonControlEventArgs e)
        {//更新样式
            try
            {
                MagazineStyle.GetInstance().Name = cb_style.Text;

                PublicVar.SetCurrentStyleJObject();

                CommonFunction.RefreshStyle();
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(BIMTRibbon), ex);
            }
        }
Пример #2
0
 private void currentStyle_TextChanged(object sender, RibbonControlEventArgs e)
 {
     try
     {
         if (DialogResult.Yes == MessageBox.Show(null, "是否应用" + cb_style.Text + "的参考文献样式?", "切换样式", MessageBoxButtons.YesNo))
         {
             MagazineStyle _style = MagazineStyle.GetInstance();
             _style.Name = cb_style.Text;
             PublicVar.SetCurrentStyleJObject();
             CommonFunction.RefreshStyle();
             QuotationStyle style = new QuotationStyle(MagazineStyle.GetInstance().Name);
             style.WriteContent();
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(typeof(BIMTRibbon), ex);
     }
 }
Пример #3
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);
            }
        }