Exemplo n.º 1
0
        private void NewEditor(IEditorViewFactory editorViewFactory)
        {
            var editorView = editorViewFactory?.CreateEditorView();

            if (editorView == null)
            {
                return;
            }

            editorView.CaretPositionChanged             += EditorViewOnCaretPositionChanged;
            editorView.ZoomLevelChanged                 += EditorViewOnZoomLevelChanged;
            editorView.Workspace.DataContext             = NorthwindDataContext.Instance;
            editorView.Workspace.CurrentDocumentChanged += WorkspaceOnCurrentDocumentChanged;

            if (CurrentEditorView != null)
            {
                editorView.ZoomLevel = CurrentEditorView.ZoomLevel;
            }

            var id      = DocumentTabControl.Items.OfType <TabItem>().Select(t => t.Tag).OfType <int>().DefaultIfEmpty().Max() + 1;
            var tabItem = new TabItem
            {
                Header  = $"Query {id} [{editorViewFactory.DisplayName}]",
                Content = editorView.Element,
                Tag     = id,
            };

            DocumentTabControl.Items.Add(tabItem);
            DocumentTabControl.SelectedItem = tabItem;
            editorView.Focus();
        }
 public void Add(Type type, IEditorViewFactory factory)
 {
     factories.Add(type, factory);
 }
Exemplo n.º 3
0
 public void Add(string fileExtension, IEditorViewFactory factory)
 {
     factories.Add(fileExtension, factory);
 }