コード例 #1
0
        public override void BuildsChilds()
        {
            IConnection     connection = null;
            ISharpQueryNode node       = null;

            try
            {
                connection = AbstractSharpQueryConnectionWrapper.CreateFromDataConnectionLink();

                if (connection != null)
                {
                    string ChildClass = "";

                    if (SharpQueryTree.SchemaClassDict.ContainsKey(connection.GetType().FullName) == true)
                    {
                        ChildClass = SharpQueryTree.SchemaClassDict[connection.GetType().FullName];
                    }

                    if ((ChildClass != null) && (ChildClass != ""))
                    {
                        node = (ISharpQueryNode)ass.CreateInstance(ChildClass, false, BindingFlags.CreateInstance, null, new object[] { connection }, null, null);
                    }
                    else
                    {
                        node = new SharpQueryNodeNotSupported(new SharpQueryNotSupported(connection, "", "", "", connection.GetType().FullName));
                    }


                    //TODO : do an interface for the node connection!
                    (node as SharpQueryNodeConnection).Connect();
                    this.Nodes.Add(node as TreeNode);
                    node.Refresh();

                    if (node.Connection.IsConnectionStringWrong == true)
                    {
                        this.Nodes.Remove(node as TreeNode);
                    }
                    else
                    {
                        this.Expand();
                    }
                }
            }
            catch (ConnectionStringException e)
            {
                if (this.Nodes.Contains(node as TreeNode) == true)
                {
                    this.Nodes.Remove(node as TreeNode);
                }
                MessageService.ShowError(e.Message);
            }
        }
コード例 #2
0
		public override void BuildsChilds()
		{
			IConnection connection = null;
			ISharpQueryNode node = null;

			try
			{
				connection = AbstractSharpQueryConnectionWrapper.CreateFromDataConnectionLink();

				if (connection != null)
				{
					string ChildClass = "";

					if (SharpQueryTree.SchemaClassDict.ContainsKey(connection.GetType().FullName) == true)
					{
						ChildClass = SharpQueryTree.SchemaClassDict[connection.GetType().FullName];
					}

					if ((ChildClass != null) && (ChildClass != ""))
					{
						node = (ISharpQueryNode)ass.CreateInstance(ChildClass, false, BindingFlags.CreateInstance, null, new object[] { connection }, null, null);
					}
					else
					{
						node = new SharpQueryNodeNotSupported(new SharpQueryNotSupported(connection, "", "", "", connection.GetType().FullName));
					}


					//TODO : do an interface for the node connection!
					(node as SharpQueryNodeConnection).Connect();
					this.Nodes.Add(node as TreeNode);
					node.Refresh();

					if (node.Connection.IsConnectionStringWrong == true)
					{
						this.Nodes.Remove(node as TreeNode);
					}
					else
					{
						this.Expand();
					}
				}
			}
			catch (ConnectionStringException e)
			{
				if (this.Nodes.Contains(node as TreeNode) == true)
				{
					this.Nodes.Remove(node as TreeNode);
				}
				MessageService.ShowError(e.Message);
			}
		}