/// <summary>
 /// Standard constructor for the tool window.
 /// </summary>
 public SqlEditorWindow() : base(null)
 {
     Caption          = "SQL Editor";
     BitmapResourceID = 301;
     BitmapIndex      = 1;
     Telemetry.TrackPageView(nameof(SqlEditorWindow));
     editor   = new SqlEditorControl(this);
     _control = editor;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Standard constructor for the tool window.
 /// </summary>
 public SqlEditorWindow() : base(null)
 {
     this.Caption = "SQL Editor";
     this.BitmapResourceID = 301;
     this.BitmapIndex = 1;
     Telemetry.TrackPageView(nameof(SqlEditorWindow));
     editor = new SqlEditorControl(this);
     control = editor;
 }
 private void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script)
 {
     SqlEditorControl editor = new SqlEditorControl();
     editor.Database = menuInfo.Connectionstring;
     editor.SqlText = script;
     FabTabItem tab = new FabTabItem();
     tab.Content = editor;
     tab.Header = menuInfo.Caption;
     _parentWindow.FabTab.Items.Add(tab);
     _parentWindow.FabTab.SelectedIndex = _parentWindow.FabTab.Items.Count - 1; 
     return;
 }
Ejemplo n.º 4
0
        public void OpenSqlEditorToolWindow(MenuCommandParameters menuInfo, string script)
        {
            SqlEditorControl editor = new SqlEditorControl();
            editor.Database = menuInfo.Connectionstring;
            editor.SqlText = script;
            FabTabItem tab = new FabTabItem();
            tab.Content = editor;
            string tabTitle = System.IO.Path.GetFileNameWithoutExtension(menuInfo.Caption) + "-" + menuInfo.Name;
            tab.Header = tabTitle;

            int i = -1;
            int insertAt = -1;
            foreach (var item in _parent.FabTab.Items)
            {
                i++;
                if (item is FabTabItem)
                {
                    FabTabItem ftItem = (FabTabItem)item;
                    if (ftItem.Header.ToString().StartsWith(tabTitle))
                    {
                        insertAt = i;
                    }
                }
            }
            if (insertAt > -1)
            {
                _parent.FabTab.Items.Insert(insertAt + 1, tab);
                if (_parent.FabTab.Items.Count == 3)
                    insertAt = insertAt + 1;
                _parent.FabTab.SelectedIndex = insertAt + 1;
            }
            else
            {
                _parent.FabTab.Items.Add(tab);
                _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1;
            }
            return;
        }