Пример #1
0
 private void printItem(object e, OutputConsole console)
 {
     var s = e as string;
      if (s != null)
     console.TextOutput += s + Environment.NewLine;
      else
      {
     var list = e as IEnumerable;
     if (list != null)
     {
        foreach (var item in list)
        {
           printItem(item, console);
        }
     }
     else
        if (e != null)
           printItem(e.ToString(), console);
      }
 }
Пример #2
0
        private TabPage createNewContainet(string name, string fullPath = null, bool saved = false)
        {
            //create new tab
             TabPage newPage = new TabPage(name);
             tabContainer.TabPages.Add(newPage);

             SplitContainer container = new SplitContainer();
             container.Orientation = Orientation.Horizontal;
             container.Dock = DockStyle.Fill;
             newPage.Controls.Add(container);

             //create output console
             OutputConsole console = new OutputConsole();
             console.Name = "outputConsole";
             console.Dock = DockStyle.Fill;
             container.Panel2.Controls.Add(console);
             container.Panel2Collapsed = true;

             //create new editor
             var newEditor = new FastColoredTextBox();
             newEditor.Name = "mainEditor";
             newEditor.DelayedTextChangedInterval = 1000;
             newEditor.DelayedEventsInterval = 500;
             newEditor.Language = FastColoredTextBoxNS.Language.wQL;
             newEditor.TextChangedDelayed += new EventHandler<TextChangedEventArgs>(editor_TextChangedDelayed);
             newEditor.TextChanged += new EventHandler<TextChangedEventArgs>(editor_TextChanged);
             newEditor.SelectionChangedDelayed += new EventHandler(editor_SelectionChangedDelayed);
             newEditor.ToolTipNeeded += NewEditor_ToolTipNeeded;
             newEditor.Name = ProjectConstants.EditorControlName;
             container.Panel1.Controls.Add(newEditor);
             //newPage.Controls.Add(newEditor);
             newEditor.CurrentLineColor = highlightCurrentLineToolStripMenuItem.Checked ? currentLineColor : Color.Transparent;
             newEditor.HighlightingRangeType = HighlightingRangeType.VisibleRange;
             newEditor.AddStyle(sameWordsStyle);//same words style
             newEditor.Dock = DockStyle.Fill;

             AutocompleteMenu popupMenu = new AutocompleteMenu(newEditor);
             //popupMenu.Items.ImageList = ilAutocomplete;
             popupMenu.Opening += new EventHandler<CancelEventArgs>(popupMenu_Opening);
             BuildAutocompleteMenu(popupMenu);
             newEditor.Tag= popupMenu;

             tabContainer.SelectedTab = newPage;

             //create the details for the file
             var details = new FileDetails()
             {
            FileName = name,
            FullPath = fullPath,
            Saved = saved
             };

             newPage.Tag = details;

             updateTab(newPage);

             newEditor.BringToFront();
             newEditor.Focus();

             return newPage;
        }