Beispiel #1
0
 private void DocumentPane_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         AvalonDock.DocumentContent activeContent = e.AddedItems[0] as AvalonDock.DocumentContent;
         if (activeContent.Title == "Layout")
         {
             if (this.mapMgr != null)
             {
                 this.mapMgr.ActivateLayoutView(true);
             }
         }
         else if (activeContent.Title == "Map")
         {
             if (this.mapMgr != null)
             {
                 this.mapMgr.ActivateMapView(true);
             }
         }
     }
 }
        private void lstFile_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock item = lstFiles.SelectedItem as TextBlock;
            string file = item.Text;

            var documentContent = new AvalonDock.DocumentContent();
            documentContent.Title = file;
            
            ICSharpCode.AvalonEdit.TextEditor newEditor = new ICSharpCode.AvalonEdit.TextEditor();
            newEditor.ShowLineNumbers = txtCode.ShowLineNumbers;
            newEditor.WordWrap = txtCode.WordWrap;
            newEditor.SyntaxHighlighting = txtCode.SyntaxHighlighting;
            newEditor.Background = Brushes.LightGray;
            newEditor.Load(Helper.GetCurrentWorkingDir() + "\\" + file + ".tex");
            newEditor.IsReadOnly = true;

            documentContent.Content = newEditor;
            documentContent.Show(dockManager);
            //select the just added document
            if(dockManager.ActiveDocument != null)
                dockManager.ActiveDocument.ContainerPane.SelectedIndex = 0;
        }