PageRenderTime 263ms CodeModel.GetById 62ms app.highlight 149ms RepoModel.GetById 16ms app.codeStats 4ms

/Tools/LinqPad/LINQPad/UI/QueryControl.cs

https://github.com/vishalsh-spec/TestProject
C# | 5227 lines | 4971 code | 255 blank | 1 comment | 1166 complexity | f9b8f29f0fabf30d488ecc21c7e86f1b MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1namespace LINQPad.UI
   2{
   3    using ActiproBridge;
   4    using ActiproSoftware.Drawing;
   5    using ActiproSoftware.SyntaxEditor;
   6    using ActiproSoftware.SyntaxEditor.Addons.CSharp;
   7    using ActiproSoftware.SyntaxEditor.Addons.DotNet.Ast;
   8    using LINQPad;
   9    using LINQPad.ExecutionModel;
  10    using LINQPad.Properties;
  11    using Microsoft.Win32;
  12    using mscorlib;
  13    using System;
  14    using System.CodeDom.Compiler;
  15    using System.Collections.Generic;
  16    using System.ComponentModel;
  17    using System.Diagnostics;
  18    using System.Drawing;
  19    using System.IO;
  20    using System.Linq;
  21    using System.Reflection;
  22    using System.Runtime.CompilerServices;
  23    using System.Runtime.InteropServices;
  24    using System.Text;
  25    using System.Text.RegularExpressions;
  26    using System.Threading;
  27    using System.Windows.Forms;
  28    using System.Xml.Linq;
  29
  30    [ComVisible(true)]
  31    public class QueryControl : UserControl
  32    {
  33        private Timer _autoSaveTimer;
  34        private volatile bool _autoSaving;
  35        private bool? _autoScrollResultsFromQuery;
  36        private bool _browserHidden;
  37        private Timer _clockTimer;
  38        private bool _compileOnly;
  39        private List<BitmapBookmarkLineIndicator> _currentExecutionStack;
  40        private DataResultsWebBrowser _dataBrowser;
  41        private BrowserBorder _dataPanel;
  42        private DocumentManager _docMan;
  43        private QueryEditor _editor;
  44        private bool _enableUseCurrentDb;
  45        private Color? _errorSquigglyColor;
  46        private QueryLanguage _executingQueryLanguage;
  47        private bool _executingQueryOptimized;
  48        private Timer _executionTrackingTimer;
  49        private bool _firstExecutionTrack;
  50        private bool _firstResultsShow;
  51        private bool _gotPluginsReadyMessage;
  52        private volatile bool _gotQueryCompletionMessage;
  53        private Timer _ieComExceptionTimer;
  54        private ResultsWebBrowser _ilBrowser;
  55        private MemoryStream _ilData;
  56        private bool _ilDirty;
  57        private BrowserBorder _ilPanel;
  58        private ResultsWebBrowser _lambdaBrowser;
  59        private MemoryStream _lambdaData;
  60        private BrowserBorder _lambdaPanel;
  61        private bool? _lastAutoScrollResultsFromQuery;
  62        private QueryCompilationEventArgs _lastCompilation;
  63        private static string _lastDefaultQueryFolder;
  64        private int _lastExecutionLine;
  65        private int _lastExecutionLineCount;
  66        private ExecutionProgress? _lastExecutionProgress;
  67        private int _lastExecutionTrackCost1;
  68        private int _lastExecutionTrackCost2;
  69        private QueryLanguage _lastQueryKind;
  70        private string _lastRanSourceSelection;
  71        private static string _lastSaveFolder;
  72        private DateTime _lastServerAction;
  73        private ExecutionTrackInfo _lastTrackInfo;
  74        private long _memoryAtStart;
  75        private bool _modifiedWhenRunning;
  76        private MemoryStream _msData;
  77        private double _oldHorizontalSplitFraction;
  78        private double _oldVerticalSplitFraction;
  79        private bool _optimizeTipShown;
  80        private string _outputInfoMessage;
  81        private bool _pendingReflection;
  82        private bool _pendingResultsShow;
  83        private string _pendingSqlTranslation;
  84        private ContextMenuStrip _pluginWinButtonMenu;
  85        private List<ToolStripButton> _pluginWinButtons;
  86        private PluginWindowManager _pluginWinManager;
  87        private volatile bool _processingProvisionalData;
  88        private RunnableQuery _query;
  89        private int _queryCount;
  90        private int _querySelectionStartCol;
  91        private int _querySelectionStartRow;
  92        private Random _random;
  93        private ReadLinePanel _readLinePanel;
  94        private bool _readLinePanelVisible;
  95        private int _refreshTicksOnResults;
  96        private Timer _refreshTimer;
  97        private byte[] _resultsContent;
  98        private SchemaTree _schemaTree;
  99        private bool _splitterMovingViaToolStrip;
 100        private int _suppressPullCount;
 101        private bool _uberCancelMessage;
 102        private static bool _warnedAboutOptimizationTracking;
 103        private Color? _warningSquigglyColor;
 104        private ToolStripMenuItem btn1NestingLevel;
 105        private ToolStripMenuItem btn2NestingLevels;
 106        private ToolStripMenuItem btn3NestingLevels;
 107        private ToolStripButton btnActivateAutocompletion;
 108        private ToolStripMenuItem btnAllNestingLevels;
 109        private ToolStripDropDownButton btnAnalyze;
 110        private ToolStripDropDownButton btnArrange;
 111        private ImageButton btnCancel;
 112        private ClearButton btnClose;
 113        private ImageButton btnExecute;
 114        private ToolStripDropDownButton btnExport;
 115        private ToolStripMenuItem btnExportExcel;
 116        private ToolStripMenuItem btnExportExcelNoFormat;
 117        private ToolStripMenuItem btnExportHtml;
 118        private ToolStripMenuItem btnExportWord;
 119        private ToolStripMenuItem btnExportWordNoFormat;
 120        private ToolStripDropDownButton btnFormat;
 121        private ClearButton btnGrids;
 122        private ToolStripButton btnIL;
 123        private ToolStripButton btnLambda;
 124        private ClearButton btnPin;
 125        private ToolStripMenuItem btnResultFormattingPreferences;
 126        private ToolStripButton btnResults;
 127        private ToolStripButton btnSql;
 128        private ClearButton btnText;
 129        private ComboBox cboDb;
 130        private ComboBox cboLanguage;
 131        private IContainer components;
 132        private Label lblDb;
 133        private ToolStripStatusLabel lblElapsed;
 134        private ToolStripStatusLabel lblExecTime;
 135        private ToolStripStatusLabel lblFill;
 136        private ToolStripStatusLabel lblMiscStatus;
 137        private ToolStripStatusLabel lblOptimize;
 138        private ToolStripStatusLabel lblStatus;
 139        private Label lblSyncDb;
 140        private Label lblType;
 141        private ToolStripStatusLabel lblUberCancel;
 142        private FixedLinkLabel llDbUseCurrent;
 143        private ToolStripMenuItem miArrangeVertical;
 144        private ToolStripMenuItem miAutoScroll;
 145        private ToolStripMenuItem miHideResults;
 146        private ToolStripMenuItem miKeyboardShortcuts;
 147        private ToolStripMenuItem miOpenInSSMS;
 148        private ToolStripMenuItem miOpenSQLQueryNewTab;
 149        private ToolStripMenuItem miScrollEnd;
 150        private ToolStripMenuItem miScrollStart;
 151        private ToolStripMenuItem miUndock;
 152        private Panel panBottom;
 153        private Panel panCloseButton;
 154        private Panel panEditor;
 155        private Panel panError;
 156        private Panel panMain;
 157        private PanelEx panOutput;
 158        private Panel panTop;
 159        private TableLayoutPanel panTopControls;
 160        private ToolStripProgressBar queryProgressBar;
 161        private SplitContainer splitContainer;
 162        private StatusStrip statusStrip;
 163        private ToolStripSeparator toolStripMenuItem1;
 164        private ToolStripSeparator toolStripMenuItem2;
 165        private ToolStripSeparator toolStripMenuItem3;
 166        private ToolStripSeparator toolStripMenuItem4;
 167        private ToolStripSeparator toolStripSeparator1;
 168        private ToolTip toolTip;
 169        private ToolStripEx tsOutput;
 170        private TextBox txtError;
 171        private ActiproSoftware.SyntaxEditor.SyntaxEditor txtSQL;
 172
 173        internal event EventHandler NextQueryRequest;
 174
 175        internal event EventHandler PreviousQueryRequest;
 176
 177        internal event EventHandler QueryClosed;
 178
 179        internal QueryControl(RunnableQuery q, SchemaTree schemaTree)
 180        {
 181            EventHandler onClick = null;
 182            EventHandler handler2 = null;
 183            EventHandler handler3 = null;
 184            EventHandler handler4 = null;
 185            SplitterCancelEventHandler handler5 = null;
 186            this._browserHidden = true;
 187            Timer timer = new Timer {
 188                Interval = 0x2710,
 189                Enabled = true
 190            };
 191            this._autoSaveTimer = timer;
 192            this._executionTrackingTimer = new Timer();
 193            this._pluginWinButtons = new List<ToolStripButton>();
 194            this._query = new RunnableQuery();
 195            this.NextQueryRequest = delegate (object sender, EventArgs e) {
 196            };
 197            this.PreviousQueryRequest = delegate (object sender, EventArgs e) {
 198            };
 199            this._lambdaData = new MemoryStream();
 200            this._ilDirty = true;
 201            this._ilData = new MemoryStream();
 202            this._queryCount = 0;
 203            Timer timer2 = new Timer {
 204                Interval = 200
 205            };
 206            this._refreshTimer = timer2;
 207            Timer timer3 = new Timer {
 208                Interval = 200
 209            };
 210            this._clockTimer = timer3;
 211            this._firstResultsShow = true;
 212            this._lastQueryKind = QueryLanguage.SQL;
 213            this._suppressPullCount = 0;
 214            this._random = new Random();
 215            this.components = null;
 216            this._query = q;
 217            this._schemaTree = schemaTree;
 218            try
 219            {
 220                this.Font = FontManager.GetDefaultFont();
 221            }
 222            catch
 223            {
 224            }
 225            this.InitializeComponent();
 226            this.CheckIsMyExtensions();
 227            this._pluginWinManager = new PluginWindowManager(this);
 228            this._pluginWinButtonMenu = new ContextMenuStrip(this.components);
 229            if (onClick == null)
 230            {
 231                onClick = (sender, e) => this.CloseCurrentVisualizer();
 232            }
 233            this._pluginWinButtonMenu.Items.Add("Close visualizer (Shift+F4 or Middle-Click or Ctrl+Click)", Resources.Delete, onClick);
 234            if (this.btnExecute.Height > 0x20)
 235            {
 236                this.btnExecute.Height -= 3;
 237                this.cboLanguage.Margin = new Padding(this.cboLanguage.Margin.Left, 2, this.cboLanguage.Margin.Right, 4);
 238                this.cboDb.Margin = new Padding(this.cboDb.Margin.Left, 2, this.cboDb.Margin.Right, 4);
 239            }
 240            else if (this.btnExecute.Height > 0x1d)
 241            {
 242                this.btnExecute.Height -= 2;
 243            }
 244            else if (this.btnExecute.Height > 0x18)
 245            {
 246                this.btnExecute.Height--;
 247            }
 248            this.btnCancel.Height = this.btnExecute.Height;
 249            this.btnText.Height = this.btnGrids.Height = this.btnExecute.Height - 1;
 250            if ((IntPtr.Size == 4) && (this.btnExecute.Height > 0x1b))
 251            {
 252                Padding margin = this.cboLanguage.Margin;
 253                this.cboLanguage.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
 254                margin = this.cboDb.Margin;
 255                this.cboDb.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
 256            }
 257            if (this.btnExecute.Height > 40)
 258            {
 259                this.btnExecute.Image = ControlUtil.ResizeImage(this.btnExecute.Image, this.btnExecute.Width, this.btnExecute.Height, true);
 260                this.btnCancel.Image = ControlUtil.ResizeImage(this.btnCancel.Image, this.btnCancel.Width, this.btnCancel.Height, true);
 261                this.btnGrids.Image = ControlUtil.ResizeImage(this.btnGrids.Image, (this.btnGrids.Width * 3) / 4, (this.btnGrids.Height * 3) / 4, true);
 262                this.btnText.Image = ControlUtil.ResizeImage(this.btnText.Image, (this.btnText.Width * 3) / 4, (this.btnText.Height * 3) / 4, true);
 263            }
 264            this.UpdateAutocompletionMsg();
 265            try
 266            {
 267                this.txtError.Font = new Font("Verdana", 8.25f);
 268                this.txtSQL.Font = new Font("Verdana", 9.5f);
 269                this.btnActivateAutocompletion.Font = new Font("Verdana", 8f, FontStyle.Bold);
 270                this.lblOptimize.Font = new Font("Verdana", 7f, FontStyle.Bold);
 271            }
 272            catch
 273            {
 274            }
 275            this.txtSQL.get_Document().set_Language(DocumentManager.GetDynamicLanguage("SQL", SystemColors.Window.GetBrightness()));
 276            this.txtSQL.get_Document().get_Outlining().set_Mode(2);
 277            this.txtSQL.set_BracketHighlightingVisible(true);
 278            this.txtSQL.get_Document().set_ReadOnly(true);
 279            VisualStudio2005SyntaxEditorRenderer renderer = new VisualStudio2005SyntaxEditorRenderer();
 280            SimpleBorder border = new SimpleBorder();
 281            border.set_Style(0);
 282            renderer.set_Border(border);
 283            VisualStudio2005SyntaxEditorRenderer renderer2 = renderer;
 284            this.txtSQL.set_Renderer(renderer2);
 285            this._docMan = new DocumentManager(this._query, this);
 286            this.CreateEditor();
 287            this.PropagateOptions();
 288            this.UpdateEditorZoom();
 289            this.CreateBrowser();
 290            this._browserHidden = true;
 291            this.panBottom.BorderStyle = BorderStyle.None;
 292            this.tsOutput.BackColor = Color.Transparent;
 293            this.tsOutput.Renderer = new OutputToolsRenderer();
 294            this.statusStrip.BackColor = Color.Transparent;
 295            this.statusStrip.Padding = new Padding(this.statusStrip.Padding.Left, this.statusStrip.Padding.Top, this.statusStrip.Padding.Left, this.statusStrip.Padding.Bottom);
 296            this.PullData(QueryChangedEventArgs.Refresh);
 297            this.ToggleResultsCollapse();
 298            this._query.QueryCompiled += new EventHandler<QueryCompilationEventArgs>(this._query_QueryCompiled);
 299            this._query.PluginsReady += new EventHandler(this._query_PluginsReady);
 300            this._query.CustomClickCompleted += new EventHandler(this._query_CustomClickCompleted);
 301            this._query.QueryCompleted += new EventHandler<QueryStatusEventArgs>(this._query_QueryCompleted);
 302            this._query.QueryChanged += new EventHandler<QueryChangedEventArgs>(this._query_QueryChanged);
 303            this._query.ReadLineRequested += new EventHandler<ReadLineEventArgs>(this._query_ReadLineRequested);
 304            this._editor.TextChanged += new EventHandler(this._editor_TextChanged);
 305            this._editor.add_SelectionChanged(new SelectionEventHandler(this, (IntPtr) this._editor_SelectionChanged));
 306            this._editor.RepositoryDropped += new EventHandler<QueryEditor.RepositoryEventArgs>(this._editor_RepositoryDropped);
 307            this._schemaTree.AfterSelect += new TreeViewEventHandler(this._schemaTree_AfterSelect);
 308            this._docMan.CheckForRepositoryChange();
 309            this._refreshTimer.Tick += new EventHandler(this.RefreshTimer_Tick);
 310            this._clockTimer.Tick += new EventHandler(this.ClockTimer_Tick);
 311            this._autoSaveTimer.Tick += new EventHandler(this.AutoSaveTimer_Tick);
 312            if (handler2 == null)
 313            {
 314                handler2 = (sender, e) => this.ReportMainThreadPosition();
 315            }
 316            this._executionTrackingTimer.Tick += handler2;
 317            if (SystemColors.Window.GetBrightness() < 0.5f)
 318            {
 319                this.llDbUseCurrent.ForeColor = SystemColors.HotTrack;
 320            }
 321            this.ExtendOutputSplitter();
 322            if (handler3 == null)
 323            {
 324                handler3 = (sender, e) => this.UpdateErrorHeight();
 325            }
 326            this.panError.SizeChanged += handler3;
 327            this.statusStrip.Parent = null;
 328            base.Controls.Add(this.statusStrip);
 329            this.statusStrip.SendToBack();
 330            if (handler4 == null)
 331            {
 332                handler4 = (sender, e) => this.RequestWinManagerRelocation();
 333            }
 334            EventHandler handler6 = handler4;
 335            this.panOutput.Resize += handler6;
 336            for (Control control = this.panOutput; control != null; control = control.Parent)
 337            {
 338                control.Move += handler6;
 339            }
 340            this._query.PluginWindowManager = this._pluginWinManager;
 341            this.queryProgressBar.Margin = new Padding(3, 3, 0, 1);
 342            this.tsOutput.Padding = new Padding(0, 0, 0, 2);
 343            this.splitContainer.SplitterWidth--;
 344            if (handler5 == null)
 345            {
 346                handler5 = delegate (object sender, SplitterCancelEventArgs e) {
 347                    if (Control.MouseButtons == MouseButtons.Left)
 348                    {
 349                        MainForm.Instance.IsSplitting = true;
 350                    }
 351                    if ((this.panOutput.BackColor == MainForm.Instance.TransparencyKey) && (this.panOutput.BackColor != Program.LightTransparencyKey))
 352                    {
 353                        this.panOutput.BackColor = MainForm.Instance.TransparencyKey = Program.LightTransparencyKey;
 354                    }
 355                };
 356            }
 357            this.splitContainer.SplitterMoving += handler5;
 358            this.panOutput.BorderStyle = BorderStyle.None;
 359            this.panOutput.BorderColor = Color.FromArgb(160, 160, 160);
 360            this.lblSyncDb.Cursor = Cursors.Hand;
 361            this.toolTip.ShowAlways = true;
 362            this.EnableControls();
 363            this.panBottom.Layout += new LayoutEventHandler(this.panBottom_Layout);
 364        }
 365
 366        private void _browser_LinqClicked(object sender, LinqClickEventArgs e)
 367        {
 368            WebHelper.LaunchBrowser(e.Uri.ToString());
 369        }
 370
 371        private void _browser_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 372        {
 373            if (e.KeyData == Keys.F5)
 374            {
 375                e.IsInputKey = true;
 376                this.Run();
 377            }
 378            else if (e.KeyData == (Keys.Control | Keys.Shift | Keys.E))
 379            {
 380                MainForm.Instance.ToggleAutoScrollResults(true);
 381            }
 382        }
 383
 384        private void _editor_RepositoryDropped(object sender, QueryEditor.RepositoryEventArgs e)
 385        {
 386            Func<LinkedDatabase, bool> predicate = null;
 387            if (!this._query.IsMyExtensions)
 388            {
 389                this.CheckToFromProgramLanguage(this._query.QueryKind, this._query.QueryKind, this._query.Repository != null, e.Repository != null);
 390                if (!((this._query.Repository != null) && e.Copy))
 391                {
 392                    this._query.Repository = e.Repository;
 393                }
 394                else
 395                {
 396                    if ((!e.Repository.IsSqlServer || !this._query.Repository.IsSqlServer) || (e.Repository.Server.ToLowerInvariant() != this._query.Repository.Server.ToLowerInvariant()))
 397                    {
 398                        MessageBox.Show("Multi-database queries are supported only for SQL Server databases on the same server (or linked servers).", "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 399                        return;
 400                    }
 401                    if (this._query.Repository.IsAzure || e.Repository.IsAzure)
 402                    {
 403                        MessageBox.Show("SQL Azure does not permit cross-database queries.", "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 404                        return;
 405                    }
 406                    if (this._query.Repository.Database == e.Repository.Database)
 407                    {
 408                        return;
 409                    }
 410                    if (predicate == null)
 411                    {
 412                        predicate = d => string.IsNullOrEmpty(d.Server) && (d.Database == e.Repository.Database);
 413                    }
 414                    if (this._query.Repository.LinkedDatabases.Any<LinkedDatabase>(predicate))
 415                    {
 416                        return;
 417                    }
 418                    if (this._query.Repository.Parent != null)
 419                    {
 420                        Repository r = this._query.Repository.Clone();
 421                        r.ID = Guid.NewGuid();
 422                        r.ShowServer = false;
 423                        r.Persist = false;
 424                        r.LinkedDatabases = r.LinkedDatabases.Concat<LinkedDatabase>(new LinkedDatabase[] { new LinkedDatabase(e.Repository.Database) });
 425                        this._schemaTree.AddCx(r, false, false);
 426                        this._query.Repository = r;
 427                    }
 428                    else
 429                    {
 430                        this._query.Repository.LinkedDatabases = this._query.Repository.LinkedDatabases.Concat<LinkedDatabase>(new LinkedDatabase[] { new LinkedDatabase(e.Repository.Database) });
 431                        this._schemaTree.UpdateRepository(this._query.Repository);
 432                    }
 433                }
 434                this._editor.Focus();
 435            }
 436        }
 437
 438        private void _editor_SelectionChanged(object sender, EventArgs e)
 439        {
 440            this.ClearQueryHighlight();
 441            if (this._docMan.ExecutedSelectionLayer.get_Count() > 0)
 442            {
 443                this._docMan.ExecutedSelectionLayer.Clear();
 444            }
 445        }
 446
 447        private void _editor_TextChanged(object sender, EventArgs e)
 448        {
 449            this._modifiedWhenRunning = true;
 450            using (this.SuppressPull())
 451            {
 452                this._query.Source = this._editor.Text;
 453            }
 454            this.btnPin.Checked = this._query.Pinned;
 455            this.ClearQueryHighlight();
 456            if (this._docMan.StackTraceLayer.get_Count() > 0)
 457            {
 458                this._docMan.StackTraceLayer.Clear();
 459            }
 460            this.ClearExecutionTrackingIndicators();
 461        }
 462
 463        private void _query_CustomClickCompleted(object sender, EventArgs e)
 464        {
 465            this._outputInfoMessage = null;
 466        }
 467
 468        private void _query_PluginsReady(object sender, EventArgs e)
 469        {
 470            this.BeginInvoke(delegate {
 471                this._gotPluginsReadyMessage = true;
 472                foreach (PluginControl control in this._pluginWinManager.GetControls())
 473                {
 474                    this.CreatePluginWinButton(control, false, false);
 475                }
 476                if (this._pluginWinButtons.Any<ToolStripButton>())
 477                {
 478                    bool flag = MainForm.Instance.CurrentQueryControl == this;
 479                    if (this.btnResults.Checked && !this.panError.Visible)
 480                    {
 481                        if (flag)
 482                        {
 483                            base.FindForm().Activate();
 484                        }
 485                        this.SelectOutputPanel(this._pluginWinButtons[0], false);
 486                    }
 487                    else
 488                    {
 489                        this.UpdateOutputToolStripLayout();
 490                    }
 491                    if (flag)
 492                    {
 493                        base.FindForm().Activate();
 494                    }
 495                    else
 496                    {
 497                        this._pluginWinManager.Hide();
 498                    }
 499                }
 500            });
 501        }
 502
 503        private void _query_QueryChanged(object sender, QueryChangedEventArgs e)
 504        {
 505            this.KillIEComExceptionTimer();
 506            this.PullData(e);
 507        }
 508
 509        private void _query_QueryCompiled(object sender, QueryCompilationEventArgs e)
 510        {
 511            this.BeginInvoke(delegate {
 512                try
 513                {
 514                    this.QueryCompiled(e);
 515                }
 516                catch (Exception exception)
 517                {
 518                    Program.ProcessException(exception);
 519                }
 520            });
 521        }
 522
 523        private void _query_QueryCompleted(object sender, QueryStatusEventArgs e)
 524        {
 525            if (e.ExecutionComplete)
 526            {
 527                this._clockTimer.Stop();
 528            }
 529            this.BeginInvoke(() => this.QueryCompleted(e));
 530        }
 531
 532        private void _query_ReadLineRequested(object sender, ReadLineEventArgs e)
 533        {
 534            int num = this._queryCount;
 535            while (this._readLinePanelVisible)
 536            {
 537                Thread.Sleep(100);
 538                if (this._queryCount != num)
 539                {
 540                    return;
 541                }
 542            }
 543            base.BeginInvoke(() => this.ShowReadLinePanel(e.Client, e.Prompt, e.DefaultValue, e.Options));
 544        }
 545
 546        private void _schemaTree_AfterSelect(object sender, TreeViewEventArgs e)
 547        {
 548            this.UpdateFocusedRepository();
 549        }
 550
 551        internal void ActivateAndKillDomain()
 552        {
 553            base.FindForm().Activate();
 554            Program.RunOnWinFormsTimer(() => this.Cancel(true), 0x7d0);
 555        }
 556
 557        internal void ActivateHelp()
 558        {
 559            if (!(MainForm.Instance.ShowLicensee || !(this._editor.get_SelectedView().get_SelectedText() == "")))
 560            {
 561                MessageBox.Show("This feature requires an Autocompletion license.", "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 562            }
 563            else
 564            {
 565                MemberHelpInfo memberHelpInfo = this.GetMemberHelpInfo();
 566                string str = ((memberHelpInfo == null) || !memberHelpInfo.HasStrongName) ? null : memberHelpInfo.get_HelpSearchString();
 567                if (string.IsNullOrEmpty(str))
 568                {
 569                    str = (this._editor.get_SelectedView().get_SelectedText() ?? "").Trim();
 570                    if (str.Length == 0)
 571                    {
 572                        return;
 573                    }
 574                    if (this._query.QueryKind <= QueryLanguage.Program)
 575                    {
 576                        str = "C# " + str;
 577                    }
 578                    else if (this._query.QueryKind.ToString().StartsWith("VB"))
 579                    {
 580                        str = "VB " + str;
 581                    }
 582                    else if (this._query.QueryKind.ToString().StartsWith("FSharp"))
 583                    {
 584                        str = "F# " + str;
 585                    }
 586                    else if (this._query.QueryKind == QueryLanguage.SQL)
 587                    {
 588                        str = "\"SQL Server\" " + str;
 589                    }
 590                    else
 591                    {
 592                        str = this._query.QueryKind + " " + str;
 593                    }
 594                }
 595                WebHelper.LaunchBrowser("http://www.google.com/search?hl=en&q=" + Uri.EscapeDataString(str));
 596            }
 597        }
 598
 599        public void ActivateReflector()
 600        {
 601            if (!MainForm.Instance.ShowLicensee)
 602            {
 603                MessageBox.Show("This feature requires an Autocompletion license.", "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 604            }
 605            else
 606            {
 607                MemberHelpInfo memberHelpInfo = this.GetMemberHelpInfo();
 608                if ((memberHelpInfo != null) && !string.IsNullOrEmpty(memberHelpInfo.get_ReflectorCodeUri()))
 609                {
 610                    ReflectorAgent.ActivateReflector(memberHelpInfo);
 611                }
 612            }
 613        }
 614
 615        internal void AncestorMoved()
 616        {
 617            this.RequestWinManagerRelocation();
 618        }
 619
 620        internal bool AreResultsCollapsed()
 621        {
 622            return (this.panEditor.Parent == this.panMain);
 623        }
 624
 625        internal bool AreResultsDetached()
 626        {
 627            return (this.panBottom.Parent != this.splitContainer.Panel2);
 628        }
 629
 630        internal bool AreResultsVisible()
 631        {
 632            return (!this.AreResultsCollapsed() || this.AreResultsDetached());
 633        }
 634
 635        internal void AttachResultsControl(Control c)
 636        {
 637            c.Parent = this.splitContainer.Panel2;
 638            if (this.AreResultsCollapsed())
 639            {
 640                this.ToggleResultsCollapse();
 641            }
 642            this.UpdateOutputVisibility();
 643        }
 644
 645        private void AutoSaveTimer_Tick(object sender, EventArgs e)
 646        {
 647            if (!base.IsDisposed && !(!this._query.IsModified || this._autoSaving))
 648            {
 649                ThreadPool.QueueUserWorkItem(delegate (object param0) {
 650                    if (!this._autoSaving)
 651                    {
 652                        this._autoSaving = true;
 653                        try
 654                        {
 655                            this._query.AutoSave(false);
 656                        }
 657                        catch
 658                        {
 659                        }
 660                        finally
 661                        {
 662                            this._autoSaving = false;
 663                        }
 664                    }
 665                });
 666            }
 667        }
 668
 669        private void BeginInvoke(Action a)
 670        {
 671            base.BeginInvoke(a);
 672        }
 673
 674        private void btn1NestingLevel_Click(object sender, EventArgs e)
 675        {
 676            this.CollapseResultsTo(1);
 677        }
 678
 679        private void btn2NestingLevels_Click(object sender, EventArgs e)
 680        {
 681            this.CollapseResultsTo(2);
 682        }
 683
 684        private void btn3NestingLevels_Click(object sender, EventArgs e)
 685        {
 686            this.CollapseResultsTo(3);
 687        }
 688
 689        private void btnActivateAutocompletion_Click(object sender, EventArgs e)
 690        {
 691            MainForm.Instance.ActivateAutocompletion();
 692        }
 693
 694        private void btnAllNestingLevels_Click(object sender, EventArgs e)
 695        {
 696            this.CollapseResultsTo(null);
 697        }
 698
 699        private void btnArrange_DropDownOpening(object sender, EventArgs e)
 700        {
 701            this.miUndock.Checked = MainForm.Instance.ResultsDockForm.AreResultsTorn;
 702            this.miArrangeVertical.Checked = MainForm.Instance.VerticalResultsLayout;
 703            this.miUndock.Enabled = MainForm.Instance.ResultsDockForm.AreResultsTorn || (Screen.AllScreens.Length > 1);
 704            this.miAutoScroll.Checked = MainForm.Instance.AutoScrollResults;
 705        }
 706
 707        private void btnCancel_Click(object sender, EventArgs e)
 708        {
 709            this.Cancel(false);
 710            this._editor.Focus();
 711        }
 712
 713        private void btnClose_Click(object sender, EventArgs e)
 714        {
 715            this.TryClose();
 716        }
 717
 718        private void btnExecute_Click(object sender, EventArgs e)
 719        {
 720            this.Run();
 721        }
 722
 723        private void btnExpandTypes_CheckedChanged(object sender, EventArgs e)
 724        {
 725        }
 726
 727        private void btnExportExcel_Click(object sender, EventArgs e)
 728        {
 729            if ((this._msData != null) && (this._msData.Length > 0L))
 730            {
 731                this.OpenExcel(this.ExportResults(false));
 732            }
 733        }
 734
 735        private void btnExportExcelNoFormat_Click(object sender, EventArgs e)
 736        {
 737            if ((this._msData != null) && (this._msData.Length > 0L))
 738            {
 739                this.OpenExcel(this.ExportResults(true));
 740            }
 741        }
 742
 743        private void btnExportHtml_Click(object sender, EventArgs e)
 744        {
 745            if ((this._msData != null) && (this._msData.Length != 0L))
 746            {
 747                using (SaveFileDialog dialog = new SaveFileDialog())
 748                {
 749                    dialog.Title = "Save Results";
 750                    dialog.DefaultExt = "html";
 751                    dialog.Filter = "HTML files (*.html)|*.html";
 752                    if ((dialog.ShowDialog() == DialogResult.OK) && !string.IsNullOrEmpty(dialog.FileName))
 753                    {
 754                        try
 755                        {
 756                            using (FileStream stream = File.Create(dialog.FileName))
 757                            {
 758                                this._msData.WriteTo(stream);
 759                            }
 760                        }
 761                        catch (Exception exception)
 762                        {
 763                            MessageBox.Show("Cannot write file: " + exception.Message);
 764                        }
 765                    }
 766                }
 767            }
 768        }
 769
 770        private void btnExportWord_Click(object sender, EventArgs e)
 771        {
 772            if ((this._msData != null) && (this._msData.Length > 0L))
 773            {
 774                this.OpenWord(this.ExportResults(false));
 775            }
 776        }
 777
 778        private void btnExportWordNoFormat_Click(object sender, EventArgs e)
 779        {
 780            if ((this._msData != null) && (this._msData.Length > 0L))
 781            {
 782                this.OpenWord(this.ExportResults(true));
 783            }
 784        }
 785
 786        private void btnGrids_Click(object sender, EventArgs e)
 787        {
 788            this._query.ToDataGrids = true;
 789        }
 790
 791        private void btnIL_Click(object sender, EventArgs e)
 792        {
 793            this.SelectILPanel(true);
 794        }
 795
 796        private void btnLambda_Click(object sender, EventArgs e)
 797        {
 798            this.SelectLambdaPanel(true);
 799        }
 800
 801        private void btnPin_Click(object sender, EventArgs e)
 802        {
 803            this._query.Pinned = !this._query.Pinned;
 804        }
 805
 806        private void btnResultFormattingPreferences_Click(object sender, EventArgs e)
 807        {
 808            using (OptionsForm form = new OptionsForm(2))
 809            {
 810                if (form.ShowDialog(MainForm.Instance) == DialogResult.OK)
 811                {
 812                    this.PropagateOptions();
 813                }
 814            }
 815        }
 816
 817        private void btnResults_Click(object sender, EventArgs e)
 818        {
 819            this.SelectResultsPanel(true);
 820        }
 821
 822        private void btnSql_Click(object sender, EventArgs e)
 823        {
 824            this.SelectSqlPanel(true);
 825        }
 826
 827        private void btnText_Click(object sender, EventArgs e)
 828        {
 829            this._query.ToDataGrids = false;
 830        }
 831
 832        internal void Cancel(bool uberMode)
 833        {
 834            if (!base.IsDisposed)
 835            {
 836                this._outputInfoMessage = null;
 837                this._executionTrackingTimer.Stop();
 838                this.ClearExecutionTrackingIndicators();
 839                if (this._editor.get_Document().get_LineIndicators().get_Count() == 0)
 840                {
 841                    this._editor.set_IndicatorMarginVisible(false);
 842                }
 843                if ((((this._query.QueryKind != QueryLanguage.SQL) && (this._query.QueryKind != QueryLanguage.ESQL)) || this.btnCancel.Enabled) || uberMode)
 844                {
 845                    this.HideReadLinePanel();
 846                    this._pendingReflection = false;
 847                    if (!((uberMode || Program.PreserveAppDomains) || this._query.IsRunning))
 848                    {
 849                        uberMode = true;
 850                    }
 851                    if (uberMode)
 852                    {
 853                        this.ResetPluginManager(true);
 854                        this._query.Cancel(false, true);
 855                    }
 856                    else
 857                    {
 858                        this._query.Cancel(true, false);
 859                    }
 860                    if (this.btnCancel.Enabled || uberMode)
 861                    {
 862                        this.EnableControls();
 863                        this.lblElapsed.Visible = false;
 864                        this.lblStatus.Text = uberMode ? "Application Domain Unloaded" : "Query canceled";
 865                        this.lblUberCancel.Visible = false;
 866                    }
 867                }
 868            }
 869        }
 870
 871        private void cboDb_DropDown(object sender, EventArgs e)
 872        {
 873            int num;
 874            this.UpdateRepositoryItems(true);
 875            Func<object, float> selector = null;
 876            using (Graphics g = this.cboDb.CreateGraphics())
 877            {
 878                if (selector == null)
 879                {
 880                    selector = item => g.MeasureString(item.ToString(), this.cboDb.Font).Width;
 881                }
 882                num = (((int) this.cboDb.Items.Cast<object>().Max<object>(selector)) + SystemInformation.VerticalScrollBarWidth) + 2;
 883            }
 884            Rectangle workingArea = Screen.FromControl(this.cboDb).WorkingArea;
 885            this.cboDb.DropDownWidth = Math.Max(this.cboDb.Width, Math.Min((workingArea.Right - this.cboDb.PointToScreen(Point.Empty).X) - 3, num));
 886        }
 887
 888        private void cboDb_DropDownClosed(object sender, EventArgs e)
 889        {
 890            this._editor.Focus();
 891        }
 892
 893        private void cboDb_Enter(object sender, EventArgs e)
 894        {
 895            if (Control.ModifierKeys == Keys.Alt)
 896            {
 897                this.cboDb.DroppedDown = true;
 898            }
 899        }
 900
 901        private void cboDb_SelectedIndexChanged(object sender, EventArgs e)
 902        {
 903            if (this.cboDb.SelectedItem != null)
 904            {
 905                using (this.SuppressPull())
 906                {
 907                    this.CheckToFromProgramLanguage();
 908                    if (this.cboDb.SelectedItem is string)
 909                    {
 910                        if ((((string) this.cboDb.SelectedItem) == "<None>") && (this._query.Repository != null))
 911                        {
 912                            this._query.Repository = null;
 913                        }
 914                        else
 915                        {
 916                            this.cboDb.SelectedIndex = 0;
 917                        }
 918                    }
 919                    Repository selectedItem = this.cboDb.SelectedItem as Repository;
 920                    if (selectedItem != null)
 921                    {
 922                        this._query.Repository = selectedItem;
 923                    }
 924                    this.lblSyncDb.Visible = this._query.Repository != null;
 925                }
 926                this.btnPin.Checked = this._query.Pinned;
 927                this.UpdateFocusedRepository();
 928                this._docMan.CheckForRepositoryChange();
 929                this._schemaTree.UpdateSqlMode(this._query);
 930            }
 931        }
 932
 933        private void cboLanguage_SelectionChangeCommitted(object sender, EventArgs e)
 934        {
 935            this.CheckToFromProgramLanguage();
 936            this._schemaTree.UpdateSqlMode(this._query);
 937        }
 938
 939        private void cboType_DropDownClosed(object sender, EventArgs e)
 940        {
 941            this._editor.Focus();
 942        }
 943
 944        private void cboType_Enter(object sender, EventArgs e)
 945        {
 946            if (Control.ModifierKeys == Keys.Alt)
 947            {
 948                this.cboLanguage.DroppedDown = true;
 949            }
 950        }
 951
 952        private void cboType_SelectedIndexChanged(object sender, EventArgs e)
 953        {
 954            if (this._editor.get_IntelliPrompt().get_MemberList().get_Visible())
 955            {
 956                this._editor.get_IntelliPrompt().get_MemberList().Abort();
 957            }
 958            QueryLanguage language = this.IndexToQueryLanguage(this.cboLanguage.SelectedIndex);
 959            if (language != this._query.QueryKind)
 960            {
 961                this._query.QueryKind = language;
 962            }
 963        }
 964
 965        private bool CheckAndPromptQueryDriver()
 966        {
 967            if ((this._query.Repository == null) || this._query.Repository.DriverLoader.IsValid)
 968            {
 969                return true;
 970            }
 971            if (MessageBox.Show("The database for this query relies on the following custom driver which has not been installed:\r\n\r\n  " + this._query.Repository.DriverLoader.SimpleAssemblyName + " (" + this._query.Repository.DriverLoader.PublicKeyToken + ")\r\n\r\nWould you like to view the publicly available drivers?", "LINQPad", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
 972            {
 973                using (BrowseDriversForm form = new BrowseDriversForm(true))
 974                {
 975                    form.ShowDialog(MainForm.Instance);
 976                    if (form.DoRestart)
 977                    {
 978                        MainForm.Instance.Restart();
 979                    }
 980                }
 981            }
 982            return false;
 983        }
 984
 985        internal void CheckAutocompletionCache()
 986        {
 987            this._docMan.ConfigureResolver();
 988        }
 989
 990        private void CheckIsMyExtensions()
 991        {
 992            if (this._query.IsMyExtensions)
 993            {
 994                if (this.cboLanguage.Items.Count > 1)
 995                {
 996                    this.cboLanguage.Items.Clear();
 997                    this.cboLanguage.Items.Add("C# Program");
 998                }
 999                this.cboDb.Enabled = false;
1000            }
1001        }
1002
1003        private void CheckQueryRepositoryWithSchemaTree()
1004        {
1005            if ((this._query.Repository != null) && (this._query.Repository != this._schemaTree.GetCurrentRepository(true)))
1006            {
1007                bool isModified = this._query.IsModified;
1008                this._schemaTree.RegisterRepository(this._query, false, false);
1009                if (!(isModified || !this._query.IsModified))
1010                {
1011                    this._query.IsModified = false;
1012                }
1013            }
1014        }
1015
1016        internal void CheckToFromProgramLanguage()
1017        {
1018            this.CheckToFromProgramLanguage(this._query.QueryKind, this.IndexToQueryLanguage(this.cboLanguage.SelectedIndex), this._query.Repository != null, this.cboDb.SelectedIndex > 0);
1019        }
1020
1021        internal void CheckToFromProgramLanguage(QueryLanguage oldLanguage, QueryLanguage newLanguage, bool oldDC, bool newDC)
1022        {
1023            string str2;
1024            bool flag = (oldLanguage == QueryLanguage.FSharpProgram) && oldDC;
1025            bool flag2 = (newLanguage == QueryLanguage.FSharpProgram) && newDC;
1026            string str = UserOptions.Instance.ConvertTabsToSpaces ? "".PadRight(UserOptions.Instance.TabSizeActual) : "\t";
1027            if ((oldLanguage == QueryLanguage.Program) && (newLanguage != QueryLanguage.Program))
1028            {
1029                if (this._editor.Text.StartsWith("void Main", StringComparison.Ordinal) && this._editor.Text.TrimEnd(new char[0]).EndsWith("// Define other methods and classes here", StringComparison.Ordinal))
1030                {
1031                    str2 = Regex.Replace(Regex.Replace(this._editor.Text, @"^void Main\s*\(\s*\)\s*{\s*", ""), @"\s*}\s*// Define other methods and classes here\s*$", "").Replace("\n" + str, "\n");
1032                    this._editor.Text = str2;
1033                }
1034            }
1035            else if ((oldLanguage == QueryLanguage.VBProgram) && (newLanguage != QueryLanguage.VBProgram))
1036            {
1037                if (this._editor.Text.StartsWith("Sub Main", StringComparison.OrdinalIgnoreCase) && this._editor.Text.TrimEnd(new char[0]).EndsWith("' Define other methods and classes here", StringComparison.OrdinalIgnoreCase))
1038                {
1039                    str2 = Regex.Replace(Regex.Replace(this._editor.Text, @"^Sub Main\s*", "", RegexOptions.IgnoreCase), @"\s*End Sub\s*' Define other methods and classes here\s*$", "", RegexOptions.IgnoreCase).Replace("\n" + str, "\n");
1040                    this._editor.Text = str2;
1041                }
1042            }
1043            else if (!(!flag || flag2) && this._editor.Text.StartsWith("let dc = new TypedDataContext()", StringComparison.Ordinal))
1044            {
1045                this._editor.Text = this._editor.Text.Substring("let dc = new TypedDataContext()".Length).TrimStart(new char[0]);
1046            }
1047            if ((oldLanguage != QueryLanguage.Program) && (newLanguage == QueryLanguage.Program))
1048            {
1049                if (!((this._editor.Text.Contains("void Main") || this._editor.Text.ToUpperInvariant().Contains("SUB MAIN")) || this._editor.Text.Contains("Task Main")))
1050                {
1051                    this._editor.Text = "void Main()\n{\n" + str + this._query.Source.Replace("\n", "\n" + str) + "\n}\n\n// Define other methods and classes here\n";
1052                    this._editor.get_SelectedView().get_Selection().set_TextRange(new TextRange(14 + str.Length));
1053                }
1054            }
1055            else if ((oldLanguage != QueryLanguage.VBProgram) && (newLanguage == QueryLanguage.VBProgram))
1056            {
1057                if (!(this._editor.Text.ToUpperInvariant().Contains("SUB MAIN") || this._editor.Text.Contains("void Main")))
1058                {
1059                    this._editor.Text = "Sub Main\n" + str + this._query.Source.Replace("\n", "\n" + str) + "\nEnd Sub\n\n' Define other methods and classes here\n";
1060                    this._editor.get_SelectedView().get_Selection().set_TextRange(new TextRange(9 + str.Length));
1061                }
1062            }
1063            else if (!(flag || !flag2) && !this._editor.Text.Contains("let dc = new TypedDataContext()"))
1064            {
1065                this._editor.Text = "let dc = new TypedDataContext()\r\n\r\n" + this._query.Source;
1066                this._editor.get_SelectedView().get_Selection().set_TextRange(new TextRange("let dc = new TypedDataContext()".Length + 2));
1067            }
1068        }
1069
1070        private void ClearExecutionTrackingIndicators()
1071        {
1072            if (this._currentExecutionStack != null)
1073            {
1074                foreach (BitmapBookmarkLineIndicator indicator in this._currentExecutionStack)
1075                {
1076                    this._editor.get_Document().get_LineIndicators().Remove(indicator);
1077                }
1078                this._currentExecutionStack = null;
1079            }
1080        }
1081
1082        private void ClearQueryHighlight()
1083        {
1084            if (this._editor.get_CurrentLineHighlightingVisible())
1085            {
1086                this._editor.set_CurrentLineHighlightingVisible(false);
1087            }
1088        }
1089
1090        private void ClearRegion()
1091        {
1092        }
1093
1094        private void ClockTimer_Tick(object sender, EventArgs e)
1095        {
1096            this.UpdateElapsed();
1097        }
1098
1099        internal void Close()
1100        {
1101            this._query.ClearAutoSave();
1102            this.KillIEComExceptionTimer();
1103            if (this.QueryClosed != null)
1104            {
1105                this.QueryClosed(this, EventArgs.Empty);
1106            }
1107        }
1108
1109        internal void CloseCurrentVisualizer()
1110        {
1111            this.CloseVisualizer(this.GetSelectedPluginControl());
1112        }
1113
1114        internal void CloseVisualizer(PluginControl c)
1115        {
1116            if (c != null)
1117            {
1118                ToolStripButton button = (this.GetSelectedPluginControl() == c) ? this._pluginWinButtons.FirstOrDefault<ToolStripButton>(b => (b.Tag == c)) : null;
1119                int num = (button == null) ? -1 : this.tsOutput.Items.IndexOf(button);
1120                ToolStripButton selectedButton = (num < 1) ? null : (this.tsOutput.Items[num - 1] as ToolStripButton);
1121                try
1122                {
1123                    this._pluginWinManager.DisposeControl(c);
1124                    if (selectedButton != null)
1125                    {
1126                        this.SelectOutputPanel(selectedButton, false);
1127                    }
1128                }
1129                catch
1130                {
1131                }
1132            }
1133        }
1134
1135        internal void CollapseResultsTo(int? depth)
1136        {
1137            this._dataBrowser.CollapseTo(depth);
1138        }
1139
1140        internal void CompleteParam()
1141        {
1142            if (this._editor.get_Document().get_Language() is CSharpSyntaxLanguage)
1143            {
1144                this._editor.get_Document().get_Language().ShowIntelliPromptParameterInfo(this._editor);
1145            }
1146        }
1147
1148        internal void CompleteWord()
1149        {
1150            if (this._editor.get_Document().get_Language() is CSharpSyntaxLanguage)
1151            {
1152                this._editor.get_Document().get_Language().IntelliPromptCompleteWord(this._editor);
1153            }
1154        }
1155
1156        internal void CopyPlain()
1157        {
1158            this._editor.CopyPlain();
1159        }
1160
1161        private void CreateBrowser()
1162        {
1163            this._dataBrowser = new DataResultsWebBrowser();
1164            this._lambdaBrowser = new ResultsWebBrowser();
1165            this._ilBrowser = new ResultsWebBrowser();
1166            this._dataBrowser.PreviewKeyDown += new PreviewKeyDownEventHandler(this._browser_PreviewKeyDown);
1167            this._dataBrowser.LinqClicked += new EventHandler<LinqClickEventArgs>(this._browser_LinqClicked);
1168            this._lambdaBrowser.PreviewKeyDown += new PreviewKeyDownEventHandler(this._browser_PreviewKeyDown);
1169            this._ilBrowser.PreviewKeyDown += new PreviewKeyDownEventHandler(this._browser_PreviewKeyDown);
1170            this._dataPanel = new BrowserBorder();
1171            BrowserBorder border = new BrowserBorder {
1172                BackColor = Control.DefaultBackColor
1173            };
1174            this._lambdaPanel = border;
1175            BrowserBorder border2 = new BrowserBorder {
1176                BackColor = Control.DefaultBackColor
1177            };
1178            this._ilPanel = border2;
1179            this._dataPanel.Controls.Add(this._dataBrowser);
1180            this._dataPanel.Dock = DockStyle.Fill;
1181            this._dataPanel.Hide();
1182            this._lambdaPanel.Controls.Add(this._lambdaBrowser);
1183            this._lambdaPanel.Dock = DockStyle.Fill;
1184            this._lambdaPanel.Hide();
1185            this._ilPanel.Controls.Add(this._ilBrowser);
1186            this._ilPanel.Dock = DockStyle.Fill;
1187            this._ilPanel.Hide();
1188            this.panOutput.Controls.Add(this._dataPanel);
1189            this.panOutput.Controls.Add(this._lambdaPanel);
1190            this.panOutput.Controls.Add(this._ilPanel);
1191            this._dataBrowser.ObjectForScripting = this;
1192        }
1193
1194        private void CreateEditor()
1195        {
1196            EventHandler handler = null;
1197            EventHandler handler2 = null;
1198            EventHandler handler3 = null;
1199            this._editor = new QueryEditor();
1200            this._editor.UriLayer = this._docMan.UriLayer;
1201            this._editor.WarningsLayer = this._docMan.WarningsLayer;
1202            this._editor.MainErrorLayer = this._docMan.MainErrorLayer;
1203            this._editor.StackTraceLayer = this._docMan.StackTraceLayer;
1204            this._editor.set_Document(this._docMan.Document);
1205            if (Program.PresentationMode)
1206            {
1207                if (handler == null)
1208                {
1209                    handler = (sender, e) => this.NextQueryRequest(this, EventArgs.Empty);
1210                }
1211                this._editor.NextQueryRequest += handler;
1212                if 

Large files files are truncated, but you can click here to view the full file