From 0ac84860425a2f794baf3c4c34c53f1416ee4398 Mon Sep 17 00:00:00 2001 From: Dickon Field Date: Fri, 11 Jan 2008 19:11:56 +0000 Subject: [PATCH] Started new style Server control, incorporating dbtool git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2814 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ServerTools/ICSharpCode.ServerTools.addin | 24 +++ .../ICSharpCode.ServerTools.csproj | 154 ++++++++++++++++++ .../ServerTools/Properties/AssemblyInfo.cs | 57 +++++++ .../Properties/Resources.Designer.cs | 71 ++++++++ .../ServerTools/Properties/Resources.resx | 117 +++++++++++++ .../Properties/Settings.Designer.cs | 30 ++++ .../ServerTools/Properties/Settings.settings | 7 + .../ServerTools/ServerBrowserHost.cs | 63 +++++++ .../ServerTools/ServerControl.xaml | 27 +++ .../ServerTools/ServerControl.xaml.cs | 80 +++++++++ .../ICSharpCode.DataTools.csproj | 10 ++ .../ICSharpCode.DataTools/OleDbUtils.cs | 112 ++++++++++--- src/SharpDevelop.sln | 26 +-- 13 files changed, 737 insertions(+), 41 deletions(-) create mode 100644 src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.addin create mode 100644 src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.csproj create mode 100644 src/AddIns/DisplayBindings/ServerTools/Properties/AssemblyInfo.cs create mode 100644 src/AddIns/DisplayBindings/ServerTools/Properties/Resources.Designer.cs create mode 100644 src/AddIns/DisplayBindings/ServerTools/Properties/Resources.resx create mode 100644 src/AddIns/DisplayBindings/ServerTools/Properties/Settings.Designer.cs create mode 100644 src/AddIns/DisplayBindings/ServerTools/Properties/Settings.settings create mode 100644 src/AddIns/DisplayBindings/ServerTools/ServerBrowserHost.cs create mode 100644 src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml create mode 100644 src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml.cs diff --git a/src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.addin b/src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.addin new file mode 100644 index 0000000000..e5c0f7f322 --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.addin @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.csproj b/src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.csproj new file mode 100644 index 0000000000..2ecd39ee3e --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.csproj @@ -0,0 +1,154 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {8CF1EB90-324F-4AA9-BAA2-DEF87392CE86} + Library + Properties + ICSharpCode.ServerTools + ICSharpCode.ServerTools + v3.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + False + False + false + + + true + Full + false + ..\..\..\..\AddIns\AddIns\DisplayBindings\ServerTools\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + True + + + False + Auto + 4194304 + AnyCPU + + + + + + 3.5 + + + + 3.5 + + + 3.5 + + + + + 3.0 + + + 3.0 + + + 3.0 + + + 3.0 + + + 3.0 + + + + + MSBuild:Compile + Designer + + + ServerControl.xaml + Code + + + {2748AD25-9C63-4E12-877B-4DCE96FBED54} + ICSharpCode.SharpDevelop + + + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} + ICSharpCode.Core + + + {EF53050B-882E-4776-B643-EDA472E8E3F2} + 2 + 7 + 0 + tlbimp + False + + + {2206CEB0-19C1-11D1-89E0-00C04FD7A829} + 1 + 0 + 0 + tlbimp + False + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + {6CC3DF82-E815-483F-B4B5-85191064D981} + ICSharpCode.DataTools + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/ServerTools/Properties/AssemblyInfo.cs b/src/AddIns/DisplayBindings/ServerTools/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..0e97e34e51 --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/Properties/AssemblyInfo.cs @@ -0,0 +1,57 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SharpServerTools.Servers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SharpServerTools.Servers")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("TestServerControl")] \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/ServerTools/Properties/Resources.Designer.cs b/src/AddIns/DisplayBindings/ServerTools/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..5fdf6b57fb --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1378 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.ServerTools.Servers.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharpServerTools.Servers.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/ServerTools/Properties/Resources.resx b/src/AddIns/DisplayBindings/ServerTools/Properties/Resources.resx new file mode 100644 index 0000000000..af7dbebbac --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/ServerTools/Properties/Settings.Designer.cs b/src/AddIns/DisplayBindings/ServerTools/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..8a3f3250ec --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1378 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.ServerTools.Servers.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/ServerTools/Properties/Settings.settings b/src/AddIns/DisplayBindings/ServerTools/Properties/Settings.settings new file mode 100644 index 0000000000..033d7a5e9e --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/ServerTools/ServerBrowserHost.cs b/src/AddIns/DisplayBindings/ServerTools/ServerBrowserHost.cs new file mode 100644 index 0000000000..5f37add597 --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/ServerBrowserHost.cs @@ -0,0 +1,63 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Windows.Forms; +using System.Windows.Forms.Integration; +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Gui; +using ICSharpCode.ServerTools.Servers; + +namespace ICSharpCode.ServerTools.Forms +{ + /// + /// Enables a user to browse metadata associated with a db server and to open resources + /// referenced therein. The intention is to extend this to other server processes over + /// time. + /// + public class ServerBrowserHost : AbstractPadContent + { + ElementHost ctl; + + /// + /// ServerBrowserTool hosts one or more TreeViews providing views of types + /// of server. Currently it shows only relational database servers. + /// + public ServerBrowserHost() + { + LoggingService.Debug("Loading ServerBrowserHost"); + ctl = new ElementHost(); + ServerControl serverControl = new ServerControl(); + ctl.Child = serverControl; + } + + /// + /// The representing the pad + /// + public override Control Control { + get { + return ctl; + } + } + + /// + /// Rebuildes the pad + /// + public override void RedrawContent() + { + + } + + /// + /// Cleans up all used resources + /// + public override void Dispose() + { + ctl.Dispose(); + } + } +} diff --git a/src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml b/src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml new file mode 100644 index 0000000000..bf79253e8c --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml.cs b/src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml.cs new file mode 100644 index 0000000000..719f80c308 --- /dev/null +++ b/src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml.cs @@ -0,0 +1,80 @@ +using System; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Data; +using System.Data.OleDb; +using System.Data.Common; +using System.Configuration; +using System.Collections.Generic; + +using ICSharpCode.DataTools; + +namespace ICSharpCode.ServerTools +{ + /// + /// Interaction logic for UserControl1.xaml + /// + public partial class ServerControl : UserControl + { + public ServerControl() + { + InitializeComponent(); + Refresh(); + } + + public void Refresh() + { + ConnectionStringSettingsCollection c + = OleDbConnectionUtil.GetConnectionSettingsCollection(); + this.dbTree.Items.Clear(); + foreach (ConnectionStringSettings s in c) + { + TreeViewItem n = new TreeViewItem(); + //n.Name = s.Name; + n.Header = s.Name; + this.dbTree.Items.Add(n); + } + } + + /// + /// Uses the DataLink dialog to define a new Oledb connection string, + /// tests it, and adds it to the exe config. + /// + /// + /// + private void addConnectionButton_Click(object sender, RoutedEventArgs e) + { + MSDASC.DataLinks mydlg = new MSDASC.DataLinks(); + OleDbConnection oleCon = new OleDbConnection(); + ADODB._Connection aDOcon; + + //Cast the generic object that PromptNew returns to an ADODB._Connection. + aDOcon = (ADODB._Connection)mydlg.PromptNew(); + + oleCon.ConnectionString = aDOcon.ConnectionString; + oleCon.Open(); + + if (oleCon.State.ToString() == "Open") + { + // TODO: add the oledb connection to the local config and + // refresh + OleDbConnectionUtil.Put("any name", oleCon.ConnectionString); + this.Refresh(); + oleCon.Close(); + } + else + { + MessageBox.Show("Connection Failed"); + } + } + } +} diff --git a/src/Libraries/ICSharpCode.DataTools/ICSharpCode.DataTools.csproj b/src/Libraries/ICSharpCode.DataTools/ICSharpCode.DataTools.csproj index 3a6d1248db..6477d8c339 100644 --- a/src/Libraries/ICSharpCode.DataTools/ICSharpCode.DataTools.csproj +++ b/src/Libraries/ICSharpCode.DataTools/ICSharpCode.DataTools.csproj @@ -40,6 +40,16 @@ + + + {2748AD25-9C63-4E12-877B-4DCE96FBED54} + ICSharpCode.SharpDevelop + + + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} + ICSharpCode.Core + +