Exemple #1
0
        public DocumentViewModel(IRDocument rdoc)
        {
            _rdocument = rdoc;

            ContentId = "Document1";

            Title = "Document-created";
        }
        private void OnNewDocumentCreated(IRDocument obj)
        {
            //if (obj is RBuilderDocument)
            //{
            //    DocumentViewModel doc = new GraphicsDocumentPanelViewModel(_data, _events, (RBuilderDocument)obj);
            //    ActiveDocumentViewModel = doc;
            //    _documentCollection.Add(doc);
            //}


            CreateDocument(obj, true);
        }
        public void CreateDocument(IRDocument obj, bool setActive)
        {
            Type doctype = obj.GetType();

            RDocumentData docData = Data.DocumentTypeData.Where(a => a.DocType == doctype).Select(a => a).FirstOrDefault();

            if (docData != null)
            {
                object[] parms = new object[1];
                parms[0] = obj;
                DocumentViewModel doc = (DocumentViewModel)Activator.CreateInstance(docData.ViewModel, parms);
                _documentCollection.Add(doc);
                if (setActive)
                {
                    ActiveDocumentViewModel = doc;
                }
            }
        }
        private void AddUITabsFromDoc(IRDocument doc)
        {
            if (RibbonControl == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_currentDoctype) || _currentDoctype != doc.GetType().ToString())
            {
                RemoveAllExistingTabs();
                List <ITab> lstTabs;

                if (Data.UIManager.RibbonTabs.TryGetValue(doc.GetType().ToString(), out lstTabs))
                {
                    foreach (var item in lstTabs)
                    {
                        _ribbonControl.Tabs.Add(item as RibbonTabItem);
                    }
                    _currentDoctype = doc.GetType().ToString();
                }
            }
        }
Exemple #5
0
        public void AddandActiveDocument(IRDocument doc, bool setactive)
        {
            string typeName = doc.GetType().ToString();
            Type   docTy;

            if (!_documentTypesLoaded.TryGetValue(typeName, out docTy))
            {
                _documentTypesLoaded.Add(typeName, doc.GetType());
                doc.CreateDocumentSpecificRibbonTabs();
                doc.CreateDocumentSpecificTools();
                LoadExternalToolsFromPlugin(typeName);
            }

            _documents.Add(doc);

            Eventaggregator.GetEvent <NewDocumentAddedEvent>().Publish(doc);

            if (setactive)
            {
                ActiveDocument = doc;
            }
        }
 private void OnActiveDocumentChanged(IRDocument obj)
 {
     AddUITabsFromDoc(obj);
 }