Beispiel #1
0
        public static Components.Editor.CodeField New_code_field_by_path(string path)
        {
            var code = new Components.Editor.CodeField {
                file_path = path
            };

            code.Editor.Load(path);
            var first_document_pane = MainWindow.instance.DockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();

            if (first_document_pane == null)
            {
                return(null);
            }
            var doc = new LayoutDocument
            {
                Title      = System.IO.Path.GetFileName(path),
                Content    = code,
                IsSelected = true
            };

            code.host_panel      = doc;
            code.host_panel_name = doc.Title;
            first_document_pane.Children.Add(doc);
            return(code);
        }
Beispiel #2
0
        public static Components.Editor.CodeField New_code_field(string header = "新的代码")
        {
            var first_document_pane = MainWindow.instance.DockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();

            if (first_document_pane == null)
            {
                return(null);
            }
            var code = new Components.Editor.CodeField();
            var doc  = new LayoutDocument
            {
                Title   = header,
                Content = code
            };

            code.host_panel      = doc;
            code.host_panel_name = doc.Title;
            first_document_pane.Children.Add(doc);
            doc.IsSelected = true;
            return(code);
        }