Ejemplo n.º 1
0
        public static RibbonDropDownItem CreateRibbonDropDownItem(this RibbonFactory factory, string label)
        {
            var result = factory.CreateRibbonDropDownItem();

            result.Label = label;
            return(result);
        }
Ejemplo n.º 2
0
        public static RibbonToggleButton CreateRibbonToggleButton(this RibbonFactory factory, string label)
        {
            var result = factory.CreateRibbonToggleButton();

            result.Label = label;
            return(result);
        }
Ejemplo n.º 3
0
        public static RibbonTab CreateRibbonTab(this RibbonFactory factory, string label)
        {
            var result = factory.CreateRibbonTab();

            result.Label = label;
            return(result);
        }
Ejemplo n.º 4
0
        private void InitMenu()
        {
            XmlDocument doc = new XmlDocument();
            //检测项目文档里面是否有插件的界面配置,如果没有,则使用默认配置,如果有,则使用配置文件里面的配置
            Guid      dllGuid = new Guid("f9bff4cd-5840-48c1-9a7b-2385c554d95b");
            XmlPlugin plugin  = ((ISecureContext)_context).YutaiProject.Plugins.FirstOrDefault(c => c.Guid == dllGuid);

            if (plugin != null)
            {
                if (string.IsNullOrEmpty(plugin.MenuXML))
                {
                    doc.Load(base.GetType().Assembly.GetManifestResourceStream("Yutai.Test.Menu.MenuLayout.xml"));
                }
                else
                {
                    FileInfo info = new FileInfo(FileHelper.GetFullPath(plugin.MenuXML));
                    if (info.Exists)
                    {
                        doc.Load(FileHelper.GetFullPath(plugin.MenuXML));
                    }
                    else
                    {
                        doc.Load(base.GetType().Assembly.GetManifestResourceStream("Yutai.Test.Menu.MenuLayout.xml"));
                    }
                }
            }
            else
            {
                doc.Load(base.GetType().Assembly.GetManifestResourceStream("Yutai.Test.Menu.MenuLayout.xml"));
            }
            RibbonFactory.CreateMenus(_commands.GetCommands(), (RibbonControl)_menuManager, _context.MainView.RibbonStatusBar as RibbonStatusBar, doc);
        }
Ejemplo n.º 5
0
        private void InitMenus()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(base.GetType().Assembly.GetManifestResourceStream("Yutai.Pipeline.Editor.Menu.MenuLayout.xml"));
            RibbonFactory.CreateMenus(_commands.GetCommands(), (RibbonControl)_menuManager,
                                      _context.MainView.RibbonStatusBar as RibbonStatusBar, doc);
        }
Ejemplo n.º 6
0
        private void InitMenu()
        {
            XmlDocument doc       = new XmlDocument();
            string      resString = "Yutai.Plugins.Bookmark.Menu.MenuLayout.xml";

            doc.Load(base.GetType().Assembly.GetManifestResourceStream(resString));
            RibbonFactory.CreateMenus(_commands.GetCommands(), (RibbonControl)_menuManager,
                                      _context.MainView.RibbonStatusBar as RibbonStatusBar, doc);
        }
Ejemplo n.º 7
0
        private void InitMenus()
        {
            XmlDocument doc      = new XmlDocument();
            Assembly    assembly = base.GetType().Assembly;
            Stream      stream   = assembly.GetManifestResourceStream(@"Yutai.Check.Menu.MenuLayout.xml");

            if (stream != null)
            {
                doc.Load(stream);
            }
            RibbonFactory.CreateMenus(_commands.GetCommands(), (RibbonControl)_menuManager,
                                      _context.MainView.RibbonStatusBar as RibbonStatusBar, doc);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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;
            }
        }
Ejemplo n.º 10
0
        private void InitMenus()
        {
            XmlDocument doc = new XmlDocument();
            //检测项目文档里面是否有插件的界面配置,如果没有,则使用默认配置,如果有,则使用配置文件里面的配置
            Guid      dllGuid   = new Guid("5e933989-b5a4-4a45-a5b7-2d9ded61df0f");
            string    resString = "Yutai.Plugins.Template.Menu.MenuLayout.xml";
            XmlPlugin plugin    =
                ((ISecureContext)_context).YutaiProject?.Plugins.FirstOrDefault(
                    c => c.Guid == dllGuid);

            if (plugin != null)
            {
                if (string.IsNullOrEmpty(plugin.MenuXML))
                {
                    doc.Load(base.GetType().Assembly.GetManifestResourceStream(resString));
                }
                else
                {
                    FileInfo info = new FileInfo(FileHelper.GetFullPath(plugin.MenuXML));
                    if (info.Exists)
                    {
                        doc.Load(FileHelper.GetFullPath(plugin.MenuXML));
                    }
                    else
                    {
                        doc.Load(base.GetType().Assembly.GetManifestResourceStream(resString));
                    }
                }
            }
            else
            {
                doc.Load(base.GetType().Assembly.GetManifestResourceStream(resString));
            }

            RibbonFactory.CreateMenus(_commands.GetCommands(), (RibbonControl)_menuManager,
                                      _context.MainView.RibbonStatusBar as RibbonStatusBar, doc);
        }
Ejemplo n.º 11
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);
            }
        }
 /// <summary>Initializes a new instance of the <see cref="ReadMessage"/> class.</summary>
 /// <param name="factory">The factory.</param>
 public ReadMessage(RibbonFactory factory)
     : base(factory)
 {
 }
Ejemplo n.º 13
0
 public RibbonFactoryTests()
 {
     _factoryUnderTest = (RibbonFactory)RibbonFactory.Instance;
     _testRibbonViewModelBase = new TestRibbonViewModelBase();
     _factoryUnderTest.InitialiseFactory(new[] {_testRibbonViewModelBase});
 }
Ejemplo n.º 14
0
        /*
        public Kinect Kinect
        {
            get
            {
                if (kinect_ == null)
                    LoadKinect();
                return kinect_;
            }
        }

        public void LoadKinect()
        {
            if (kinect_ != null)
                return;
            try
            {
                kinect_ = new Kinect();
                kinect_.GestureDone += kinect__GestureDone;
                kinect_.Init();
            }
            catch (Exception e)
            {
                kinect_ = null;
            }
            //kinect_.LoadGesturesFromFile("Kynapsee.gestures.txt");
            using (var str = new StringReader(pres_.Tags["KY_Gestures"]))
                kinect_.LoadGesturesFromFile(str);
        }

        public void UnloadKinect()
        {
            if (kinect_ == null)
                return;
            kinect_.Uninit();
            kinect_ = null;
        }
        */
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            Application.SlideShowBegin += Application_SlideShowBegin;
            Application.SlideShowEnd += Application_SlideShowEnd;
            Application.AfterPresentationOpen += Application_AfterPresentationOpen;
            Application.WindowActivate += Application_WindowActivate;
            Application.SlideSelectionChanged += Application_SlideSelectionChanged;

            Application.PresentationClose += Application_PresentationClose;
            Application.WindowSelectionChange += Application_WindowSelectionChange;
            Application.SlideShowNextSlide += Application_SlideShowNextSlide;

            paneModel_ = new KynapseePaneModel();
            paneModel_.PropertyChanged += paneModel__PropertyChanged;

            pane_ = Globals.Ribbons.KynapseePane;
            pane_.Bind(paneModel_);

            factory_ = Globals.Factory.GetRibbonFactory();
        }
 ///
 internal ThisRibbonCollection(RibbonFactory factory) :
     base(factory)
 {
 }
Ejemplo n.º 16
0
 private void BIMTrackRibbon_Load(object sender, RibbonUIEventArgs e)
 {
     api            = new BIMTrackAPI();
     factory        = Globals.Factory.GetRibbonFactory();
     txtApiKey.Text = api.ApiKey;
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Sets all the necessary references from the main view.
        /// </summary>
        /// <remarks>We don't use contructor injection here since most of other services use this one as a parameter.
        /// Perhaps property injection can be used.</remarks>
        internal void Init(
            IMainView mainView,
            IProjectService project,
            IConfigService configService,
            MapLegendPresenter mapLegendPresenter,
            OverviewPresenter overviewPresenter
            )
        {
            Logger.Current.Trace("Start AppContext.Init()");
            if (mainView == null)
            {
                throw new ArgumentNullException("mainView");
            }
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (mapLegendPresenter == null)
            {
                throw new ArgumentNullException("legendPresenter");
            }
            //初始化图例控件
            _mapLegendPresenter = mapLegendPresenter;
            var legend = _mapLegendPresenter.LegendControl;

            legend.LegendControl.SetBuddyControl(mainView.MapControl);


            // it's expected here that we are on the UI thread
            SynchronizationContext = SynchronizationContext.Current;

            PluginManager = Container.GetSingleton <IPluginManager>();
            Broadcaster   = Container.GetSingleton <IBroadcasterService>();
            Container.RegisterInstance <IMapControl2>(mainView.MapControl);

            MainView       = mainView;
            View           = new AppView(mainView, _styleService);
            _project       = project;
            _configService = configService;
            MainView.AddFrameworkControl(legend.LegendControl.Object);

            _overviewPresenter = overviewPresenter;
            _overviewPresenter.SetBuddyControl(mainView.MapControl);
            MainView.AddFrameworkControl(_overviewPresenter.OverviewControl);

            //  _map = mainView.Map;
            //
            //   Repository = repository;

            //  Legend.Lock();

            DockPanels = new DockPanelCollection(mainView.DockingManager, mainView as Form, Broadcaster, _styleService);

            //Menu到最后丢弃不用,Menu部分全部采用Ribbon
            RibbonMenu = RibbonFactory.InitMenus((RibbonControl)mainView.RibbonManager,
                                                 mainView.RibbonStatusBar as RibbonStatusBar);

            // Menu = MenuFactory.CreateMainMenu(mainView.RibbonManager,true);
            // Toolbars = MenuFactory.CreateMainToolbars(mainView.MenuManager);
            // StatusBar = MenuFactory.CreateStatusBar(mainView.RibbonStatusBar, PluginIdentity.Default);

            // _projectionDatabase.ReadFromExecutablePath(Application.ExecutablePath);

            // Repository.Initialize(this);

            // comment this line to prevent locator loading
            // may be useful for ocx debugging to not create additional
            // instance of map
            // _locator = new LocatorPresenter(_map);

            this.InitDocking();

            //YTHookHelper设置

            OperationStack  = new OperationStackClass();
            m_pStyleGallery = null;

            //Catalog配置
            GxCatalog = new GxCatalog();
            //GxSelection=new GxSelection();
            //if (this._gxSelection is IGxSelectionEvents)
            //{
            //    (this._gxSelection as IGxSelectionEvents).OnSelectionChanged += new OnSelectionChangedEventHandler(this.GxSelection_Changed);
            //}

            Initialized = true;
            Logger.Current.Trace("End AppContext.Init()");

            //为了减少修改,给ApplicationRef赋值
            ApplicationRef.AppContext = this;
        }
Ejemplo n.º 18
0
 public RibbonFactoryTests()
 {
     _factoryUnderTest        = (RibbonFactory)RibbonFactory.Instance;
     _testRibbonViewModelBase = new TestRibbonViewModelBase();
     _factoryUnderTest.InitialiseFactory(new[] { _testRibbonViewModelBase });
 }
 /// 
 internal ThisRibbonCollection(RibbonFactory factory) : 
         base(factory) {
 }