예제 #1
0
 public ResultsDockForm(MainForm mainForm)
 {
     this._mainForm = mainForm;
     this.InitializeComponent();
     base.Icon = mainForm.Icon;
     base.Padding = new Padding(3);
     this.AutoPosition();
 }
예제 #2
0
 public static bool HandleKey(MainForm form, QueryControl qc, Keys keyData)
 {
     HotKeyManager manager = new HotKeyManager(form, qc);
     if (manager.HandleCommonQuerylessKeys(keyData))
     {
         return true;
     }
     if (manager.CurrentQueryControl == null)
     {
         return false;
     }
     if (manager.HandleCommonKeys(keyData))
     {
         return true;
     }
     if (UseStudioKeys)
     {
         return manager.HandleStudioKey(keyData);
     }
     return manager.HandleSSMSKey(keyData);
 }
예제 #3
0
 public MainForm(string queryToLoad, bool runQuery)
 {
     Func<Screen, bool> predicate = null;
     Action a = null;
     SplitterCancelEventHandler handler = null;
     Action action2 = null;
     Action action3 = null;
     EventHandler handler2 = null;
     EventHandler handler3 = null;
     EventHandler handler4 = null;
     EventHandler handler5 = null;
     EventHandler handler6 = null;
     EventHandler handler7 = null;
     this._untitledCount = 1;
     this._firstOpen = true;
     this._queryPages = new Dictionary<RunnableQuery, TabPage>();
     this._cacheQueryControls = new Queue<QueryControl>();
     this._transparencyEnabled = false;
     int? maxQueryRows = UserOptions.Instance.MaxQueryRows;
     this._lastMaxQueryRows = maxQueryRows.HasValue ? maxQueryRows.GetValueOrDefault() : 0x3e8;
     this._lastFormState = FormWindowState.Normal;
     this.components = null;
     this.InitializeComponent();
     base.Icon = Resources.LINQPad;
     LINQPad.UI.ResultsDockForm form = new LINQPad.UI.ResultsDockForm(this) {
         Owner = this
     };
     this._resultsDockForm = form;
     try
     {
         this.llOrganize.UseCompatibleTextRendering = true;
         this.llSetFolder.UseCompatibleTextRendering = true;
     }
     catch
     {
     }
     if (!this.RestoreWindow())
     {
         base.Location = new Point(20, 20);
     }
     this.mainMenu.RenderMode = ToolStripRenderMode.System;
     this.miUnload.Text = "Cancel All Threads and Reset";
     this.miUnload.ShortcutKeys = Keys.Control | Keys.Shift | Keys.F5;
     this.UpdateHotkeys();
     Rectangle testBounds = base.Bounds;
     testBounds.Inflate(-10, -10);
     if (!Screen.AllScreens.Any<Screen>(s => s.Bounds.Contains(testBounds)))
     {
         base.ClientSize = new Size((base.ClientSize.Width * 3) / 4, (base.ClientSize.Height * 3) / 4);
         if (predicate == null)
         {
             predicate = s => s.Bounds.Contains(base.Bounds);
         }
         if (!Screen.AllScreens.Any<Screen>(predicate))
         {
             this._lastWindowState = FormWindowState.Maximized;
             base.WindowState = FormWindowState.Maximized;
         }
     }
     this.schemaTree.NewQuery += new EventHandler<NewQueryArgs>(this.schemaTree_NewQuery);
     this.schemaTree.CxEdited += new EventHandler(this.schemaTree_CxEdited);
     this.schemaTree.RepositoryDeleted += new EventHandler<RepositoryArgs>(this.schemaTree_RepositoryDeleted);
     this.schemaTree.StaticSchemaRepositoryChanged += new EventHandler<RepositoryArgs>(this.schemaTree_StaticSchemaRepositoryChanged);
     Instance = this;
     if (!(!string.IsNullOrEmpty(queryToLoad) && File.Exists(queryToLoad)))
     {
         this.AddQueryPage();
     }
     if (a == null)
     {
         a = delegate {
             if (this.CurrentQueryControl != null)
             {
                 this.CurrentQueryControl.FocusQuery();
             }
         };
     }
     Program.RunOnWinFormsTimer(a);
     this.DisplayMessageCore("Activate premium features", true, true, true);
     this.RepopulateSchemaTree();
     bool flag = false;
     if (!string.IsNullOrEmpty(queryToLoad))
     {
         flag = this.OpenQuery(queryToLoad, true) != null;
     }
     this.verticalSplit.Layout += new LayoutEventHandler(this.verticalSplit_Layout);
     this.verticalSplit.SplitterMoved += new SplitterEventHandler(this.verticalSplit_SplitterMoved);
     if (handler == null)
     {
         handler = delegate (object sender, SplitterCancelEventArgs e) {
             if (Control.MouseButtons == MouseButtons.Left)
             {
                 this.IsSplitting = true;
             }
         };
     }
     this.verticalSplit.SplitterMoving += handler;
     this.tvMyQueries.MouseDown += new MouseEventHandler(this.tvMyQueries_MouseDown);
     this.sampleQueries.MouseDown += new MouseEventHandler(this.sampleQueries_MouseDown);
     if (Program.PresentationMode)
     {
         this.tvMyQueries.KeyDown += new KeyEventHandler(this.tv_KeyDown);
         this.sampleQueries.KeyDown += new KeyEventHandler(this.tv_KeyDown);
         this.schemaTree.KeyDown += new KeyEventHandler(this.tv_KeyDown);
     }
     this._lastQueryControl = this.CurrentQueryControl;
     LicenseManager.GetLicensee();
     if (action2 == null)
     {
         action2 = () => base.Invoke(new Action(this.RestoreActivationMessage));
     }
     WSAgent.MessageChanged = action2;
     base.KeyPreview = true;
     this.Text = this.Text + " 4";
     if ((flag && runQuery) && (this.CurrentQueryControl != null))
     {
         this.CurrentQueryControl.Run();
     }
     if (flag && (this.CurrentQueryControl != null))
     {
         if (action3 == null)
         {
             action3 = delegate {
                 if (this.CurrentQueryControl != null)
                 {
                     this.CurrentQueryControl.FixOutliningStartupBug();
                 }
             };
         }
         Program.RunOnWinFormsTimer(action3);
     }
     if (handler2 == null)
     {
         handler2 = delegate (object sender, EventArgs e) {
             if (this.CurrentQueryControl != null)
             {
                 this.CurrentQueryControl.AncestorMoved();
             }
         };
     }
     EventHandler handler8 = handler2;
     for (Control control = this.tcQueries; control != null; control = control.Parent)
     {
         control.Move += handler8;
     }
     Timer timer = new Timer {
         Interval = 0xbb8
     };
     this._collectTimer = timer;
     if (handler3 == null)
     {
         handler3 = delegate (object sender, EventArgs e) {
             if (this._pendingGC > 0)
             {
                 GC.Collect();
                 if (--this._pendingGC == 0)
                 {
                     this._collectTimer.Stop();
                 }
             }
         };
     }
     this._collectTimer.Tick += handler3;
     Timer timer2 = new Timer {
         Interval = 300
     };
     this._assemblyUnlockTimer = timer2;
     this._assemblyUnlockTimer.Tick += new EventHandler(this._assemblyUnlockTimer_Tick);
     Timer timer3 = new Timer {
         Interval = 0x1388
     };
     this._newQueryCacheTimer = timer3;
     this._newQueryCacheTimer.Tick += new EventHandler(this._newQueryCacheTimer_Tick);
     this._newQueryCacheTimer.Start();
     Timer timer4 = new Timer {
         Interval = 300
     };
     this._fakeActiveFormTimer = timer4;
     if (handler4 == null)
     {
         handler4 = (sender, e) => this.InactivateTitleBarNecessary();
     }
     this._fakeActiveFormTimer.Tick += handler4;
     if (Application.RenderWithVisualStyles)
     {
         this.tvMyQueries.Dock = DockStyle.None;
         this.tvMyQueries.BorderStyle = BorderStyle.None;
         this.pagMyQueries.Layout += new LayoutEventHandler(this.pagMyQueries_Layout);
         this.sampleQueries.BorderStyle = BorderStyle.None;
         this.pagSamples.Padding = new Padding(0, 3, 0, 0);
     }
     this.tvMyQueries.QueryRenamed += new RenamedEventHandler(this.tvMyQueries_QueryRenamed);
     this.tvMyQueries.QueryPotentiallyMoved += new Action<string, string>(this.tvMyQueries_QueryPotentiallyMoved);
     this.miAutoScroll.Checked = UserOptionsLive.Instance.AutoScrollResults;
     if (handler5 == null)
     {
         handler5 = (sender, e) => this.ApplyEditToPlugin = (this.CurrentQueryControl != null) && this.CurrentQueryControl.WasPluginRecentlyFocused;
     }
     this.mainMenu.MenuActivate += handler5;
     if (handler6 == null)
     {
         handler6 = delegate (object sender, EventArgs e) {
             if (this.ApplyEditToPlugin)
             {
                 QueryControl qc = this.CurrentQueryControl;
                 Program.RunOnWinFormsTimer(delegate {
                     this.ApplyEditToPlugin = false;
                     if ((this.CurrentQueryControl == qc) && qc.IsPluginSelected())
                     {
                         this.CurrentQueryControl.FocusSelectedPlugin();
                     }
                 }, 50);
             }
         };
     }
     this.mainMenu.MenuDeactivate += handler6;
     if (handler7 == null)
     {
         handler7 = delegate (object sender, EventArgs e) {
             if (!base.IsDisposed)
             {
                 foreach (QueryControl control in this.GetQueryControls())
                 {
                     control.RefreshOptimizeQuery();
                     control.Query.RequiresRecompilation = true;
                 }
             }
         };
     }
     UserOptionsLive.Instance.OptimizeQueriesChanged += handler7;
 }
예제 #4
0
 private HotKeyManager(MainForm f, QueryControl qc)
 {
     this._mainForm = f;
     this._queryControl = qc;
 }