git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4678 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Windows.Interop; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Data.Addin.Pad; |
||||
using ICSharpCode.Data.Core.UI.Windows; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Addin.Commands |
||||
{ |
||||
public class AddDatabaseCommand : AbstractCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
ConnectionWizardWindow connectionWizardWindow = new ConnectionWizardWindow(); |
||||
connectionWizardWindow.Owner = WorkbenchSingleton.MainWindow; |
||||
|
||||
connectionWizardWindow.AddAction = new Action(delegate() |
||||
{ |
||||
if (connectionWizardWindow.SelectedDatabase.LoadDatabase()) |
||||
{ |
||||
DatabasesTreeViewPad.Instance.Databases.Add(connectionWizardWindow.SelectedDatabase); |
||||
connectionWizardWindow.Close(); |
||||
} |
||||
}); |
||||
|
||||
connectionWizardWindow.ShowDialog(); |
||||
} |
||||
} |
||||
|
||||
public class RemoveDatabaseCommand : AbstractCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
#region Using directives
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
using System.Runtime.InteropServices; |
||||
using System.Windows.Markup; |
||||
|
||||
#endregion
|
||||
|
||||
// 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("ICSharpCode.Data.Addin")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyProduct("ICSharpCode.Data.Addin")] |
||||
[assembly: AssemblyCopyright("Copyright 2009")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)] |
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all the values or you can use the default the Revision and
|
||||
// Build Numbers by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.*")] |
||||
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.DatabaseTools.Addin.DatabaseInfo |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DatabaseInfo.
|
||||
/// </summary>
|
||||
public class DatabaseInfo : INotifyPropertyChanged |
||||
{ |
||||
#region Constructor
|
||||
|
||||
public DatabaseInfo() |
||||
{ |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region IPropertyChanged
|
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
private void NotifyReportView(string property) |
||||
{ |
||||
if (this.PropertyChanged != null) { |
||||
this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,157 @@
@@ -0,0 +1,157 @@
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{A9F12710-24E4-46D4-832C-6ECB395B9EAD}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.Data.Addin</RootNamespace> |
||||
<AssemblyName>ICSharpCode.Data.Addin</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Phil\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<FileUpgradeFlags> |
||||
</FileUpgradeFlags> |
||||
<OldToolsVersion>3.5</OldToolsVersion> |
||||
<UpgradeBackupLocation /> |
||||
<TargetFrameworkProfile /> |
||||
<PublishUrl>publish\</PublishUrl> |
||||
<Install>true</Install> |
||||
<InstallFrom>Disk</InstallFrom> |
||||
<UpdateEnabled>false</UpdateEnabled> |
||||
<UpdateMode>Foreground</UpdateMode> |
||||
<UpdateInterval>7</UpdateInterval> |
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> |
||||
<UpdatePeriodically>false</UpdatePeriodically> |
||||
<UpdateRequired>false</UpdateRequired> |
||||
<MapFileExtensions>true</MapFileExtensions> |
||||
<ApplicationRevision>0</ApplicationRevision> |
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
||||
<IsWebBootstrapper>false</IsWebBootstrapper> |
||||
<UseApplicationTrust>false</UseApplicationTrust> |
||||
<BootstrapperEnabled>true</BootstrapperEnabled> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\Data\</OutputPath> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<StartAction>Program</StartAction> |
||||
<StartProgram>..\..\..\..\Program Files %28x86%29\SharpDevelop\3.0\bin\SharpDevelop.exe</StartProgram> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Data.DataSetExtensions"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.EnterpriseServices" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="UIAutomationProvider"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsBase" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="ICSharpCode.Data.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<Compile Include="Commands\DatabaseTreeViewCommands.cs" /> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Pad\DatabaseTreeViewPad.cs" /> |
||||
<Compile Include="Pad\DatabasesTreeViewUserControl.xaml.cs"> |
||||
<DependentUpon>DatabasesTreeViewUserControl.xaml</DependentUpon> |
||||
</Compile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Pad\DatabasesTreeViewUserControl.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
</ItemGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Windows\" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
||||
<Visible>False</Visible> |
||||
<ProductName>.NET Framework 3.5 SP1</ProductName> |
||||
<Install>true</Install> |
||||
</BootstrapperPackage> |
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> |
||||
<Visible>False</Visible> |
||||
<ProductName>Windows Installer 3.1</ProductName> |
||||
<Install>true</Install> |
||||
</BootstrapperPackage> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\..\..\..\..\src\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\..\src\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\..\src\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj"> |
||||
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project> |
||||
<Name>ICSharpCode.Core.Presentation</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\ICSharpCode.Data.Core.UI\ICSharpCode.Data.Core.UI.csproj"> |
||||
<Project>{BAD94D6E-4159-4CB6-B991-486F412D9BB6}</Project> |
||||
<Name>ICSharpCode.Data.Core.UI</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\ICSharpCode.Data.Core\ICSharpCode.Data.Core.csproj"> |
||||
<Project>{B7823AE9-4B43-4859-8796-2EBDC116FBB8}</Project> |
||||
<Name>ICSharpCode.Data.Core</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\ICSharpCode.Data.DemoApp\ICSharpCode.Data.DemoApp.csproj"> |
||||
<Project>{1EB79CD3-ECF1-420E-8A44-FA1EDD15390F}</Project> |
||||
<Name>ICSharpCode.Data.DemoApp</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\ICSharpCode.Data.EDMDesigner.Core.UI\ICSharpCode.Data.EDMDesigner.Core.UI.csproj"> |
||||
<Project>{EEF5E054-4192-4A57-8FBF-E860D808A51D}</Project> |
||||
<Name>ICSharpCode.Data.EDMDesigner.Core.UI</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\ICSharpCode.Data.EDMDesigner.Core\ICSharpCode.Data.EDMDesigner.Core.csproj"> |
||||
<Project>{5C70D6AB-0A33-43F9-B8B5-54558C35BBB1}</Project> |
||||
<Name>ICSharpCode.Data.EDMDesigner.Core</Name> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
</Project> |
||||
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
<AddIn name = "Data Addin" |
||||
author = "Philipp Maihart" |
||||
url = "http://www.pmnet.info" |
||||
description = "Database Tools Addin for SharpDevelop"> |
||||
|
||||
<Runtime> |
||||
<Import assembly="ICSharpCode.Data.Addin.dll" /> |
||||
<Import assembly="ICSharpCode.Data.Core.dll" /> |
||||
<Import assembly="ICSharpCode.Data.Core.UI.dll" /> |
||||
<Import assembly="ICSharpCode.Data.SQLServer.dll" /> |
||||
<Import assembly="ICSharpCode.Data.EDMDesigner.Core.dll" /> |
||||
<Import assebmly="ICSharpCode.Data.EDMDesigner.Core.UI.dll" /> |
||||
</Runtime> |
||||
|
||||
<Manifest> |
||||
<Identity name="ICSharpCode.Data.Addin" version="@ICSharpCode.Data.Addin.dll" /> |
||||
<Dependency addin="SharpDevelop" version="4.0" /> |
||||
</Manifest> |
||||
|
||||
<Path name="/SharpDevelop/Workbench/FileFilter"> |
||||
<FileFilter id="EntityFramework" |
||||
insertbefore="AllFiles" |
||||
name="Entity Framework Files (*.edmx)" |
||||
extensions="*.edmx" /> |
||||
</Path> |
||||
|
||||
<Path name="/SharpDevelop/Workbench/Pads"> |
||||
<Pad id="DatabaseExplorer" |
||||
icon="Icons.16x16.SharpQuery.Refresh" |
||||
category="Tools" |
||||
title="DatabaseExplorer" |
||||
shortcut="Control|Alt|D" |
||||
class="ICSharpCode.Data.Addin.Pad.DatabasesTreeViewPad" /> |
||||
</Path> |
||||
|
||||
<Path name="/SharpDevelop/Workbench/DisplayBindings"> |
||||
<DisplayBinding id="EDMDesignerDisplayBinding" |
||||
class="ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding.EDMDesignerDisplayBinding" |
||||
insertbefore="Text" |
||||
fileNamePattern="\.(edmx)$" |
||||
languagePattern="^Edmx$" /> |
||||
</Path> |
||||
</AddIn> |
||||
@ -0,0 +1,116 @@
@@ -0,0 +1,116 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Windows.Controls; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using ICSharpCode.Data.Core.UI.UserControls; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Addin.Pad |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DatabasesTreeViewPad.
|
||||
/// </summary>
|
||||
public class DatabasesTreeViewPad : AbstractPadContent, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
private static DatabasesTreeViewPad _instance = null; |
||||
|
||||
private DatabasesTreeViewUserControl _control = null; |
||||
private DatabasesTreeView _databasesTreeView = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public static DatabasesTreeViewPad Instance |
||||
{ |
||||
get { return _instance; } |
||||
} |
||||
|
||||
public ObservableCollection<IDatabase> Databases |
||||
{ |
||||
get { return _databasesTreeView.Databases; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
|
||||
/// </summary>
|
||||
public override object Control |
||||
{ |
||||
get |
||||
{ |
||||
return _control; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ReportExplorer object
|
||||
/// </summary>
|
||||
public DatabasesTreeViewPad() : base() |
||||
{ |
||||
WorkbenchSingleton.Workbench.ActiveViewContentChanged += ActiveViewContentChanged; |
||||
WorkbenchSingleton.Workbench.ViewClosed += ActiveViewClosed; |
||||
|
||||
_control = new DatabasesTreeViewUserControl(); |
||||
_databasesTreeView = new DatabasesTreeView(); |
||||
_databasesTreeView.AdditionalNodes.Add(CSDLDatabaseTreeViewAdditionalNode.Instance); |
||||
DockPanel.SetDock(_databasesTreeView, Dock.Top); |
||||
_control.Content.Children.Add(_databasesTreeView); |
||||
|
||||
_instance = this; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void ActiveViewContentChanged(object source, EventArgs e) |
||||
{ |
||||
|
||||
} |
||||
|
||||
private void ActiveViewClosed (object source, ViewContentEventArgs e) |
||||
{ |
||||
|
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up all used resources
|
||||
/// </summary>
|
||||
public override void Dispose() |
||||
{ |
||||
WorkbenchSingleton.Workbench.ActiveViewContentChanged -= ActiveViewContentChanged; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
private void OnPropertyChanged(string property) |
||||
{ |
||||
if (this.PropertyChanged != null) |
||||
{ |
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
<UserControl x:Class="ICSharpCode.Data.Addin.Pad.DatabaseTreeViewUserControl" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:data="http://icsharpcode.org/data"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<ToolBar> |
||||
<Button Click="btnAddConnection_Click">Add connection...</Button> |
||||
</ToolBar> |
||||
|
||||
<DockPanel x:Name="dockPanel" Grid.Row="1" VerticalAlignment="Stretch" /> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
#region Usings
|
||||
|
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using ICSharpCode.Data.Addin.Commands; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Addin.Pad |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for DatabaseTreeViewUserControl.xaml
|
||||
/// </summary>
|
||||
public partial class DatabaseTreeViewUserControl : UserControl |
||||
{ |
||||
#region Properties
|
||||
|
||||
public new DockPanel Content |
||||
{ |
||||
get { return dockPanel; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public DatabaseTreeViewUserControl() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void btnAddConnection_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
AddDatabaseCommand addDatabaseCommand = new AddDatabaseCommand(); |
||||
addDatabaseCommand.Owner = this; |
||||
addDatabaseCommand.Run(); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
<UserControl x:Class="ICSharpCode.Data.Addin.Pad.DatabasesTreeViewUserControl" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:data="http://icsharpcode.org/data"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<ToolBar> |
||||
<Button Click="btnAddConnection_Click">Add connection...</Button> |
||||
</ToolBar> |
||||
|
||||
<DockPanel x:Name="dockPanel" Grid.Row="1" VerticalAlignment="Stretch" /> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
#region Usings
|
||||
|
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using ICSharpCode.Data.Addin.Commands; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Addin.Pad |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for DatabaseTreeViewUserControl.xaml
|
||||
/// </summary>
|
||||
public partial class DatabasesTreeViewUserControl : UserControl |
||||
{ |
||||
#region Properties
|
||||
|
||||
public new DockPanel Content |
||||
{ |
||||
get { return dockPanel; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public DatabasesTreeViewUserControl() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void btnAddConnection_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
AddDatabaseCommand addDatabaseCommand = new AddDatabaseCommand(); |
||||
addDatabaseCommand.Owner = this; |
||||
addDatabaseCommand.Run(); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
<UserControl x:Class="ICSharpCode.DatabaseTools.Addin.UserControls.DatabaseTreeView" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<ToolBar> |
||||
<Button>Add connection...</Button> |
||||
</ToolBar> |
||||
|
||||
<TreeView Grid.Row="1" Background="White"> |
||||
<TreeViewItem>Lokal</TreeViewItem> |
||||
</TreeView> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
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; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.DatabaseTools.Addin.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for DatabaseTreeView.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class DatabaseTreeView : UserControl |
||||
{ |
||||
public DatabaseTreeView() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using System.Windows.Forms.Integration; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.DatabaseTools.Addin.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Description of DatabaseTreeViewPad.
|
||||
/// </summary>
|
||||
public class DatabaseTreeViewPad : AbstractPadContent, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
private static DatabaseTreeViewPad _instance = null; |
||||
|
||||
private ElementHost _winformElementHost = null; |
||||
private DatabaseTreeView _databaseTreeView = null; |
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ReportExplorer object
|
||||
/// </summary>
|
||||
public DatabaseTreeViewPad() : base() |
||||
{ |
||||
WorkbenchSingleton.Workbench.ActiveViewContentChanged += ActiveViewContentChanged; |
||||
WorkbenchSingleton.Workbench.ViewClosed += ActiveViewClosed; |
||||
|
||||
_databaseTreeView = new DatabaseTreeView(); |
||||
_winformElementHost = new ElementHost(); |
||||
_winformElementHost.Child = _databaseTreeView; |
||||
_winformElementHost.Dock = DockStyle.Fill; |
||||
|
||||
_instance = this; |
||||
} |
||||
|
||||
void ActiveViewContentChanged(object source, EventArgs e) |
||||
{ |
||||
|
||||
} |
||||
|
||||
void ActiveViewClosed (object source, ViewContentEventArgs e) |
||||
{ |
||||
|
||||
} |
||||
|
||||
public static DatabaseTreeViewPad Instance { |
||||
get { return _instance; } |
||||
} |
||||
|
||||
#region IPropertyChanged
|
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
private void NotifyReportView(string property) |
||||
{ |
||||
if (this.PropertyChanged != null) { |
||||
this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region AbstractPadContent
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
|
||||
/// </summary>
|
||||
public override Control Control |
||||
{ |
||||
get |
||||
{ |
||||
return _winformElementHost; |
||||
} |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up all used resources
|
||||
/// </summary>
|
||||
public override void Dispose() |
||||
{ |
||||
WorkbenchSingleton.Workbench.ActiveViewContentChanged -= ActiveViewContentChanged; |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Reflection; |
||||
using System.Collections; |
||||
using System.Windows.Forms; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.Helpers |
||||
{ |
||||
public static class DragDropInterop |
||||
{ |
||||
public static T GetObjectFromDragEventArgs<T>(DragEventArgs e) |
||||
{ |
||||
if (!e.Data.GetDataPresent(typeof(T))) |
||||
{ |
||||
return default(T); |
||||
} |
||||
try |
||||
{ |
||||
var temp = e.Data.GetData(typeof(T)); |
||||
if (temp != null) |
||||
{ |
||||
return (T)temp; |
||||
} |
||||
var fieldInfo = e.Data.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
temp = fieldInfo.GetValue(e.Data); |
||||
fieldInfo = temp.GetType().GetField("data", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
fieldInfo = temp.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
temp = fieldInfo.GetValue(temp); |
||||
fieldInfo = temp.GetType().GetField("_innerData", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
temp = fieldInfo.GetValue(temp); |
||||
fieldInfo = temp.GetType().GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
var hashtable = (Hashtable)fieldInfo.GetValue(temp); |
||||
var array = (object[])hashtable.Cast<DictionaryEntry>().First().Value; |
||||
temp = array[0]; |
||||
fieldInfo = temp.GetType().GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); |
||||
return (T)fieldInfo.GetValue(temp); |
||||
} |
||||
catch |
||||
{ |
||||
return default(T); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,530 @@
@@ -0,0 +1,530 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Threading; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Controls.Primitives; |
||||
using System.Windows.Media; |
||||
using System.Windows.Threading; |
||||
using System.Windows.Input; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI |
||||
{ |
||||
/// <summary>
|
||||
/// Helperklasse, um das Navigieren durch Visual-Trees, suchen von Resourcen in den Visuals und etc... zu erleichtern
|
||||
/// </summary>
|
||||
public class VisualHelper |
||||
{ |
||||
/// <summary>
|
||||
/// Rekursiv durch den Baum des DependencyObjects durchgehen
|
||||
/// </summary>
|
||||
/// <param name="visual"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<DependencyObject> GetAllVisualChildren(DependencyObject visual) |
||||
{ |
||||
int childrenCount = VisualTreeHelper.GetChildrenCount(visual); |
||||
for (int i = 0; i < childrenCount; i++) |
||||
{ |
||||
// das Child retournieren
|
||||
DependencyObject child = VisualTreeHelper.GetChild(visual, i); |
||||
yield return child; |
||||
|
||||
// Rekursiv hinunter
|
||||
if (VisualTreeHelper.GetChildrenCount(child) > 0) |
||||
foreach (DependencyObject grandChild in GetAllVisualChildren(child)) |
||||
yield return grandChild; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// liefert das FrameworkElement mit angegebenen Namen
|
||||
/// </summary>
|
||||
/// <param name="visualParent"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static FrameworkElement GetChild(DependencyObject visualParent, string name) |
||||
{ |
||||
|
||||
// Animation zum Anzeigen der neuen Grid starten
|
||||
foreach (DependencyObject child in VisualHelper.GetAllVisualChildren(visualParent)) |
||||
{ |
||||
FrameworkElement childElement = child as FrameworkElement; |
||||
|
||||
if (childElement != null && childElement.Name != string.Empty) |
||||
System.Diagnostics.Debug.WriteLine(string.Format("VisualHelper.GetChild: such nach [{0}] child = {1}", name, childElement.Name)); |
||||
|
||||
if (childElement != null && childElement.Name == name) |
||||
{ |
||||
return childElement; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// sucht ein SubElement eines 'templated' FrameworkElements
|
||||
/// </summary>
|
||||
/// <param name="subElementName"></param>
|
||||
/// <param name="control"></param>
|
||||
/// <returns></returns>
|
||||
public static ElementType TryFindSubElement<ElementType>(string subElementName, Control control) where ElementType : class |
||||
{ |
||||
if (control == null || control.Template == null) |
||||
return null; |
||||
|
||||
// sucht das Element
|
||||
object subObject = control.Template.FindName(subElementName, control); |
||||
if (subObject == null) |
||||
return null; |
||||
|
||||
ElementType subElement = subObject as ElementType; |
||||
if (subElement == null) |
||||
return null; |
||||
|
||||
return subElement; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// sucht ein SubElement eines 'templated' FrameworkElements
|
||||
/// </summary>
|
||||
/// <param name="subElementName"></param>
|
||||
/// <param name="control"></param>
|
||||
/// <returns></returns>
|
||||
public static ElementType FindSubElement<ElementType>(string subElementName, Control control) where ElementType : class |
||||
{ |
||||
if (control == null || control.Template == null) |
||||
{ |
||||
throw new Exception("Element hat kein Template!"); |
||||
} |
||||
|
||||
// sucht das Element
|
||||
object subObject = control.Template.FindName(subElementName, control); |
||||
if (subObject == null) |
||||
{ |
||||
throw new Exception("Template-Subelement nicht gefunden!"); |
||||
} |
||||
|
||||
ElementType subElement = subObject as ElementType; |
||||
if (subElement == null) |
||||
{ |
||||
throw new Exception("Template-Subelement nicht gefunden!"); |
||||
} |
||||
|
||||
return subElement; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sucht die Resource in dem FrameworkElement (dem 'hierarchischen Baum') aufwärts
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="element"></param>
|
||||
/// <returns></returns>
|
||||
public static T FindResource<T>(string key, FrameworkElement element) |
||||
{ |
||||
try |
||||
{ |
||||
T value = (T)element.FindResource(key); |
||||
return value; |
||||
} |
||||
catch (ResourceReferenceKeyNotFoundException) |
||||
{ |
||||
throw new Exception("Control hat kein Template!"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sucht die Resource in dem FrameworkElement (dem 'hierarchischen Baum') aufwärts,
|
||||
/// falls nicht gefunden, wird der Defaultwerte zurückgegeben
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="element"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static T FindResource<T>(string key, FrameworkElement element, T defaultValue) |
||||
{ |
||||
try |
||||
{ |
||||
return (T)element.FindResource(key); |
||||
} |
||||
catch (ResourceReferenceKeyNotFoundException) |
||||
{ |
||||
return defaultValue; |
||||
} |
||||
catch (Exception) |
||||
{ |
||||
throw new Exception("Control hat kein Template!"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sucht das Element unter der Mouse mit dem Namen name
|
||||
/// </summary>
|
||||
/// <param name="reference"></param>
|
||||
/// <param name="mousePosition"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static FrameworkElement FindElementUnderPointer(Visual reference, Point mousePosition, string name) |
||||
{ |
||||
// Hit-test to find out the ItemsControl under the mouse-pointer.
|
||||
_element = null; |
||||
_hittedElements = null; |
||||
_name = name; |
||||
VisualTreeHelper.HitTest(reference, |
||||
new HitTestFilterCallback(VisualHelper.FilterHitTestKeyCallback), |
||||
new HitTestResultCallback(VisualHelper.HitTestResultCallback), |
||||
new PointHitTestParameters(mousePosition)); |
||||
|
||||
try |
||||
{ |
||||
return _element; |
||||
} |
||||
finally |
||||
{ |
||||
_element = null; |
||||
_hittedElements = null; |
||||
_name = null; |
||||
_type = null; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sucht das Element unter der Mouse des Typs type
|
||||
/// </summary>
|
||||
/// <param name="reference"></param>
|
||||
/// <param name="mousePosition"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static FrameworkElement FindElementUnderPointer(Visual reference, Point mousePosition, Type type) |
||||
{ |
||||
// Hit-test to find out the ItemsControl under the mouse-pointer.
|
||||
_element = null; |
||||
_hittedElements = null; |
||||
_type = type; |
||||
VisualTreeHelper.HitTest(reference, |
||||
new HitTestFilterCallback(VisualHelper.FilterHitTestTypeCallback), |
||||
new HitTestResultCallback(VisualHelper.HitTestResultCallback), |
||||
new PointHitTestParameters(mousePosition)); |
||||
|
||||
try |
||||
{ |
||||
return _element; |
||||
} |
||||
finally |
||||
{ |
||||
_element = null; |
||||
_name = null; |
||||
_hittedElements = null; |
||||
_type = null; |
||||
} |
||||
} |
||||
|
||||
public static IEnumerable<FrameworkElement> GetElementsUnderPointer(Visual reference, Point mousePosition) |
||||
{ |
||||
// Hit-test to find out the ItemsControl under the mouse-pointer.
|
||||
_element = null; |
||||
_hittedElements = new List<FrameworkElement>(); |
||||
_type = null; |
||||
|
||||
VisualTreeHelper.HitTest(reference, |
||||
new HitTestFilterCallback(VisualHelper.NoFilterHitTestCallback), |
||||
new HitTestResultCallback(VisualHelper.HitTestResultCallback), |
||||
new PointHitTestParameters(mousePosition)); |
||||
|
||||
try |
||||
{ |
||||
return _hittedElements; |
||||
} |
||||
finally |
||||
{ |
||||
_element = null; |
||||
_hittedElements = null; |
||||
_name = null; |
||||
_type = null; |
||||
} |
||||
} |
||||
|
||||
private static FrameworkElement _element = null; |
||||
private static List<FrameworkElement> _hittedElements = null; |
||||
private static string _name = null; |
||||
private static Type _type = null; |
||||
|
||||
private static HitTestFilterBehavior FilterHitTestKeyCallback(DependencyObject target) |
||||
{ |
||||
FrameworkElement element = target as FrameworkElement; |
||||
if (element != null && element.Name == _name) |
||||
{ |
||||
if (_hittedElements != null) |
||||
_hittedElements.Add(element); |
||||
_element = element; |
||||
return HitTestFilterBehavior.Stop; |
||||
} |
||||
else |
||||
{ |
||||
if (_hittedElements != null) |
||||
_hittedElements.Add(element); |
||||
return HitTestFilterBehavior.Continue; |
||||
} |
||||
} |
||||
|
||||
private static HitTestFilterBehavior FilterHitTestTypeCallback(DependencyObject target) |
||||
{ |
||||
if (target.GetType().IsAssignableFrom(_type)) |
||||
{ |
||||
_element = target as FrameworkElement; |
||||
if (_hittedElements != null) |
||||
_hittedElements.Add(_element); |
||||
return HitTestFilterBehavior.Stop; |
||||
} |
||||
else |
||||
{ |
||||
if (_hittedElements != null) |
||||
_hittedElements.Add(target as FrameworkElement); |
||||
return HitTestFilterBehavior.Continue; |
||||
} |
||||
} |
||||
|
||||
private static HitTestFilterBehavior NoFilterHitTestCallback(DependencyObject target) |
||||
{ |
||||
if (_hittedElements != null && target is FrameworkElement && (target as FrameworkElement).IsVisible) |
||||
_hittedElements.Add(target as FrameworkElement); |
||||
return HitTestFilterBehavior.Continue; |
||||
} |
||||
|
||||
private static HitTestResultBehavior HitTestResultCallback(HitTestResult result) |
||||
{ |
||||
return HitTestResultBehavior.Continue; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt ein visuelles Child eines bestimmten Typs eines DependencyObjects zurück.
|
||||
/// </summary>
|
||||
/// <typeparam name="TChild"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static TChild GetVisualChild<TChild>(DependencyObject obj) where TChild : DependencyObject |
||||
{ |
||||
if (obj == null) |
||||
return null; |
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) |
||||
{ |
||||
// TODO: Was passiert hier, wenn ich kein Visual, sondern z.B. ein Run will?
|
||||
DependencyObject child = VisualTreeHelper.GetChild(obj, i); |
||||
if (child != null && child is TChild) |
||||
return (TChild)child; |
||||
else |
||||
{ |
||||
TChild childOfChild = GetVisualChild<TChild>(child); |
||||
if (childOfChild != null) |
||||
return childOfChild; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt ein visuelles Child mit einem bestimmten Namen eines DependencyObjects zurück.
|
||||
/// </summary>
|
||||
/// <typeparam name="TChild"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static TChild GetVisualChild<TChild>(DependencyObject obj, string name) where TChild : FrameworkElement |
||||
{ |
||||
if (obj == null) |
||||
return null; |
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) |
||||
{ |
||||
// TODO: Was passiert hier, wenn ich kein Visual, sondern z.B. ein Run will?
|
||||
DependencyObject child = VisualTreeHelper.GetChild(obj, i); |
||||
if (child != null && child is TChild && ((TChild)child).Name == name) |
||||
return (TChild)child; |
||||
else |
||||
{ |
||||
TChild childOfChild = GetVisualChild<TChild>(child, name); |
||||
if (childOfChild != null) |
||||
return childOfChild; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt ein visuelles Child mit einem bestimmten Namen eines DependencyObjects zurück.
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>Ich habe diese Methode hier aus Rückwärtskompatibilitätsgründen zurückgelassen.</remarks>
|
||||
public static FrameworkElement GetVisualChild(DependencyObject obj, string name) |
||||
{ |
||||
return GetVisualChild<FrameworkElement>(obj, name); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt ein visuelles Child, welches eine übergebene Bedingung erfüllt zurück
|
||||
/// </summary>
|
||||
/// <typeparam name="TChild"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="comparePredicate"></param>
|
||||
/// <returns></returns>
|
||||
public static TChild GetVisualChild<TChild>(DependencyObject obj, Func<DependencyObject, bool> comparePredicate) where TChild : FrameworkElement |
||||
{ |
||||
if (obj == null) |
||||
return null; |
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) |
||||
{ |
||||
// TODO: Was passiert hier, wenn ich kein Visual, sondern z.B. ein Run will?
|
||||
DependencyObject child = VisualTreeHelper.GetChild(obj, i); |
||||
if (child != null && child is TChild && child is DependencyObject && comparePredicate(child as DependencyObject)) |
||||
return (TChild)child; |
||||
else |
||||
{ |
||||
TChild childOfChild = GetVisualChild<TChild>(child, comparePredicate); |
||||
if (childOfChild != null) |
||||
return childOfChild; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt ein visuelles Child, welches eine übergebene Bedingung erfüllt zurück
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>Ich habe diese Methode hier aus Rückwärtskompatibilitätsgründen zurückgelassen.</remarks>
|
||||
public static FrameworkElement GetVisualChild(DependencyObject obj, Func<DependencyObject, bool> comparePredicate) |
||||
{ |
||||
return GetVisualChild<FrameworkElement>(obj, comparePredicate); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück.
|
||||
/// </summary>
|
||||
/// <typeparam name="TParent"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static TParent GetVisualParent<TParent>(DependencyObject obj) where TParent : DependencyObject |
||||
{ |
||||
return GetVisualParent<TParent>(obj, true); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt einen visuellen Parent mit einem speziellen Namen eines DependencyObjects zurück.
|
||||
/// </summary>
|
||||
/// <typeparam name="TParent"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="parentName"></param>
|
||||
/// <returns></returns>
|
||||
public static FrameworkElement GetVisualParent(DependencyObject obj, string parentName) |
||||
{ |
||||
return GetVisualParent<FrameworkElement>(obj, true, parent => ((FrameworkElement)parent).Name == parentName); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück.
|
||||
/// </summary>
|
||||
/// <typeparam name="TParent"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="walkThroughPopupRoot">Gibt an, ob auch über einen PopupRoot weitergemacht werden soll.</param>
|
||||
/// <returns></returns>
|
||||
public static TParent GetVisualParent<TParent>(DependencyObject obj, bool walkThroughPopupRoot) where TParent : DependencyObject |
||||
{ |
||||
if (obj == null) |
||||
return null; |
||||
|
||||
return GetVisualParent<TParent>(obj, walkThroughPopupRoot, |
||||
parent => parent != null && parent is TParent); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück.
|
||||
/// </summary>
|
||||
/// <typeparam name="TParent"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="walkThroughPopupRoot">Gibt an, ob auch über einen PopupRoot weitergemacht werden soll.</param>
|
||||
/// <param name="comparePredicate">Func mit dem Parent-Vergleich</param>
|
||||
/// <returns></returns>
|
||||
public static TParent GetVisualParent<TParent>(DependencyObject obj, bool walkThroughPopupRoot, |
||||
Func<DependencyObject, bool> comparePredicate) |
||||
where TParent : DependencyObject |
||||
{ |
||||
if (obj == null) |
||||
return null; |
||||
|
||||
// Wenn es kein Visual (z.B. Run) oder ein PopupRoot ist, dann komme ich nur im LogicalTree weiter voran...
|
||||
DependencyObject parent = (!(obj is Visual) || (walkThroughPopupRoot && obj.GetType().Name == "PopupRoot")) ? |
||||
LogicalTreeHelper.GetParent(obj) : VisualTreeHelper.GetParent(obj); |
||||
if (comparePredicate(parent)) |
||||
return (TParent)parent; |
||||
else |
||||
return GetVisualParent<TParent>(parent, walkThroughPopupRoot, comparePredicate); |
||||
} |
||||
|
||||
public static object GetVisualParentObject(DependencyObject obj, bool walkThroughPopupRoot, |
||||
Func<DependencyObject, bool> comparePredicate) |
||||
{ |
||||
if (obj == null) |
||||
return null; |
||||
|
||||
// Wenn es kein Visual (z.B. Run) oder ein PopupRoot ist, dann komme ich nur im LogicalTree weiter voran...
|
||||
DependencyObject parent = (!(obj is Visual) || (walkThroughPopupRoot && obj.GetType().Name == "PopupRoot")) ? |
||||
LogicalTreeHelper.GetParent(obj) : VisualTreeHelper.GetParent(obj); |
||||
if (comparePredicate(parent)) |
||||
return parent; |
||||
else |
||||
return GetVisualParentObject(parent, walkThroughPopupRoot, comparePredicate); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Runs an Action in the current dispatcher.
|
||||
/// </summary>
|
||||
/// <param name="actionToRun"></param>
|
||||
public static void RunInDispatcher(Action actionToRun) |
||||
{ |
||||
if (Application.Current != null) |
||||
RunInDispatcher(Application.Current.Dispatcher, actionToRun); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Runs an Action in a given dispatcher.
|
||||
/// </summary>
|
||||
/// <param name="dispatcher"></param>
|
||||
/// <param name="actionToRun"></param>
|
||||
public static void RunInDispatcher(Dispatcher dispatcher, Action actionToRun) |
||||
{ |
||||
dispatcher.Invoke(DispatcherPriority.Background, actionToRun); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Runs through all items in the dispatcher.
|
||||
/// </summary>
|
||||
public static void DoEvents() |
||||
{ |
||||
if (Application.Current != null) |
||||
DoEvents(Application.Current.Dispatcher); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gives DispatcherFrames of the given Dispatcher priority, if
|
||||
/// their DispatcherPriority is higher than "DispatcherPriority.Background".
|
||||
/// </summary>
|
||||
/// <param name="dispatcherToPause"></param>
|
||||
public static void DoEvents(Dispatcher dispatcherToPause) |
||||
{ |
||||
dispatcherToPause.Invoke(DispatcherPriority.Background, new System.Action(() => { })); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,289 @@
@@ -0,0 +1,289 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<ProductVersion>10.0.20506</ProductVersion> |
||||
<SchemaVersion>2.0</SchemaVersion> |
||||
<ProjectGuid>{BAD94D6E-4159-4CB6-B991-486F412D9BB6}</ProjectGuid> |
||||
<OutputType>library</OutputType> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<RootNamespace>ICSharpCode.Data.Core.UI</RootNamespace> |
||||
<AssemblyName>ICSharpCode.Data.Core.UI</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<FileAlignment>512</FileAlignment> |
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||
<WarningLevel>4</WarningLevel> |
||||
<FileUpgradeFlags> |
||||
</FileUpgradeFlags> |
||||
<OldToolsVersion>3.5</OldToolsVersion> |
||||
<UpgradeBackupLocation /> |
||||
<TargetFrameworkProfile /> |
||||
<PublishUrl>publish\</PublishUrl> |
||||
<Install>true</Install> |
||||
<InstallFrom>Disk</InstallFrom> |
||||
<UpdateEnabled>false</UpdateEnabled> |
||||
<UpdateMode>Foreground</UpdateMode> |
||||
<UpdateInterval>7</UpdateInterval> |
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> |
||||
<UpdatePeriodically>false</UpdatePeriodically> |
||||
<UpdateRequired>false</UpdateRequired> |
||||
<MapFileExtensions>true</MapFileExtensions> |
||||
<ApplicationRevision>0</ApplicationRevision> |
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
||||
<IsWebBootstrapper>false</IsWebBootstrapper> |
||||
<UseApplicationTrust>false</UseApplicationTrust> |
||||
<BootstrapperEnabled>true</BootstrapperEnabled> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>full</DebugType> |
||||
<Optimize>false</Optimize> |
||||
<OutputPath>bin\Debug\</OutputPath> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
<DebugType>pdbonly</DebugType> |
||||
<Optimize>true</Optimize> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data.DataSetExtensions"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="UIAutomationProvider"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsBase"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsFormsIntegration"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="MainDictionary.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
<Page Include="Images\ImageDictionary.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
<Page Include="UserControls\DatabaseTreeView.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
<Page Include="UserControls\DatabasesTreeView.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
<Page Include="UserControls\DatabaseTreeViewResources.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="UserControls\ErrorRetryButton.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="UserControls\LoadingCircle.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
<Page Include="Windows\ConnectionWizardWindow.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
<Page Include="Windows\WizardWindowInnards.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Helpers\DragDropInterop.cs" /> |
||||
<Compile Include="Helpers\VisualHelper.cs" /> |
||||
<Compile Include="Properties\AssemblyInfo.cs"> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Properties\Resources.Designer.cs"> |
||||
<AutoGen>True</AutoGen> |
||||
<DesignTime>True</DesignTime> |
||||
<DependentUpon>Resources.resx</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Properties\Settings.Designer.cs"> |
||||
<AutoGen>True</AutoGen> |
||||
<DependentUpon>Settings.settings</DependentUpon> |
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput> |
||||
</Compile> |
||||
<Compile Include="UserControls\DatabaseTreeView.xaml.cs"> |
||||
<DependentUpon>DatabaseTreeView.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="UserControls\DatabasesTreeView.xaml.cs"> |
||||
<DependentUpon>DatabasesTreeView.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="UserControls\DatabaseTreeViewDataTemplateSelector.cs" /> |
||||
<Compile Include="UserControls\DatabaseTreeViewResources.xaml.cs"> |
||||
<DependentUpon>DatabaseTreeViewResources.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="UserControls\ErrorRetryButton.xaml.cs"> |
||||
<DependentUpon>ErrorRetryButton.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="UserControls\IDatabasesTreeViewAdditionalNode.cs" /> |
||||
<Compile Include="UserControls\LoadingCircle.xaml.cs"> |
||||
<DependentUpon>LoadingCircle.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="UserControls\WizardUserControl.cs" /> |
||||
<Compile Include="Windows\ConnectionWizardWindow.xaml.cs"> |
||||
<DependentUpon>ConnectionWizardWindow.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Windows\WizardWindow.cs" /> |
||||
<Compile Include="Windows\WizardWindowInnards.xaml.cs"> |
||||
<DependentUpon>WizardWindowInnards.xaml</DependentUpon> |
||||
</Compile> |
||||
<EmbeddedResource Include="Properties\Resources.resx"> |
||||
<Generator>ResXFileCodeGenerator</Generator> |
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
||||
</EmbeddedResource> |
||||
<None Include="Properties\Settings.settings"> |
||||
<Generator>SettingsSingleFileGenerator</Generator> |
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> |
||||
</None> |
||||
<AppDesigner Include="Properties\" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_add.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_connect.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_delete.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_edit.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_error.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_gear.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_go.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_key.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_lightning.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_link.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_refresh.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_save.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\database_table.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\table.png" /> |
||||
<Resource Include="Images\Icons\table_add.png" /> |
||||
<Resource Include="Images\Icons\table_delete.png" /> |
||||
<Resource Include="Images\Icons\table_edit.png" /> |
||||
<Resource Include="Images\Icons\table_error.png" /> |
||||
<Resource Include="Images\Icons\table_gear.png" /> |
||||
<Resource Include="Images\Icons\table_go.png" /> |
||||
<Resource Include="Images\Icons\table_key.png" /> |
||||
<Resource Include="Images\Icons\table_lightning.png" /> |
||||
<Resource Include="Images\Icons\table_link.png" /> |
||||
<Resource Include="Images\Icons\table_multiple.png" /> |
||||
<Resource Include="Images\Icons\table_refresh.png" /> |
||||
<Resource Include="Images\Icons\table_relationship.png" /> |
||||
<Resource Include="Images\Icons\table_row_delete.png" /> |
||||
<Resource Include="Images\Icons\table_row_insert.png" /> |
||||
<Resource Include="Images\Icons\table_save.png" /> |
||||
<Resource Include="Images\Icons\table_sort.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\table_fkey.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\procedure.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
||||
<Visible>False</Visible> |
||||
<ProductName>.NET Framework 3.5 SP1</ProductName> |
||||
<Install>true</Install> |
||||
</BootstrapperPackage> |
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> |
||||
<Visible>False</Visible> |
||||
<ProductName>Windows Installer 3.1</ProductName> |
||||
<Install>true</Install> |
||||
</BootstrapperPackage> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\error.png" /> |
||||
<Resource Include="Images\Icons\exclamation.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons\refresh.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\..\..\..\..\src\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\..\src\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\ICSharpCode.Data.Core\ICSharpCode.Data.Core.csproj"> |
||||
<Project>{B7823AE9-4B43-4859-8796-2EBDC116FBB8}</Project> |
||||
<Name>ICSharpCode.Data.Core</Name> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||
Other similar extension points exist, see Microsoft.Common.targets. |
||||
<Target Name="BeforeBuild"> |
||||
</Target> |
||||
<Target Name="AfterBuild"> |
||||
</Target> |
||||
--> |
||||
</Project> |
||||
|
After Width: | Height: | Size: 390 B |
|
After Width: | Height: | Size: 658 B |
|
After Width: | Height: | Size: 763 B |
|
After Width: | Height: | Size: 659 B |
|
After Width: | Height: | Size: 767 B |
|
After Width: | Height: | Size: 682 B |
|
After Width: | Height: | Size: 468 B |
|
After Width: | Height: | Size: 698 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 775 B |
|
After Width: | Height: | Size: 679 B |
|
After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 755 B |
|
After Width: | Height: | Size: 726 B |
|
After Width: | Height: | Size: 666 B |
|
After Width: | Height: | Size: 701 B |
|
After Width: | Height: | Size: 748 B |
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 566 B |
|
After Width: | Height: | Size: 663 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 744 B |
|
After Width: | Height: | Size: 687 B |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 714 B |
|
After Width: | Height: | Size: 683 B |
|
After Width: | Height: | Size: 746 B |
|
After Width: | Height: | Size: 736 B |
|
After Width: | Height: | Size: 728 B |
|
After Width: | Height: | Size: 612 B |
|
After Width: | Height: | Size: 795 B |
|
After Width: | Height: | Size: 663 B |
|
After Width: | Height: | Size: 629 B |
|
After Width: | Height: | Size: 641 B |
|
After Width: | Height: | Size: 723 B |
|
After Width: | Height: | Size: 678 B |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
<ResourceDictionary x:Class="ICSharpCode.Data.Core.UI.ImageDictionary" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
||||
<BitmapImage x:Key="ErrorImage" UriSource="Icons/error.png" /> |
||||
<BitmapImage x:Key="ExclamationImage" UriSource="Icons/exclamation.png" /> |
||||
<BitmapImage x:Key="RefreshImage" UriSource="Icons/refresh.png" /> |
||||
|
||||
<BitmapImage x:Key="DatabaseImage" UriSource="Icons/database.png" /> |
||||
<BitmapImage x:Key="DatabaseAddImage" UriSource="Icons/database_add.png" /> |
||||
<BitmapImage x:Key="DatabaseConnectImage" UriSource="Icons/database_connect.png" /> |
||||
<BitmapImage x:Key="DatabaseDeleteImage" UriSource="Icons/database_delete.png" /> |
||||
<BitmapImage x:Key="DatabaseEditImage" UriSource="Icons/database_edit.png" /> |
||||
<BitmapImage x:Key="DatabaseErrorImage" UriSource="Icons/database_error.png" /> |
||||
<BitmapImage x:Key="DatabaseGearImage" UriSource="Icons/database_gear.png" /> |
||||
<BitmapImage x:Key="DatabaseGoImage" UriSource="Icons/database_go.png" /> |
||||
<BitmapImage x:Key="DatabaseKeyImage" UriSource="Icons/database_key.png" /> |
||||
<BitmapImage x:Key="DatabaseLightningImage" UriSource="Icons/database_lightning.png" /> |
||||
<BitmapImage x:Key="DatabaseLinkImage" UriSource="Icons/database_link.png" /> |
||||
<BitmapImage x:Key="DatabaseRefreshImage" UriSource="Icons/database_refresh.png" /> |
||||
<BitmapImage x:Key="DatabaseSaveImage" UriSource="Icons/database_save.png" /> |
||||
<BitmapImage x:Key="DatabaseTableImage" UriSource="Icons/database_table.png" /> |
||||
|
||||
<BitmapImage x:Key="TableImage" UriSource="Icons/table.png" /> |
||||
<BitmapImage x:Key="TableAddImage" UriSource="Icons/table_add.png" /> |
||||
<BitmapImage x:Key="TableDeleteImage" UriSource="Icons/table_delete.png" /> |
||||
<BitmapImage x:Key="TableEditImage" UriSource="Icons/table_edit.png" /> |
||||
<BitmapImage x:Key="TableErrorImage" UriSource="Icons/table_error.png" /> |
||||
<BitmapImage x:Key="TableForeignKeyImage" UriSource="Icons/table_fkey.png" /> |
||||
<BitmapImage x:Key="TableGearImage" UriSource="Icons/table_gear.png" /> |
||||
<BitmapImage x:Key="TableGoImage" UriSource="Icons/table_go.png" /> |
||||
<BitmapImage x:Key="TableKeyImage" UriSource="Icons/table_key.png" /> |
||||
<BitmapImage x:Key="TableLightningImage" UriSource="Icons/table_lightning.png" /> |
||||
<BitmapImage x:Key="TableLinkImage" UriSource="Icons/table_link.png" /> |
||||
<BitmapImage x:Key="TableMultipleImage" UriSource="Icons/table_multiple.png" /> |
||||
<BitmapImage x:Key="TableRefreshImage" UriSource="Icons/table_refresh.png" /> |
||||
<BitmapImage x:Key="TableRelationshipImage" UriSource="Icons/table_relationship.png" /> |
||||
<BitmapImage x:Key="TableRowDeleteImage" UriSource="Icons/table_row_delete.png" /> |
||||
<BitmapImage x:Key="TableRowInsertImage" UriSource="Icons/table_row_insert.png" /> |
||||
<BitmapImage x:Key="TableSaveImage" UriSource="Icons/table_save.png" /> |
||||
<BitmapImage x:Key="TableSortImage" UriSource="Icons/table_sort.png" /> |
||||
|
||||
<BitmapImage x:Key="ProcedureImage" UriSource="Icons/Procedure.png" /> |
||||
</ResourceDictionary> |
||||
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
<ResourceDictionary x:Class="ICSharpCode.Data.Core.UI.MainDictionary" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="Images/ImageDictionary.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
using System.Reflection; |
||||
using System.Resources; |
||||
using System.Runtime.CompilerServices; |
||||
using System.Runtime.InteropServices; |
||||
using System.Windows; |
||||
using System.Windows.Markup; |
||||
|
||||
// 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("ICSharpCode.Database.Core.UI")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("Microsoft")] |
||||
[assembly: AssemblyProduct("ICSharpCode.Database.Core.UI")] |
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] |
||||
[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
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> 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: XmlnsDefinition("http://icsharpcode.net/data", "ICSharpCode.Data.Core.UI.Helpers")] |
||||
[assembly: XmlnsDefinition("http://icsharpcode.net/data", "ICSharpCode.Data.Core.UI.UserControls")] |
||||
[assembly: XmlnsDefinition("http://icsharpcode.net/data", "ICSharpCode.Data.Core.UI.Windows")] |
||||
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.20506.1
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.Properties { |
||||
using System; |
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// 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", "4.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() { |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||
internal static global::System.Resources.ResourceManager ResourceManager { |
||||
get { |
||||
if (object.ReferenceEquals(resourceMan, null)) { |
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ICSharpCode.Data.Core.UI.Properties.Resources", typeof(Resources).Assembly); |
||||
resourceMan = temp; |
||||
} |
||||
return resourceMan; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||
internal static global::System.Globalization.CultureInfo Culture { |
||||
get { |
||||
return resourceCulture; |
||||
} |
||||
set { |
||||
resourceCulture = value; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,117 @@
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 2.0 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">2.0</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||
<comment>This is a comment</comment> |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="metadata"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
<xsd:attribute name="type" type="xsd:string" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="assembly"> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="alias" type="xsd:string" /> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>2.0</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
</root> |
||||
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.20506.1
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.Properties { |
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?> |
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> |
||||
<Profiles> |
||||
<Profile Name="(Default)" /> |
||||
</Profiles> |
||||
<Settings /> |
||||
</SettingsFile> |
||||
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
<TreeView x:Class="ICSharpCode.Data.Core.UI.UserControls.DatabaseTreeView" |
||||
x:Name="This" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:data="http://icsharpcode.net/data" |
||||
xmlns:local="clr-namespace:ICSharpCode.Data.Core.UI.UserControls"> |
||||
<TreeView.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="DatabaseTreeViewResources.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
</TreeView.Resources> |
||||
|
||||
<TreeViewItem ItemsSource="{Binding Database.Tables, ElementName=This}" ItemTemplateSelector="{StaticResource DatabaseTreeViewDataTemplateSelector}"> |
||||
<TreeViewItem.Header> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox Margin="2" Click="chkIsSelected_Click" IsChecked="True" Tag="{Binding Database.Tables, ElementName=This}" /> |
||||
<TextBlock Grid.Column="1" Margin="2">Tables</TextBlock> |
||||
</Grid> |
||||
</TreeViewItem.Header> |
||||
</TreeViewItem> |
||||
<TreeViewItem ItemsSource="{Binding Database.Views, ElementName=This}" ItemTemplateSelector="{StaticResource DatabaseTreeViewDataTemplateSelector}"> |
||||
<TreeViewItem.Header> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox Margin="2" Click="chkIsSelected_Click" IsChecked="True" Tag="{Binding Database.Views, ElementName=This}" /> |
||||
<TextBlock Grid.Column="1" Margin="2">Views</TextBlock> |
||||
</Grid> |
||||
</TreeViewItem.Header> |
||||
</TreeViewItem> |
||||
<TreeViewItem ItemsSource="{Binding Database.Procedures, ElementName=This}" ItemTemplateSelector="{StaticResource DatabaseTreeViewDataTemplateSelector}"> |
||||
<TreeViewItem.Header> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox Margin="2" Click="chkIsSelected_Click" IsChecked="True" Tag="{Binding Database.Procedures, ElementName=This}" /> |
||||
<TextBlock Grid.Column="1" Margin="2">Procedures</TextBlock> |
||||
</Grid> |
||||
</TreeViewItem.Header> |
||||
</TreeViewItem> |
||||
</TreeView> |
||||
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Input; |
||||
using System.Windows.Interop; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using ICSharpCode.Data.Core.UI.Windows; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for DatabasesTreeView.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class DatabaseTreeView : TreeView, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
public static readonly DependencyProperty DatabaseProperty = |
||||
DependencyProperty.Register("Database", typeof(IDatabase), typeof(DatabaseTreeView), new FrameworkPropertyMetadata(null)); |
||||
|
||||
private bool _showCheckBoxes = false; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public IDatabase Database |
||||
{ |
||||
get { return (IDatabase)GetValue(DatabaseProperty); } |
||||
set { SetValue(DatabaseProperty, value); } |
||||
} |
||||
|
||||
public bool ShowCheckBoxes |
||||
{ |
||||
get { return _showCheckBoxes; } |
||||
set { _showCheckBoxes = value; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public DatabaseTreeView() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void chkIsSelected_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
CheckBox checkBox = sender as CheckBox; |
||||
|
||||
if (checkBox != null) |
||||
{ |
||||
if (checkBox.Tag is IDatabaseObjectsCollection) |
||||
{ |
||||
IDatabaseObjectsCollection collection = checkBox.Tag as IDatabaseObjectsCollection; |
||||
|
||||
foreach (IDatabaseObjectBase item in collection.NonGenericItems) |
||||
{ |
||||
if (checkBox.IsChecked.HasValue && checkBox.IsChecked.Value) |
||||
item.IsSelected = true; |
||||
else |
||||
item.IsSelected = false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
private void OnPropertyChanged(string property) |
||||
{ |
||||
if (this.PropertyChanged != null) |
||||
{ |
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Windows.Controls; |
||||
using System.Windows; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using ICSharpCode.Data.Core.DatabaseObjects; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
public class DatabaseTreeViewDataTemplateSelector : DataTemplateSelector |
||||
{ |
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container) |
||||
{ |
||||
FrameworkElement element = container as FrameworkElement; |
||||
|
||||
if (element == null) |
||||
return null; |
||||
|
||||
if (item is DatabaseObjectBase) |
||||
{ |
||||
if (element != null) |
||||
{ |
||||
if (item is IDatabase) |
||||
return element.FindResource("DatabaseDataTemplate") as DataTemplate; |
||||
else if (item is ITable || item is IView) |
||||
return element.FindResource("TableDataTemplate") as DataTemplate; |
||||
else if (item is IColumn) |
||||
return element.FindResource("ColumnDataTemplate") as DataTemplate; |
||||
else if (item is IProcedure) |
||||
return element.FindResource("ProcedureDataTemplate") as DataTemplate; |
||||
else if (item is IProcedureParameter) |
||||
return element.FindResource("ProcedureParameterDataTemplate") as DataTemplate; |
||||
} |
||||
} |
||||
|
||||
return element.FindResource("StandardDataTemplate") as DataTemplate; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
<ResourceDictionary x:Class="ICSharpCode.Data.Core.UI.UserControls.DatabaseTreeViewResources" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:local="clr-namespace:ICSharpCode.Data.Core.UI.UserControls"> |
||||
|
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="../MainDictionary.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
<HierarchicalDataTemplate x:Key="StandardDataTemplate" ItemsSource="{Binding Path=Items}"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox x:Name="chkIsSelected" Margin="2" Click="chkStandardTemplateIsSelected_Click" Visibility="Collapsed" Tag="{Binding Path=Items}" /> |
||||
<TextBlock Margin="2" Text="{Binding Name}" /> |
||||
</Grid> |
||||
<HierarchicalDataTemplate.Triggers> |
||||
<DataTrigger Binding="{Binding ShowCheckBoxes, RelativeSource={RelativeSource AncestorType=TreeView}}" Value="True"> |
||||
<Setter Property="Visibility" TargetName="chkIsSelected" Value="Visible" /> |
||||
</DataTrigger> |
||||
</HierarchicalDataTemplate.Triggers> |
||||
</HierarchicalDataTemplate> |
||||
<HierarchicalDataTemplate x:Key="DatabaseDataTemplate" ItemsSource="{Binding Path=Items}"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox x:Name="chkIsSelected" Margin="2" Click="chkStandardTemplateIsSelected_Click" |
||||
IsChecked="{Binding IsSelected}" Visibility="Collapsed" Tag="{Binding Path=Items}" /> |
||||
<Image Grid.Column="1" Margin="2" Source="{StaticResource DatabaseImage}" Width="16" Height="16" /> |
||||
<TextBlock Grid.Column="2" Margin="2" Text="{Binding Name}" VerticalAlignment="Center" /> |
||||
</Grid> |
||||
<HierarchicalDataTemplate.Triggers> |
||||
<DataTrigger Binding="{Binding ShowCheckBoxes, RelativeSource={RelativeSource AncestorType=TreeView}}" Value="True"> |
||||
<Setter Property="Visibility" TargetName="chkIsSelected" Value="Visible" /> |
||||
</DataTrigger> |
||||
</HierarchicalDataTemplate.Triggers> |
||||
</HierarchicalDataTemplate> |
||||
<HierarchicalDataTemplate x:Key="TableDataTemplate" ItemsSource="{Binding Path=Items}"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox x:Name="chkIsSelected" Margin="2" Click="chkStandardTemplateIsSelected_Click" |
||||
IsChecked="{Binding IsSelected}" Visibility="Collapsed" Tag="{Binding Path=Items}" /> |
||||
<Image Grid.Column="1" Margin="2" Source="{StaticResource DatabaseTableImage}" Width="16" Height="16" /> |
||||
<TextBlock Grid.Column="2" Margin="2" Text="{Binding Name}" VerticalAlignment="Center" PreviewMouseLeftButtonDown="DatabaseObject_PreviewMouseLeftButtonDown" /> |
||||
</Grid> |
||||
<HierarchicalDataTemplate.Triggers> |
||||
<DataTrigger Binding="{Binding ShowCheckBoxes, RelativeSource={RelativeSource AncestorType=TreeView}}" Value="True"> |
||||
<Setter Property="Visibility" TargetName="chkIsSelected" Value="Visible" /> |
||||
</DataTrigger> |
||||
</HierarchicalDataTemplate.Triggers> |
||||
</HierarchicalDataTemplate> |
||||
<DataTemplate x:Key="ColumnDataTemplate"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Image x:Name="imgColumn" Grid.Column="1" Margin="2" Source="{StaticResource TableImage}" Width="16" Height="16" /> |
||||
<TextBlock Grid.Column="2" Margin="2" Text="{Binding ColumnSummary}" VerticalAlignment="Center" PreviewMouseLeftButtonDown="DatabaseObject_PreviewMouseLeftButtonDown" /> |
||||
</Grid> |
||||
<DataTemplate.Triggers> |
||||
<DataTrigger Binding="{Binding IsForeignKey}" Value="True"> |
||||
<Setter TargetName="imgColumn" Property="Source" Value="{StaticResource TableForeignKeyImage}" /> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding IsPrimaryKey}" Value="True"> |
||||
<Setter TargetName="imgColumn" Property="Source" Value="{StaticResource TableKeyImage}" /> |
||||
</DataTrigger> |
||||
</DataTemplate.Triggers> |
||||
</DataTemplate> |
||||
<HierarchicalDataTemplate x:Key="ProcedureDataTemplate" ItemsSource="{Binding Path=Items}"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<CheckBox x:Name="chkIsSelected" Margin="2" Click="chkStandardTemplateIsSelected_Click" |
||||
IsChecked="{Binding IsSelected}" Visibility="Collapsed" Tag="{Binding Path=Items}" /> |
||||
<Image Grid.Column="1" Margin="2" Source="{StaticResource ProcedureImage}" Width="16" Height="16" /> |
||||
<TextBlock Grid.Column="2" Margin="2" Text="{Binding Name}" VerticalAlignment="Center" PreviewMouseLeftButtonDown="DatabaseObject_PreviewMouseLeftButtonDown" /> |
||||
</Grid> |
||||
<HierarchicalDataTemplate.Triggers> |
||||
<DataTrigger Binding="{Binding ShowCheckBoxes, RelativeSource={RelativeSource AncestorType=TreeView}}" Value="True"> |
||||
<Setter Property="Visibility" TargetName="chkIsSelected" Value="Visible" /> |
||||
</DataTrigger> |
||||
</HierarchicalDataTemplate.Triggers> |
||||
</HierarchicalDataTemplate> |
||||
<DataTemplate x:Key="ProcedureParameterDataTemplate"> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<TextBlock Margin="2,2,0,2" Text="@" VerticalAlignment="Center" PreviewMouseLeftButtonDown="DatabaseObject_PreviewMouseLeftButtonDown" /> |
||||
<TextBlock Margin="0,2,2,2" Text="{Binding Name}" VerticalAlignment="Center" PreviewMouseLeftButtonDown="DatabaseObject_PreviewMouseLeftButtonDown" /> |
||||
</StackPanel> |
||||
</DataTemplate> |
||||
|
||||
<local:DatabaseTreeViewDataTemplateSelector x:Key="DatabaseTreeViewDataTemplateSelector" /> |
||||
</ResourceDictionary> |
||||
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
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 ICSharpCode.Data.Core.DatabaseObjects; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for DatabaseTreeViewResources.xaml
|
||||
/// </summary>
|
||||
public partial class DatabaseTreeViewResources : ResourceDictionary |
||||
{ |
||||
public DatabaseTreeViewResources() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
private void DatabaseObject_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||||
{ |
||||
FrameworkElement frameworkElement = sender as FrameworkElement; |
||||
|
||||
if (frameworkElement != null) |
||||
{ |
||||
DragDropEffects allowedEffects = DragDropEffects.Scroll | DragDropEffects.Copy; |
||||
DragDrop.DoDragDrop(frameworkElement, frameworkElement.DataContext, allowedEffects); |
||||
} |
||||
} |
||||
|
||||
private void chkStandardTemplateIsSelected_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
CheckBox checkBox = sender as CheckBox; |
||||
|
||||
if (checkBox != null) |
||||
{ |
||||
if (checkBox.Tag is IDatabaseObjectsCollection) |
||||
{ |
||||
IDatabaseObjectsCollection collection = checkBox.Tag as IDatabaseObjectsCollection; |
||||
|
||||
foreach (IDatabaseObjectBase item in collection.NonGenericItems) |
||||
{ |
||||
if (checkBox.IsChecked.HasValue && checkBox.IsChecked.Value) |
||||
item.IsSelected = true; |
||||
else |
||||
item.IsSelected = false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
<TreeView x:Class="ICSharpCode.Data.Core.UI.UserControls.DatabasesTreeView" |
||||
x:Name="This" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:data="http://icsharpcode.net/data" |
||||
xmlns:local="clr-namespace:ICSharpCode.Data.Core.UI.UserControls"> |
||||
<TreeView.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="DatabaseTreeViewResources.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
</TreeView.Resources> |
||||
|
||||
<TreeViewItem x:Name="tviDatabases" ItemsSource="{Binding Databases, ElementName=This}" ItemTemplateSelector="{StaticResource DatabaseTreeViewDataTemplateSelector}"> |
||||
<TreeViewItem.Header> |
||||
<Grid> |
||||
<Grid.ContextMenu> |
||||
<ContextMenu> |
||||
<MenuItem Header="Add database..." Click="mnuAddDatabase_Click" /> |
||||
<MenuItem Header="Refresh" Click="mnuRefresh_Click" /> |
||||
</ContextMenu> |
||||
</Grid.ContextMenu> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Image Margin="2" Source="{StaticResource DatabaseImage}" Width="16" Height="16" /> |
||||
<TextBlock Margin="2" Grid.Column="1" Text="Databases" VerticalAlignment="Center" /> |
||||
</Grid> |
||||
</TreeViewItem.Header> |
||||
</TreeViewItem> |
||||
</TreeView> |
||||
@ -0,0 +1,138 @@
@@ -0,0 +1,138 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Input; |
||||
using System.Windows.Interop; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using ICSharpCode.Data.Core.UI.Windows; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using System.Windows.Data; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for DatabasesTreeView.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class DatabasesTreeView : TreeView, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
private ObservableCollection<IDatabase> _databases = new ObservableCollection<IDatabase>(); |
||||
private ObservableCollection<IDatabasesTreeViewAdditionalNode> _additionalNodes = new ObservableCollection<IDatabasesTreeViewAdditionalNode>(); |
||||
private bool _showCheckBoxes = false; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public ObservableCollection<IDatabase> Databases |
||||
{ |
||||
get { return _databases; } |
||||
set |
||||
{ |
||||
_databases = value; |
||||
OnPropertyChanged("Databases"); |
||||
} |
||||
} |
||||
|
||||
public ObservableCollection<IDatabasesTreeViewAdditionalNode> AdditionalNodes |
||||
{ |
||||
get { return _additionalNodes; } |
||||
} |
||||
|
||||
public bool ShowCheckBoxes |
||||
{ |
||||
get { return _showCheckBoxes; } |
||||
set { _showCheckBoxes = value; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public DatabasesTreeView() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
_additionalNodes.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(AdditionalNodes_CollectionChanged); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void mnuAddDatabase_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
ConnectionWizardWindow connectionWizardWindow = new ConnectionWizardWindow(); |
||||
connectionWizardWindow.Owner = Application.Current.MainWindow; |
||||
connectionWizardWindow.ShowDialog(); |
||||
|
||||
if (connectionWizardWindow.DialogResult.Value) |
||||
{ |
||||
connectionWizardWindow.SelectedDatabase.LoadDatabase(); |
||||
|
||||
if (Databases.FirstOrDefault(database => database.ConnectionString == connectionWizardWindow.SelectedDatabase.ConnectionString) == null) |
||||
Databases.Add(connectionWizardWindow.SelectedDatabase); |
||||
} |
||||
} |
||||
|
||||
private void mnuRefresh_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
|
||||
} |
||||
|
||||
private void AdditionalNodes_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||
{ |
||||
if (e.OldItems != null) |
||||
{ |
||||
foreach (IDatabasesTreeViewAdditionalNode additionalNode in e.OldItems) |
||||
{ |
||||
TreeViewItem tvi = ItemContainerGenerator.ContainerFromItem(additionalNode) as TreeViewItem; |
||||
|
||||
if (tvi != null) |
||||
Items.Remove(tvi); |
||||
} |
||||
} |
||||
|
||||
if (e.NewItems != null) |
||||
{ |
||||
foreach (IDatabasesTreeViewAdditionalNode additionalNode in e.NewItems) |
||||
{ |
||||
TreeViewItem tvi = new TreeViewItem(); |
||||
tvi.Header = additionalNode.Name; |
||||
tvi.ItemTemplate = Application.Current.TryFindResource(additionalNode.DataTemplate) as DataTemplate; |
||||
|
||||
Binding binding = new Binding("Items"); |
||||
binding.Source = additionalNode; |
||||
tvi.SetBinding(TreeViewItem.ItemsSourceProperty, binding); |
||||
|
||||
Items.Add(tvi); |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
private void OnPropertyChanged(string property) |
||||
{ |
||||
if (this.PropertyChanged != null) |
||||
{ |
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
<UserControl x:Class="ICSharpCode.Data.Core.UI.UserControls.ErrorRetryButton" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
x:Name="This" Visibility="Collapsed"> |
||||
<UserControl.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="../Images/ImageDictionary.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
</UserControl.Resources> |
||||
|
||||
<Grid x:Name="grd"> |
||||
<Image x:Name="imgError" Source="{StaticResource ErrorImage}" ToolTip="{Binding Exception.Message, ElementName=This}" Width="16" Height="16" Visibility="Collapsed" /> |
||||
<Image x:Name="imgExclamation" Source="{StaticResource ExclamationImage}" ToolTip="{Binding Exception.Message, ElementName=This}" Width="16" Height="16" Visibility="Collapsed" /> |
||||
<Image x:Name="imgRefresh" Source="{StaticResource RefreshImage}" ToolTip="{Binding Exception.Message, ElementName=This}" Width="16" Height="16" Opacity="0" |
||||
Cursor="Hand" /> |
||||
<Grid.Triggers> |
||||
<EventTrigger SourceName="grd" RoutedEvent="Grid.MouseEnter"> |
||||
<BeginStoryboard> |
||||
<Storyboard> |
||||
<DoubleAnimation Storyboard.TargetName="imgError" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.5" /> |
||||
<DoubleAnimation Storyboard.TargetName="imgRefresh" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5" /> |
||||
</Storyboard> |
||||
</BeginStoryboard> |
||||
</EventTrigger> |
||||
<EventTrigger SourceName="grd" RoutedEvent="Grid.MouseEnter"> |
||||
<BeginStoryboard> |
||||
<Storyboard> |
||||
<DoubleAnimation Storyboard.TargetName="imgExclamation" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.5" /> |
||||
<DoubleAnimation Storyboard.TargetName="imgRefresh" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5" /> |
||||
</Storyboard> |
||||
</BeginStoryboard> |
||||
</EventTrigger> |
||||
<EventTrigger SourceName="grd" RoutedEvent="Grid.MouseLeave"> |
||||
<BeginStoryboard> |
||||
<Storyboard> |
||||
<DoubleAnimation Storyboard.TargetName="imgError" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5" /> |
||||
<DoubleAnimation Storyboard.TargetName="imgRefresh" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.5" /> |
||||
</Storyboard> |
||||
</BeginStoryboard> |
||||
</EventTrigger> |
||||
<EventTrigger SourceName="grd" RoutedEvent="Grid.MouseLeave"> |
||||
<BeginStoryboard> |
||||
<Storyboard> |
||||
<DoubleAnimation Storyboard.TargetName="imgExclamation" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5" /> |
||||
<DoubleAnimation Storyboard.TargetName="imgRefresh" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.5" /> |
||||
</Storyboard> |
||||
</BeginStoryboard> |
||||
</EventTrigger> |
||||
</Grid.Triggers> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
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; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for ErrorRetryButton.xaml
|
||||
/// </summary>
|
||||
public partial class ErrorRetryButton : UserControl |
||||
{ |
||||
#region Fields
|
||||
|
||||
public static readonly DependencyProperty ExceptionProperty = |
||||
DependencyProperty.Register("Exception", typeof(Exception), typeof(ErrorRetryButton), new FrameworkPropertyMetadata(null, ExceptionChanged)); |
||||
|
||||
private bool _useExclamationMark = false; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the exception to display.
|
||||
/// </summary>
|
||||
public Exception Exception |
||||
{ |
||||
get { return (Exception)GetValue(ErrorRetryButton.ExceptionProperty); } |
||||
set { SetValue(ErrorRetryButton.ExceptionProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets or set if the control should use the exclamation mark for displaying the exception.
|
||||
/// </summary>
|
||||
public bool UseExclamationMark |
||||
{ |
||||
get { return _useExclamationMark; } |
||||
set { _useExclamationMark = value; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public ErrorRetryButton() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private static void ExceptionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||
{ |
||||
ErrorRetryButton errorRetryButton = d as ErrorRetryButton; |
||||
|
||||
if (errorRetryButton == null) |
||||
return; |
||||
|
||||
if (e.NewValue is Exception) |
||||
{ |
||||
errorRetryButton.This.Visibility = Visibility.Visible; |
||||
|
||||
if (errorRetryButton._useExclamationMark) |
||||
{ |
||||
errorRetryButton.imgExclamation.Visibility = Visibility.Visible; |
||||
errorRetryButton.imgError.Visibility = Visibility.Collapsed; |
||||
} |
||||
else |
||||
{ |
||||
errorRetryButton.imgError.Visibility = Visibility.Visible; |
||||
errorRetryButton.imgExclamation.Visibility = Visibility.Collapsed; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
errorRetryButton.This.Visibility = Visibility.Collapsed; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Collections; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
public interface IDatabasesTreeViewAdditionalNode |
||||
{ |
||||
string Name { get; } |
||||
IEnumerable Items { get; } |
||||
string DataTemplate { get; } |
||||
} |
||||
} |
||||
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
<UserControl x:Class="ICSharpCode.Data.Core.UI.UserControls.LoadingCircle" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<UserControl.Resources> |
||||
<Storyboard x:Key="RenderDoubleAnimationStoryboard" Storyboard.TargetName="MainCanvas"> |
||||
<DoubleAnimation Storyboard.TargetProperty="(RenderTransform).(RotateTransform.Angle)" From="0" To="359" |
||||
Duration="0:0:0.75" RepeatBehavior="Forever" /> |
||||
</Storyboard> |
||||
<Storyboard x:Key="OpacityDoubleAnimationStoryboardToVisible" Storyboard.TargetName="MainCanvas"> |
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.5" FillBehavior="HoldEnd" /> |
||||
</Storyboard> |
||||
<Storyboard x:Key="OpacityDoubleAnimationStoryboardToUnvisible" Storyboard.TargetName="MainCanvas" Completed="DeactivationCompleted"> |
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.5" FillBehavior="HoldEnd" /> |
||||
</Storyboard> |
||||
</UserControl.Resources> |
||||
<Canvas x:Name="MainCanvas" Opacity="0"> |
||||
<Canvas.RenderTransform> |
||||
<RotateTransform x:Name="CanvasRotateTransformation" Angle="0" /> |
||||
</Canvas.RenderTransform> |
||||
<Ellipse Stroke="White" x:Name="BackgroundEllipse" /> |
||||
</Canvas> |
||||
</UserControl> |
||||
|
||||
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Media.Animation; |
||||
using System.Windows.Shapes; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for LoadingCircle.xaml
|
||||
/// </summary>
|
||||
public partial class LoadingCircle : UserControl |
||||
{ |
||||
#region Fields
|
||||
|
||||
public static readonly DependencyProperty IsActivatedProperty = |
||||
DependencyProperty.Register("IsActivated", typeof(bool), typeof(LoadingCircle), new FrameworkPropertyMetadata(false, IsActivatedChanged)); |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the LoadingCircle is activated.
|
||||
/// </summary>
|
||||
public bool IsActivated |
||||
{ |
||||
get { return (bool)GetValue(LoadingCircle.IsActivatedProperty); } |
||||
set { SetValue(LoadingCircle.IsActivatedProperty, value); } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public LoadingCircle() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Protected methods
|
||||
|
||||
/// <summary>
|
||||
/// Returns the standard size (20x20).
|
||||
/// </summary>
|
||||
/// <param name="constraint"></param>
|
||||
/// <returns></returns>
|
||||
protected override Size MeasureOverride(Size constraint) |
||||
{ |
||||
return new Size(Math.Min(20, constraint.Width), Math.Min(20, constraint.Height)); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Called to arange and size the content of the LoadingCircle.
|
||||
/// </summary>
|
||||
/// <param name="arrangeBounds"></param>
|
||||
/// <returns></returns>
|
||||
protected override Size ArrangeOverride(Size arrangeBounds) |
||||
{ |
||||
// Save ellipse for later re-creation
|
||||
Ellipse backgroundEllipse = BackgroundEllipse; |
||||
MainCanvas.Children.Clear(); |
||||
MainCanvas.Children.Add(backgroundEllipse); |
||||
double lengthOfOneSide = Math.Min(arrangeBounds.Height, arrangeBounds.Width); |
||||
double outerRadius = lengthOfOneSide / 2d; |
||||
double innerRadius = outerRadius - outerRadius / 2.4; |
||||
BackgroundEllipse.Height = BackgroundEllipse.Width = lengthOfOneSide; |
||||
BackgroundEllipse.StrokeThickness = outerRadius - innerRadius; |
||||
CanvasRotateTransformation.CenterX = CanvasRotateTransformation.CenterY = outerRadius; |
||||
|
||||
Point middlePoint = new Point(outerRadius, outerRadius); |
||||
|
||||
int numberOfStrokes = (int)Math.Round(lengthOfOneSide * 26d / 20d); |
||||
double angleFactorPerStroke = 360d / (double)numberOfStrokes; |
||||
double transparentFactorPerStroke = 1d / (double)numberOfStrokes; |
||||
double currentTransparentFactor = 1; |
||||
for (double angle = 0, i = 1; angle < 360; angle += angleFactorPerStroke, i++) |
||||
{ |
||||
double angleInRad = Math.PI * angle / 180d; |
||||
Line line = new Line(); |
||||
line.Opacity = currentTransparentFactor; |
||||
line.Stroke = this.Foreground; |
||||
line.StrokeThickness = 3; |
||||
line.X1 = middlePoint.X + outerRadius * Math.Cos(angleInRad); |
||||
line.Y1 = middlePoint.Y + outerRadius * Math.Sin(angleInRad); |
||||
line.X2 = middlePoint.X + innerRadius * Math.Cos(angleInRad); |
||||
line.Y2 = middlePoint.Y + innerRadius * Math.Sin(angleInRad); |
||||
MainCanvas.Children.Add(line); |
||||
currentTransparentFactor -= transparentFactorPerStroke; |
||||
} |
||||
return base.ArrangeOverride(arrangeBounds); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
|
||||
/// <summary>
|
||||
/// Starts/Stops animation.
|
||||
/// </summary>
|
||||
/// <param name="d"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void IsActivatedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||
{ |
||||
LoadingCircle lc = (LoadingCircle)d; |
||||
if ((bool)e.NewValue) |
||||
{ |
||||
((Storyboard)lc.FindResource("OpacityDoubleAnimationStoryboardToUnvisible")).Stop(lc); |
||||
((Storyboard)lc.FindResource("RenderDoubleAnimationStoryboard")).Begin(lc, true); |
||||
((Storyboard)lc.FindResource("OpacityDoubleAnimationStoryboardToVisible")).Begin(lc, true); |
||||
} |
||||
else |
||||
{ |
||||
((Storyboard)lc.FindResource("OpacityDoubleAnimationStoryboardToVisible")).Stop(lc); |
||||
((Storyboard)lc.FindResource("OpacityDoubleAnimationStoryboardToUnvisible")).Begin(lc, true); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Stops the rotation animation.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void DeactivationCompleted(object sender, EventArgs e) |
||||
{ |
||||
((Storyboard)this.FindResource("RenderDoubleAnimationStoryboard")).Stop(this); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,116 @@
@@ -0,0 +1,116 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
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.ComponentModel; |
||||
using ICSharpCode.Data.Core.UI.Windows; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.UserControls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for WizardUserControl.xaml
|
||||
/// </summary>
|
||||
public abstract partial class WizardUserControl : UserControl, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
private WizardWindow _wizardWindow = null; |
||||
private bool _isReadyForNextStep = false; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Returns the parent WizardWindow.
|
||||
/// </summary>
|
||||
public WizardWindow WizardWindow |
||||
{ |
||||
get { return _wizardWindow; } |
||||
set { _wizardWindow = value; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the index of this WizardUserControl in a WizardWindow.
|
||||
/// </summary>
|
||||
public virtual int Index |
||||
{ |
||||
get { throw new NotImplementedException(); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the title of this WizardUserControl.
|
||||
/// </summary>
|
||||
public virtual string Title |
||||
{ |
||||
get { throw new NotImplementedException(); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns if this WizardUserControl can finish the WizardWindow.
|
||||
/// </summary>
|
||||
public virtual bool CanFinish |
||||
{ |
||||
get { throw new NotImplementedException(); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets it this WizardUserControl is ready for the next step.
|
||||
/// </summary>
|
||||
public bool IsReadyForNextStep |
||||
{ |
||||
get { return _isReadyForNextStep; } |
||||
protected set |
||||
{ |
||||
_isReadyForNextStep = value; |
||||
OnPropertyChanged("IsReadyForNextStep"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Intializes a WizardUserControl.
|
||||
/// </summary>
|
||||
public WizardUserControl() |
||||
{ } |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void OnPropertyChanged(string property) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
{ |
||||
PropertyChanged(this, new PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public virtual void OnActivate() |
||||
{ } |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
<Window x:Class="ICSharpCode.Data.Core.UI.Windows.ConnectionWizardWindow" |
||||
x:Name="This" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:data="http://icsharpcode.net/data" |
||||
xmlns:userControls="clr-namespace:ICSharpCode.Data.Core.UI.UserControls" |
||||
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" |
||||
Title="Add new database connection" Height="400" Width="600" WindowStartupLocation="CenterOwner"> |
||||
<Window.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="../Images/ImageDictionary.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
</Window.Resources> |
||||
|
||||
<Grid Margin="5"> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition Height="Auto" /> |
||||
<RowDefinition /> |
||||
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Border Background="White"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Image Margin="5,5,10,10" Width="16" Height="16" Source="{StaticResource DatabaseConnectImage}" VerticalAlignment="Center" /> |
||||
<TextBlock Grid.Column="1" Margin="10,5,10,10" FontWeight="Bold" VerticalAlignment="Center">Add new database connection</TextBlock> |
||||
</Grid> |
||||
</Border> |
||||
|
||||
<TextBlock Grid.Row="1" Margin="3">Database driver:</TextBlock> |
||||
<ComboBox x:Name="cboDatabaseDriver" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="3" SelectedItem="{Binding SelectedDatabaseDriver, ElementName=This}" |
||||
ItemsSource="{x:Static data:DatabaseDriver.DatabaseDrivers}" SelectionChanged="cboDatabaseDriver_SelectionChanged"> |
||||
<ComboBox.ItemTemplate> |
||||
<DataTemplate> |
||||
<TextBlock Text="{Binding Name}" /> |
||||
</DataTemplate> |
||||
</ComboBox.ItemTemplate> |
||||
</ComboBox> |
||||
|
||||
<TextBlock Grid.Row="2" Margin="3">Data source:</TextBlock> |
||||
<Grid Grid.Row="2" Grid.Column="1"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition /> |
||||
<ColumnDefinition Width="Auto" /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<ComboBox x:Name="cboDatasources" Margin="3" IsEditable="True" KeyDown="cboDatasources_KeyDown" SelectionChanged="cboDatasources_SelectionChanged" |
||||
SelectedItem="{Binding SelectedDatasource, ElementName=This}" ItemsSource="{Binding SelectedDatabaseDriver.Datasources, ElementName=This}"> |
||||
<ComboBox.ItemTemplate> |
||||
<DataTemplate> |
||||
<TextBlock Text="{Binding Name}" /> |
||||
</DataTemplate> |
||||
</ComboBox.ItemTemplate> |
||||
</ComboBox> |
||||
<userControls:ErrorRetryButton x:Name="erbDatasources" Grid.Column="1" UseExclamationMark="True" Exception="{Binding DatasourceException, ElementName=This}" MouseLeftButtonUp="erbDatasources_MouseLeftButtonUp" /> |
||||
</Grid> |
||||
|
||||
<ContentControl Grid.Row="3" Grid.Column="1" Margin="3" Content="{Binding SelectedDatasource.ControlPanel, ElementName=This}" /> |
||||
|
||||
<TextBlock Grid.Row="4" Margin="3">Database:</TextBlock> |
||||
|
||||
<ComboBox x:Name="cboDatabases" Grid.Row="4" Grid.Column="1" Margin="3" SelectedItem="{Binding SelectedDatabase, ElementName=This}" |
||||
ItemsSource="{Binding SelectedDatasource.Databases, ElementName=This}" SelectionChanged="cboDatabases_SelectionChanged"> |
||||
<ComboBox.ItemTemplate> |
||||
<DataTemplate> |
||||
<TextBlock Text="{Binding Name}" /> |
||||
</DataTemplate> |
||||
</ComboBox.ItemTemplate> |
||||
</ComboBox> |
||||
|
||||
<Expander Grid.Row="5" Grid.Column="1" Margin="2" Header="Connection String" VerticalAlignment="Top" |
||||
IsExpanded="{Binding SelectedDatasource.UseUserDefinedConnectionString, ElementName=This}"> |
||||
<TextBox Text="{Binding SelectedDatasource.ConnectionString, ElementName=This}" MinLines="5" /> |
||||
</Expander> |
||||
|
||||
<userControls:LoadingCircle Grid.Row="6" Margin="3" IsActivated="{Binding IsLoading, ElementName=This}" /> |
||||
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> |
||||
<Button x:Name="btnAdd" Margin="3" Padding="3" Click="btnAdd_Click" IsEnabled="False">Add</Button> |
||||
<Button Margin="3" IsCancel="True" Padding="3" Click="btnCancel_Click">Cancel</Button> |
||||
</StackPanel> |
||||
</Grid> |
||||
</Window> |
||||
@ -0,0 +1,233 @@
@@ -0,0 +1,233 @@
|
||||
#region Usings
|
||||
|
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Input; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using System; |
||||
using System.Threading; |
||||
using System.Windows.Threading; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.Windows |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for ConnectionWizardWindow.xaml
|
||||
/// </summary>
|
||||
|
||||
public partial class ConnectionWizardWindow : Window, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
private Action _addAction = null; |
||||
private IDatabaseDriver _selectedDatabaseDriver = null; |
||||
private IDatasource _selectedDatasource = null; |
||||
private IDatabase _selectedDatabase = null; |
||||
private bool _isLoading = false; |
||||
private Exception _datasourceException = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public Action AddAction |
||||
{ |
||||
get { return _addAction; } |
||||
set { _addAction = value; } |
||||
} |
||||
|
||||
public IDatabaseDriver SelectedDatabaseDriver |
||||
{ |
||||
get { return _selectedDatabaseDriver; } |
||||
set |
||||
{ |
||||
_selectedDatabaseDriver = value; |
||||
OnPropertyChanged("SelectedDatabaseDriver"); |
||||
} |
||||
} |
||||
|
||||
public IDatasource SelectedDatasource |
||||
{ |
||||
get { return _selectedDatasource; } |
||||
set |
||||
{ |
||||
_selectedDatasource = value; |
||||
OnPropertyChanged("SelectedDatasource"); |
||||
} |
||||
} |
||||
|
||||
public IDatabase SelectedDatabase |
||||
{ |
||||
get { return _selectedDatabase; } |
||||
set |
||||
{ |
||||
_selectedDatabase = value; |
||||
OnPropertyChanged("SelectedDatabase"); |
||||
} |
||||
} |
||||
|
||||
public bool IsLoading |
||||
{ |
||||
get { return _isLoading; } |
||||
set |
||||
{ |
||||
_isLoading = value; |
||||
OnPropertyChanged("IsLoading"); |
||||
} |
||||
} |
||||
|
||||
public Exception DatasourceException |
||||
{ |
||||
get { return _datasourceException; } |
||||
set |
||||
{ |
||||
_datasourceException = value; |
||||
OnPropertyChanged("DatasourceException"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public ConnectionWizardWindow() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
|
||||
private void SetIsLoading(bool value) |
||||
{ |
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { IsLoading = value; })); |
||||
} |
||||
|
||||
private void SetException(Exception exception) |
||||
{ |
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { DatasourceException = exception; })); |
||||
} |
||||
|
||||
private void PopulateDatasources() |
||||
{ |
||||
Thread thread = new Thread(new ThreadStart(delegate() |
||||
{ |
||||
if (SelectedDatabaseDriver != null) |
||||
{ |
||||
SetIsLoading(true); |
||||
SelectedDatabaseDriver.PopulateDatasources(); |
||||
SetIsLoading(false); |
||||
} |
||||
} |
||||
)); |
||||
|
||||
thread.SetApartmentState(ApartmentState.STA); |
||||
thread.IsBackground = true; |
||||
thread.Start(); |
||||
|
||||
} |
||||
|
||||
private void PopulateDatabases() |
||||
{ |
||||
SetException(null); |
||||
|
||||
Thread thread = new Thread(new ThreadStart(delegate() |
||||
{ |
||||
if (SelectedDatabaseDriver != null) |
||||
{ |
||||
SetIsLoading(true); |
||||
|
||||
try |
||||
{ |
||||
SelectedDatabaseDriver.PopulateDatabases(); |
||||
} |
||||
catch (Exception ex) |
||||
{ |
||||
SetException(ex); |
||||
} |
||||
|
||||
SetIsLoading(false); |
||||
} |
||||
})); |
||||
|
||||
thread.SetApartmentState(ApartmentState.STA); |
||||
thread.IsBackground = true; |
||||
thread.Start(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void cboDatabaseDriver_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||||
{ |
||||
PopulateDatasources(); |
||||
} |
||||
|
||||
private void cboDatasources_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||||
{ |
||||
PopulateDatabases(); |
||||
} |
||||
|
||||
private void erbDatasources_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) |
||||
{ |
||||
PopulateDatabases(); |
||||
} |
||||
|
||||
private void cboDatasources_KeyDown(object sender, KeyEventArgs e) |
||||
{ |
||||
if (e.Key == Key.Enter) |
||||
{ |
||||
if (SelectedDatabaseDriver != null) |
||||
{ |
||||
IDatasource newDatasource = SelectedDatabaseDriver.AddNewDatasource(cboDatasources.Text); |
||||
newDatasource.PopulateDatabases(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void cboDatabases_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||||
{ |
||||
btnAdd.IsEnabled = true; |
||||
} |
||||
|
||||
private void btnAdd_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
if (_addAction == null) |
||||
{ |
||||
DialogResult = true; |
||||
Close(); |
||||
} |
||||
else |
||||
{ |
||||
_addAction.Invoke(); |
||||
} |
||||
} |
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
DialogResult = false; |
||||
Close(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void OnPropertyChanged(string property) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
{ |
||||
PropertyChanged(this, new PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using ICSharpCode.Data.Core.UI.UserControls; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.Windows |
||||
{ |
||||
public class WizardWindow : Window |
||||
{ |
||||
#region Fields
|
||||
|
||||
private WizardWindowInnards _wizardWindowInnards = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public WizardWindowInnards WizardWindowInnards |
||||
{ |
||||
get { return _wizardWindowInnards; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public WizardWindow() |
||||
{ |
||||
_wizardWindowInnards = new WizardWindowInnards(this); |
||||
Content = _wizardWindowInnards; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void AddWizardUserControl<T>() where T : WizardUserControl |
||||
{ |
||||
T newWizardUserControl = Activator.CreateInstance<T>(); |
||||
newWizardUserControl.WizardWindow = this; |
||||
_wizardWindowInnards.WizardUserControls.Add(newWizardUserControl); |
||||
} |
||||
|
||||
public virtual void OnFinished() |
||||
{ } |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
<UserControl x:Class="ICSharpCode.Data.Core.UI.Windows.WizardWindowInnards" x:Name="This" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
||||
<UserControl.Resources> |
||||
<ResourceDictionary> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="../MainDictionary.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
</ResourceDictionary> |
||||
</UserControl.Resources> |
||||
|
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="50" /> |
||||
<RowDefinition /> |
||||
<RowDefinition Height="Auto" /> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Border Background="White"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" /> |
||||
<ColumnDefinition /> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Image Margin="10" Width="16" Height="16" Source="{StaticResource DatabaseConnectImage}" VerticalAlignment="Center" /> |
||||
<TextBlock Grid.Column="1" Margin="10" FontWeight="Bold" VerticalAlignment="Center" Text="{Binding CurrentWizardUserControl.Title, ElementName=This}" /> |
||||
</Grid> |
||||
</Border> |
||||
|
||||
<ContentControl Grid.Row="1" Content="{Binding CurrentWizardUserControl, ElementName=This}" /> |
||||
|
||||
<Grid Grid.Row="2" Margin="5"> |
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> |
||||
<Button x:Name="btnPrevious" Margin="3,3,1,3" Padding="3" IsEnabled="False" Click="btnPrevious_Click">Previous</Button> |
||||
<Button x:Name="btnNext" Margin="1,3,3,3" Padding="3" Click="btnNext_Click">Next</Button> |
||||
<Button x:Name="btnFinish" Margin="3" Padding="3" IsEnabled="False" Click="btnFinish_Click">Finish</Button> |
||||
<Button x:Name="btnCancel" Margin="3" Padding="3" Click="btnCancel_Click">Cancel</Button> |
||||
</StackPanel> |
||||
</Grid> |
||||
</Grid> |
||||
</UserControl> |
||||
@ -0,0 +1,206 @@
@@ -0,0 +1,206 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
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.Shapes; |
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Data.Core.UI.UserControls; |
||||
using System.ComponentModel; |
||||
using System.Collections.Specialized; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.UI.Windows |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for WizardWindow.xaml
|
||||
/// </summary>
|
||||
public partial class WizardWindowInnards : UserControl, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
internal static readonly DependencyProperty IsReadyForNextStepProperty = |
||||
DependencyProperty.Register("IsReadyForNextStep", typeof(bool), typeof(WizardWindowInnards), new FrameworkPropertyMetadata(false, IsReadyForNextStep_Changed)); |
||||
private WizardWindow _wizardWindow = null; |
||||
private ObservableCollection<WizardUserControl> _wizardUserControls = new ObservableCollection<WizardUserControl>(); |
||||
private WizardUserControl _currentWizardUserControl = null; |
||||
private int _currentIndex = 0; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Returns the ObservableCollection of WizardUserControls, which are displayed in this WizardWindow.
|
||||
/// </summary>
|
||||
public ObservableCollection<WizardUserControl> WizardUserControls |
||||
{ |
||||
get { return _wizardUserControls; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the current WizardUserControls index of the WizardWindow.
|
||||
/// </summary>
|
||||
public int CurrentIndex |
||||
{ |
||||
get { return _currentIndex; } |
||||
protected set |
||||
{ |
||||
_currentIndex = value; |
||||
_currentWizardUserControl = null; |
||||
OnPropertyChanged("CurrentIndex"); |
||||
OnPropertyChanged("CurrentWizardUserControl"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the current WizardUserControl of the WizardWindow.
|
||||
/// </summary>
|
||||
public WizardUserControl CurrentWizardUserControl |
||||
{ |
||||
get |
||||
{ |
||||
if (_currentWizardUserControl != null) |
||||
return _currentWizardUserControl; |
||||
else |
||||
{ |
||||
_currentWizardUserControl = _wizardUserControls.FirstOrDefault(wuc => wuc.Index == _currentIndex); |
||||
BindingBase binding = new Binding("IsReadyForNextStep") { Source = _currentWizardUserControl }; |
||||
SetBinding(WizardWindowInnards.IsReadyForNextStepProperty, binding); |
||||
ToggleEnabledButtons(); |
||||
return _currentWizardUserControl; |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initizales the WizardWindow.
|
||||
/// </summary>
|
||||
public WizardWindowInnards(WizardWindow wizardWindow) |
||||
{ |
||||
InitializeComponent(); |
||||
_wizardWindow = wizardWindow; |
||||
_wizardUserControls.CollectionChanged += new NotifyCollectionChangedEventHandler(WizardUserControls_CollectionChanged); |
||||
DataContext = wizardWindow; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void ToggleEnabledButtons() |
||||
{ |
||||
if (!IsInitialized) |
||||
return; |
||||
|
||||
if (CurrentIndex == 0) |
||||
{ |
||||
btnPrevious.IsEnabled = false; |
||||
} |
||||
else |
||||
{ |
||||
btnPrevious.IsEnabled = true; |
||||
} |
||||
|
||||
if (CurrentIndex == _wizardUserControls.Count - 1) |
||||
{ |
||||
btnNext.IsEnabled = false; |
||||
} |
||||
else |
||||
{ |
||||
if (CurrentWizardUserControl.IsReadyForNextStep) |
||||
btnNext.IsEnabled = true; |
||||
else |
||||
btnNext.IsEnabled = false; |
||||
} |
||||
|
||||
if (CurrentWizardUserControl.CanFinish) |
||||
{ |
||||
if (CurrentWizardUserControl.IsReadyForNextStep) |
||||
btnFinish.IsEnabled = true; |
||||
} |
||||
else |
||||
btnFinish.IsEnabled = false; |
||||
|
||||
CurrentWizardUserControl.OnActivate(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private static void IsReadyForNextStep_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||
{ |
||||
WizardWindowInnards wizardWindowInnards = d as WizardWindowInnards; |
||||
wizardWindowInnards.ToggleEnabledButtons(); |
||||
} |
||||
|
||||
private void WizardUserControls_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
||||
{ |
||||
OnPropertyChanged("CurrentWizardUserControl"); |
||||
} |
||||
|
||||
private void btnPrevious_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
if (CurrentIndex == 0) |
||||
return; |
||||
else |
||||
{ |
||||
CurrentIndex--; |
||||
} |
||||
} |
||||
|
||||
private void btnNext_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
if (CurrentIndex == _wizardUserControls.Count - 1) |
||||
return; |
||||
else |
||||
{ |
||||
CurrentIndex++; |
||||
} |
||||
} |
||||
|
||||
private void btnFinish_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
_wizardWindow.OnFinished(); |
||||
|
||||
_wizardWindow.DialogResult = true; |
||||
_wizardWindow.Close(); |
||||
} |
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e) |
||||
{ |
||||
_wizardWindow.DialogResult = false; |
||||
_wizardWindow.Close(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void OnPropertyChanged(string property) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
{ |
||||
PropertyChanged(this, new PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Collections.ObjectModel; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.Common |
||||
{ |
||||
/// <summary>
|
||||
/// Eigene Extension Methods für IEnumerable
|
||||
/// </summary>
|
||||
public static class Enumerable |
||||
{ |
||||
#region ForEach
|
||||
|
||||
/// <summary>
|
||||
/// Führt ein foreach auf IEnumerable T aus.
|
||||
/// WICHTIG: Hier gibt es kein break oder continue!
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="action"></param>
|
||||
public static void ForEach<TSource>(this IEnumerable<TSource> source, Action<TSource> action) |
||||
{ |
||||
foreach (TSource item in source) |
||||
action(item); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Führt ein foreach auf IEnumerable T aus.
|
||||
/// WICHTIG: return false bei der Action löst ein break aus!
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="action"></param>
|
||||
public static void ForEach<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> action) |
||||
{ |
||||
foreach (TSource item in source) |
||||
if (!action(item)) |
||||
break; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates an observable collection from an IEnumerable object.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static ObservableCollection<TSource> ToObservableCollection<TSource>(this IEnumerable<TSource> source) |
||||
{ |
||||
ObservableCollection<TSource> dest = new ObservableCollection<TSource>(); |
||||
|
||||
foreach (TSource item in source) |
||||
dest.Add(item); |
||||
|
||||
return dest; |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.Common |
||||
{ |
||||
/// <summary>
|
||||
/// Helper class for the ExtensionMethods.
|
||||
/// </summary>
|
||||
internal static class Helper |
||||
{ |
||||
/// <summary>
|
||||
/// Checks if a parameter is null and throws an exception if that's true.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
/// <param name="parameterName"></param>
|
||||
internal static void CheckIfParameterIsNull(object parameter, string parameterName) |
||||
{ |
||||
if (parameter == null) |
||||
{ |
||||
throw new Exception(string.Format("Der Parameter '{0}' darf nicht NULL sein.", parameterName)); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Trys to cast TSource to TTarget and throws an exception if that's not possible.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TTarget"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="castLogic"></param>
|
||||
internal static TTarget TryCast<TSource, TTarget>(TSource source, Func<TSource, TTarget> castLogic) |
||||
{ |
||||
try |
||||
{ |
||||
return castLogic(source); |
||||
} |
||||
catch (InvalidCastException) |
||||
{ |
||||
throw new Exception(string.Format("Der SourceType '{0}' kann nicht auf den TargetType '{1}' gecastet werden.", typeof(TSource).ToString(), typeof(TTarget).ToString())); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.Common |
||||
{ |
||||
/// <summary>
|
||||
/// ExtensionMethods for System.Object.
|
||||
/// </summary>
|
||||
public static class Objects |
||||
{ |
||||
#region Public methods
|
||||
|
||||
#region DoIfNull
|
||||
|
||||
/// <summary>
|
||||
/// Does something if the object isn't null.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <returns>Source object</returns>
|
||||
public static TSource DoIfNull<TSource>(this TSource source, Action action) |
||||
{ |
||||
Helper.CheckIfParameterIsNull(action, "action"); |
||||
|
||||
if (source == null) |
||||
action(); |
||||
return source; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region DoIfNotNull
|
||||
|
||||
/// <summary>
|
||||
/// Does something if the object isn't null, otherwise the method returns null.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TTarget"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="action"></param>
|
||||
/// <returns></returns>
|
||||
public static TTarget DoIfNotNull<TSource, TTarget>(this TSource source, Func<TSource, TTarget> action) |
||||
{ |
||||
Helper.CheckIfParameterIsNull(action, "action"); |
||||
|
||||
return source == null ? default(TTarget) : action(source); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Does something if the object isn't null.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="action"></param>
|
||||
public static void DoIfNotNull<TSource>(this TSource source, Action<TSource> action) |
||||
{ |
||||
Helper.CheckIfParameterIsNull(action, "action"); |
||||
|
||||
if (source != null) |
||||
action(source); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,334 @@
@@ -0,0 +1,334 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class Column : DatabaseObjectBase, IColumn |
||||
{ |
||||
#region Fields
|
||||
|
||||
private ITable _parentTable = null; |
||||
private string _dataType = string.Empty; |
||||
private string _systemType = string.Empty; |
||||
private int _length = 0; |
||||
private bool _allowsNull = false; |
||||
private int _columnId = 0; |
||||
private int _fullTextTypeColumn = 0; |
||||
private bool _isComputed = false; |
||||
private bool _isCursorType = false; |
||||
private bool _isDeterministic = false; |
||||
private bool _isFulltextIndexed = false; |
||||
private bool _isIdentity = false; |
||||
private bool _isIdNotForRepl = false; |
||||
private bool _isIndexable = false; |
||||
private bool _isOutParam = false; |
||||
private bool _isPrecise = false; |
||||
private bool _isPrimaryKey = false; |
||||
private bool _isRowGuidCol = false; |
||||
private bool _isSystemVerified = false; |
||||
private bool _isXmlIndexable = false; |
||||
private int _precision = 0; |
||||
private int _scale = 0; |
||||
private bool _systemDataAccess = false; |
||||
private bool _userDataAccess = false; |
||||
private bool _usesAnsiTrim = false; |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public Column(ITable parentTable) |
||||
{ |
||||
_parentTable = parentTable; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string ColumnSummary |
||||
{ |
||||
get |
||||
{ |
||||
string allowsNull = string.Empty; |
||||
|
||||
if (IsNullable) |
||||
allowsNull = "null"; |
||||
else |
||||
allowsNull = "not null"; |
||||
|
||||
if (_parentTable != null && _parentTable.Constraints != null) |
||||
{ |
||||
IConstraint constraint = _parentTable.Constraints.FirstOrDefault(constr => constr.FKColumnName == Name); |
||||
|
||||
if (constraint != null) |
||||
return string.Format("{0} (FK, {1}, {2})", Name, DataType, allowsNull); |
||||
} |
||||
|
||||
return string.Format("{0} ({1}, {2})", Name, DataType, allowsNull); |
||||
} |
||||
} |
||||
|
||||
public string DataType |
||||
{ |
||||
get { return _dataType; } |
||||
set |
||||
{ |
||||
_dataType = value; |
||||
OnPropertyChanged("DataType"); |
||||
} |
||||
} |
||||
|
||||
public string SystemType |
||||
{ |
||||
get { return _systemType; } |
||||
set |
||||
{ |
||||
_systemType = value; |
||||
OnPropertyChanged("SystemType"); |
||||
} |
||||
} |
||||
|
||||
public int Length |
||||
{ |
||||
get { return _length; } |
||||
set |
||||
{ |
||||
_length = value; |
||||
OnPropertyChanged("Length"); |
||||
} |
||||
} |
||||
|
||||
public bool IsNullable |
||||
{ |
||||
get { return _allowsNull; } |
||||
set |
||||
{ |
||||
_allowsNull = value; |
||||
OnPropertyChanged("AllowsNull"); |
||||
} |
||||
} |
||||
|
||||
public int ColumnId |
||||
{ |
||||
get { return _columnId; } |
||||
set |
||||
{ |
||||
_columnId = value; |
||||
OnPropertyChanged("ColumnId"); |
||||
} |
||||
} |
||||
|
||||
public int FullTextTypeColumn |
||||
{ |
||||
get { return _fullTextTypeColumn; } |
||||
set |
||||
{ |
||||
_fullTextTypeColumn = value; |
||||
OnPropertyChanged("FullTextTypeColumn"); |
||||
} |
||||
} |
||||
|
||||
public bool IsComputed |
||||
{ |
||||
get { return _isComputed; } |
||||
set |
||||
{ |
||||
_isComputed = value; |
||||
OnPropertyChanged("IsComputed"); |
||||
} |
||||
} |
||||
|
||||
public bool IsCursorType |
||||
{ |
||||
get { return _isCursorType; } |
||||
set |
||||
{ |
||||
_isCursorType = value; |
||||
OnPropertyChanged("IsCursorType"); |
||||
} |
||||
} |
||||
|
||||
public bool IsDeterministic |
||||
{ |
||||
get { return _isDeterministic; } |
||||
set |
||||
{ |
||||
_isDeterministic = value; |
||||
OnPropertyChanged("IsDeterministic"); |
||||
} |
||||
} |
||||
|
||||
public bool IsFulltextIndexed |
||||
{ |
||||
get { return _isFulltextIndexed; } |
||||
set |
||||
{ |
||||
_isFulltextIndexed = value; |
||||
OnPropertyChanged("IsFulltextIndexed"); |
||||
} |
||||
} |
||||
|
||||
public bool IsIdentity |
||||
{ |
||||
get { return _isIdentity; } |
||||
set |
||||
{ |
||||
_isIdentity = value; |
||||
OnPropertyChanged("IsIdentity"); |
||||
} |
||||
} |
||||
|
||||
public bool IsForeignKey |
||||
{ |
||||
get |
||||
{ |
||||
IConstraint constraint = _parentTable.Constraints.FirstOrDefault(constr => constr.FKColumnName == Name); |
||||
|
||||
if (constraint == null) |
||||
return false; |
||||
else |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public bool IsIdNotForRepl |
||||
{ |
||||
get { return _isIdNotForRepl; } |
||||
set |
||||
{ |
||||
_isIdNotForRepl = value; |
||||
OnPropertyChanged("IsIdNotForRepl"); |
||||
} |
||||
} |
||||
|
||||
public bool IsIndexable |
||||
{ |
||||
get { return _isIndexable; } |
||||
set |
||||
{ |
||||
_isIndexable = value; |
||||
OnPropertyChanged("IsIndexable"); |
||||
} |
||||
} |
||||
|
||||
public bool IsOutParam |
||||
{ |
||||
get { return _isOutParam; } |
||||
set |
||||
{ |
||||
_isOutParam = value; |
||||
OnPropertyChanged("IsOutParam"); |
||||
} |
||||
} |
||||
|
||||
public bool IsPrecise |
||||
{ |
||||
get { return _isPrecise; } |
||||
set |
||||
{ |
||||
_isPrecise = value; |
||||
OnPropertyChanged("IsPrecise"); |
||||
} |
||||
} |
||||
|
||||
public bool IsPrimaryKey |
||||
{ |
||||
get { return _isPrimaryKey; } |
||||
set |
||||
{ |
||||
_isPrimaryKey = value; |
||||
OnPropertyChanged("IsPrimaryKey"); |
||||
} |
||||
} |
||||
|
||||
public bool IsRowGuidCol |
||||
{ |
||||
get { return _isRowGuidCol; } |
||||
set |
||||
{ |
||||
_isRowGuidCol = value; |
||||
OnPropertyChanged("IsRowGuidCol"); |
||||
} |
||||
} |
||||
|
||||
public bool IsSystemVerified |
||||
{ |
||||
get { return _isSystemVerified; } |
||||
set |
||||
{ |
||||
_isSystemVerified = value; |
||||
OnPropertyChanged("IsSystemVerified"); |
||||
} |
||||
} |
||||
|
||||
public bool IsXmlIndexable |
||||
{ |
||||
get { return _isXmlIndexable; } |
||||
set |
||||
{ |
||||
_isXmlIndexable = value; |
||||
OnPropertyChanged("IsXmlIndexable"); |
||||
} |
||||
} |
||||
|
||||
public int Precision |
||||
{ |
||||
get { return _precision; } |
||||
set |
||||
{ |
||||
_precision = value; |
||||
OnPropertyChanged("Precision"); |
||||
} |
||||
} |
||||
|
||||
public int Scale |
||||
{ |
||||
get { return _scale; } |
||||
set |
||||
{ |
||||
_scale = value; |
||||
OnPropertyChanged("Scale"); |
||||
} |
||||
} |
||||
|
||||
public bool SystemDataAccess |
||||
{ |
||||
get { return _systemDataAccess; } |
||||
set |
||||
{ |
||||
_systemDataAccess = value; |
||||
OnPropertyChanged("SystemDataAccess"); |
||||
} |
||||
} |
||||
|
||||
public bool UserDataAccess |
||||
{ |
||||
get { return _userDataAccess; } |
||||
set |
||||
{ |
||||
_userDataAccess = value; |
||||
OnPropertyChanged("UserDataAccess"); |
||||
} |
||||
} |
||||
|
||||
public bool UsesAnsiTrim |
||||
{ |
||||
get { return _usesAnsiTrim; } |
||||
set |
||||
{ |
||||
_usesAnsiTrim = value; |
||||
OnPropertyChanged("UsesAnsiTrim"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,159 @@
@@ -0,0 +1,159 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using ICSharpCode.Data.Core.Enums; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class Constraint : DatabaseObjectBase, IConstraint |
||||
{ |
||||
#region Fields
|
||||
|
||||
private string _pkColumnName = string.Empty; |
||||
private string _pkTableName = string.Empty; |
||||
private string _fkColumnName = string.Empty; |
||||
private string _fkTableName = string.Empty; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string PKColumnName |
||||
{ |
||||
get { return _pkColumnName; } |
||||
set |
||||
{ |
||||
_pkColumnName = value; |
||||
OnPropertyChanged("PKColumnName"); |
||||
} |
||||
} |
||||
|
||||
public string PKTableName |
||||
{ |
||||
get { return _pkTableName; } |
||||
set |
||||
{ |
||||
_pkTableName = value; |
||||
OnPropertyChanged("PKTableName"); |
||||
} |
||||
} |
||||
|
||||
public string FKColumnName |
||||
{ |
||||
get { return _fkColumnName; } |
||||
set |
||||
{ |
||||
_fkColumnName = value; |
||||
OnPropertyChanged("FKColumnName"); |
||||
} |
||||
} |
||||
|
||||
public string FKTableName |
||||
{ |
||||
get { return _fkTableName; } |
||||
set |
||||
{ |
||||
_fkTableName = value; |
||||
OnPropertyChanged("FKTableName"); |
||||
} |
||||
} |
||||
|
||||
public IColumn PKColumn |
||||
{ |
||||
get |
||||
{ |
||||
ITable table = PKTable; |
||||
|
||||
if (table != null) |
||||
return GetColumnFromTableByName(table, PKColumnName); |
||||
else |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public ITable PKTable |
||||
{ |
||||
get { return GetTableByName(PKTableName); } |
||||
} |
||||
|
||||
public Cardinality PKCardinality |
||||
{ |
||||
get |
||||
{ |
||||
if (!FKColumn.IsPrimaryKey && FKColumn.IsNullable) |
||||
return Cardinality.ZeroToOne; |
||||
else if (!FKColumn.IsPrimaryKey && !FKColumn.IsNullable) |
||||
return Cardinality.One; |
||||
else if (!FKColumn.IsPrimaryKey) |
||||
return Cardinality.Many; |
||||
else |
||||
return Cardinality.One; |
||||
} |
||||
} |
||||
|
||||
public IColumn FKColumn |
||||
{ |
||||
get |
||||
{ |
||||
ITable table = FKTable; |
||||
|
||||
if (table != null) |
||||
return GetColumnFromTableByName(table, FKColumnName); |
||||
else |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public ITable FKTable |
||||
{ |
||||
get { return GetTableByName(FKTableName); } |
||||
} |
||||
|
||||
public Cardinality FKCardinality |
||||
{ |
||||
get |
||||
{ |
||||
if (PKColumn.IsPrimaryKey) |
||||
return Cardinality.Many; |
||||
else if (!PKColumn.IsPrimaryKey && !FKColumn.IsNullable) |
||||
return Cardinality.One; |
||||
else // !PKColumn.IsPrimaryKey && FKColumn.IsNullable
|
||||
return Cardinality.ZeroToOne; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private ITable GetTableByName(string name) |
||||
{ |
||||
if (Parent is ITable) |
||||
{ |
||||
ITable table = Parent as ITable; |
||||
|
||||
if (table.Parent is IDatabase) |
||||
{ |
||||
IDatabase database = table.Parent as IDatabase; |
||||
|
||||
return database.Tables.FirstOrDefault(t => t.TableName == name); |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
private IColumn GetColumnFromTableByName(ITable table, string columnName) |
||||
{ |
||||
return table.Items.FirstOrDefault(c => c.Name == columnName); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,119 @@
@@ -0,0 +1,119 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using System.Collections.ObjectModel; |
||||
using System.Windows; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Database.
|
||||
/// </summary>
|
||||
public class Database : DatabaseObjectBase<DatabaseObjectBase>, IDatabase |
||||
{ |
||||
#region Fields
|
||||
|
||||
private IDatasource _datasource = null; |
||||
private DatabaseObjectBase<ITable> _tables = null; |
||||
private DatabaseObjectBase<IView> _views = null; |
||||
private DatabaseObjectBase<IProcedure> _procedures = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public IDatasource Datasource |
||||
{ |
||||
get { return _datasource; } |
||||
} |
||||
|
||||
public string ConnectionString |
||||
{ |
||||
get { return _datasource.ConnectionString + ";Initial Catalog=" + _name; } |
||||
} |
||||
|
||||
public DatabaseObjectsCollection<ITable> Tables |
||||
{ |
||||
get |
||||
{ |
||||
if (_tables != null) |
||||
return _tables.Items; |
||||
else |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public DatabaseObjectsCollection<IView> Views |
||||
{ |
||||
get |
||||
{ |
||||
if (_views != null) |
||||
return _views.Items; |
||||
else |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public DatabaseObjectsCollection<IProcedure> Procedures |
||||
{ |
||||
get |
||||
{ |
||||
if (_procedures != null) |
||||
return _procedures.Items; |
||||
else |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public Database(IDatasource datasource) |
||||
{ |
||||
_datasource = datasource; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public bool LoadDatabase() |
||||
{ |
||||
try |
||||
{ |
||||
_tables = new DatabaseObjectBase<ITable>(); |
||||
_tables.Name = "Tables"; |
||||
_tables.Items = Datasource.DatabaseDriver.LoadTables(this); |
||||
Items.Add(_tables); |
||||
OnPropertyChanged("Tables"); |
||||
|
||||
_views = new DatabaseObjectBase<IView>(); |
||||
_views.Name = "Views"; |
||||
_views.Items = Datasource.DatabaseDriver.LoadViews(this); |
||||
Items.Add(_views); |
||||
OnPropertyChanged("Views"); |
||||
|
||||
_procedures = new DatabaseObjectBase<IProcedure>(); |
||||
_procedures.Name = "Procedures"; |
||||
_procedures.Items = Datasource.DatabaseDriver.LoadProcedures(this); |
||||
Items.Add(_procedures); |
||||
OnPropertyChanged("Procedures"); |
||||
|
||||
return true; |
||||
} |
||||
catch (Exception exception) |
||||
{ |
||||
MessageBox.Show(string.Format("Error while trying to load database '{0}'.\n\n" + exception.Message, Name), _datasource.DatabaseDriver.Name , MessageBoxButton.OK, MessageBoxImage.Exclamation); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,256 @@
@@ -0,0 +1,256 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
using ICSharpCode.Data.Core.DatabaseObjects; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using System.IO; |
||||
using System.Reflection; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
/// <summary>
|
||||
/// Holds all available database drivers.
|
||||
/// </summary>
|
||||
public static class DatabaseDriver |
||||
{ |
||||
#region Static fields
|
||||
|
||||
private static List<IDatabaseDriver> _databaseDrivers = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Static properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets all available database drivers.
|
||||
/// </summary>
|
||||
public static List<IDatabaseDriver> DatabaseDrivers |
||||
{ |
||||
get { return _databaseDrivers; } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Static constructor which loads all available database drivers.
|
||||
/// </summary>
|
||||
static DatabaseDriver() |
||||
{ |
||||
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_ReflectionOnlyAssemblyResolve); |
||||
|
||||
// Get all assumed plug in assemblies
|
||||
_databaseDrivers = new List<IDatabaseDriver>(); |
||||
FileInfo fileInfo = new FileInfo(Assembly.GetExecutingAssembly().Location); |
||||
string[] files = Directory.GetFiles(fileInfo.Directory.FullName, "ICSharpCode.Data.*.dll"); |
||||
|
||||
// Iterate through all found files and search for IDatabaseDriver interface
|
||||
foreach (string file in files) |
||||
{ |
||||
try |
||||
{ |
||||
Assembly assembly = Assembly.ReflectionOnlyLoadFrom(file); |
||||
|
||||
Type[] types = assembly.GetTypes(); |
||||
|
||||
foreach (Type type in types) |
||||
{ |
||||
if (type.GetInterface("IDatabaseDriver") != null) |
||||
{ |
||||
if (!type.IsAbstract) |
||||
{ |
||||
// Create an instance of the driver
|
||||
Type loadedType = Assembly.LoadFrom(file).GetType(type.FullName); |
||||
_databaseDrivers.Add(Activator.CreateInstance(loadedType) as IDatabaseDriver); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
catch { } |
||||
} |
||||
} |
||||
|
||||
static Assembly CurrentDomain_ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args) |
||||
{ |
||||
return Assembly.ReflectionOnlyLoad(args.Name); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Description of DatabaseDriver.
|
||||
/// </summary>
|
||||
public abstract class DatabaseDriver<T> : DatabaseObjectBase, IDatabaseDriver where T : IDatasource |
||||
{ |
||||
#region Fields
|
||||
|
||||
private DatabaseObjectsCollection<T> _datasources = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the datasources of this database driver.
|
||||
/// </summary>
|
||||
public DatabaseObjectsCollection<T> Datasources |
||||
{ |
||||
get { return _datasources; } |
||||
protected set |
||||
{ |
||||
_datasources = value; |
||||
OnPropertyChanged("Datasources"); |
||||
OnPropertyChanged("IDatasources"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the datasources of this database driver.
|
||||
/// </summary>
|
||||
public DatabaseObjectsCollection<IDatasource> IDatasources |
||||
{ |
||||
get { return _datasources.Cast<IDatasource>().ToDatabaseObjectsCollection(); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the provider name of this database driver.
|
||||
/// </summary>
|
||||
public virtual string ProviderName |
||||
{ |
||||
get { throw new NotImplementedException(); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the ODBC provider name of this database driver.
|
||||
/// </summary>
|
||||
public virtual string ODBCProviderName |
||||
{ |
||||
get { throw new NotImplementedException(); } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Public methods
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new datasource for this driver.
|
||||
/// </summary>
|
||||
/// <param name="datasourceName">Location name or IP address</param>
|
||||
/// <returns>New datasource</returns>
|
||||
public IDatasource CreateNewIDatasource(string datasourceName) |
||||
{ |
||||
return CreateNewDatasource(datasourceName); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates a new datasource for this driver.
|
||||
/// </summary>
|
||||
/// <param name="name">Location name or IP address</param>
|
||||
/// <returns>New datasource</returns>
|
||||
public T CreateNewDatasource(string datasourceName) |
||||
{ |
||||
T newDatasource = (T)Activator.CreateInstance(typeof(T), new object[]{ this }); |
||||
newDatasource.Name = datasourceName; |
||||
return newDatasource; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Adds a new datasource for this driver.
|
||||
/// </summary>
|
||||
/// <param name="datasourceName">Location name or IP address</param>
|
||||
/// <returns>Added new datasource</returns>
|
||||
public IDatasource AddNewDatasource(string datasourceName) |
||||
{ |
||||
T existingDatasource = Datasources.FirstOrDefault(datasource => datasource.Name.ToUpper() == datasourceName.ToUpper()); |
||||
if (existingDatasource != null) |
||||
return existingDatasource; |
||||
|
||||
T newDatasource = CreateNewDatasource(datasourceName); |
||||
_datasources.Add(newDatasource); |
||||
return newDatasource; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Remove datasource by its name.
|
||||
/// </summary>
|
||||
/// <param name="datasourceName">Location name or IP address</param>
|
||||
public void RemoveDatasource(string datasourceName) |
||||
{ |
||||
T existingDatasource = Datasources.FirstOrDefault(datasource => datasource.Name.ToUpper() == datasourceName.ToUpper()); |
||||
if (existingDatasource != null) |
||||
_datasources.Remove(existingDatasource); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Searches for datasources and populates the Datasources property.
|
||||
/// </summary>
|
||||
public virtual void PopulateDatasources() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Searches for databases in all available datasources.
|
||||
/// </summary>
|
||||
public void PopulateDatabases() |
||||
{ |
||||
if (Datasources == null) |
||||
return; |
||||
|
||||
foreach (IDatasource datasource in Datasources) |
||||
{ |
||||
PopulateDatabases(datasource); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Searches for databases in a specific datasource.
|
||||
/// </summary>
|
||||
/// <param name="datasource">Datasource</param>
|
||||
public virtual void PopulateDatabases(IDatasource datasource) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Loads tables of a database.
|
||||
/// </summary>
|
||||
/// <param name="database">Database</param>
|
||||
/// <returns>Collection of ITables</returns>
|
||||
public virtual DatabaseObjectsCollection<ITable> LoadTables(IDatabase database) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Loads views of a database.
|
||||
/// </summary>
|
||||
/// <param name="database">Database</param>
|
||||
/// <returns>Collection of IViews</returns>
|
||||
public virtual DatabaseObjectsCollection<IView> LoadViews(IDatabase database) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Loads procedures of a database.
|
||||
/// </summary>
|
||||
/// <param name="database">Database</param>
|
||||
/// <returns>Collection of IProcedures</returns>
|
||||
public virtual DatabaseObjectsCollection<IProcedure> LoadProcedures(IDatabase database) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,100 @@
@@ -0,0 +1,100 @@
|
||||
#region Usings
|
||||
|
||||
using System.ComponentModel; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class DatabaseObjectBase : IDatabaseObjectBase, INotifyPropertyChanged |
||||
{ |
||||
#region Fields
|
||||
|
||||
protected string _name = string.Empty; |
||||
protected IDatabaseObjectBase _parent = null; |
||||
protected bool _isSelected = true; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public virtual string Name |
||||
{ |
||||
get { return _name; } |
||||
set |
||||
{ |
||||
_name = value; |
||||
OnPropertyChanged("Name"); |
||||
} |
||||
} |
||||
|
||||
public IDatabaseObjectBase Parent |
||||
{ |
||||
get { return _parent; } |
||||
set |
||||
{ |
||||
_parent = value; |
||||
OnPropertyChanged("Parent"); |
||||
} |
||||
} |
||||
|
||||
public bool IsSelected |
||||
{ |
||||
get { return _isSelected; } |
||||
set |
||||
{ |
||||
_isSelected = value; |
||||
OnPropertyChanged("IsSelected"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void OnPropertyChanged(string property) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
{ |
||||
PropertyChanged(this, new PropertyChangedEventArgs(property)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
|
||||
public class DatabaseObjectBase<T> : DatabaseObjectBase, IDatabaseObjectBase<T> where T : IDatabaseObjectBase |
||||
{ |
||||
#region Fields
|
||||
|
||||
private DatabaseObjectsCollection<T> _items = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public DatabaseObjectsCollection<T> Items |
||||
{ |
||||
get { return _items; } |
||||
set |
||||
{ |
||||
_items = value; |
||||
OnPropertyChanged("Items"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public DatabaseObjectBase() : base() |
||||
{ |
||||
_items = new DatabaseObjectsCollection<T>(this); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class DatabaseObjectsCollection<T> : ObservableCollection<T>, IDatabaseObjectsCollection where T : IDatabaseObjectBase |
||||
{ |
||||
#region Fields
|
||||
|
||||
protected IDatabaseObjectBase _parent = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public List<IDatabaseObjectBase> NonGenericItems |
||||
{ |
||||
get |
||||
{ |
||||
List<IDatabaseObjectBase> items = new List<IDatabaseObjectBase>(); |
||||
items.AddRange(this.Cast<IDatabaseObjectBase>()); |
||||
return items; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public new void Add(T item) |
||||
{ |
||||
item.Parent = _parent; |
||||
base.Add(item); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public DatabaseObjectsCollection(IDatabaseObjectBase parent) |
||||
{ |
||||
_parent = parent; |
||||
} |
||||
|
||||
public DatabaseObjectsCollection() |
||||
{ } |
||||
|
||||
#endregion
|
||||
} |
||||
|
||||
public static class DatabaseObjectsCollection |
||||
{ |
||||
#region Extension methods
|
||||
|
||||
public static DatabaseObjectsCollection<T> ToDatabaseObjectsCollection<T>(this IEnumerable<T> source) where T : IDatabaseObjectBase |
||||
{ |
||||
DatabaseObjectsCollection<T> dest = new DatabaseObjectsCollection<T>(null); |
||||
|
||||
foreach (T item in source) |
||||
dest.Add(item); |
||||
|
||||
return dest; |
||||
} |
||||
|
||||
public static DatabaseObjectsCollection<T> ToDatabaseObjectsCollection<T>(this IEnumerable<T> source, IDatabaseObjectBase parent) where T : IDatabaseObjectBase |
||||
{ |
||||
DatabaseObjectsCollection<T> dest = new DatabaseObjectsCollection<T>(parent); |
||||
|
||||
foreach (T item in source) |
||||
dest.Add(item); |
||||
|
||||
return dest; |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,189 @@
@@ -0,0 +1,189 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using System.Collections.ObjectModel; |
||||
using System.ComponentModel; |
||||
using System.Windows.Controls; |
||||
using System.Windows; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public abstract class Datasource : DatabaseObjectBase, IDatasource |
||||
{ |
||||
#region Fields
|
||||
|
||||
private IDatabaseDriver _databaseDriver = null; |
||||
private string _providerManifestToken = string.Empty; |
||||
|
||||
private Dictionary<string, string> _connectionStringSettings = new Dictionary<string, string>(); |
||||
private string _userDefinedConnectionString = string.Empty; |
||||
private bool _useUserDefinedConnectionString = false; |
||||
|
||||
private ObservableCollection<IDatabase> _databases = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public IDatabaseDriver DatabaseDriver |
||||
{ |
||||
get { return _databaseDriver; } |
||||
} |
||||
|
||||
public virtual string ProviderName |
||||
{ |
||||
get { throw new NotImplementedException(); } |
||||
} |
||||
|
||||
public virtual string ProviderManifestToken |
||||
{ |
||||
get { return _providerManifestToken; } |
||||
set |
||||
{ |
||||
_providerManifestToken = value; |
||||
OnPropertyChanged("ProviderManifestToken"); |
||||
} |
||||
} |
||||
|
||||
public string ConnectionString |
||||
{ |
||||
get |
||||
{ |
||||
if (_useUserDefinedConnectionString) |
||||
return UserDefinedConnectionString; |
||||
|
||||
string connectionString = string.Format("Data Source={0};", _name); |
||||
|
||||
foreach (string key in _connectionStringSettings.Keys) |
||||
{ |
||||
connectionString += key + "=" + _connectionStringSettings[key] + ";"; |
||||
} |
||||
|
||||
return connectionString.Remove(connectionString.Length - 1).Trim(); |
||||
} |
||||
} |
||||
|
||||
public Dictionary<string, string> ConnectionStringSettings |
||||
{ |
||||
get { return _connectionStringSettings; } |
||||
set { _connectionStringSettings = value; } |
||||
} |
||||
|
||||
public string UserDefinedConnectionString |
||||
{ |
||||
get { return _userDefinedConnectionString; } |
||||
set |
||||
{ |
||||
_userDefinedConnectionString = value; |
||||
|
||||
OnPropertyChanged("UserDefinedConnectionString"); |
||||
|
||||
if (_useUserDefinedConnectionString) |
||||
OnPropertyChanged("ConnectionString"); |
||||
} |
||||
} |
||||
|
||||
public bool UseUserDefinedConnectionString |
||||
{ |
||||
get { return _useUserDefinedConnectionString; } |
||||
set |
||||
{ |
||||
if (value && string.IsNullOrEmpty(_userDefinedConnectionString)) |
||||
UserDefinedConnectionString = ConnectionString; |
||||
|
||||
_useUserDefinedConnectionString = value; |
||||
OnPropertyChanged("UseUserDefinedConnectionString"); |
||||
} |
||||
} |
||||
|
||||
public virtual UserControl ControlPanel |
||||
{ |
||||
get { return null; } |
||||
} |
||||
|
||||
public ObservableCollection<IDatabase> Databases |
||||
{ |
||||
get { return _databases; } |
||||
set |
||||
{ |
||||
_databases = value; |
||||
OnPropertyChanged("Databases"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public Datasource(IDatabaseDriver databaseDriver) |
||||
{ |
||||
_databaseDriver = databaseDriver; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public bool PopulateDatabases() |
||||
{ |
||||
try |
||||
{ |
||||
_databaseDriver.PopulateDatabases(this); |
||||
return true; |
||||
} |
||||
catch (Exception exception) |
||||
{ |
||||
_databaseDriver.RemoveDatasource(Name); |
||||
MessageBox.Show("Error while trying to populate databases.\n\n" + exception.Message, _databaseDriver.Name, MessageBoxButton.OK, MessageBoxImage.Exclamation); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public string GetConnectionStringSetting(string setting) |
||||
{ |
||||
if (_connectionStringSettings.ContainsKey(setting)) |
||||
return _connectionStringSettings[setting]; |
||||
else |
||||
return null; |
||||
} |
||||
|
||||
public string GetConnectionStringSetting(string setting, string defaultValue) |
||||
{ |
||||
if (_connectionStringSettings.ContainsKey(setting)) |
||||
return _connectionStringSettings[setting]; |
||||
else |
||||
return defaultValue; |
||||
} |
||||
|
||||
public void SetConnectionStringSetting(string setting, string value) |
||||
{ |
||||
if (string.IsNullOrEmpty(value)) |
||||
{ |
||||
if (_connectionStringSettings.ContainsKey(setting)) |
||||
_connectionStringSettings.Remove(setting); |
||||
} |
||||
else |
||||
{ |
||||
if (_connectionStringSettings.ContainsKey(setting)) |
||||
_connectionStringSettings[setting] = value; |
||||
else |
||||
_connectionStringSettings.Add(setting, value); |
||||
} |
||||
|
||||
OnPropertyChanged("ConnectionString"); |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return _name; |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using ICSharpCode.Data.Core.Enums; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class Procedure : DatabaseObjectBase<IProcedureParameter>, IProcedure |
||||
{ |
||||
#region Fields
|
||||
|
||||
private string _schemaName = string.Empty; |
||||
private string _dataType = null; |
||||
private int _length = 0; |
||||
private ProcedureType _procedureType; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string SchemaName |
||||
{ |
||||
get { return _schemaName; } |
||||
set |
||||
{ |
||||
_schemaName = value; |
||||
OnPropertyChanged("SchemaName"); |
||||
} |
||||
} |
||||
|
||||
public string DataType |
||||
{ |
||||
get { return _dataType; } |
||||
set |
||||
{ |
||||
_dataType = value; |
||||
OnPropertyChanged("DataType"); |
||||
} |
||||
} |
||||
|
||||
public int Length |
||||
{ |
||||
get { return _length; } |
||||
set |
||||
{ |
||||
_length = value; |
||||
OnPropertyChanged("Length"); |
||||
} |
||||
} |
||||
|
||||
public ProcedureType ProcedureType |
||||
{ |
||||
get { return _procedureType; } |
||||
set |
||||
{ |
||||
_procedureType = value; |
||||
OnPropertyChanged("ProcedureType"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using ICSharpCode.Data.Core.Enums; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class ProcedureParameter : DatabaseObjectBase, IProcedureParameter |
||||
{ |
||||
#region Fields
|
||||
|
||||
private string _dataType = string.Empty; |
||||
private int _length = 0; |
||||
private ParameterMode _parameterMode; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string DataType |
||||
{ |
||||
get { return _dataType; } |
||||
set |
||||
{ |
||||
_dataType = value; |
||||
OnPropertyChanged("DataType"); |
||||
} |
||||
} |
||||
|
||||
public int Length |
||||
{ |
||||
get { return _length; } |
||||
set |
||||
{ |
||||
_length = value; |
||||
OnPropertyChanged("Length"); |
||||
} |
||||
} |
||||
|
||||
public ParameterMode ParameterMode |
||||
{ |
||||
get { return _parameterMode; } |
||||
set |
||||
{ |
||||
_parameterMode = value; |
||||
OnPropertyChanged("ParameterMode"); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
using System.ComponentModel; |
||||
using System.Collections.ObjectModel; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class Table : DatabaseObjectBase<IColumn>, ITable |
||||
{ |
||||
#region Fields
|
||||
|
||||
private string _schemaName = string.Empty; |
||||
private string _tableName = string.Empty; |
||||
private DatabaseObjectsCollection<IConstraint> _constraints = null; |
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string SchemaName |
||||
{ |
||||
get { return _schemaName; } |
||||
set |
||||
{ |
||||
_schemaName = value; |
||||
OnPropertyChanged("SchemaName"); |
||||
OnPropertyChanged("Name"); |
||||
} |
||||
} |
||||
|
||||
public string TableName |
||||
{ |
||||
get { return _tableName; } |
||||
set |
||||
{ |
||||
_tableName = value; |
||||
OnPropertyChanged("TableName"); |
||||
OnPropertyChanged("Name"); |
||||
} |
||||
} |
||||
|
||||
public DatabaseObjectsCollection<IConstraint> Constraints |
||||
{ |
||||
get { return _constraints; } |
||||
set |
||||
{ |
||||
_constraints = value; |
||||
OnPropertyChanged("Constraints"); |
||||
} |
||||
} |
||||
|
||||
public new string Name |
||||
{ |
||||
get { return string.Format("[{0}].[{1}]", _schemaName, _tableName); } |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region IDatabaseObjectBase Members
|
||||
|
||||
string IDatabaseObjectBase.Name |
||||
{ |
||||
get |
||||
{ |
||||
return Name; |
||||
} |
||||
set |
||||
{ |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public enum TableType |
||||
{ |
||||
Table, |
||||
View |
||||
} |
||||
} |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Interfaces; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.DatabaseObjects |
||||
{ |
||||
public class View : Table, IView |
||||
{ |
||||
} |
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
namespace ICSharpCode.Data.Core.Enums |
||||
{ |
||||
public enum Cardinality |
||||
{ |
||||
One, |
||||
ZeroToOne, |
||||
Many |
||||
} |
||||
} |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
namespace ICSharpCode.Data.Core.Enums |
||||
{ |
||||
public enum ParameterMode |
||||
{ |
||||
In, |
||||
InOut, |
||||
Out |
||||
} |
||||
} |
||||
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
namespace ICSharpCode.Data.Core.Enums |
||||
{ |
||||
public enum ProcedureType |
||||
{ |
||||
SQL, |
||||
External |
||||
} |
||||
} |
||||
@ -0,0 +1,145 @@
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<ProductVersion>10.0.20506</ProductVersion> |
||||
<SchemaVersion>2.0</SchemaVersion> |
||||
<ProjectGuid>{B7823AE9-4B43-4859-8796-2EBDC116FBB8}</ProjectGuid> |
||||
<OutputType>library</OutputType> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<RootNamespace>ICSharpCode.Data.Core</RootNamespace> |
||||
<AssemblyName>ICSharpCode.Data.Core</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<FileAlignment>512</FileAlignment> |
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||
<WarningLevel>4</WarningLevel> |
||||
<FileUpgradeFlags> |
||||
</FileUpgradeFlags> |
||||
<OldToolsVersion>3.5</OldToolsVersion> |
||||
<UpgradeBackupLocation /> |
||||
<TargetFrameworkProfile /> |
||||
<PublishUrl>publish\</PublishUrl> |
||||
<Install>true</Install> |
||||
<InstallFrom>Disk</InstallFrom> |
||||
<UpdateEnabled>false</UpdateEnabled> |
||||
<UpdateMode>Foreground</UpdateMode> |
||||
<UpdateInterval>7</UpdateInterval> |
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits> |
||||
<UpdatePeriodically>false</UpdatePeriodically> |
||||
<UpdateRequired>false</UpdateRequired> |
||||
<MapFileExtensions>true</MapFileExtensions> |
||||
<ApplicationRevision>0</ApplicationRevision> |
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> |
||||
<IsWebBootstrapper>false</IsWebBootstrapper> |
||||
<UseApplicationTrust>false</UseApplicationTrust> |
||||
<BootstrapperEnabled>true</BootstrapperEnabled> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>full</DebugType> |
||||
<Optimize>false</Optimize> |
||||
<OutputPath>bin\Debug\</OutputPath> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
<DebugType>pdbonly</DebugType> |
||||
<Optimize>true</Optimize> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data.DataSetExtensions"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="WindowsBase" /> |
||||
<Reference Include="PresentationCore" /> |
||||
<Reference Include="PresentationFramework" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="DatabaseObjects\ProcedureParameter.cs" /> |
||||
<Compile Include="DatabaseObjects\DatabaseObjectsCollection.cs" /> |
||||
<Compile Include="DatabaseObjects\Column.cs" /> |
||||
<Compile Include="DatabaseObjects\Constraint.cs" /> |
||||
<Compile Include="DatabaseObjects\Database.cs" /> |
||||
<Compile Include="DatabaseObjects\DatabaseDriver.cs" /> |
||||
<Compile Include="DatabaseObjects\DatabaseObjectBase.cs" /> |
||||
<Compile Include="DatabaseObjects\Datasource.cs" /> |
||||
<Compile Include="DatabaseObjects\Procedure.cs" /> |
||||
<Compile Include="DatabaseObjects\Table.cs" /> |
||||
<Compile Include="Common\Enumerable.cs" /> |
||||
<Compile Include="Common\Helper.cs" /> |
||||
<Compile Include="DatabaseObjects\TableType.cs" /> |
||||
<Compile Include="DatabaseObjects\View.cs" /> |
||||
<Compile Include="Enums\Cardinality.cs" /> |
||||
<Compile Include="Enums\ParameterMode.cs" /> |
||||
<Compile Include="Enums\ProcedureType.cs" /> |
||||
<Compile Include="Interfaces\IColumn.cs" /> |
||||
<Compile Include="Interfaces\IConstraint.cs" /> |
||||
<Compile Include="Interfaces\IDatabase.cs" /> |
||||
<Compile Include="Interfaces\IDatabaseDriver.cs" /> |
||||
<Compile Include="Interfaces\IDatabaseObjectBase.cs" /> |
||||
<Compile Include="Interfaces\IDatabaseObjectsCollection.cs" /> |
||||
<Compile Include="Interfaces\IDatasource.cs" /> |
||||
<Compile Include="Interfaces\IProcedure.cs" /> |
||||
<Compile Include="Interfaces\IProcedureParameter.cs" /> |
||||
<Compile Include="Interfaces\ITable.cs" /> |
||||
<Compile Include="Interfaces\IView.cs" /> |
||||
<Compile Include="Common\Objects.cs" /> |
||||
<Compile Include="Properties\AssemblyInfo.cs"> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Properties\Resources.Designer.cs"> |
||||
<AutoGen>True</AutoGen> |
||||
<DesignTime>True</DesignTime> |
||||
<DependentUpon>Resources.resx</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Properties\Settings.Designer.cs"> |
||||
<AutoGen>True</AutoGen> |
||||
<DependentUpon>Settings.settings</DependentUpon> |
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput> |
||||
</Compile> |
||||
<EmbeddedResource Include="Properties\Resources.resx"> |
||||
<Generator>ResXFileCodeGenerator</Generator> |
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
||||
</EmbeddedResource> |
||||
<None Include="Properties\Settings.settings"> |
||||
<Generator>SettingsSingleFileGenerator</Generator> |
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> |
||||
</None> |
||||
<AppDesigner Include="Properties\" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> |
||||
<Visible>False</Visible> |
||||
<ProductName>.NET Framework 3.5 SP1</ProductName> |
||||
<Install>true</Install> |
||||
</BootstrapperPackage> |
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> |
||||
<Visible>False</Visible> |
||||
<ProductName>Windows Installer 3.1</ProductName> |
||||
<Install>true</Install> |
||||
</BootstrapperPackage> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||
Other similar extension points exist, see Microsoft.Common.targets. |
||||
<Target Name="BeforeBuild"> |
||||
</Target> |
||||
<Target Name="AfterBuild"> |
||||
</Target> |
||||
--> |
||||
</Project> |
||||
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.Data.Core.Interfaces |
||||
{ |
||||
public interface IColumn : IDatabaseObjectBase |
||||
{ |
||||
string ColumnSummary { get; } |
||||
string DataType { get; set; } |
||||
string SystemType { get; set; } |
||||
int Length { get; set; } |
||||
int ColumnId { get; set; } |
||||
int FullTextTypeColumn { get; set; } |
||||
bool IsComputed { get; set; } |
||||
bool IsCursorType { get; set; } |
||||
bool IsDeterministic { get; set; } |
||||
bool IsFulltextIndexed { get; set; } |
||||
bool IsIdentity { get; set; } |
||||
bool IsIdNotForRepl { get; set; } |
||||
bool IsIndexable { get; set; } |
||||
bool IsNullable { get; set; } |
||||
bool IsOutParam { get; set; } |
||||
bool IsPrecise { get; set; } |
||||
bool IsPrimaryKey { get; set; } |
||||
bool IsRowGuidCol { get; set; } |
||||
bool IsSystemVerified { get; set; } |
||||
bool IsXmlIndexable { get; set; } |
||||
int Precision { get; set; } |
||||
int Scale { get; set; } |
||||
bool SystemDataAccess { get; set; } |
||||
bool UserDataAccess { get; set; } |
||||
bool UsesAnsiTrim { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using ICSharpCode.Data.Core.Enums; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.Interfaces |
||||
{ |
||||
public interface IConstraint : IDatabaseObjectBase |
||||
{ |
||||
string PKColumnName { get; set; } |
||||
string PKTableName { get; set; } |
||||
string FKColumnName { get; set; } |
||||
string FKTableName { get; set; } |
||||
IColumn PKColumn { get; } |
||||
ITable PKTable { get; } |
||||
IColumn FKColumn { get; } |
||||
ITable FKTable { get; } |
||||
Cardinality PKCardinality { get; } |
||||
Cardinality FKCardinality { get; } |
||||
} |
||||
} |
||||
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
#region Usings
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Collections.ObjectModel; |
||||
using ICSharpCode.Data.Core.DatabaseObjects; |
||||
|
||||
#endregion
|
||||
|
||||
namespace ICSharpCode.Data.Core.Interfaces |
||||
{ |
||||
public interface IDatabase : IDatabaseObjectBase |
||||
{ |
||||
string ConnectionString { get; } |
||||
IDatasource Datasource { get; } |
||||
DatabaseObjectsCollection<ITable> Tables { get; } |
||||
DatabaseObjectsCollection<IView> Views { get; } |
||||
DatabaseObjectsCollection<IProcedure> Procedures { get; } |
||||
|
||||
bool LoadDatabase(); |
||||
} |
||||
} |
||||