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;
        }
Пример #2
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;
        }
        public void SpawnSqlEditorWindow(object sender, ExecutedRoutedEventArgs e)
        {
            var databaseInfo = ValidateMenuInfo(sender);

            if (databaseInfo == null)
            {
                return;
            }

            SqlEditorControl editor = new SqlEditorControl();

            editor.Database = databaseInfo.Connectionstring;
            FabTabItem tab = new FabTabItem();

            tab.Content = editor;
            tab.Header  = databaseInfo.Caption;
            _parentWindow.FabTab.Items.Add(tab);
            _parentWindow.FabTab.SelectedIndex = _parentWindow.FabTab.Items.Count - 1;
            return;
        }