Esempio n. 1
0
 internal QueryControl(RunnableQuery q, SchemaTree schemaTree)
 {
     EventHandler onClick = null;
     EventHandler handler2 = null;
     EventHandler handler3 = null;
     EventHandler handler4 = null;
     SplitterCancelEventHandler handler5 = null;
     this._browserHidden = true;
     Timer timer = new Timer {
         Interval = 0x2710,
         Enabled = true
     };
     this._autoSaveTimer = timer;
     this._executionTrackingTimer = new Timer();
     this._pluginWinButtons = new List<ToolStripButton>();
     this._query = new RunnableQuery();
     this.NextQueryRequest = delegate (object sender, EventArgs e) {
     };
     this.PreviousQueryRequest = delegate (object sender, EventArgs e) {
     };
     this._lambdaData = new MemoryStream();
     this._ilDirty = true;
     this._ilData = new MemoryStream();
     this._queryCount = 0;
     Timer timer2 = new Timer {
         Interval = 200
     };
     this._refreshTimer = timer2;
     Timer timer3 = new Timer {
         Interval = 200
     };
     this._clockTimer = timer3;
     this._firstResultsShow = true;
     this._lastQueryKind = QueryLanguage.SQL;
     this._suppressPullCount = 0;
     this._random = new Random();
     this.components = null;
     this._query = q;
     this._schemaTree = schemaTree;
     try
     {
         this.Font = FontManager.GetDefaultFont();
     }
     catch
     {
     }
     this.InitializeComponent();
     this.CheckIsMyExtensions();
     this._pluginWinManager = new PluginWindowManager(this);
     this._pluginWinButtonMenu = new ContextMenuStrip(this.components);
     if (onClick == null)
     {
         onClick = (sender, e) => this.CloseCurrentVisualizer();
     }
     this._pluginWinButtonMenu.Items.Add("Close visualizer (Shift+F4 or Middle-Click or Ctrl+Click)", Resources.Delete, onClick);
     if (this.btnExecute.Height > 0x20)
     {
         this.btnExecute.Height -= 3;
         this.cboLanguage.Margin = new Padding(this.cboLanguage.Margin.Left, 2, this.cboLanguage.Margin.Right, 4);
         this.cboDb.Margin = new Padding(this.cboDb.Margin.Left, 2, this.cboDb.Margin.Right, 4);
     }
     else if (this.btnExecute.Height > 0x1d)
     {
         this.btnExecute.Height -= 2;
     }
     else if (this.btnExecute.Height > 0x18)
     {
         this.btnExecute.Height--;
     }
     this.btnCancel.Height = this.btnExecute.Height;
     this.btnText.Height = this.btnGrids.Height = this.btnExecute.Height - 1;
     if ((IntPtr.Size == 4) && (this.btnExecute.Height > 0x1b))
     {
         Padding margin = this.cboLanguage.Margin;
         this.cboLanguage.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
         margin = this.cboDb.Margin;
         this.cboDb.Margin = new Padding(margin.Left, margin.Top, margin.Right, margin.Bottom - 1);
     }
     if (this.btnExecute.Height > 40)
     {
         this.btnExecute.Image = ControlUtil.ResizeImage(this.btnExecute.Image, this.btnExecute.Width, this.btnExecute.Height, true);
         this.btnCancel.Image = ControlUtil.ResizeImage(this.btnCancel.Image, this.btnCancel.Width, this.btnCancel.Height, true);
         this.btnGrids.Image = ControlUtil.ResizeImage(this.btnGrids.Image, (this.btnGrids.Width * 3) / 4, (this.btnGrids.Height * 3) / 4, true);
         this.btnText.Image = ControlUtil.ResizeImage(this.btnText.Image, (this.btnText.Width * 3) / 4, (this.btnText.Height * 3) / 4, true);
     }
     this.UpdateAutocompletionMsg();
     try
     {
         this.txtError.Font = new Font("Verdana", 8.25f);
         this.txtSQL.Font = new Font("Verdana", 9.5f);
         this.btnActivateAutocompletion.Font = new Font("Verdana", 8f, FontStyle.Bold);
         this.lblOptimize.Font = new Font("Verdana", 7f, FontStyle.Bold);
     }
     catch
     {
     }
     this.txtSQL.get_Document().set_Language(DocumentManager.GetDynamicLanguage("SQL", SystemColors.Window.GetBrightness()));
     this.txtSQL.get_Document().get_Outlining().set_Mode(2);
     this.txtSQL.set_BracketHighlightingVisible(true);
     this.txtSQL.get_Document().set_ReadOnly(true);
     VisualStudio2005SyntaxEditorRenderer renderer = new VisualStudio2005SyntaxEditorRenderer();
     SimpleBorder border = new SimpleBorder();
     border.set_Style(0);
     renderer.set_Border(border);
     VisualStudio2005SyntaxEditorRenderer renderer2 = renderer;
     this.txtSQL.set_Renderer(renderer2);
     this._docMan = new DocumentManager(this._query, this);
     this.CreateEditor();
     this.PropagateOptions();
     this.UpdateEditorZoom();
     this.CreateBrowser();
     this._browserHidden = true;
     this.panBottom.BorderStyle = BorderStyle.None;
     this.tsOutput.BackColor = Color.Transparent;
     this.tsOutput.Renderer = new OutputToolsRenderer();
     this.statusStrip.BackColor = Color.Transparent;
     this.statusStrip.Padding = new Padding(this.statusStrip.Padding.Left, this.statusStrip.Padding.Top, this.statusStrip.Padding.Left, this.statusStrip.Padding.Bottom);
     this.PullData(QueryChangedEventArgs.Refresh);
     this.ToggleResultsCollapse();
     this._query.QueryCompiled += new EventHandler<QueryCompilationEventArgs>(this._query_QueryCompiled);
     this._query.PluginsReady += new EventHandler(this._query_PluginsReady);
     this._query.CustomClickCompleted += new EventHandler(this._query_CustomClickCompleted);
     this._query.QueryCompleted += new EventHandler<QueryStatusEventArgs>(this._query_QueryCompleted);
     this._query.QueryChanged += new EventHandler<QueryChangedEventArgs>(this._query_QueryChanged);
     this._query.ReadLineRequested += new EventHandler<ReadLineEventArgs>(this._query_ReadLineRequested);
     this._editor.TextChanged += new EventHandler(this._editor_TextChanged);
     this._editor.add_SelectionChanged(new SelectionEventHandler(this, (IntPtr) this._editor_SelectionChanged));
     this._editor.RepositoryDropped += new EventHandler<QueryEditor.RepositoryEventArgs>(this._editor_RepositoryDropped);
     this._schemaTree.AfterSelect += new TreeViewEventHandler(this._schemaTree_AfterSelect);
     this._docMan.CheckForRepositoryChange();
     this._refreshTimer.Tick += new EventHandler(this.RefreshTimer_Tick);
     this._clockTimer.Tick += new EventHandler(this.ClockTimer_Tick);
     this._autoSaveTimer.Tick += new EventHandler(this.AutoSaveTimer_Tick);
     if (handler2 == null)
     {
         handler2 = (sender, e) => this.ReportMainThreadPosition();
     }
     this._executionTrackingTimer.Tick += handler2;
     if (SystemColors.Window.GetBrightness() < 0.5f)
     {
         this.llDbUseCurrent.ForeColor = SystemColors.HotTrack;
     }
     this.ExtendOutputSplitter();
     if (handler3 == null)
     {
         handler3 = (sender, e) => this.UpdateErrorHeight();
     }
     this.panError.SizeChanged += handler3;
     this.statusStrip.Parent = null;
     base.Controls.Add(this.statusStrip);
     this.statusStrip.SendToBack();
     if (handler4 == null)
     {
         handler4 = (sender, e) => this.RequestWinManagerRelocation();
     }
     EventHandler handler6 = handler4;
     this.panOutput.Resize += handler6;
     for (Control control = this.panOutput; control != null; control = control.Parent)
     {
         control.Move += handler6;
     }
     this._query.PluginWindowManager = this._pluginWinManager;
     this.queryProgressBar.Margin = new Padding(3, 3, 0, 1);
     this.tsOutput.Padding = new Padding(0, 0, 0, 2);
     this.splitContainer.SplitterWidth--;
     if (handler5 == null)
     {
         handler5 = delegate (object sender, SplitterCancelEventArgs e) {
             if (Control.MouseButtons == MouseButtons.Left)
             {
                 MainForm.Instance.IsSplitting = true;
             }
             if ((this.panOutput.BackColor == MainForm.Instance.TransparencyKey) && (this.panOutput.BackColor != Program.LightTransparencyKey))
             {
                 this.panOutput.BackColor = MainForm.Instance.TransparencyKey = Program.LightTransparencyKey;
             }
         };
     }
     this.splitContainer.SplitterMoving += handler5;
     this.panOutput.BorderStyle = BorderStyle.None;
     this.panOutput.BorderColor = Color.FromArgb(160, 160, 160);
     this.lblSyncDb.Cursor = Cursors.Hand;
     this.toolTip.ShowAlways = true;
     this.EnableControls();
     this.panBottom.Layout += new LayoutEventHandler(this.panBottom_Layout);
 }
Esempio n. 2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && (this.components != null))
     {
         this.components.Dispose();
         this.KillIEComExceptionTimer();
         if (this._dataBrowser != null)
         {
             this._dataBrowser.ObjectForScripting = null;
         }
         this._pluginWinManager.Reset(false);
         this._query.Dispose();
         this._query = null;
         this._schemaTree.AfterSelect -= new TreeViewEventHandler(this._schemaTree_AfterSelect);
         if (this._docMan != null)
         {
             this._docMan.Dispose();
         }
         this._docMan = null;
         if (this._readLinePanel != null)
         {
             this._readLinePanel.Dispose();
             this._readLinePanel = null;
         }
         this._dataBrowser.Dispose();
         this._lambdaBrowser.Dispose();
         this._ilBrowser.Dispose();
         this._dataPanel.Dispose();
         this._lambdaPanel.Dispose();
         this._ilPanel.Dispose();
         this._refreshTimer.Dispose();
         this._clockTimer.Dispose();
         this._autoSaveTimer.Dispose();
         this._executionTrackingTimer.Dispose();
         this._pluginWinManager.Dispose();
     }
     base.Dispose(disposing);
 }