예제 #1
0
        internal bool ProcessClick()
        {
            // This item is obfuscated and can not be translated.
            if (this._explorerItem.HyperlinkTarget == null)
            {
                return(false);
            }
            for (TreeNode node = base.Parent; node == null; node = node.Parent)
            {
Label_0024:
                if (0 == 0)
                {
                    RepositoryNode node2 = node as RepositoryNode;
                    if (node2 == null)
                    {
                        return(false);
                    }
                    ExplorerItemNode node3 = node2.FindExplorerItemNode(this._explorerItem.HyperlinkTarget);
                    if (node3 == null)
                    {
                        return(false);
                    }
                    base.TreeView.SelectedNode = node3;
                    if (node3.Nodes.Count > 0)
                    {
                        node3.Nodes.Cast <TreeNode>().Take <TreeNode>(7).Last <TreeNode>().EnsureVisible();
                    }
                    return(true);
                }
            }
            goto Label_0024;
        }
예제 #2
0
        public NodeContextMenu(SchemaTree tree, RepositoryNode node)
        {
            EventHandler onClick = null;

            this._tree = tree;
            this._node = node;
            if ((node.Repository.DriverLoader.InternalID == null) && node.Repository.DriverLoader.IsValid)
            {
                ToolStripLabel label = new ToolStripLabel("Custom driver: " + node.Repository.DriverLoader.Driver.Name);
                this.Items.Add(label);
                this.Items.Add("-");
                label.Font = new Font(label.Font, FontStyle.Bold);
            }
            if (node.Repository.IsQueryable)
            {
                this.Items.Add("New Query", Resources.New, new EventHandler(this.NewQuery));
                this.Items.Add("-");
                if ((MainForm.Instance != null) && (MainForm.Instance.CurrentQueryControl != null))
                {
                    this.Items.Add("Use in Current Query", Resources.UseCurrentQuery, (sender, e) => MainForm.Instance.CurrentQueryControl.UseCurrentDb(false));
                    if (MainForm.Instance.CurrentQueryControl.Query.Repository == node.Repository)
                    {
                        this.Items[this.Items.Count - 1].Enabled = false;
                    }
                    this.Items.Add("-");
                }
                if (MainForm.Instance != null)
                {
                    if (onClick == null)
                    {
                        onClick = (sender, e) => MainForm.Instance.ClearAllConnections(node.Repository);
                    }
                    this.Items.Add("Close all connections", null, onClick);
                    this.Items.Add("-");
                }
            }
            this.Items.Add("Refresh", Resources.Refresh, new EventHandler(this.Refresh));
            if (node.Parent == null)
            {
                this.Items.Add("Delete Connection", Resources.Delete, new EventHandler(this.Delete));
            }
            if (!((this._node.Repository.DriverLoader.SimpleAssemblyName != null) && this._node.Repository.DriverLoader.SimpleAssemblyName.StartsWith("Mindscape.LightSpeed", StringComparison.InvariantCultureIgnoreCase)) && (this._node.Repository.Parent == null))
            {
                this.Items.Add("-");
                this.Items.Add("Rename Connection", null, new EventHandler(this.Rename));
                if (!string.IsNullOrEmpty(this._node.Repository.DisplayName))
                {
                    this.Items.Add("Reset Connection Name", null, new EventHandler(this.ResetName));
                }
            }
            if (node.Parent == null)
            {
                this.Items.Add("Create Similar Connection...", null, new EventHandler(this.CreateSimilar));
                this.Items.Add("-");
                this.Items.Add("Properties", Resources.AdvancedProperties, new EventHandler(this.Edit));
            }
        }
예제 #3
0
 public NodeContextMenu(SchemaTree tree, RepositoryNode node)
 {
     EventHandler onClick = null;
     this._tree = tree;
     this._node = node;
     if ((node.Repository.DriverLoader.InternalID == null) && node.Repository.DriverLoader.IsValid)
     {
         ToolStripLabel label = new ToolStripLabel("Custom driver: " + node.Repository.DriverLoader.Driver.Name);
         this.Items.Add(label);
         this.Items.Add("-");
         label.Font = new Font(label.Font, FontStyle.Bold);
     }
     if (node.Repository.IsQueryable)
     {
         this.Items.Add("New Query", Resources.New, new EventHandler(this.NewQuery));
         this.Items.Add("-");
         if ((MainForm.Instance != null) && (MainForm.Instance.CurrentQueryControl != null))
         {
             this.Items.Add("Use in Current Query", Resources.UseCurrentQuery, (sender, e) => MainForm.Instance.CurrentQueryControl.UseCurrentDb(false));
             if (MainForm.Instance.CurrentQueryControl.Query.Repository == node.Repository)
             {
                 this.Items[this.Items.Count - 1].Enabled = false;
             }
             this.Items.Add("-");
         }
         if (MainForm.Instance != null)
         {
             if (onClick == null)
             {
                 onClick = (sender, e) => MainForm.Instance.ClearAllConnections(node.Repository);
             }
             this.Items.Add("Close all connections", null, onClick);
             this.Items.Add("-");
         }
     }
     this.Items.Add("Refresh", Resources.Refresh, new EventHandler(this.Refresh));
     if (node.Parent == null)
     {
         this.Items.Add("Delete Connection", Resources.Delete, new EventHandler(this.Delete));
     }
     if (!((this._node.Repository.DriverLoader.SimpleAssemblyName != null) && this._node.Repository.DriverLoader.SimpleAssemblyName.StartsWith("Mindscape.LightSpeed", StringComparison.InvariantCultureIgnoreCase)) && (this._node.Repository.Parent == null))
     {
         this.Items.Add("-");
         this.Items.Add("Rename Connection", null, new EventHandler(this.Rename));
         if (!string.IsNullOrEmpty(this._node.Repository.DisplayName))
         {
             this.Items.Add("Reset Connection Name", null, new EventHandler(this.ResetName));
         }
     }
     if (node.Parent == null)
     {
         this.Items.Add("Create Similar Connection...", null, new EventHandler(this.CreateSimilar));
         this.Items.Add("-");
         this.Items.Add("Properties", Resources.AdvancedProperties, new EventHandler(this.Edit));
     }
 }
        private TResult ProcessDDL <TResult>(Func <RepositoryNode, TResult> action)
        {
            TreeNode parent = this._node;

            while (!(parent is RepositoryNode))
            {
                parent = parent.Parent;
                if (parent == null)
                {
                    return(default(TResult));
                }
            }
            RepositoryNode   rNode      = (RepositoryNode)parent;
            string           errorMsg   = null;
            TResult          result     = default(TResult);
            ManualResetEvent waitHandle = new ManualResetEvent(false);

            new Thread(delegate {
                try
                {
                    result = action(rNode);
                }
                catch (Exception exception)
                {
                    errorMsg = exception.Message;
                }
                finally
                {
                    waitHandle.Set();
                }
            })
            {
                Name = "DDL Query", IsBackground = true
            }.Start();
            if (!waitHandle.WaitOne(0x1b58, false))
            {
                MessageBox.Show("The server timed out.", "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(default(TResult));
            }
            if (errorMsg != null)
            {
                MessageBox.Show("Error: " + errorMsg, "LINQPad", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(default(TResult));
            }
            return(result);
        }
예제 #5
0
 internal void Edit(RepositoryNode node)
 {
     if (RepositoryDialogManager.Show(node.Repository, false))
     {
         this.UpdateRepositoryNode(node);
     }
 }
예제 #6
0
 internal void Delete(RepositoryNode node)
 {
     if (node.Repository.Persist)
     {
         node.Repository.Persist = false;
         node.Repository.SaveToDisk();
     }
     base.Nodes.Remove(node);
     node.Dispose();
     RepositoryArgs args = new RepositoryArgs {
         Repository = node.Repository
     };
     this.OnRepositoryDeleted(args);
     this.UpdateAllNodeText();
 }