private DocumentMeta AddNewDocument(HeliosObject profileObject) { DocumentMeta meta = FindDocumentMeta(profileObject); if (meta != null) { meta.document.IsSelected = true; return(meta); } HeliosEditorDocument editor = CreateDocumentEditor(profileObject); if (editor != null) { LayoutDocument document = new LayoutDocument(); document.Title = editor.Title; document.IsSelected = true; document.ContentId = HeliosSerializer.GetReferenceName(profileObject); document.Content = CreateDocumentContent(editor); DocumentPane.Children.Add(document); document.Closed += Document_Closed; meta = AddDocumentMeta(profileObject, document, editor); profileObject.PropertyChanged += DocumentObject_PropertyChanged; } return(meta); }
private HeliosEditorDocument CreateDocumentEditor(HeliosObject profileObject) { HeliosEditorDocument editor = null; if (profileObject is Monitor) { editor = new MonitorDocument((Monitor)profileObject); } else if (profileObject is HeliosPanel) { editor = new PanelDocument((HeliosPanel)profileObject); } else if (profileObject is HeliosInterface) { editor = ConfigManager.ModuleManager.CreateInterfaceEditor((HeliosInterface)profileObject, Profile); if (editor != null) { editor.Style = App.Current.Resources["InterfaceEditor"] as Style; } } else { throw new ArgumentException("Cannot create a editor document for profileobject requested.", "profileObject"); } return(editor); }
private DocumentMeta FindDocumentMeta(HeliosEditorDocument editor) { foreach (DocumentMeta meta in _documents) { if (meta.editor == editor) { return(meta); } } return(null); }
void LayoutSerializer_LayoutSerializationCallback(object sender, LayoutSerializationCallbackEventArgs e) { if (Profile != null && e.Model is LayoutDocument) { HeliosObject profileObject = HeliosSerializer.ResolveReferenceName(Profile, e.Model.ContentId); HeliosEditorDocument editor = CreateDocumentEditor(profileObject); profileObject.PropertyChanged += DocumentObject_PropertyChanged; e.Content = CreateDocumentContent(editor); e.Model.Closed += Document_Closed; AddDocumentMeta(profileObject, (LayoutDocument)e.Model, editor); } }
private object CreateDocumentContent(HeliosEditorDocument editor) { if (editor.HandlesScroll) { return(editor); } else { ScrollViewer scroller = new ScrollViewer(); scroller.Content = editor; scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; return(scroller); } }
void LayoutSerializer_LayoutSerializationCallback(object sender, LayoutSerializationCallbackEventArgs e) { if (Profile != null && e.Model is LayoutDocument) { HeliosObject profileObject = HeliosSerializer.ResolveReferenceName(Profile, e.Model.ContentId); if (profileObject != null) { HeliosEditorDocument editor = CreateDocumentEditor(profileObject); profileObject.PropertyChanged += DocumentObject_PropertyChanged; e.Content = CreateDocumentContent(editor); //DocumentPane.Children.Add((LayoutDocument)e.Model); e.Model.Closed += Document_Closed; AddDocumentMeta(profileObject, (LayoutDocument)e.Model, editor); } else { ConfigManager.LogManager.LogDebug("Layout Serializer: Unable to resolve Layout Document " + e.Model.ContentId); } } }
private DocumentMeta AddNewDocument(HeliosObject profileObject) { DocumentMeta meta = FindDocumentMeta(profileObject); if (meta != null) { meta.document.IsSelected = true; return(meta); } HeliosEditorDocument editor = CreateDocumentEditor(profileObject); if (editor != null) { LayoutDocument document = new LayoutDocument(); document.Title = editor.Title; document.IsSelected = true; document.ContentId = HeliosSerializer.GetReferenceName(profileObject); document.Content = CreateDocumentContent(editor); // Since a new LayoutRoot object is created upon de-serialization, the Child LayoutDocumentPane no longer belongs to the LayoutRoot // therefore the LayoutDocumentPane 'DocumentPane' must be referred to dynamically // change added by yzfanimal LayoutDocumentPane DocumentPane = this.DockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault(); if (DocumentPane != null) { DocumentPane.Children.Add(document); } document.Closed += Document_Closed; meta = AddDocumentMeta(profileObject, document, editor); profileObject.PropertyChanged += DocumentObject_PropertyChanged; } return(meta); }
void DockManager_ActiveDocumentChanged(object sender, EventArgs e) { HeliosEditorDocument activeDocument = null; // Interface Editor documents are embeded in a scrollviewer. Unwrap them if they are // the current content. ScrollViewer viewer = DockManager.ActiveContent as ScrollViewer; if (viewer != null) { activeDocument = viewer.Content as HeliosEditorDocument; } else { activeDocument = DockManager.ActiveContent as HeliosEditorDocument; } if (activeDocument != null) { if (activeDocument != CurrentEditor) { CurrentEditor = activeDocument; } } }
private DocumentMeta AddDocumentMeta(HeliosObject profileObject, LayoutDocument document, HeliosEditorDocument editor) { DocumentMeta meta = new DocumentMeta(); meta.editor = editor; meta.document = document; meta.hobj = profileObject; _documents.Add(meta); return(meta); }
private object CreateDocumentContent(HeliosEditorDocument editor) { if (editor.HandlesScroll) { return editor; } else { ScrollViewer scroller = new ScrollViewer(); scroller.Content = editor; scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scroller.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; return scroller; } }
private DocumentMeta FindDocumentMeta(HeliosEditorDocument editor) { foreach (DocumentMeta meta in _documents) { if (meta.editor == editor) { return meta; } } return null; }
private DocumentMeta AddDocumentMeta(HeliosObject profileObject, LayoutDocument document, HeliosEditorDocument editor) { DocumentMeta meta = new DocumentMeta(); meta.editor = editor; meta.document = document; meta.hobj = profileObject; _documents.Add(meta); return meta; }