PageRenderTime 68ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/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
Possible License(s): CC-BY-SA-3.0, LGPL-2.0, Apache-2.0

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

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

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