diff --git a/SharpDevelop.sln b/SharpDevelop.sln index 14900b5384..9e0c6720f0 100644 --- a/SharpDevelop.sln +++ b/SharpDevelop.sln @@ -1,22 +1,24 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 10 -# SharpDevelop 4.0.0.4289 +# SharpDevelop 4.0.0.4668 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartUp", "src\Main\StartUp\Project\StartUp.csproj", "{1152B71B-3C05-4598-B20D-823B5D40559E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "src\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.Presentation", "src\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj", "{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Widgets", "src\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj", "{8035765F-D51F-4A0C-A746-2FD100E19419}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.WinForms", "src\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj", "{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "src\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "src\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection @@ -26,63 +28,59 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Sd {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "src\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "src\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.WinForms", "src\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj", "{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Widgets", "src\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj", "{8035765F-D51F-4A0C-A746-2FD100E19419}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.Presentation", "src\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj", "{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartUp", "src\Main\StartUp\Project\StartUp.csproj", "{1152B71B-3C05-4598-B20D-823B5D40559E}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "src\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" -EndProject -Project("{00000000-0000-0000-0000-000000000000}") = "Tools", "src\Tools\Tools.build", "{3DF4060F-5EE0-41CF-8096-F27355FD5511}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{2A232EF1-EB95-41C6-B63A-C106E0C95D3C}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "src\Libraries\SharpTreeView\ICSharpCode.TreeView\ICSharpCode.TreeView.csproj", "{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}" - ProjectSection(ProjectDependencies) = postProject - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NRefactory", "NRefactory", "{E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}" + ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aga.Controls", "src\Libraries\TreeViewAdv\Aga.Controls\Aga.Controls.csproj", "{E73BB233-D88B-44A7-A98F-D71EE158381D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "src\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryASTGenerator", "src\Libraries\NRefactory\NRefactoryASTGenerator\NRefactoryASTGenerator.csproj", "{B22522AA-B5BF-4A58-AC6D-D4B45805521F}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Build.Tasks", "src\Libraries\ICSharpCode.Build.Tasks\Project\ICSharpCode.Build.Tasks.csproj", "{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "src\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonDock", "src\Libraries\AvalonDock\AvalonDock.csproj", "{2FF700C2-A38A-48BD-A637-8CAFD4FE6237}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.AvalonEdit", "src\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj", "{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonDock", "src\Libraries\AvalonDock\AvalonDock.csproj", "{2FF700C2-A38A-48BD-A637-8CAFD4FE6237}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NRefactory", "NRefactory", "{E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}" - ProjectSection(SolutionItems) = postProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Build.Tasks", "src\Libraries\ICSharpCode.Build.Tasks\Project\ICSharpCode.Build.Tasks.csproj", "{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}" + ProjectSection(ProjectDependencies) = postProject + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "src\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "src\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryASTGenerator", "src\Libraries\NRefactory\NRefactoryASTGenerator\NRefactoryASTGenerator.csproj", "{B22522AA-B5BF-4A58-AC6D-D4B45805521F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aga.Controls", "src\Libraries\TreeViewAdv\Aga.Controls\Aga.Controls.csproj", "{E73BB233-D88B-44A7-A98F-D71EE158381D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "src\Libraries\SharpTreeView\ICSharpCode.TreeView\ICSharpCode.TreeView.csproj", "{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection @@ -91,126 +89,132 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{393278 ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analysis", "Analysis", "{F355E45F-F54F-4B42-8916-9A633A392789}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language Bindings", "Language Bindings", "{E0646C25-36F2-4524-969F-FA621353AB94}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceAnalysis", "src\AddIns\Misc\SourceAnalysis\SourceAnalysis.csproj", "{CE498514-D12D-4B6E-AE0E-FEC29BD43748}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Boo", "Boo", "{97B3B514-AB0E-4FE1-89DE-8A945F5112AE}" + ProjectSection(SolutionItems) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooBinding", "src\AddIns\BackendBindings\Boo\BooBinding\Project\BooBinding.csproj", "{4AC2D5F1-F671-480C-A075-6BF62B3721B2}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage", "src\AddIns\Misc\CodeCoverage\Project\CodeCoverage.csproj", "{08CE9972-283B-44F4-82FA-966F7DFA6B7A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryToBooConverter", "src\AddIns\BackendBindings\Boo\NRefactoryToBooConverter\Project\NRefactoryToBooConverter.csproj", "{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysis", "src\AddIns\Misc\CodeAnalysis\CodeAnalysis.csproj", "{3EAA45A9-735C-4AC7-A799-947B93EA449D}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Python", "Python", "{CA76F702-5B4E-4918-B8D8-7FF8382434FF}" + ProjectSection(SolutionItems) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Build.Tasks", "src\AddIns\BackendBindings\Python\Python.Build.Tasks\Project\Python.Build.Tasks.csproj", "{D332F2D1-2CF1-43B7-903C-844BD5211A7E}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "src\AddIns\Misc\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PythonBinding", "src\AddIns\BackendBindings\Python\PythonBinding\Project\PythonBinding.csproj", "{8D732610-8FC6-43BA-94C9-7126FD7FE361}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComponentInspector", "ComponentInspector", "{D599885D-E161-4CCE-A66E-7A40C8C4F4CC}" - ProjectSection(SolutionItems) = postProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILAsmBinding", "src\AddIns\BackendBindings\ILAsmBinding\Project\ILAsmBinding.csproj", "{6E59AF58-F635-459A-9A35-C9AC41C00339}" + ProjectSection(ProjectDependencies) = postProject + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector.AddIn", "src\AddIns\Misc\ComponentInspector\ComponentInspector.AddIn\ComponentInspector.AddIn.csproj", "{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixBinding", "src\AddIns\BackendBindings\WixBinding\Project\WixBinding.csproj", "{E1B288A2-08EE-4318-8BBB-8AB72C69E33E}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector.Core", "src\AddIns\Misc\ComponentInspector\ComponentInspector.Core\ComponentInspector.Core.csproj", "{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpBinding", "src\AddIns\BackendBindings\CSharpBinding\Project\CSharpBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector", "src\AddIns\Misc\ComponentInspector\ComponentInspector\ComponentInspector.csproj", "{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VBNetBinding", "src\AddIns\BackendBindings\VBNetBinding\Project\VBNetBinding.csproj", "{BF38FB72-B380-4196-AF8C-95749D726C61}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}" - ProjectSection(SolutionItems) = postProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlBinding", "src\AddIns\BackendBindings\XamlBinding\XamlBinding\XamlBinding.csproj", "{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}" + ProjectSection(ProjectDependencies) = postProject + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IconEditor", "IconEditor", "{0773ED53-08E2-4495-A3BE-CA0B5D413C15}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IconEditorAddIn", "src\AddIns\DisplayBindings\IconEditor\IconEditorAddIn\IconEditorAddIn.csproj", "{DFB936AD-90EE-4B4F-941E-4F4A636F0D92}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "src\AddIns\Misc\Debugger\Debugger.Core\Project\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IconEditor", "src\AddIns\DisplayBindings\IconEditor\IconEditor\IconEditor.csproj", "{DC1CCE11-CB91-40FA-9C47-4D9EB5D67BFD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.AddIn", "src\AddIns\Misc\Debugger\Debugger.AddIn\Project\Debugger.AddIn.csproj", "{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HexEditor", "src\AddIns\DisplayBindings\HexEditor\Project\HexEditor.csproj", "{E618A9CD-A39F-4925-A538-E8A3FEF24E54}" - ProjectSection(ProjectDependencies) = postProject - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9EA2-4591-BBC6-97361DCE50A9}" + ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsEditor", "src\AddIns\DisplayBindings\SettingsEditor\Project\SettingsEditor.csproj", "{85226AFB-CE71-4851-9A75-7EEC663A8E8A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchAndReplace", "src\AddIns\Misc\SearchAndReplace\Project\SearchAndReplace.csproj", "{9196DD8A-B4D4-4780-8742-C5762E547FC2}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkflowDesigner", "src\AddIns\DisplayBindings\WorkflowDesigner\Project\WorkflowDesigner.csproj", "{533F4684-DBA6-4518-B005-C84F22A2DD57}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReflectorAddIn", "src\AddIns\Misc\ReflectorAddIn\ReflectorAddIn\Project\ReflectorAddIn.csproj", "{8AA421C8-D7AF-4957-9F43-5135328ACB24}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEditor", "src\AddIns\DisplayBindings\ResourceEditor\Project\ResourceEditor.csproj", "{CBC6C247-747B-4908-B09A-4D2E0F640B6B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartPage", "src\AddIns\Misc\StartPage\Project\StartPage.csproj", "{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager", "src\AddIns\Misc\AddInManager\Project\AddInManager.csproj", "{F93E52FD-DA66-4CE5-A0CB-BCD902811122}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor", "src\AddIns\DisplayBindings\XmlEditor\Project\XmlEditor.csproj", "{DCA2703D-250A-463E-A68A-07ED105AE6BD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddinScout", "src\AddIns\Misc\AddinScout\Project\AddinScout.csproj", "{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "src\AddIns\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiletypeRegisterer", "src\AddIns\Misc\FiletypeRegisterer\Project\FiletypeRegisterer.csproj", "{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ClassDiagram", "ClassDiagram", "{BFA3BF26-33BD-4A65-B84D-C7F30D131668}" - ProjectSection(SolutionItems) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassCanvas", "src\AddIns\DisplayBindings\ClassDiagram\ClassCanvas\ClassCanvas.csproj", "{08F772A1-F0BE-433E-8B37-F6522953DB05}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HtmlHelp2", "src\AddIns\Misc\HtmlHelp2\Project\HtmlHelp2.csproj", "{918487B7-2153-4618-BBB3-344DBDDF2A2A}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagramAddin", "src\AddIns\DisplayBindings\ClassDiagram\ClassDiagramAddin\ClassDiagramAddin.csproj", "{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}" +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HtmlHelp2JScriptGlobals", "src\AddIns\Misc\HtmlHelp2\JScriptGlobals\HtmlHelp2JScriptGlobals.vbproj", "{E54A5AD2-418D-4A85-BA5E-CD803DE38715}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diagrams", "src\AddIns\DisplayBindings\ClassDiagram\DiagramRouter\Diagrams.csproj", "{0991423A-DBF6-4C89-B365-A1DF1EB32E42}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PInvokeAddIn", "src\AddIns\Misc\PInvokeAddIn\Project\PInvokeAddIn.csproj", "{5EEB99CF-EA2B-4733-80A6-CE9192D68170}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9EA2-4591-BBC6-97361DCE50A9}" - ProjectSection(SolutionItems) = postProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegExpTk", "src\AddIns\Misc\RegExpTk\Project\RegExpTk.csproj", "{64A3E5E6-90BF-47F6-94DF-68C94B62C817}" + ProjectSection(ProjectDependencies) = postProject + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubversionAddIn", "src\AddIns\Misc\SubversionAddIn\Project\SubversionAddIn.csproj", "{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceToolkit", "src\AddIns\Misc\ResourceToolkit\Project\ResourceToolkit.csproj", "{461606BD-E824-4D0A-8CBA-01810B1F5E02}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection @@ -220,136 +224,152 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpRefactoring", "src\Add {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceToolkit", "src\AddIns\Misc\ResourceToolkit\Project\ResourceToolkit.csproj", "{461606BD-E824-4D0A-8CBA-01810B1F5E02}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubversionAddIn", "src\AddIns\Misc\SubversionAddIn\Project\SubversionAddIn.csproj", "{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegExpTk", "src\AddIns\Misc\RegExpTk\Project\RegExpTk.csproj", "{64A3E5E6-90BF-47F6-94DF-68C94B62C817}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}" + ProjectSection(SolutionItems) = postProject + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ClassDiagram", "ClassDiagram", "{BFA3BF26-33BD-4A65-B84D-C7F30D131668}" + ProjectSection(SolutionItems) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diagrams", "src\AddIns\DisplayBindings\ClassDiagram\DiagramRouter\Diagrams.csproj", "{0991423A-DBF6-4C89-B365-A1DF1EB32E42}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PInvokeAddIn", "src\AddIns\Misc\PInvokeAddIn\Project\PInvokeAddIn.csproj", "{5EEB99CF-EA2B-4733-80A6-CE9192D68170}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagramAddin", "src\AddIns\DisplayBindings\ClassDiagram\ClassDiagramAddin\ClassDiagramAddin.csproj", "{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HtmlHelp2JScriptGlobals", "src\AddIns\Misc\HtmlHelp2\JScriptGlobals\HtmlHelp2JScriptGlobals.vbproj", "{E54A5AD2-418D-4A85-BA5E-CD803DE38715}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassCanvas", "src\AddIns\DisplayBindings\ClassDiagram\ClassCanvas\ClassCanvas.csproj", "{08F772A1-F0BE-433E-8B37-F6522953DB05}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HtmlHelp2", "src\AddIns\Misc\HtmlHelp2\Project\HtmlHelp2.csproj", "{918487B7-2153-4618-BBB3-344DBDDF2A2A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "src\AddIns\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiletypeRegisterer", "src\AddIns\Misc\FiletypeRegisterer\Project\FiletypeRegisterer.csproj", "{D022A6CE-7438-41E8-AC64-F2DE18EC54C6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor", "src\AddIns\DisplayBindings\XmlEditor\Project\XmlEditor.csproj", "{DCA2703D-250A-463E-A68A-07ED105AE6BD}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddinScout", "src\AddIns\Misc\AddinScout\Project\AddinScout.csproj", "{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager", "src\AddIns\Misc\AddInManager\Project\AddInManager.csproj", "{F93E52FD-DA66-4CE5-A0CB-BCD902811122}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEditor", "src\AddIns\DisplayBindings\ResourceEditor\Project\ResourceEditor.csproj", "{CBC6C247-747B-4908-B09A-4D2E0F640B6B}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartPage", "src\AddIns\Misc\StartPage\Project\StartPage.csproj", "{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkflowDesigner", "src\AddIns\DisplayBindings\WorkflowDesigner\Project\WorkflowDesigner.csproj", "{533F4684-DBA6-4518-B005-C84F22A2DD57}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReflectorAddIn", "src\AddIns\Misc\ReflectorAddIn\ReflectorAddIn\Project\ReflectorAddIn.csproj", "{8AA421C8-D7AF-4957-9F43-5135328ACB24}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsEditor", "src\AddIns\DisplayBindings\SettingsEditor\Project\SettingsEditor.csproj", "{85226AFB-CE71-4851-9A75-7EEC663A8E8A}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchAndReplace", "src\AddIns\Misc\SearchAndReplace\Project\SearchAndReplace.csproj", "{9196DD8A-B4D4-4780-8742-C5762E547FC2}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HexEditor", "src\AddIns\DisplayBindings\HexEditor\Project\HexEditor.csproj", "{E618A9CD-A39F-4925-A538-E8A3FEF24E54}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IconEditor", "IconEditor", "{0773ED53-08E2-4495-A3BE-CA0B5D413C15}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.AddIn", "src\AddIns\Misc\Debugger\Debugger.AddIn\Project\Debugger.AddIn.csproj", "{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IconEditor", "src\AddIns\DisplayBindings\IconEditor\IconEditor\IconEditor.csproj", "{DC1CCE11-CB91-40FA-9C47-4D9EB5D67BFD}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "src\AddIns\Misc\Debugger\Debugger.Core\Project\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IconEditorAddIn", "src\AddIns\DisplayBindings\IconEditor\IconEditorAddIn\IconEditorAddIn.csproj", "{DFB936AD-90EE-4B4F-941E-4F4A636F0D92}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language Bindings", "Language Bindings", "{E0646C25-36F2-4524-969F-FA621353AB94}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlBinding", "src\AddIns\BackendBindings\XamlBinding\XamlBinding\XamlBinding.csproj", "{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}" - ProjectSection(ProjectDependencies) = postProject - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.Addin", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.Addin\ICSharpCode.Data.Addin.csproj", "{A9F12710-24E4-46D4-832C-6ECB395B9EAD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VBNetBinding", "src\AddIns\BackendBindings\VBNetBinding\Project\VBNetBinding.csproj", "{BF38FB72-B380-4196-AF8C-95749D726C61}" - ProjectSection(ProjectDependencies) = postProject - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.Core", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.Core\ICSharpCode.Data.Core.csproj", "{B7823AE9-4B43-4859-8796-2EBDC116FBB8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.Core.UI", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.Core.UI\ICSharpCode.Data.Core.UI.csproj", "{BAD94D6E-4159-4CB6-B991-486F412D9BB6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.DemoApp", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.DemoApp\ICSharpCode.Data.DemoApp.csproj", "{1EB79CD3-ECF1-420E-8A44-FA1EDD15390F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.EDMDesigner.Core", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.EDMDesigner.Core\ICSharpCode.Data.EDMDesigner.Core.csproj", "{5C70D6AB-0A33-43F9-B8B5-54558C35BBB1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.EDMDesigner.Core.UI", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.EDMDesigner.Core.UI\ICSharpCode.Data.EDMDesigner.Core.UI.csproj", "{EEF5E054-4192-4A57-8FBF-E860D808A51D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.SQLServer", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.SQLServer\ICSharpCode.Data.SQLServer.csproj", "{AFE34868-AFA1-4E1C-9450-47AB4BE329D5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComponentInspector", "ComponentInspector", "{D599885D-E161-4CCE-A66E-7A40C8C4F4CC}" + ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpBinding", "src\AddIns\BackendBindings\CSharpBinding\Project\CSharpBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector", "src\AddIns\Misc\ComponentInspector\ComponentInspector\ComponentInspector.csproj", "{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixBinding", "src\AddIns\BackendBindings\WixBinding\Project\WixBinding.csproj", "{E1B288A2-08EE-4318-8BBB-8AB72C69E33E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector.Core", "src\AddIns\Misc\ComponentInspector\ComponentInspector.Core\ComponentInspector.Core.csproj", "{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILAsmBinding", "src\AddIns\BackendBindings\ILAsmBinding\Project\ILAsmBinding.csproj", "{6E59AF58-F635-459A-9A35-C9AC41C00339}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector.AddIn", "src\AddIns\Misc\ComponentInspector\ComponentInspector.AddIn\ComponentInspector.AddIn.csproj", "{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Python", "Python", "{CA76F702-5B4E-4918-B8D8-7FF8382434FF}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analysis", "Analysis", "{F355E45F-F54F-4B42-8916-9A633A392789}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PythonBinding", "src\AddIns\BackendBindings\Python\PythonBinding\Project\PythonBinding.csproj", "{8D732610-8FC6-43BA-94C9-7126FD7FE361}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "src\AddIns\Misc\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Python.Build.Tasks", "src\AddIns\BackendBindings\Python\Python.Build.Tasks\Project\Python.Build.Tasks.csproj", "{D332F2D1-2CF1-43B7-903C-844BD5211A7E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysis", "src\AddIns\Misc\CodeAnalysis\CodeAnalysis.csproj", "{3EAA45A9-735C-4AC7-A799-947B93EA449D}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Boo", "Boo", "{97B3B514-AB0E-4FE1-89DE-8A945F5112AE}" - ProjectSection(SolutionItems) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryToBooConverter", "src\AddIns\BackendBindings\Boo\NRefactoryToBooConverter\Project\NRefactoryToBooConverter.csproj", "{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage", "src\AddIns\Misc\CodeCoverage\Project\CodeCoverage.csproj", "{08CE9972-283B-44F4-82FA-966F7DFA6B7A}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooBinding", "src\AddIns\BackendBindings\Boo\BooBinding\Project\BooBinding.csproj", "{4AC2D5F1-F671-480C-A075-6BF62B3721B2}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceAnalysis", "src\AddIns\Misc\SourceAnalysis\SourceAnalysis.csproj", "{CE498514-D12D-4B6E-AE0E-FEC29BD43748}" ProjectSection(ProjectDependencies) = postProject {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} EndProjectSection EndProject +Project("{00000000-0000-0000-0000-000000000000}") = "Tools", "src\Tools\Tools.build", "{3DF4060F-5EE0-41CF-8096-F27355FD5511}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -592,80 +612,116 @@ Global {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|Any CPU.Build.0 = Release|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9F12710-24E4-46D4-832C-6ECB395B9EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9F12710-24E4-46D4-832C-6ECB395B9EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9F12710-24E4-46D4-832C-6ECB395B9EAD}.Release|Any CPU.Build.0 = Release|Any CPU + {A9F12710-24E4-46D4-832C-6ECB395B9EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7823AE9-4B43-4859-8796-2EBDC116FBB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7823AE9-4B43-4859-8796-2EBDC116FBB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7823AE9-4B43-4859-8796-2EBDC116FBB8}.Release|Any CPU.Build.0 = Release|Any CPU + {B7823AE9-4B43-4859-8796-2EBDC116FBB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAD94D6E-4159-4CB6-B991-486F412D9BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAD94D6E-4159-4CB6-B991-486F412D9BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAD94D6E-4159-4CB6-B991-486F412D9BB6}.Release|Any CPU.Build.0 = Release|Any CPU + {BAD94D6E-4159-4CB6-B991-486F412D9BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EB79CD3-ECF1-420E-8A44-FA1EDD15390F}.Debug|x86.Build.0 = Debug|x86 + {1EB79CD3-ECF1-420E-8A44-FA1EDD15390F}.Debug|x86.ActiveCfg = Debug|x86 + {1EB79CD3-ECF1-420E-8A44-FA1EDD15390F}.Release|x86.Build.0 = Release|x86 + {1EB79CD3-ECF1-420E-8A44-FA1EDD15390F}.Release|x86.ActiveCfg = Release|x86 + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1}.Debug|x86.Build.0 = Debug|x86 + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1}.Debug|x86.ActiveCfg = Debug|x86 + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1}.Release|x86.Build.0 = Release|x86 + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1}.Release|x86.ActiveCfg = Release|x86 + {EEF5E054-4192-4A57-8FBF-E860D808A51D}.Debug|x86.Build.0 = Debug|x86 + {EEF5E054-4192-4A57-8FBF-E860D808A51D}.Debug|x86.ActiveCfg = Debug|x86 + {EEF5E054-4192-4A57-8FBF-E860D808A51D}.Release|x86.Build.0 = Release|x86 + {EEF5E054-4192-4A57-8FBF-E860D808A51D}.Release|x86.ActiveCfg = Release|x86 + {AFE34868-AFA1-4E1C-9450-47AB4BE329D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFE34868-AFA1-4E1C-9450-47AB4BE329D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFE34868-AFA1-4E1C-9450-47AB4BE329D5}.Release|Any CPU.Build.0 = Release|Any CPU + {AFE34868-AFA1-4E1C-9450-47AB4BE329D5}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} - {80318B5F-A25D-45AB-8A95-EF31D2370A4C} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} - {2748AD25-9C63-4E12-877B-4DCE96FBED54} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} - {8035765F-D51F-4A0C-A746-2FD100E19419} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} {1152B71B-3C05-4598-B20D-823B5D40559E} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} - {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} - {2FF700C2-A38A-48BD-A637-8CAFD4FE6237} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} - {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} - {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} - {E73BB233-D88B-44A7-A98F-D71EE158381D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} + {8035765F-D51F-4A0C-A746-2FD100E19419} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} + {2748AD25-9C63-4E12-877B-4DCE96FBED54} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} + {80318B5F-A25D-45AB-8A95-EF31D2370A4C} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} + {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} + {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} + {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} {DDE2A481-8271-4EAC-A330-8FA6A38D13D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} - {B22522AA-B5BF-4A58-AC6D-D4B45805521F} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} + {E73BB233-D88B-44A7-A98F-D71EE158381D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} + {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} + {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} + {2FF700C2-A38A-48BD-A637-8CAFD4FE6237} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} + {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} - {E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D} - {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF} = {39327899-ED91-4F7F-988C-4FE4E17C014D} - {F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D} - {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D} - {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {B22522AA-B5BF-4A58-AC6D-D4B45805521F} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} {F355E45F-F54F-4B42-8916-9A633A392789} = {39327899-ED91-4F7F-988C-4FE4E17C014D} - {1F261725-6318-4434-A1B1-6C70CE4CD324} = {F355E45F-F54F-4B42-8916-9A633A392789} - {3EAA45A9-735C-4AC7-A799-947B93EA449D} = {F355E45F-F54F-4B42-8916-9A633A392789} - {08CE9972-283B-44F4-82FA-966F7DFA6B7A} = {F355E45F-F54F-4B42-8916-9A633A392789} - {CE498514-D12D-4B6E-AE0E-FEC29BD43748} = {F355E45F-F54F-4B42-8916-9A633A392789} - {000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD} = {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} - {E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF} = {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} - {869951D5-A0D6-4DC6-9F1D-E6B9A12AC446} = {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} - {BFA3BF26-33BD-4A65-B84D-C7F30D131668} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {DCA2703D-250A-463E-A68A-07ED105AE6BD} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {533F4684-DBA6-4518-B005-C84F22A2DD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {0773ED53-08E2-4495-A3BE-CA0B5D413C15} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {DC1CCE11-CB91-40FA-9C47-4D9EB5D67BFD} = {0773ED53-08E2-4495-A3BE-CA0B5D413C15} - {DFB936AD-90EE-4B4F-941E-4F4A636F0D92} = {0773ED53-08E2-4495-A3BE-CA0B5D413C15} - {0991423A-DBF6-4C89-B365-A1DF1EB32E42} = {BFA3BF26-33BD-4A65-B84D-C7F30D131668} - {5A1354DF-4989-4BB4-BC6B-D627C2E9FA13} = {BFA3BF26-33BD-4A65-B84D-C7F30D131668} - {08F772A1-F0BE-433E-8B37-F6522953DB05} = {BFA3BF26-33BD-4A65-B84D-C7F30D131668} - {9196DD8A-B4D4-4780-8742-C5762E547FC2} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {8AA421C8-D7AF-4957-9F43-5135328ACB24} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {F93E52FD-DA66-4CE5-A0CB-BCD902811122} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {4B8F0F98-8BE1-402B-AA8B-C8D548577B38} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {D022A6CE-7438-41E8-AC64-F2DE18EC54C6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {918487B7-2153-4618-BBB3-344DBDDF2A2A} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {E54A5AD2-418D-4A85-BA5E-CD803DE38715} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {5EEB99CF-EA2B-4733-80A6-CE9192D68170} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {461606BD-E824-4D0A-8CBA-01810B1F5E02} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {3CA90546-3B4C-4663-9445-C4E9371750A7} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {17F4D7E0-6933-4C2E-8714-FD7E98D625D5} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF} - {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF} - {97B3B514-AB0E-4FE1-89DE-8A945F5112AE} = {E0646C25-36F2-4524-969F-FA621353AB94} - {CA76F702-5B4E-4918-B8D8-7FF8382434FF} = {E0646C25-36F2-4524-969F-FA621353AB94} - {6E59AF58-F635-459A-9A35-C9AC41C00339} = {E0646C25-36F2-4524-969F-FA621353AB94} - {E1B288A2-08EE-4318-8BBB-8AB72C69E33E} = {E0646C25-36F2-4524-969F-FA621353AB94} - {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {E0646C25-36F2-4524-969F-FA621353AB94} - {BF38FB72-B380-4196-AF8C-95749D726C61} = {E0646C25-36F2-4524-969F-FA621353AB94} + {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D} {7C96B65D-28A5-4F28-A35B-8D83CE831EE8} = {E0646C25-36F2-4524-969F-FA621353AB94} - {D332F2D1-2CF1-43B7-903C-844BD5211A7E} = {CA76F702-5B4E-4918-B8D8-7FF8382434FF} - {8D732610-8FC6-43BA-94C9-7126FD7FE361} = {CA76F702-5B4E-4918-B8D8-7FF8382434FF} - {4AC2D5F1-F671-480C-A075-6BF62B3721B2} = {97B3B514-AB0E-4FE1-89DE-8A945F5112AE} + {BF38FB72-B380-4196-AF8C-95749D726C61} = {E0646C25-36F2-4524-969F-FA621353AB94} + {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {E0646C25-36F2-4524-969F-FA621353AB94} + {E1B288A2-08EE-4318-8BBB-8AB72C69E33E} = {E0646C25-36F2-4524-969F-FA621353AB94} + {6E59AF58-F635-459A-9A35-C9AC41C00339} = {E0646C25-36F2-4524-969F-FA621353AB94} + {CA76F702-5B4E-4918-B8D8-7FF8382434FF} = {E0646C25-36F2-4524-969F-FA621353AB94} + {97B3B514-AB0E-4FE1-89DE-8A945F5112AE} = {E0646C25-36F2-4524-969F-FA621353AB94} {DBCF20A1-BA13-4582-BFA9-74DE4D987B73} = {97B3B514-AB0E-4FE1-89DE-8A945F5112AE} + {4AC2D5F1-F671-480C-A075-6BF62B3721B2} = {97B3B514-AB0E-4FE1-89DE-8A945F5112AE} + {8D732610-8FC6-43BA-94C9-7126FD7FE361} = {CA76F702-5B4E-4918-B8D8-7FF8382434FF} + {D332F2D1-2CF1-43B7-903C-844BD5211A7E} = {CA76F702-5B4E-4918-B8D8-7FF8382434FF} + {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF} + {1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {CDE0C5A4-2096-48B5-BEA3-74DBA0F0E1EF} + {17F4D7E0-6933-4C2E-8714-FD7E98D625D5} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {3CA90546-3B4C-4663-9445-C4E9371750A7} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {461606BD-E824-4D0A-8CBA-01810B1F5E02} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {5EEB99CF-EA2B-4733-80A6-CE9192D68170} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {E54A5AD2-418D-4A85-BA5E-CD803DE38715} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {918487B7-2153-4618-BBB3-344DBDDF2A2A} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {D022A6CE-7438-41E8-AC64-F2DE18EC54C6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {4B8F0F98-8BE1-402B-AA8B-C8D548577B38} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {F93E52FD-DA66-4CE5-A0CB-BCD902811122} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {8AA421C8-D7AF-4957-9F43-5135328ACB24} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {9196DD8A-B4D4-4780-8742-C5762E547FC2} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {0773ED53-08E2-4495-A3BE-CA0B5D413C15} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {533F4684-DBA6-4518-B005-C84F22A2DD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {DCA2703D-250A-463E-A68A-07ED105AE6BD} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {BFA3BF26-33BD-4A65-B84D-C7F30D131668} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {08F772A1-F0BE-433E-8B37-F6522953DB05} = {BFA3BF26-33BD-4A65-B84D-C7F30D131668} + {5A1354DF-4989-4BB4-BC6B-D627C2E9FA13} = {BFA3BF26-33BD-4A65-B84D-C7F30D131668} + {0991423A-DBF6-4C89-B365-A1DF1EB32E42} = {BFA3BF26-33BD-4A65-B84D-C7F30D131668} + {DFB936AD-90EE-4B4F-941E-4F4A636F0D92} = {0773ED53-08E2-4495-A3BE-CA0B5D413C15} + {DC1CCE11-CB91-40FA-9C47-4D9EB5D67BFD} = {0773ED53-08E2-4495-A3BE-CA0B5D413C15} + {AFE34868-AFA1-4E1C-9450-47AB4BE329D5} = {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} + {EEF5E054-4192-4A57-8FBF-E860D808A51D} = {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} = {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} + {1EB79CD3-ECF1-420E-8A44-FA1EDD15390F} = {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} + {BAD94D6E-4159-4CB6-B991-486F412D9BB6} = {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} + {B7823AE9-4B43-4859-8796-2EBDC116FBB8} = {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} + {A9F12710-24E4-46D4-832C-6ECB395B9EAD} = {78EAFBB4-09B6-4CF9-AAA6-A833B3D02B6E} + {869951D5-A0D6-4DC6-9F1D-E6B9A12AC446} = {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} + {E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF} = {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} + {000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD} = {D599885D-E161-4CCE-A66E-7A40C8C4F4CC} + {CE498514-D12D-4B6E-AE0E-FEC29BD43748} = {F355E45F-F54F-4B42-8916-9A633A392789} + {08CE9972-283B-44F4-82FA-966F7DFA6B7A} = {F355E45F-F54F-4B42-8916-9A633A392789} + {3EAA45A9-735C-4AC7-A799-947B93EA449D} = {F355E45F-F54F-4B42-8916-9A633A392789} + {1F261725-6318-4434-A1B1-6C70CE4CD324} = {F355E45F-F54F-4B42-8916-9A633A392789} EndGlobalSection EndGlobal diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Commands/DatabaseTreeViewCommands.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Commands/DatabaseTreeViewCommands.cs new file mode 100644 index 0000000000..66f09a5c2c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Commands/DatabaseTreeViewCommands.cs @@ -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() + { + + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Configuration/AssemblyInfo.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Configuration/AssemblyInfo.cs new file mode 100644 index 0000000000..cb90196ff8 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Configuration/AssemblyInfo.cs @@ -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.*")] diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/DatabaseInfo/DatabaseInfo.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/DatabaseInfo/DatabaseInfo.cs new file mode 100644 index 0000000000..0eb620ef5f --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/DatabaseInfo/DatabaseInfo.cs @@ -0,0 +1,36 @@ +#region Usings + +using System; +using System.ComponentModel; + +#endregion + +namespace ICSharpCode.DatabaseTools.Addin.DatabaseInfo +{ + /// + /// Description of DatabaseInfo. + /// + 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.Addin.csproj b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.Addin.csproj new file mode 100644 index 0000000000..a9430c4227 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.Addin.csproj @@ -0,0 +1,157 @@ + + + {A9F12710-24E4-46D4-832C-6ECB395B9EAD} + Debug + AnyCPU + Library + ICSharpCode.Data.Addin + ICSharpCode.Data.Addin + v4.0 + C:\Users\Phil\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis + + + 3.5 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + False + False + 4 + false + OnBuildSuccess + + + ..\..\..\..\..\AddIns\AddIns\DisplayBindings\Data\ + true + Full + False + True + DEBUG;TRACE + Program + ..\..\..\..\Program Files %28x86%29\SharpDevelop\3.0\bin\SharpDevelop.exe + + + bin\Release\ + False + None + True + False + TRACE + + + + + 3.0 + + + 3.0 + + + + 3.5 + + + + 3.5 + + + + + + 3.5 + + + 3.0 + + + + + + Always + + + + + + DatabasesTreeViewUserControl.xaml + + + + + Designer + MSBuild:Compile + MSBuild:Compile + Designer + + + + False + Auto + 4194304 + AnyCPU + 4096 + + + + + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + {2748AD25-9C63-4E12-877B-4DCE96FBED54} + ICSharpCode.SharpDevelop + + + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} + ICSharpCode.Core + + + {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9} + ICSharpCode.Core.Presentation + + + {BAD94D6E-4159-4CB6-B991-486F412D9BB6} + ICSharpCode.Data.Core.UI + + + {B7823AE9-4B43-4859-8796-2EBDC116FBB8} + ICSharpCode.Data.Core + + + {1EB79CD3-ECF1-420E-8A44-FA1EDD15390F} + ICSharpCode.Data.DemoApp + + + {EEF5E054-4192-4A57-8FBF-E860D808A51D} + ICSharpCode.Data.EDMDesigner.Core.UI + + + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} + ICSharpCode.Data.EDMDesigner.Core + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.addin b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.addin new file mode 100644 index 0000000000..9b05209ffc --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.addin @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewPad.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewPad.cs new file mode 100644 index 0000000000..dbd216d44a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewPad.cs @@ -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 +{ + /// + /// Description of DatabasesTreeViewPad. + /// + 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 Databases + { + get { return _databasesTreeView.Databases; } + } + + /// + /// The representing the pad + /// + public override object Control + { + get + { + return _control; + } + } + + #endregion + + #region Constructor + + /// + /// Creates a new ReportExplorer object + /// + 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 + + /// + /// Cleans up all used resources + /// + 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewUserControl.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewUserControl.xaml new file mode 100644 index 0000000000..90669851c8 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewUserControl.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewUserControl.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewUserControl.xaml.cs new file mode 100644 index 0000000000..22608d267a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabaseTreeViewUserControl.xaml.cs @@ -0,0 +1,45 @@ +#region Usings + +using System.Windows; +using System.Windows.Controls; +using ICSharpCode.Data.Addin.Commands; + +#endregion + +namespace ICSharpCode.Data.Addin.Pad +{ + /// + /// Interaction logic for DatabaseTreeViewUserControl.xaml + /// + 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabasesTreeViewUserControl.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabasesTreeViewUserControl.xaml new file mode 100644 index 0000000000..6aeafc797b --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabasesTreeViewUserControl.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabasesTreeViewUserControl.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabasesTreeViewUserControl.xaml.cs new file mode 100644 index 0000000000..26f4d31330 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/Pad/DatabasesTreeViewUserControl.xaml.cs @@ -0,0 +1,45 @@ +#region Usings + +using System.Windows; +using System.Windows.Controls; +using ICSharpCode.Data.Addin.Commands; + +#endregion + +namespace ICSharpCode.Data.Addin.Pad +{ + /// + /// Interaction logic for DatabaseTreeViewUserControl.xaml + /// + 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeView.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeView.xaml new file mode 100644 index 0000000000..f0d5182f52 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeView.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + Lokal + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeView.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeView.xaml.cs new file mode 100644 index 0000000000..0375043143 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeView.xaml.cs @@ -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 +{ + /// + /// Interaction logic for DatabaseTreeView.xaml + /// + + public partial class DatabaseTreeView : UserControl + { + public DatabaseTreeView() + { + InitializeComponent(); + } + + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeViewPad.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeViewPad.cs new file mode 100644 index 0000000000..40beef817f --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/UserControls/DatabaseTreeViewPad.cs @@ -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 +{ + /// + /// Description of DatabaseTreeViewPad. + /// + public class DatabaseTreeViewPad : AbstractPadContent, INotifyPropertyChanged + { + #region Fields + + private static DatabaseTreeViewPad _instance = null; + + private ElementHost _winformElementHost = null; + private DatabaseTreeView _databaseTreeView = null; + + #endregion + + /// + /// Creates a new ReportExplorer object + /// + 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 + + /// + /// The representing the pad + /// + public override Control Control + { + get + { + return _winformElementHost; + } + } + + + /// + /// Cleans up all used resources + /// + public override void Dispose() + { + WorkbenchSingleton.Workbench.ActiveViewContentChanged -= ActiveViewContentChanged; + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Helpers/DragDropInterop.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Helpers/DragDropInterop.cs new file mode 100644 index 0000000000..e08e722c26 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Helpers/DragDropInterop.cs @@ -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(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().First().Value; + temp = array[0]; + fieldInfo = temp.GetType().GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); + return (T)fieldInfo.GetValue(temp); + } + catch + { + return default(T); + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Helpers/VisualHelper.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Helpers/VisualHelper.cs new file mode 100644 index 0000000000..47316043d7 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Helpers/VisualHelper.cs @@ -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 +{ + /// + /// Helperklasse, um das Navigieren durch Visual-Trees, suchen von Resourcen in den Visuals und etc... zu erleichtern + /// + public class VisualHelper + { + /// + /// Rekursiv durch den Baum des DependencyObjects durchgehen + /// + /// + /// + public static IEnumerable 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; + } + } + + /// + /// liefert das FrameworkElement mit angegebenen Namen + /// + /// + /// + /// + 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; + } + + /// + /// sucht ein SubElement eines 'templated' FrameworkElements + /// + /// + /// + /// + public static ElementType TryFindSubElement(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; + } + + /// + /// sucht ein SubElement eines 'templated' FrameworkElements + /// + /// + /// + /// + public static ElementType FindSubElement(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; + } + + /// + /// Sucht die Resource in dem FrameworkElement (dem 'hierarchischen Baum') aufwärts + /// + /// + /// + /// + /// + public static T FindResource(string key, FrameworkElement element) + { + try + { + T value = (T)element.FindResource(key); + return value; + } + catch (ResourceReferenceKeyNotFoundException) + { + throw new Exception("Control hat kein Template!"); + } + } + + /// + /// Sucht die Resource in dem FrameworkElement (dem 'hierarchischen Baum') aufwärts, + /// falls nicht gefunden, wird der Defaultwerte zurückgegeben + /// + /// + /// + /// + /// + /// + public static T FindResource(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!"); + } + } + + /// + /// Sucht das Element unter der Mouse mit dem Namen name + /// + /// + /// + /// + /// + 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; + } + } + + /// + /// Sucht das Element unter der Mouse des Typs type + /// + /// + /// + /// + /// + 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 GetElementsUnderPointer(Visual reference, Point mousePosition) + { + // Hit-test to find out the ItemsControl under the mouse-pointer. + _element = null; + _hittedElements = new List(); + _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 _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; + } + + /// + /// Gibt ein visuelles Child eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// + public static TChild GetVisualChild(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(child); + if (childOfChild != null) + return childOfChild; + } + } + return null; + } + + /// + /// Gibt ein visuelles Child mit einem bestimmten Namen eines DependencyObjects zurück. + /// + /// + /// + /// + /// + public static TChild GetVisualChild(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(child, name); + if (childOfChild != null) + return childOfChild; + } + } + return null; + } + + /// + /// Gibt ein visuelles Child mit einem bestimmten Namen eines DependencyObjects zurück. + /// + /// + /// + /// + /// Ich habe diese Methode hier aus Rückwärtskompatibilitätsgründen zurückgelassen. + public static FrameworkElement GetVisualChild(DependencyObject obj, string name) + { + return GetVisualChild(obj, name); + } + + /// + /// Gibt ein visuelles Child, welches eine übergebene Bedingung erfüllt zurück + /// + /// + /// + /// + /// + public static TChild GetVisualChild(DependencyObject obj, Func 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(child, comparePredicate); + if (childOfChild != null) + return childOfChild; + } + } + return null; + } + + /// + /// Gibt ein visuelles Child, welches eine übergebene Bedingung erfüllt zurück + /// + /// + /// + /// + /// Ich habe diese Methode hier aus Rückwärtskompatibilitätsgründen zurückgelassen. + public static FrameworkElement GetVisualChild(DependencyObject obj, Func comparePredicate) + { + return GetVisualChild(obj, comparePredicate); + } + + /// + /// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// + public static TParent GetVisualParent(DependencyObject obj) where TParent : DependencyObject + { + return GetVisualParent(obj, true); + } + + /// + /// Gibt einen visuellen Parent mit einem speziellen Namen eines DependencyObjects zurück. + /// + /// + /// + /// + /// + public static FrameworkElement GetVisualParent(DependencyObject obj, string parentName) + { + return GetVisualParent(obj, true, parent => ((FrameworkElement)parent).Name == parentName); + } + + /// + /// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// Gibt an, ob auch über einen PopupRoot weitergemacht werden soll. + /// + public static TParent GetVisualParent(DependencyObject obj, bool walkThroughPopupRoot) where TParent : DependencyObject + { + if (obj == null) + return null; + + return GetVisualParent(obj, walkThroughPopupRoot, + parent => parent != null && parent is TParent); + } + + /// + /// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// Gibt an, ob auch über einen PopupRoot weitergemacht werden soll. + /// Func mit dem Parent-Vergleich + /// + public static TParent GetVisualParent(DependencyObject obj, bool walkThroughPopupRoot, + Func 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(parent, walkThroughPopupRoot, comparePredicate); + } + + public static object GetVisualParentObject(DependencyObject obj, bool walkThroughPopupRoot, + Func 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); + } + + /// + /// Runs an Action in the current dispatcher. + /// + /// + public static void RunInDispatcher(Action actionToRun) + { + if (Application.Current != null) + RunInDispatcher(Application.Current.Dispatcher, actionToRun); + } + + /// + /// Runs an Action in a given dispatcher. + /// + /// + /// + public static void RunInDispatcher(Dispatcher dispatcher, Action actionToRun) + { + dispatcher.Invoke(DispatcherPriority.Background, actionToRun); + } + + /// + /// Runs through all items in the dispatcher. + /// + public static void DoEvents() + { + if (Application.Current != null) + DoEvents(Application.Current.Dispatcher); + } + + /// + /// Gives DispatcherFrames of the given Dispatcher priority, if + /// their DispatcherPriority is higher than "DispatcherPriority.Background". + /// + /// + public static void DoEvents(Dispatcher dispatcherToPause) + { + dispatcherToPause.Invoke(DispatcherPriority.Background, new System.Action(() => { })); + } + } +} + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/ICSharpCode.Data.Core.UI.csproj b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/ICSharpCode.Data.Core.UI.csproj new file mode 100644 index 0000000000..6fa49cbce0 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/ICSharpCode.Data.Core.UI.csproj @@ -0,0 +1,289 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {BAD94D6E-4159-4CB6-B991-486F412D9BB6} + library + Properties + ICSharpCode.Data.Core.UI + ICSharpCode.Data.Core.UI + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + 3.5 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + 3.5 + + + 3.5 + + + + + 3.0 + + + 3.0 + + + 3.0 + + + 3.0 + + + 3.0 + + + + + MSBuild:Compile + Designer + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + Designer + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + DatabaseTreeView.xaml + + + DatabasesTreeView.xaml + + + + DatabaseTreeViewResources.xaml + + + ErrorRetryButton.xaml + + + + LoadingCircle.xaml + + + + ConnectionWizardWindow.xaml + + + + WizardWindowInnards.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + {2748AD25-9C63-4E12-877B-4DCE96FBED54} + ICSharpCode.SharpDevelop + + + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} + ICSharpCode.Core + + + {B7823AE9-4B43-4859-8796-2EBDC116FBB8} + ICSharpCode.Data.Core + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database.png new file mode 100644 index 0000000000..3d09261a26 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_add.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_add.png new file mode 100644 index 0000000000..802bd6cde0 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_add.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_connect.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_connect.png new file mode 100644 index 0000000000..3a111977cd Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_connect.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_delete.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_delete.png new file mode 100644 index 0000000000..cce652e845 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_delete.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_edit.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_edit.png new file mode 100644 index 0000000000..e501b668c7 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_edit.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_error.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_error.png new file mode 100644 index 0000000000..578221aaab Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_error.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_gear.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_gear.png new file mode 100644 index 0000000000..7c0ab2b4c6 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_gear.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_go.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_go.png new file mode 100644 index 0000000000..61a8556c40 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_go.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_key.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_key.png new file mode 100644 index 0000000000..3334147679 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_key.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_lightning.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_lightning.png new file mode 100644 index 0000000000..d9eefc2251 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_lightning.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_link.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_link.png new file mode 100644 index 0000000000..4c8204af15 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_link.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_refresh.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_refresh.png new file mode 100644 index 0000000000..ff803be124 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_refresh.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_save.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_save.png new file mode 100644 index 0000000000..44c06dddf1 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_save.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_table.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_table.png new file mode 100644 index 0000000000..693709cbc1 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/database_table.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/error.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/error.png new file mode 100644 index 0000000000..628cf2dae3 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/error.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/exclamation.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/exclamation.png new file mode 100644 index 0000000000..c37bd062e6 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/exclamation.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/procedure.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/procedure.png new file mode 100644 index 0000000000..0f9ed4d483 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/procedure.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/refresh.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/refresh.png new file mode 100644 index 0000000000..0de26566d4 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/refresh.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table.png new file mode 100644 index 0000000000..abcd93689a Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_add.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_add.png new file mode 100644 index 0000000000..2a3e5c4df1 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_add.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_delete.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_delete.png new file mode 100644 index 0000000000..b85916d921 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_delete.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_edit.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_edit.png new file mode 100644 index 0000000000..bfcb0249af Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_edit.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_error.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_error.png new file mode 100644 index 0000000000..589e92b554 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_error.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_fkey.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_fkey.png new file mode 100644 index 0000000000..f003939d4f Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_fkey.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_gear.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_gear.png new file mode 100644 index 0000000000..cfc2702acd Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_gear.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_go.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_go.png new file mode 100644 index 0000000000..0528dfa24e Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_go.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_key.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_key.png new file mode 100644 index 0000000000..34e23e24e8 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_key.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_lightning.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_lightning.png new file mode 100644 index 0000000000..612612b5e4 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_lightning.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_link.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_link.png new file mode 100644 index 0000000000..decac8a62e Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_link.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_multiple.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_multiple.png new file mode 100644 index 0000000000..d76448e34a Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_multiple.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_refresh.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_refresh.png new file mode 100644 index 0000000000..ab92010c2c Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_refresh.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_relationship.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_relationship.png new file mode 100644 index 0000000000..28b8505c0e Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_relationship.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_row_delete.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_row_delete.png new file mode 100644 index 0000000000..54c69691ed Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_row_delete.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_row_insert.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_row_insert.png new file mode 100644 index 0000000000..ff5925efd4 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_row_insert.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_save.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_save.png new file mode 100644 index 0000000000..25b74d18f7 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_save.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_sort.png b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_sort.png new file mode 100644 index 0000000000..ed6785a6a3 Binary files /dev/null and b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/Icons/table_sort.png differ diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/ImageDictionary.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/ImageDictionary.xaml new file mode 100644 index 0000000000..16442265fe --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Images/ImageDictionary.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/MainDictionary.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/MainDictionary.xaml new file mode 100644 index 0000000000..ccbbeb8b73 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/MainDictionary.xaml @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/AssemblyInfo.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..da370b710b --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/AssemblyInfo.cs @@ -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 +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: 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")] diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Resources.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..a89c1673df --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.Data.Core.UI.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Resources.resx b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Resources.resx new file mode 100644 index 0000000000..af7dbebbac --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Settings.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..60f9d209c9 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Settings.settings b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Settings.settings new file mode 100644 index 0000000000..033d7a5e9e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeView.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeView.xaml new file mode 100644 index 0000000000..3c07f32f0e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeView.xaml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + Tables + + + + + + + + + + + + + Views + + + + + + + + + + + + + Procedures + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeView.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeView.xaml.cs new file mode 100644 index 0000000000..2a8ab06268 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeView.xaml.cs @@ -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 +{ + /// + /// Interaction logic for DatabasesTreeView.xaml + /// + + 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 + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewDataTemplateSelector.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewDataTemplateSelector.cs new file mode 100644 index 0000000000..25326b58df --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewDataTemplateSelector.cs @@ -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; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml new file mode 100644 index 0000000000..bf1a88234b --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml.cs new file mode 100644 index 0000000000..8ec7ea51fa --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabaseTreeViewResources.xaml.cs @@ -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 +{ + /// + /// Interaction logic for DatabaseTreeViewResources.xaml + /// + 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; + } + } + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabasesTreeView.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabasesTreeView.xaml new file mode 100644 index 0000000000..5299c55429 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabasesTreeView.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabasesTreeView.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabasesTreeView.xaml.cs new file mode 100644 index 0000000000..e0a739041e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/DatabasesTreeView.xaml.cs @@ -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 +{ + /// + /// Interaction logic for DatabasesTreeView.xaml + /// + + public partial class DatabasesTreeView : TreeView, INotifyPropertyChanged + { + #region Fields + + private ObservableCollection _databases = new ObservableCollection(); + private ObservableCollection _additionalNodes = new ObservableCollection(); + private bool _showCheckBoxes = false; + + #endregion + + #region Properties + + public ObservableCollection Databases + { + get { return _databases; } + set + { + _databases = value; + OnPropertyChanged("Databases"); + } + } + + public ObservableCollection 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 + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/ErrorRetryButton.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/ErrorRetryButton.xaml new file mode 100644 index 0000000000..098a1be56a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/ErrorRetryButton.xaml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/ErrorRetryButton.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/ErrorRetryButton.xaml.cs new file mode 100644 index 0000000000..94ff9a500c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/ErrorRetryButton.xaml.cs @@ -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 +{ + /// + /// Interaction logic for ErrorRetryButton.xaml + /// + 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 + + /// + /// Gets or sets the exception to display. + /// + public Exception Exception + { + get { return (Exception)GetValue(ErrorRetryButton.ExceptionProperty); } + set { SetValue(ErrorRetryButton.ExceptionProperty, value); } + } + + /// + /// Gets or set if the control should use the exclamation mark for displaying the exception. + /// + 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/IDatabasesTreeviewAdditionalNode.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/IDatabasesTreeviewAdditionalNode.cs new file mode 100644 index 0000000000..d769f29c49 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/IDatabasesTreeviewAdditionalNode.cs @@ -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; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/LoadingCircle.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/LoadingCircle.xaml new file mode 100644 index 0000000000..add15235f4 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/LoadingCircle.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/LoadingCircle.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/LoadingCircle.xaml.cs new file mode 100644 index 0000000000..cf3a982b13 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/LoadingCircle.xaml.cs @@ -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 +{ + /// + /// Interaction logic for LoadingCircle.xaml + /// + 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 + + /// + /// Gets or sets if the LoadingCircle is activated. + /// + public bool IsActivated + { + get { return (bool)GetValue(LoadingCircle.IsActivatedProperty); } + set { SetValue(LoadingCircle.IsActivatedProperty, value); } + } + + #endregion + + #region Constructor + + /// + /// Constructor. + /// + public LoadingCircle() + { + InitializeComponent(); + } + + #endregion + + #region Protected methods + + /// + /// Returns the standard size (20x20). + /// + /// + /// + protected override Size MeasureOverride(Size constraint) + { + return new Size(Math.Min(20, constraint.Width), Math.Min(20, constraint.Height)); + } + + /// + /// Called to arange and size the content of the LoadingCircle. + /// + /// + /// + 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 + + /// + /// Starts/Stops animation. + /// + /// + /// + 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); + } + } + + /// + /// Stops the rotation animation. + /// + /// + /// + private void DeactivationCompleted(object sender, EventArgs e) + { + ((Storyboard)this.FindResource("RenderDoubleAnimationStoryboard")).Stop(this); + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/WizardUserControl.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/WizardUserControl.cs new file mode 100644 index 0000000000..ae7157f7de --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/WizardUserControl.cs @@ -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 +{ + /// + /// Interaction logic for WizardUserControl.xaml + /// + public abstract partial class WizardUserControl : UserControl, INotifyPropertyChanged + { + #region Fields + + private WizardWindow _wizardWindow = null; + private bool _isReadyForNextStep = false; + + #endregion + + #region Properties + + /// + /// Returns the parent WizardWindow. + /// + public WizardWindow WizardWindow + { + get { return _wizardWindow; } + set { _wizardWindow = value; } + } + + /// + /// Returns the index of this WizardUserControl in a WizardWindow. + /// + public virtual int Index + { + get { throw new NotImplementedException(); } + } + + /// + /// Returns the title of this WizardUserControl. + /// + public virtual string Title + { + get { throw new NotImplementedException(); } + } + + /// + /// Returns if this WizardUserControl can finish the WizardWindow. + /// + public virtual bool CanFinish + { + get { throw new NotImplementedException(); } + } + + /// + /// Gets or sets it this WizardUserControl is ready for the next step. + /// + public bool IsReadyForNextStep + { + get { return _isReadyForNextStep; } + protected set + { + _isReadyForNextStep = value; + OnPropertyChanged("IsReadyForNextStep"); + } + } + + #endregion + + #region Constructor + + /// + /// Intializes a WizardUserControl. + /// + 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml new file mode 100644 index 0000000000..55131efa0d --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add new database connection + + + + Database driver: + + + + + + + + + Data source: + + + + + + + + + + + + + + + + + + + Database: + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml.cs new file mode 100644 index 0000000000..2e668b488b --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml.cs @@ -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 +{ + /// + /// Interaction logic for ConnectionWizardWindow.xaml + /// + + 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 + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindow.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindow.cs new file mode 100644 index 0000000000..9a07846f75 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindow.cs @@ -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() where T : WizardUserControl + { + T newWizardUserControl = Activator.CreateInstance(); + newWizardUserControl.WizardWindow = this; + _wizardWindowInnards.WizardUserControls.Add(newWizardUserControl); + } + + public virtual void OnFinished() + { } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindowInnards.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindowInnards.xaml new file mode 100644 index 0000000000..91b1ede29f --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindowInnards.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindowInnards.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindowInnards.xaml.cs new file mode 100644 index 0000000000..6ed5a1b6e2 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/WizardWindowInnards.xaml.cs @@ -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 +{ + /// + /// Interaction logic for WizardWindow.xaml + /// + 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 _wizardUserControls = new ObservableCollection(); + private WizardUserControl _currentWizardUserControl = null; + private int _currentIndex = 0; + + #endregion + + #region Properties + + /// + /// Returns the ObservableCollection of WizardUserControls, which are displayed in this WizardWindow. + /// + public ObservableCollection WizardUserControls + { + get { return _wizardUserControls; } + } + + /// + /// Returns the current WizardUserControls index of the WizardWindow. + /// + public int CurrentIndex + { + get { return _currentIndex; } + protected set + { + _currentIndex = value; + _currentWizardUserControl = null; + OnPropertyChanged("CurrentIndex"); + OnPropertyChanged("CurrentWizardUserControl"); + } + } + + /// + /// Returns the current WizardUserControl of the WizardWindow. + /// + 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 + + /// + /// Initizales the WizardWindow. + /// + 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Enumerable.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Enumerable.cs new file mode 100644 index 0000000000..47087fecb1 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Enumerable.cs @@ -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 +{ + /// + /// Eigene Extension Methods für IEnumerable + /// + public static class Enumerable + { + #region ForEach + + /// + /// Führt ein foreach auf IEnumerable T aus. + /// WICHTIG: Hier gibt es kein break oder continue! + /// + /// + /// + /// + public static void ForEach(this IEnumerable source, Action action) + { + foreach (TSource item in source) + action(item); + } + + /// + /// Führt ein foreach auf IEnumerable T aus. + /// WICHTIG: return false bei der Action löst ein break aus! + /// + /// + /// + /// + public static void ForEach(this IEnumerable source, Func action) + { + foreach (TSource item in source) + if (!action(item)) + break; + } + + /// + /// Creates an observable collection from an IEnumerable object. + /// + /// + /// + /// + public static ObservableCollection ToObservableCollection(this IEnumerable source) + { + ObservableCollection dest = new ObservableCollection(); + + foreach (TSource item in source) + dest.Add(item); + + return dest; + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Helper.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Helper.cs new file mode 100644 index 0000000000..1193b41bc7 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Helper.cs @@ -0,0 +1,49 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +#endregion + +namespace ICSharpCode.Data.Core.Common +{ + /// + /// Helper class for the ExtensionMethods. + /// + internal static class Helper + { + /// + /// Checks if a parameter is null and throws an exception if that's true. + /// + /// + /// + internal static void CheckIfParameterIsNull(object parameter, string parameterName) + { + if (parameter == null) + { + throw new Exception(string.Format("Der Parameter '{0}' darf nicht NULL sein.", parameterName)); + } + } + + /// + /// Trys to cast TSource to TTarget and throws an exception if that's not possible. + /// + /// + /// + /// + /// + internal static TTarget TryCast(TSource source, Func 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())); + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Objects.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Objects.cs new file mode 100644 index 0000000000..e2ea9780b6 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Common/Objects.cs @@ -0,0 +1,74 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +#endregion + +namespace ICSharpCode.Data.Core.Common +{ + /// + /// ExtensionMethods for System.Object. + /// + public static class Objects + { + #region Public methods + + #region DoIfNull + + /// + /// Does something if the object isn't null. + /// + /// + /// + /// + /// Source object + public static TSource DoIfNull(this TSource source, Action action) + { + Helper.CheckIfParameterIsNull(action, "action"); + + if (source == null) + action(); + return source; + } + + #endregion + + #region DoIfNotNull + + /// + /// Does something if the object isn't null, otherwise the method returns null. + /// + /// + /// + /// + /// + /// + public static TTarget DoIfNotNull(this TSource source, Func action) + { + Helper.CheckIfParameterIsNull(action, "action"); + + return source == null ? default(TTarget) : action(source); + } + + /// + /// Does something if the object isn't null. + /// + /// + /// + /// + public static void DoIfNotNull(this TSource source, Action action) + { + Helper.CheckIfParameterIsNull(action, "action"); + + if (source != null) + action(source); + } + + #endregion + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Column.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Column.cs new file mode 100644 index 0000000000..0aedf464b3 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Column.cs @@ -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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Constraint.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Constraint.cs new file mode 100644 index 0000000000..0da7f5265d --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Constraint.cs @@ -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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Database.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Database.cs new file mode 100644 index 0000000000..27f998741c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Database.cs @@ -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 +{ + /// + /// Description of Database. + /// + public class Database : DatabaseObjectBase, IDatabase + { + #region Fields + + private IDatasource _datasource = null; + private DatabaseObjectBase _tables = null; + private DatabaseObjectBase _views = null; + private DatabaseObjectBase _procedures = null; + + #endregion + + #region Properties + + public IDatasource Datasource + { + get { return _datasource; } + } + + public string ConnectionString + { + get { return _datasource.ConnectionString + ";Initial Catalog=" + _name; } + } + + public DatabaseObjectsCollection Tables + { + get + { + if (_tables != null) + return _tables.Items; + else + return null; + } + } + + public DatabaseObjectsCollection Views + { + get + { + if (_views != null) + return _views.Items; + else + return null; + } + } + + public DatabaseObjectsCollection 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(); + _tables.Name = "Tables"; + _tables.Items = Datasource.DatabaseDriver.LoadTables(this); + Items.Add(_tables); + OnPropertyChanged("Tables"); + + _views = new DatabaseObjectBase(); + _views.Name = "Views"; + _views.Items = Datasource.DatabaseDriver.LoadViews(this); + Items.Add(_views); + OnPropertyChanged("Views"); + + _procedures = new DatabaseObjectBase(); + _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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseDriver.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseDriver.cs new file mode 100644 index 0000000000..18c380f965 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseDriver.cs @@ -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 +{ + /// + /// Holds all available database drivers. + /// + public static class DatabaseDriver + { + #region Static fields + + private static List _databaseDrivers = null; + + #endregion + + #region Static properties + + /// + /// Gets all available database drivers. + /// + public static List DatabaseDrivers + { + get { return _databaseDrivers; } + } + + #endregion + + #region Constructor + + /// + /// Static constructor which loads all available database drivers. + /// + static DatabaseDriver() + { + AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_ReflectionOnlyAssemblyResolve); + + // Get all assumed plug in assemblies + _databaseDrivers = new List(); + 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 + } + + /// + /// Description of DatabaseDriver. + /// + public abstract class DatabaseDriver : DatabaseObjectBase, IDatabaseDriver where T : IDatasource + { + #region Fields + + private DatabaseObjectsCollection _datasources = null; + + #endregion + + #region Properties + + /// + /// Gets or sets the datasources of this database driver. + /// + public DatabaseObjectsCollection Datasources + { + get { return _datasources; } + protected set + { + _datasources = value; + OnPropertyChanged("Datasources"); + OnPropertyChanged("IDatasources"); + } + } + + /// + /// Gets or sets the datasources of this database driver. + /// + public DatabaseObjectsCollection IDatasources + { + get { return _datasources.Cast().ToDatabaseObjectsCollection(); } + } + + /// + /// Gets the provider name of this database driver. + /// + public virtual string ProviderName + { + get { throw new NotImplementedException(); } + } + + /// + /// Gets the ODBC provider name of this database driver. + /// + public virtual string ODBCProviderName + { + get { throw new NotImplementedException(); } + } + + #endregion + + #region Public methods + + /// + /// Creates a new datasource for this driver. + /// + /// Location name or IP address + /// New datasource + public IDatasource CreateNewIDatasource(string datasourceName) + { + return CreateNewDatasource(datasourceName); + } + + /// + /// Creates a new datasource for this driver. + /// + /// Location name or IP address + /// New datasource + public T CreateNewDatasource(string datasourceName) + { + T newDatasource = (T)Activator.CreateInstance(typeof(T), new object[]{ this }); + newDatasource.Name = datasourceName; + return newDatasource; + } + + /// + /// Adds a new datasource for this driver. + /// + /// Location name or IP address + /// Added new datasource + 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; + } + + /// + /// Remove datasource by its name. + /// + /// Location name or IP address + public void RemoveDatasource(string datasourceName) + { + T existingDatasource = Datasources.FirstOrDefault(datasource => datasource.Name.ToUpper() == datasourceName.ToUpper()); + if (existingDatasource != null) + _datasources.Remove(existingDatasource); + } + + /// + /// Searches for datasources and populates the Datasources property. + /// + public virtual void PopulateDatasources() + { + throw new NotImplementedException(); + } + + /// + /// Searches for databases in all available datasources. + /// + public void PopulateDatabases() + { + if (Datasources == null) + return; + + foreach (IDatasource datasource in Datasources) + { + PopulateDatabases(datasource); + } + } + + /// + /// Searches for databases in a specific datasource. + /// + /// Datasource + public virtual void PopulateDatabases(IDatasource datasource) + { + throw new NotImplementedException(); + } + + /// + /// Loads tables of a database. + /// + /// Database + /// Collection of ITables + public virtual DatabaseObjectsCollection LoadTables(IDatabase database) + { + throw new NotImplementedException(); + } + + /// + /// Loads views of a database. + /// + /// Database + /// Collection of IViews + public virtual DatabaseObjectsCollection LoadViews(IDatabase database) + { + throw new NotImplementedException(); + } + + /// + /// Loads procedures of a database. + /// + /// Database + /// Collection of IProcedures + public virtual DatabaseObjectsCollection LoadProcedures(IDatabase database) + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectBase.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectBase.cs new file mode 100644 index 0000000000..4a18810078 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectBase.cs @@ -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 : DatabaseObjectBase, IDatabaseObjectBase where T : IDatabaseObjectBase + { + #region Fields + + private DatabaseObjectsCollection _items = null; + + #endregion + + #region Properties + + public DatabaseObjectsCollection Items + { + get { return _items; } + set + { + _items = value; + OnPropertyChanged("Items"); + } + } + + #endregion + + #region Constructor + + public DatabaseObjectBase() : base() + { + _items = new DatabaseObjectsCollection(this); + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectsCollection.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectsCollection.cs new file mode 100644 index 0000000000..358e391d09 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/DatabaseObjectsCollection.cs @@ -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 : ObservableCollection, IDatabaseObjectsCollection where T : IDatabaseObjectBase + { + #region Fields + + protected IDatabaseObjectBase _parent = null; + + #endregion + + #region Properties + + public List NonGenericItems + { + get + { + List items = new List(); + items.AddRange(this.Cast()); + 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 ToDatabaseObjectsCollection(this IEnumerable source) where T : IDatabaseObjectBase + { + DatabaseObjectsCollection dest = new DatabaseObjectsCollection(null); + + foreach (T item in source) + dest.Add(item); + + return dest; + } + + public static DatabaseObjectsCollection ToDatabaseObjectsCollection(this IEnumerable source, IDatabaseObjectBase parent) where T : IDatabaseObjectBase + { + DatabaseObjectsCollection dest = new DatabaseObjectsCollection(parent); + + foreach (T item in source) + dest.Add(item); + + return dest; + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Datasource.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Datasource.cs new file mode 100644 index 0000000000..337a93e90d --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Datasource.cs @@ -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 _connectionStringSettings = new Dictionary(); + private string _userDefinedConnectionString = string.Empty; + private bool _useUserDefinedConnectionString = false; + + private ObservableCollection _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 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 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Procedure.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Procedure.cs new file mode 100644 index 0000000000..3b7d836818 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Procedure.cs @@ -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, 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/ProcedureParameter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/ProcedureParameter.cs new file mode 100644 index 0000000000..d23e4c41d2 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/ProcedureParameter.cs @@ -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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Table.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Table.cs new file mode 100644 index 0000000000..2018877893 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/Table.cs @@ -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, ITable + { + #region Fields + + private string _schemaName = string.Empty; + private string _tableName = string.Empty; + private DatabaseObjectsCollection _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 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 + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/TableType.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/TableType.cs new file mode 100644 index 0000000000..844a8d3838 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/TableType.cs @@ -0,0 +1,8 @@ +namespace ICSharpCode.Data.Core.DatabaseObjects +{ + public enum TableType + { + Table, + View + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/View.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/View.cs new file mode 100644 index 0000000000..efbc68f778 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/DatabaseObjects/View.cs @@ -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 + { + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/Cardinality.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/Cardinality.cs new file mode 100644 index 0000000000..70e0bf47e6 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/Cardinality.cs @@ -0,0 +1,9 @@ +namespace ICSharpCode.Data.Core.Enums +{ + public enum Cardinality + { + One, + ZeroToOne, + Many + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/ParameterMode.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/ParameterMode.cs new file mode 100644 index 0000000000..17aaf82145 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/ParameterMode.cs @@ -0,0 +1,9 @@ +namespace ICSharpCode.Data.Core.Enums +{ + public enum ParameterMode + { + In, + InOut, + Out + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/ProcedureType.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/ProcedureType.cs new file mode 100644 index 0000000000..fa448e2e41 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Enums/ProcedureType.cs @@ -0,0 +1,8 @@ +namespace ICSharpCode.Data.Core.Enums +{ + public enum ProcedureType + { + SQL, + External + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/ICSharpCode.Data.Core.csproj b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/ICSharpCode.Data.Core.csproj new file mode 100644 index 0000000000..90b3716651 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/ICSharpCode.Data.Core.csproj @@ -0,0 +1,145 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {B7823AE9-4B43-4859-8796-2EBDC116FBB8} + library + Properties + ICSharpCode.Data.Core + ICSharpCode.Data.Core + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + 3.5 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IColumn.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IColumn.cs new file mode 100644 index 0000000000..4d51469220 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IColumn.cs @@ -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; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IConstraint.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IConstraint.cs new file mode 100644 index 0000000000..97142200f3 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IConstraint.cs @@ -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; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabase.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabase.cs new file mode 100644 index 0000000000..b2f996b4b7 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabase.cs @@ -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 Tables { get; } + DatabaseObjectsCollection Views { get; } + DatabaseObjectsCollection Procedures { get; } + + bool LoadDatabase(); + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseDriver.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseDriver.cs new file mode 100644 index 0000000000..aace2e3f91 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseDriver.cs @@ -0,0 +1,37 @@ +#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 IDatabaseDriver : IDatabaseObjectBase + { + DatabaseObjectsCollection IDatasources { get; } + string ProviderName { get; } + string ODBCProviderName { get; } + + IDatasource AddNewDatasource(string datasourceName); + IDatasource CreateNewIDatasource(string name); + + void RemoveDatasource(string datasourceName); + DatabaseObjectsCollection LoadTables(IDatabase database); + DatabaseObjectsCollection LoadViews(IDatabase database); + DatabaseObjectsCollection LoadProcedures(IDatabase database); + void PopulateDatasources(); + void PopulateDatabases(); + void PopulateDatabases(IDatasource datasource); + } + + public interface IDatabaseDriver : IDatabaseDriver where T : IDatasource + { + T CreateNewDatasource(string name); + DatabaseObjectsCollection Datasources { get; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseObjectBase.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseObjectBase.cs new file mode 100644 index 0000000000..046bbcbd8c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseObjectBase.cs @@ -0,0 +1,24 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ICSharpCode.Data.Core.DatabaseObjects; + +#endregion + +namespace ICSharpCode.Data.Core.Interfaces +{ + public interface IDatabaseObjectBase + { + string Name { get; set; } + IDatabaseObjectBase Parent { get; set; } + bool IsSelected { get; set; } + } + + public interface IDatabaseObjectBase : IDatabaseObjectBase where T : IDatabaseObjectBase + { + DatabaseObjectsCollection Items { get; set; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseObjectsCollection.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseObjectsCollection.cs new file mode 100644 index 0000000000..405fae05f5 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatabaseObjectsCollection.cs @@ -0,0 +1,16 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +#endregion + +namespace ICSharpCode.Data.Core.Interfaces +{ + public interface IDatabaseObjectsCollection + { + List NonGenericItems { get; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatasource.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatasource.cs new file mode 100644 index 0000000000..a52bf94ce3 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IDatasource.cs @@ -0,0 +1,23 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Collections.ObjectModel; + +#endregion + +namespace ICSharpCode.Data.Core.Interfaces +{ + public interface IDatasource : IDatabaseObjectBase + { + IDatabaseDriver DatabaseDriver { get; } + ObservableCollection Databases { get; set; } + string ConnectionString { get; } + string UserDefinedConnectionString { get; set; } + bool UseUserDefinedConnectionString { get; set; } + string ProviderManifestToken { get; set; } + bool PopulateDatabases(); + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IProcedure.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IProcedure.cs new file mode 100644 index 0000000000..2b26b42fd0 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IProcedure.cs @@ -0,0 +1,22 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ICSharpCode.Data.Core.DatabaseObjects; +using ICSharpCode.Data.Core.Enums; + +#endregion + +namespace ICSharpCode.Data.Core.Interfaces +{ + public interface IProcedure : IDatabaseObjectBase + { + string SchemaName { get; set; } + string DataType { get; set; } + int Length { get; set; } + ProcedureType ProcedureType { get; set; } + DatabaseObjectsCollection Items { get; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IProcedureParameter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IProcedureParameter.cs new file mode 100644 index 0000000000..9bed9f9a07 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IProcedureParameter.cs @@ -0,0 +1,18 @@ +#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 IProcedureParameter : IDatabaseObjectBase + { + string DataType { get; set; } + ParameterMode ParameterMode { get; set; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/ITable.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/ITable.cs new file mode 100644 index 0000000000..a27ae727fd --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/ITable.cs @@ -0,0 +1,20 @@ +#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 ITable : IDatabaseObjectBase + { + string TableName { get; set; } + string SchemaName { get; set; } + DatabaseObjectsCollection Constraints { get; } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IView.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IView.cs new file mode 100644 index 0000000000..140d1bf2c0 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Interfaces/IView.cs @@ -0,0 +1,15 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +#endregion + +namespace ICSharpCode.Data.Core.Interfaces +{ + public interface IView : ITable + { + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/AssemblyInfo.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..b22434be6b --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/AssemblyInfo.cs @@ -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.DatabaseTools.Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ICSharpCode.DatabaseTools.Core")] +[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 +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: XmlnsDefinition("http://icsharpcode.net/data", "ICSharpCode.Data.Core.Common")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data", "ICSharpCode.Data.Core.Interfaces")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data", "ICSharpCode.Data.Core.DatabaseObjects")] diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Resources.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..36e280cdd0 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.Data.Core.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ICSharpCode.Data.Core.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Resources.resx b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Resources.resx new file mode 100644 index 0000000000..af7dbebbac --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Settings.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..edf9f798f7 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.Data.Core.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; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Settings.settings b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Settings.settings new file mode 100644 index 0000000000..033d7a5e9e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/App.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/App.xaml new file mode 100644 index 0000000000..1eabc2bcdc --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/App.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/App.xaml.cs new file mode 100644 index 0000000000..9e2311fdb9 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/App.xaml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Windows; + +namespace ICSharpCode.Data.DemoApp +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/ICSharpCode.Data.DemoApp.csproj b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/ICSharpCode.Data.DemoApp.csproj new file mode 100644 index 0000000000..138084eef6 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/ICSharpCode.Data.DemoApp.csproj @@ -0,0 +1,144 @@ + + + + Debug + x86 + 10.0.20506 + 2.0 + {1EB79CD3-ECF1-420E-8A44-FA1EDD15390F} + WinExe + Properties + ICSharpCode.Data.DemoApp + ICSharpCode.Data.DemoApp + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + x86 + bin\Debug\ + False + False + None + false + false + + + prompt + 4 + + + prompt + 4 + + + TRACE + true + + + False + False + + + False + Auto + 4194304 + + + + + + + 4.0 + + + 3.5 + + + 3.5 + + + 3.5 + + + 3.0 + + + 3.0 + + + 3.0 + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + {BAD94D6E-4159-4CB6-B991-486F412D9BB6} + ICSharpCode.Data.Core.UI + + + {B7823AE9-4B43-4859-8796-2EBDC116FBB8} + ICSharpCode.Data.Core + + + {EEF5E054-4192-4A57-8FBF-E860D808A51D} + ICSharpCode.Data.EDMDesigner.Core.UI + + + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} + ICSharpCode.Data.EDMDesigner.Core + + + {AFE34868-AFA1-4E1C-9450-47AB4BE329D5} + ICSharpCode.Data.SQLServer + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/MainWindow.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/MainWindow.xaml new file mode 100644 index 0000000000..5e7d047332 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/MainWindow.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/MainWindow.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/MainWindow.xaml.cs new file mode 100644 index 0000000000..cb7fc34c04 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/MainWindow.xaml.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +#region Usings + +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.EDMDesigner.Core.Windows; +using ICSharpCode.Data.EDMDesigner.Core.Windows.EDMWizard; + +#endregion + +namespace ICSharpCode.Data.DemoApp +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + + private void btnCreateNewEDM_Click(object sender, RoutedEventArgs e) + { + //EDMWizardWindow edmWizardWindow = new EDMWizardWindow("C:\\TEMP\\test.ssdl"); + EDMWizardWindow edmWizardWindow = new EDMWizardWindow("C:\\TEMP\\test.edmx"); + edmWizardWindow.Owner = this; + edmWizardWindow.ShowDialog(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/AssemblyInfo.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..1b2eb89835 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ICSharpCode.Data.DemoApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ICSharpCode.Data.DemoApp")] +[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 +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Resources.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..a5769fa7ca --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.Data.DemoApp.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ICSharpCode.Data.DemoApp.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Resources.resx b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Resources.resx new file mode 100644 index 0000000000..af7dbebbac --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Settings.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..cc9b5f0f38 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.Data.DemoApp.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; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Settings.settings b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Settings.settings new file mode 100644 index 0000000000..033d7a5e9e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.DemoApp/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AreStringsEqualConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AreStringsEqualConverter.cs new file mode 100644 index 0000000000..5f60fb41f5 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AreStringsEqualConverter.cs @@ -0,0 +1,42 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class AreStringsEqualConverter : IValueConverter + { + public bool ReturnVisibility { get; set; } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null || DependencyProperty.UnsetValue.Equals(value)) + return false; + + if (value.ToString() == parameter.ToString()) + { + if (ReturnVisibility) + return Visibility.Visible; + else + return true; + } + else + { + if (ReturnVisibility) + return Visibility.Collapsed; + else + return false; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return Binding.DoNothing; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToAlignmentConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToAlignmentConverter.cs new file mode 100644 index 0000000000..a7e0f49881 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToAlignmentConverter.cs @@ -0,0 +1,136 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Shapes; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class AssociationToAlignmentConverter : IValueConverter + { + private const double MARGIN = 10; + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var association = (Association)value; + string stringParameter = (string)parameter; + if (stringParameter.Length != 2) + throw new InvalidOperationException(); + switch (stringParameter[0]) + { + case 'X': + switch (Compare(association.X1, association.X2)) + { + case -1: + if (association.FourPoints) + return HorizontalAlignment.Right; + switch (stringParameter[1]) + { + case '1': + return HorizontalAlignment.Right; + case '2': + return HorizontalAlignment.Left; + default: + throw new InvalidCastException(); + } + case 0: + return HorizontalAlignment.Left; + case 1: + if (association.FourPoints) + return HorizontalAlignment.Left; + switch (stringParameter[1]) + { + case '1': + return HorizontalAlignment.Left; + case '2': + //if (association.FourPoints) + // return HorizontalAlignment.Left; + //else + return HorizontalAlignment.Right; + default: + throw new InvalidOperationException(); + } + } + break; + //case 'Y': + // switch (Compare(relationContener.Y1, relationContener.Y2)) + // { + // case -1: + // switch (stringParameter[1]) + // { + // case '1': + // return VerticalAlignment.Bottom; + // case '2': + // if (relationContener.FourPoints) + // return FourPointsVerticalAlignement(relationContener); + // else + // return VerticalAlignment.Top; + // default: + // throw new InvalidOperationException(); + // } + // case 0: + // return VerticalAlignment.Top; + // case 1: + // switch (stringParameter[1]) + // { + // case '1': + // return VerticalAlignment.Top; + // case '2': + // if (relationContener.FourPoints) + // return FourPointsVerticalAlignement(relationContener); + // else + // return VerticalAlignment.Bottom; + // default: + // throw new InvalidOperationException(); + // } + // } + // return null; + } + throw new NotImplementedException(); + } + + private static HorizontalAlignment FourPointsHorizontalAlignement(Association association) + { + switch (Compare(association.X4, association.X3)) + { + case -1: + return HorizontalAlignment.Right; + case 0: + case 1: + return HorizontalAlignment.Left; + default: + throw new NotImplementedException(); + } + } + private static VerticalAlignment FourPointsVerticalAlignement(Association association) + { + switch (Compare(association.Y4, association.Y3)) + { + case -1: + return VerticalAlignment.Bottom; + case 0: + case 1: + return VerticalAlignment.Top; + default: + throw new NotImplementedException(); + } + } + + private static int Compare(double v1, double v2) + { + if (v1 > v2 + MARGIN) + return -1; + if (v2 > v1 + MARGIN) + return 1; + return 0; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToMarginConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToMarginConverter.cs new file mode 100644 index 0000000000..457cdf4d82 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToMarginConverter.cs @@ -0,0 +1,95 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class AssociationToMarginConverter : IValueConverter + { + private const double MARGIN_HORIZONTAL = 5; + private const double MARGIN_TOP = -2; + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var association = (Association)value; + double left, top, right; //, bottom; + double x1, x2, y1, y2; + TextBlock tb; + switch ((string)parameter) + { + case "From": + tb = association.tb1; + x1 = association.X1; + x2 = association.X2; + y1 = association.Y1; + y2 = association.Y2; + break; + case "To": + tb = association.tb2; + if (association.FourPoints) + { + x1 = association.X4; + x2 = association.X3; + y1 = association.Y4; + y2 = association.Y3; + } + else + { + x1 = association.X2; + x2 = association.X1; + y1 = association.Y2; + y2 = association.Y1; + } + break; + default: + throw new InvalidOperationException(); + } + switch (tb.HorizontalAlignment) + { + case HorizontalAlignment.Left: + left = x1 + MARGIN_HORIZONTAL; + right = 0; + break; + case HorizontalAlignment.Right: + if (association.FourPoints) + right = Math.Max(association.X1, association.X4) - x1 + MARGIN_HORIZONTAL; + else + right = x2 + MARGIN_HORIZONTAL; + left = 0; + break; + default: + left = 0; + right = 0; + break; + } + switch (tb.VerticalAlignment) + { + case VerticalAlignment.Top: + top = y1 + MARGIN_TOP; + //bottom = 0; + break; + case VerticalAlignment.Bottom: + top = y2; + //bottom = 0; + break; + default: + top = 0; + //bottom = 0; + break; + } + return new Thickness(left, top, right, 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToVisibleConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToVisibleConverter.cs new file mode 100644 index 0000000000..8d90304e0c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToVisibleConverter.cs @@ -0,0 +1,28 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class AssociationToVisibleConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Association association = (Association)value; + bool visible = association.FromTypeDesigner != association.ToTypeDesigner || association.FromTypeDesigner.IsExpanded; + if (visible && parameter == null) + visible = association.FourPoints; + return visible ? Visibility.Visible : Visibility.Collapsed; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToXYConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToXYConverter.cs new file mode 100644 index 0000000000..d18deb3066 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/AssociationToXYConverter.cs @@ -0,0 +1,116 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Media; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class AssociationToXYConverter : RelationToXYConverterBase + { + public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var association = (Association)value; + var fromX = -((MatrixTransform)association.Canvas.TransformToVisual(association.FromTypeDesigner)).Matrix.OffsetX; + var toX = -((MatrixTransform)association.Canvas.TransformToVisual(association.ToTypeDesigner)).Matrix.OffsetX; + var xDiff = toX - fromX; + double x1, x2, x3, x4; + double xCanvas; + if (xDiff > 0) + { + x1 = 0; + x2 = xDiff; + xCanvas = fromX; + if (xDiff > MIN_SIZE) + { + var moreX = association.FromTypeDesigner.ActualWidth; + xCanvas += moreX; + x2 -= moreX; + } + } + else + { + x1 = -xDiff; + x2 = 0; + xCanvas = toX; + if (xDiff < -MIN_SIZE) + { + var moreX = association.ToTypeDesigner.ActualWidth; + xCanvas += moreX; + x1 -= moreX; + } + } + + var fromItem = association.FromTypeDesigner.IsExpanded ? association.FromItem : association.FromTypeDesigner; + var toItem = association.ToTypeDesigner.IsExpanded ? association.ToItem : association.ToTypeDesigner; + var fromY = -((MatrixTransform)association.Canvas.TransformToVisual(fromItem)).Matrix.OffsetY; + var toY = -((MatrixTransform)association.Canvas.TransformToVisual(toItem)).Matrix.OffsetY; + var yDiff = toY - fromY; + var y1 = fromItem.ActualHeight / 2.0; + var y2 = toItem.ActualHeight / 2.0; + double y3; + double yCanvas; + if (yDiff > 0) + { + y2 += yDiff - y1; + yCanvas = fromY + y1; + y1 = 0; + } + else + { + y1 += -yDiff - y2; + yCanvas = toY + y2; + y2 = 0; + } + + double fromRight = fromX + association.FromTypeDesigner.ActualWidth; + double toRight = toX + association.ToTypeDesigner.ActualWidth; + var xDiff1 = toX - fromRight; + var xDiff2 = toRight - fromX; + var fromDesignerTop = -((MatrixTransform)association.Canvas.TransformToVisual(association.FromTypeDesigner)).Matrix.OffsetY; + var fromDesignerBottom = fromDesignerTop + association.FromTypeDesigner.ActualHeight; + var toDesignerTop = -((MatrixTransform)association.Canvas.TransformToVisual(association.ToTypeDesigner)).Matrix.OffsetY; + var toDesignerBottom = toDesignerTop + association.ToTypeDesigner.ActualHeight; + bool twoPoints = (Math.Min(Math.Abs(xDiff1), Math.Abs(xDiff2)) > MIN_SIZE && xDiff1 < 0 == xDiff2 < 0 || !(fromDesignerBottom <= toDesignerTop || toDesignerBottom <= fromDesignerTop)) && association.FromTypeDesigner != association.ToTypeDesigner; + if (twoPoints) + { + x3 = 0; + x4 = 0; + y3 = 0; + } + else + { + y3 = y2; + y2 = y1; + x4 = 0; + bool left = Math.Abs(toX - fromX) < Math.Abs(toRight - fromRight); + if (left) + { + x1 = MIN_SIZE + (double)association.FromItemIndex * MORE_SIZE_PER_ITEM; + x4 = MIN_SIZE + (double)association.ToItemIndex * MORE_SIZE_PER_ITEM; + if (fromX > toX) + x1 += fromX - toX; + else + x4 += toX - fromX; + xCanvas = Math.Min(fromX - x1, toX - x4); + x2 = 0; + } + if (!left || xCanvas < 0) + { + x1 = fromRight; + x4 = toRight; + xCanvas = Math.Min(fromRight, toRight); + x1 -= xCanvas; + x4 -= xCanvas; + x2 = Math.Max(x1 + (double)association.FromItemIndex * MORE_SIZE_PER_ITEM, x4 + (double)association.ToItemIndex * MORE_SIZE_PER_ITEM) + MIN_SIZE; + } + x3 = x2; + } + + return new double[][] { new[] { xCanvas, yCanvas }, new[] { x1, y1 }, new[] { x2, y2 }, new[] { x3, y3 }, new[] { x4, y3 } }; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToFontWeightConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToFontWeightConverter.cs new file mode 100644 index 0000000000..da91edfaee --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToFontWeightConverter.cs @@ -0,0 +1,25 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class BoolToFontWeightConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if ((bool)value) + return FontWeights.Bold; + return FontWeights.Normal; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (FontWeight)value == FontWeights.Bold; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToOpacityConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToOpacityConverter.cs new file mode 100644 index 0000000000..2c0ff66d87 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToOpacityConverter.cs @@ -0,0 +1,36 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class BoolToOpacityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var boolValue = (bool?)value; + double parameterValue; + if (parameter is string) + parameterValue = double.Parse((string)parameter, CultureInfo.InvariantCulture); + parameterValue = (double)parameter; + if (boolValue.HasValue) + { + if (boolValue.Value) + return 1; + else + return parameterValue; + } + else + return 1; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToVisibilityConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToVisibilityConverter.cs new file mode 100644 index 0000000000..cd9e61101a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/BoolToVisibilityConverter.cs @@ -0,0 +1,33 @@ +#region Usings + +using System; +using System.Windows.Data; +using System.Globalization; +using System.Windows; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class BoolToVisibilityConverter : DependencyObject, IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if ((bool)value) + return Visibility.Visible; + return Hidden; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (Visibility)value == Visibility.Visible; + } + + public Visibility Hidden + { + get { return (Visibility)GetValue(HiddenProperty); } + set { SetValue(HiddenProperty, value); } + } + public static readonly DependencyProperty HiddenProperty = + DependencyProperty.Register("Hidden", typeof(Visibility), typeof(BoolToVisibilityConverter), new UIPropertyMetadata(Visibility.Collapsed)); + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ComplexPropertyRelationToVisibleConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ComplexPropertyRelationToVisibleConverter.cs new file mode 100644 index 0000000000..4f2eea230a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ComplexPropertyRelationToVisibleConverter.cs @@ -0,0 +1,27 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class ComplexPropertyRelationToVisibleConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var complexPropertyRelation = ((ComplexPropertyRelation)value); + if (parameter != null && (string)parameter == "3") + return complexPropertyRelation.ThreePoints || complexPropertyRelation.FivePoints ? Visibility.Visible : Visibility.Collapsed; + return complexPropertyRelation.FivePoints ? Visibility.Visible : Visibility.Collapsed; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ComplexPropertyRelationToXYConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ComplexPropertyRelationToXYConverter.cs new file mode 100644 index 0000000000..c382b51c72 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ComplexPropertyRelationToXYConverter.cs @@ -0,0 +1,207 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Globalization; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; +using System.Windows.Media; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class ComplexPropertyRelationToXYConverter : RelationToXYConverterBase + { + public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var complexPropertyRelation = (ComplexPropertyRelation)value; + var fromX = -((MatrixTransform)complexPropertyRelation.Canvas.TransformToVisual(complexPropertyRelation.FromTypeDesigner)).Matrix.OffsetX; + var toMiddleWidth = complexPropertyRelation.ToTypeDesigner.ActualWidth / 2.0; + var toX = -((MatrixTransform)complexPropertyRelation.Canvas.TransformToVisual(complexPropertyRelation.ToTypeDesigner)).Matrix.OffsetX + toMiddleWidth; + var xDiff = toX - fromX; + double x1, x2, x3, x4, x1Arrow, x2Arrow, xCanvas; + var fromByLeft = true; + if (xDiff > 0) + { + x1 = 0; + x2 = xDiff; + xCanvas = fromX; + if (xDiff > complexPropertyRelation.FromTypeDesigner.ActualWidth / 2.0) + { + double moreX = complexPropertyRelation.FromTypeDesigner.ActualWidth; + xCanvas += moreX; + x2 -= moreX; + fromByLeft = false; + } + } + else + { + x1 = -xDiff; + x2 = 0; + xCanvas = toX; + } + + var fromItem = complexPropertyRelation.FromTypeDesigner.IsExpanded ? complexPropertyRelation.FromItem : complexPropertyRelation.FromTypeDesigner; + var fromY = -((MatrixTransform)complexPropertyRelation.Canvas.TransformToVisual(fromItem)).Matrix.OffsetY; + var toY = -((MatrixTransform)complexPropertyRelation.Canvas.TransformToVisual(complexPropertyRelation.ToTypeDesigner)).Matrix.OffsetY; + var yDiff = toY - fromY; + var itemMiddleHeight = fromItem.ActualHeight / 2.0; + var y1 = itemMiddleHeight; + double y2, y3, y4, y1Arrow, y2Arrow, yCanvas; + bool toByTop = true; + if (yDiff > 0) + { + y2 = yDiff - y1; + yCanvas = fromY + y1; + y1 = 0; + } + else + { + y1 -= yDiff; + yCanvas = toY; + y2 = 0; + if (yDiff < -complexPropertyRelation.ToTypeDesigner.ActualHeight / 2.0 || toY < MIN_SIZE) + { + double moreY = complexPropertyRelation.ToTypeDesigner.ActualHeight; + yCanvas += moreY; + y1 -= moreY; + toByTop = false; + } + } + + var angle = GetAngle(x1, x2, y1, y2); + var angleAbs = Math.Abs(angle); + yDiff = y2 - y1; + xDiff = x2 - x1; + bool twoPoints, threePoints, fivePoints, fivePointsV, fivePointsH; + if (angleAbs >= ARROW_LINE_MIN_ANGLE && angleAbs <= ARROW_LINE_MAX_ANGLE && (toByTop ? angle > 0 : angle < 0)) + { + twoPoints = true; + threePoints = fivePoints = fivePointsH = fivePointsV = false; + } + else + { + threePoints = ((y2 > y1) ? toByTop && yDiff > MIN_SIZE : !toByTop && yDiff < -MIN_SIZE) && (xDiff > MIN_SIZE ? !fromByLeft && x2 - x1 > MIN_SIZE : fromByLeft && x2 - x1 < -MIN_SIZE); + if (threePoints) + { + fivePointsH = false; + fivePointsV = false; + fivePoints = false; + } + else + { + fromY += fromItem.ActualHeight / 2.0; + fivePointsV = fromX - MIN_SIZE * 2.0 < toX && fromX + complexPropertyRelation.ToTypeDesigner.ActualWidth + MIN_SIZE * (double)2 > toX && (fromY > toY + complexPropertyRelation.ToTypeDesigner.ActualHeight + MIN_SIZE || fromY < toY + complexPropertyRelation.ToTypeDesigner.ActualHeight + MIN_SIZE); + fivePointsH = (toByTop ? toY - MIN_SIZE <= fromY : toY + complexPropertyRelation.ToTypeDesigner.ActualHeight + MIN_SIZE > fromY) && (fromX - MIN_SIZE * 2.0 > toX || fromX + complexPropertyRelation.FromTypeDesigner.ActualWidth + MIN_SIZE * (double)2 < toX); + fivePoints = fivePointsH || fivePointsV; + } + twoPoints = !(fivePoints || threePoints); + } + + if (twoPoints) + { + x3 = y3 = x4 = y4 = 0; + FillArrow(angle, x1, x2, y1, y2, out x1Arrow, out x2Arrow, out y1Arrow, out y2Arrow); + var translateXCanvas = Math.Min(x1Arrow, x2Arrow); + if (translateXCanvas < 0) + { + x1 -= translateXCanvas; + x2 -= translateXCanvas; + x1Arrow -= translateXCanvas; + x2Arrow -= translateXCanvas; + xCanvas += translateXCanvas; + } + var translateYCanvas = Math.Min(y1Arrow, y2Arrow); + if (translateYCanvas < 0) + { + y1 -= translateYCanvas; + y2 -= translateYCanvas; + y1Arrow -= translateYCanvas; + y2Arrow -= translateYCanvas; + yCanvas += translateYCanvas; + } + } + else + { + var xTranslate = x2 - ARROW_WIDTH; + if (xTranslate < 0) + { + xCanvas += xTranslate; + x1 -= xTranslate; + x2 -= xTranslate; + } + x1Arrow = x2 - ARROW_WIDTH; + x2Arrow = x2 + ARROW_WIDTH; + if (threePoints) + { + x4 = y4 = 0; + y3 = y2; + y2 = y1; + x3 = x2; + if (y3 > y1) + y1Arrow = y3 - ARROW_HEIGHT; + else + y1Arrow = y3 + ARROW_HEIGHT; + } + else if (fivePoints) + { + x4 = x2; + y4 = y2; + if (fivePointsH) + { + x2 = Math.Abs(fromByLeft ? x1 - x2 + toMiddleWidth : x2 - toMiddleWidth - x1 ) / 2.0; + if (fromByLeft) + { + x3 = x1 + MIN_SIZE + (double)complexPropertyRelation.FromItemIndex * MORE_SIZE_PER_ITEM; + if (x3 < x4 - MIN_SIZE) + x2 = Math.Max(x2, x3); + } + else + { + x3 = x1 - MIN_SIZE - (double)complexPropertyRelation.FromItemIndex * MORE_SIZE_PER_ITEM; + if (x3 > x4 + MIN_SIZE) + x2 = Math.Min(x2, x3); + } + } + else if (fivePointsV) + { + var fromTypeY = -((MatrixTransform)complexPropertyRelation.Canvas.TransformToVisual(complexPropertyRelation.FromTypeDesigner)).Matrix.OffsetY; + if (toByTop) + y2 = Math.Abs(y2 - fromTypeY + yCanvas) / 2.0; + else + { + fromTypeY += complexPropertyRelation.FromTypeDesigner.ActualHeight; + y2 = Math.Abs(y2 - fromTypeY + yCanvas) / 2.0; + } + if (fromByLeft) + x2 = x1 - MIN_SIZE - (double)complexPropertyRelation.FromItemIndex * MORE_SIZE_PER_ITEM; + else + x2 = x1 + MIN_SIZE + (double)complexPropertyRelation.FromItemIndex * MORE_SIZE_PER_ITEM; + } + else + throw new NotImplementedException(); + x3 = x2; + y2 = y1; + if (toByTop) + { + y3 = y4 - MIN_SIZE; + y1Arrow = y4 - ARROW_HEIGHT; + } + else + { + y3 = y4 + MIN_SIZE; + y1Arrow = y4 + ARROW_HEIGHT; + } + } + else + throw new InvalidOperationException(); + y2Arrow = y1Arrow; + } + + return new double[][] { new[] { xCanvas, yCanvas }, new[] { x1, y1 }, new[] { x2, y2 }, new[] { x3, y3 }, new[] { x4, y3 }, new[] { x4, y4 }, new[] { x1Arrow, y1Arrow }, new[] { x2Arrow, y2Arrow } }; + } + } +} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ConditionOperatorToVisibilityConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ConditionOperatorToVisibilityConverter.cs new file mode 100644 index 0000000000..1808733c2c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ConditionOperatorToVisibilityConverter.cs @@ -0,0 +1,35 @@ +#region Usings + +using System; +using System.Windows; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.MSL.Condition; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class ConditionOperatorToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (value == null) + return Visibility.Collapsed; + var conditionOperator = (ConditionOperator)value; + switch (conditionOperator) + { + case ConditionOperator.Equals: + return Visibility.Visible; + case ConditionOperator.IsNull: + case ConditionOperator.IsNotNull: + return Visibility.Collapsed; + default: + throw new NotImplementedException(); + } + } + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/DesignerAssociationToSelectionLocationConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/DesignerAssociationToSelectionLocationConverter.cs new file mode 100644 index 0000000000..56a2778860 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/DesignerAssociationToSelectionLocationConverter.cs @@ -0,0 +1,36 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class DesignerAssociationToSelectionLocationConverter : IValueConverter + { + private const double DEC = 2; + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var association = (Association)value; + var point = association.FourPoints ? association.XY[4] : association.XY[2]; + switch (parameter.ToString()) + { + case "1": + return new Thickness(association.X1 - DEC, association.Y1 - DEC, 0, 0); + case "2": + return new Thickness(point[0] - DEC, point[1] - DEC, 0, 0); + } + throw new InvalidOperationException(); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/DesignerInheritanceRelationToSelectionLocationConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/DesignerInheritanceRelationToSelectionLocationConverter.cs new file mode 100644 index 0000000000..f0834c81a5 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/DesignerInheritanceRelationToSelectionLocationConverter.cs @@ -0,0 +1,35 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class DesignerInheritanceRelationToSelectionLocationConverter : IValueConverter + { + private const double DEC = 2; + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var relation = (InheritanceRelation)value; + switch (parameter.ToString()) + { + case "1": + return new Thickness(relation.X1 - DEC, relation.Y1 - DEC, 0, 0); + case "2": + return new Thickness(relation.X3Arrow - DEC, relation.Y3Arrow - DEC, 0, 0); + } + throw new InvalidOperationException(); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ExpanderHeightConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ExpanderHeightConverter.cs new file mode 100644 index 0000000000..9d91c06ba1 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ExpanderHeightConverter.cs @@ -0,0 +1,35 @@ +#region Usings + +using System; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + #region ExpanderHeightConverter + + public class ExpanderHeightConverter : IMultiValueConverter + { + #region IMultiValueConverter Members + + public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + double result = 1.0; + + for (int i = 0; i < values.Length; i++) + result *= (double)values[i]; + + return result; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) + { + return null; + } + + #endregion + } + + #endregion +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IEnumerableToVisibilityConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IEnumerableToVisibilityConverter.cs new file mode 100644 index 0000000000..3983ed4a38 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IEnumerableToVisibilityConverter.cs @@ -0,0 +1,26 @@ +#region Usings + +using System; +using System.Collections; +using System.Globalization; +using System.Linq; +using System.Windows; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class IEnumerableToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return ((IEnumerable)value).OfType().Any() ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IUITypeToBackgroundConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IUITypeToBackgroundConverter.cs new file mode 100644 index 0000000000..c8a6ba302e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IUITypeToBackgroundConverter.cs @@ -0,0 +1,51 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using System.Windows; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class IUITypeToBackgroundConverter : IValueConverter + { + #region Fields + + private static LinearGradientBrush _entityTypeBrush = null; + private static LinearGradientBrush _complexTypeBrush = null; + + #endregion + + static IUITypeToBackgroundConverter() + { + _entityTypeBrush = new LinearGradientBrush(); + _entityTypeBrush.StartPoint = new Point(0, 1); + _entityTypeBrush.EndPoint = new Point(1, 1); + _entityTypeBrush.GradientStops.Add(new GradientStop(Colors.DarkSeaGreen, 0.0)); + _entityTypeBrush.GradientStops.Add(new GradientStop(Colors.Honeydew, 0.75)); + + _complexTypeBrush = new LinearGradientBrush(); + _complexTypeBrush.StartPoint = new Point(0, 1); + _complexTypeBrush.EndPoint = new Point(1, 1); + _complexTypeBrush.GradientStops.Add(new GradientStop(Colors.DarkOliveGreen, 0.0)); + _complexTypeBrush.GradientStops.Add(new GradientStop(Colors.Honeydew, 0.75)); + } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is UIEntityType) + return _entityTypeBrush; + else if (value is UIComplexType) + return _complexTypeBrush; + throw new NotImplementedException(); + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IUITypeToBorderBrushConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IUITypeToBorderBrushConverter.cs new file mode 100644 index 0000000000..11452843a1 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IUITypeToBorderBrushConverter.cs @@ -0,0 +1,33 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class IUITypeToBorderBrushConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var uiEntityType = value as UIEntityType; + if (uiEntityType != null) + { + if (uiEntityType.BusinessInstance.Abstract) + return new DrawingBrush(new GeometryDrawing(Brushes.Blue, null, Geometry.Parse("M0,0 0,1 1,1 1,0Z M 1,1 2,1 2,2 1,2Z"))) { ViewportUnits = BrushMappingMode.Absolute, Viewport = new System.Windows.Rect(0, 0, 4, 4), TileMode = TileMode.FlipXY }; + return Brushes.Olive; + } + else if (value is UIComplexType) + return Brushes.DarkOliveGreen; + throw new NotImplementedException(); + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/InheritanceRelationToVisibleConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/InheritanceRelationToVisibleConverter.cs new file mode 100644 index 0000000000..f334f47c84 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/InheritanceRelationToVisibleConverter.cs @@ -0,0 +1,24 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class InheritanceRelationToVisibleConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return ((InheritanceRelation)value).FourPoints ? Visibility.Visible : Visibility.Collapsed; + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/InheritanceRelationToXYConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/InheritanceRelationToXYConverter.cs new file mode 100644 index 0000000000..0e21794475 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/InheritanceRelationToXYConverter.cs @@ -0,0 +1,148 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class InheritanceRelationToXYConverter : RelationToXYConverterBase + { + public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var inheritanceRelation = (InheritanceRelation)value; + var fromY = -((MatrixTransform)inheritanceRelation.Canvas.TransformToVisual(inheritanceRelation.FromTypeDesigner)).Matrix.OffsetY; + var toY = -((MatrixTransform)inheritanceRelation.Canvas.TransformToVisual(inheritanceRelation.ToTypeDesigner)).Matrix.OffsetY; + var yDiff = toY - fromY; + double y1, y2, y3, y4; + double yCanvas; + if (yDiff > 0) + { + y1 = 0; + y2 = yDiff; + yCanvas = fromY; + if (yDiff > MIN_SIZE) + { + var moreY = inheritanceRelation.FromTypeDesigner.ActualHeight; + yCanvas += moreY; + y2 -= moreY; + } + } + else + { + y1 = -yDiff; + y2 = 0; + yCanvas = toY; + if (yDiff < -MIN_SIZE) + { + double moreY = inheritanceRelation.ToTypeDesigner.ActualHeight; + yCanvas += moreY; + y1 -= moreY; + } + } + + var x1 = inheritanceRelation.FromTypeDesigner.ActualWidth / 2.0; + var x2 = inheritanceRelation.ToTypeDesigner.ActualWidth / 2.0; + var fromX = -((MatrixTransform)inheritanceRelation.Canvas.TransformToVisual(inheritanceRelation.FromTypeDesigner)).Matrix.OffsetX + x1; + var toX = -((MatrixTransform)inheritanceRelation.Canvas.TransformToVisual(inheritanceRelation.ToTypeDesigner)).Matrix.OffsetX + x2; + var xDiff = toX - fromX; + double x3; + double xCanvas; + xCanvas = Math.Min(fromX, toX); + if (xDiff > 0) + { + x2 = xDiff; + x1 = 0; + } + else + { + x1 = -xDiff; + x2 = 0; + } + + double x1Arrow, x2Arrow, x3Arrow, y1Arrow, y2Arrow, y3Arrow; + + double fromBottom = fromY + inheritanceRelation.FromTypeDesigner.ActualHeight; + double toBottom = toY + inheritanceRelation.ToTypeDesigner.ActualHeight; + var yDiff1 = toY - fromBottom; + var yDiff2 = toBottom - fromY; + var fromDesignerLeft = -((MatrixTransform)inheritanceRelation.Canvas.TransformToVisual(inheritanceRelation.FromTypeDesigner)).Matrix.OffsetX; + var fromDesignerRight = fromDesignerLeft + inheritanceRelation.FromTypeDesigner.ActualWidth; + var toDesignerLeft = -((MatrixTransform)inheritanceRelation.Canvas.TransformToVisual(inheritanceRelation.ToTypeDesigner)).Matrix.OffsetX; + var toDesignerRight = toDesignerLeft + inheritanceRelation.ToTypeDesigner.ActualWidth; + var angle = GetAngle(x1, x2, y1, y2); + var angleAbs = Math.Abs(angle); + bool twoPoints = (angleAbs >= ARROW_LINE_MIN_ANGLE && angleAbs <= Math.PI / 2.0 + ARROW_LINE_MAX_ANGLE) && (Math.Min(Math.Abs(yDiff1), Math.Abs(yDiff2)) > MIN_SIZE && yDiff1 < 0 == yDiff2 < 0 || !(fromDesignerRight <= toDesignerLeft || toDesignerRight <= fromDesignerLeft)) && inheritanceRelation.FromTypeDesigner != inheritanceRelation.ToTypeDesigner; + x3Arrow = x2; + y3Arrow = y2; + if (twoPoints) + { + y3 = 0; + y4 = 0; + x3 = 0; + FillArrow(x1, x2, y1, y2, out x1Arrow, out x2Arrow, out y1Arrow, out y2Arrow); + var translateXCanvas = Math.Min(x1Arrow, x2Arrow); + if (translateXCanvas < 0) + { + x1 -= translateXCanvas; + x1Arrow -= translateXCanvas; + x2Arrow -= translateXCanvas; + x3Arrow -= translateXCanvas; + xCanvas += translateXCanvas; + } + var translateYCanvas = Math.Min(y1Arrow, y2Arrow); + if (translateYCanvas < 0) + { + y1 -= translateYCanvas; + y1Arrow -= translateYCanvas; + y2Arrow -= translateYCanvas; + y3Arrow -= translateYCanvas; + yCanvas += translateYCanvas; + } + x2 = (x1Arrow + x2Arrow) / 2.0; + y2 = (y1Arrow + y2Arrow) / 2.0; + } + else + { + x3 = x2; + x1Arrow = x2 - ARROW_WIDTH; + x2Arrow = x2 + ARROW_WIDTH; + x3Arrow = x2; + x2 = x1; + y4 = 0; + var top = Math.Abs(toY - fromY) > Math.Abs(toBottom - fromBottom); + if (top) + { + y1 = y4 = MIN_SIZE; + if (fromY > toY) + y1 += fromY - toY; + else + y4 += toY - fromY; + yCanvas = Math.Min(fromY - MIN_SIZE, toY - MIN_SIZE); + y2 = 0; + y3Arrow = y4; + y4 -= ARROW_HEIGHT; + } + if (! top || yCanvas < 0) + { + y1 = fromBottom; + y4 = toBottom; + yCanvas = Math.Min(fromBottom, toBottom); + y1 -= yCanvas; + y4 -= yCanvas; + y2 = Math.Max(y1, y4) + MIN_SIZE; + y3Arrow = y4; + y4 += ARROW_HEIGHT; + } + y1Arrow = y2Arrow = y4; + y3 = y2; + } + + return new double[][] { new[] { xCanvas, yCanvas }, new[] { x1, y1 }, new[] { x2, y2 }, new[] { x3, y3 }, new[] { x3, y4 }, new[] { x1Arrow, y1Arrow }, new[] { x2Arrow, y2Arrow }, new[] { x3Arrow, y3Arrow } }; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IsTypeOfConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IsTypeOfConverter.cs new file mode 100644 index 0000000000..34ede0c635 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IsTypeOfConverter.cs @@ -0,0 +1,44 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class IsTypeOfConverter : IValueConverter + { + public bool ReturnVisibility { get; set; } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null || DependencyProperty.UnsetValue.Equals(value)) + return false; + + Type type = (Type)parameter; + + if (value.GetType() == type) + { + if (ReturnVisibility) + return Visibility.Visible; + else + return true; + } + else + { + if (ReturnVisibility) + return Visibility.Collapsed; + else + return false; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return Binding.DoNothing; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/MenuSeparatorToMenuSeparatorVisibilityConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/MenuSeparatorToMenuSeparatorVisibilityConverter.cs new file mode 100644 index 0000000000..6099a0b4df --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/MenuSeparatorToMenuSeparatorVisibilityConverter.cs @@ -0,0 +1,55 @@ +#region Usings + +using System; +using System.Globalization; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class MenuSeparatorToMenuSeparatorVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var separator = (MenuSeparator)value; + var items = VisualTreeHelperUtil.GetControlAscendant(separator).Items.OfType(); + bool visibleBefore = false; + bool visibleAfter = false; + bool before = true; + foreach (var item in items) + { + if (item is Separator) + { + if (item == separator) + before = false; + else if (item.IsVisible) + { + if (before) + visibleBefore = false; + else + break; + } + } + else if (item.IsVisible) + { + if (before) + visibleBefore = true; + else + visibleAfter = true; + } + } + return visibleBefore && visibleAfter ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/NotBoolConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/NotBoolConverter.cs new file mode 100644 index 0000000000..d79652ff3e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/NotBoolConverter.cs @@ -0,0 +1,24 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class NotBoolConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return !((bool)value); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ObjectToVisibilityConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ObjectToVisibilityConverter.cs new file mode 100644 index 0000000000..0f9f232f3d --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/ObjectToVisibilityConverter.cs @@ -0,0 +1,24 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class ObjectToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value == null ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/RelationToXYConverterBase.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/RelationToXYConverterBase.cs new file mode 100644 index 0000000000..6f89028494 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/RelationToXYConverterBase.cs @@ -0,0 +1,48 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Data; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public abstract class RelationToXYConverterBase : IValueConverter + { + protected const double MIN_SIZE = 30; + protected const double MORE_SIZE_PER_ITEM = 5; + protected const double ARROW_ANGLE = Math.PI / 6.0; + protected const double ARROW_HEIGHT = 10; + protected const double ARROW_WIDTH = 5.0; + protected const double ARROW_LINE_MIN_ANGLE = Math.PI / 6.0; + protected const double ARROW_LINE_MAX_ANGLE = Math.PI / 3.0; + + public abstract object Convert(object value, System.Type targetType, object parameter, CultureInfo culture); + + protected double GetAngle(double x1, double x2, double y1, double y2) + { + return (y2 - y1) / (Math.Abs(x2 - x1) + Math.Abs(y2 - y1)) * Math.PI / 2.0; + } + protected void FillArrow(double x1, double x2, double y1, double y2, out double x1Arrow, out double x2Arrow, out double y1Arrow, out double y2Arrow) + { + double angle = GetAngle(x1, x2, y1, y2); + FillArrow(angle, x1, x2, y1, y2, out x1Arrow, out x2Arrow, out y1Arrow, out y2Arrow); + } + + protected void FillArrow(double angle, double x1, double x2, double y1, double y2, out double x1Arrow, out double x2Arrow, out double y1Arrow, out double y2Arrow) + { + if (x1 > x2) + angle = Math.PI - angle; + x1Arrow = x2 - ARROW_HEIGHT * Math.Cos(angle - ARROW_ANGLE); + x2Arrow = x2 - ARROW_HEIGHT * Math.Cos(angle + ARROW_ANGLE); + y1Arrow = y2 - ARROW_HEIGHT * Math.Sin(angle - ARROW_ANGLE); + y2Arrow = y2 - ARROW_HEIGHT * Math.Sin(angle + ARROW_ANGLE); + } + + public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) + { + throw new System.NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/UIPropertyFontStyleConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/UIPropertyFontStyleConverter.cs new file mode 100644 index 0000000000..a7d70f1cb1 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/UIPropertyFontStyleConverter.cs @@ -0,0 +1,29 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Property; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class UIPropertyFontStyleConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var navigationProperty = ((UIProperty)value).BusinessInstance as NavigationProperty; + if (navigationProperty != null && ! navigationProperty.Generate) + return FontStyles.Italic; + return FontStyles.Normal; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/UIPropertyToOpacityConverter.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/UIPropertyToOpacityConverter.cs new file mode 100644 index 0000000000..285a348886 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/UIPropertyToOpacityConverter.cs @@ -0,0 +1,30 @@ +#region Usings + +using System; +using System.Globalization; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Property; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters +{ + public class UIPropertyToOpacityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var navigationProperty = ((UIProperty)value).BusinessInstance as NavigationProperty; + if (navigationProperty == null || (navigationProperty.Association.Mapping.IsCompletlyMapped && navigationProperty.Generate)) + return 1; + if (parameter is string) + return double.Parse((string)parameter, CultureInfo.InvariantCulture); + return (double)parameter; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/CSDLDatabaseTreeViewAdditionalNode.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/CSDLDatabaseTreeViewAdditionalNode.cs new file mode 100644 index 0000000000..235472497f --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/CSDLDatabaseTreeViewAdditionalNode.cs @@ -0,0 +1,68 @@ +#region Usings + +using System.Collections; +using System.Collections.ObjectModel; +using ICSharpCode.Data.Core.UI.UserControls; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL; +using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding +{ + public class CSDLDatabaseTreeViewAdditionalNode : IDatabasesTreeViewAdditionalNode + { + #region Fields + + private static CSDLDatabaseTreeViewAdditionalNode _instance = null; + private ObservableCollection _csdlViews = new ObservableCollection(); + + #endregion + + #region Constructor + + static CSDLDatabaseTreeViewAdditionalNode() + { + ResourceDictionaryLoader.LoadResourceDictionary("/DisplayBinding/CSDLDatabaseTreeViewNodeResourceDictionary.xaml"); + } + + #endregion + + #region Properties + + public static CSDLDatabaseTreeViewAdditionalNode Instance + { + get + { + if (_instance == null) + { + _instance = new CSDLDatabaseTreeViewAdditionalNode(); + } + + return _instance; + } + } + + public string Name + { + get { return "CSDL Models"; } + } + + public string DataTemplate + { + get { return "CSDLViewTreeViewDataTemplate"; } + } + + public IEnumerable Items + { + get { return _csdlViews; } + } + + internal ObservableCollection CSDLViews + { + get { return _csdlViews; } + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/CSDLDatabaseTreeViewNodeResourceDictionary.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/CSDLDatabaseTreeViewNodeResourceDictionary.xaml new file mode 100644 index 0000000000..4d46942e84 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/CSDLDatabaseTreeViewNodeResourceDictionary.xaml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerDisplayBinding.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerDisplayBinding.cs new file mode 100644 index 0000000000..072d19c986 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerDisplayBinding.cs @@ -0,0 +1,27 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Gui; +using System.IO; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding +{ + public class EDMDesignerDisplayBinding : IDisplayBinding + { + public bool CanCreateContentForFile(string fileName) + { + return Path.GetExtension(fileName).Equals(".edmx", StringComparison.OrdinalIgnoreCase); + } + + public IViewContent CreateContentForFile(OpenedFile file) + { + return new EDMDesignerViewContent(file); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerViewContent.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerViewContent.cs new file mode 100644 index 0000000000..7f6e9d6ce4 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerViewContent.cs @@ -0,0 +1,152 @@ +#region Usings + +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; +using System.Xml.Linq; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.IO; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType; +using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Gui; +using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding +{ + public class EDMDesignerViewContent : AbstractViewContent, IHasPropertyContainer, IToolsHost + { + #region Fields + + private DesignerCanvas _designerCanvas = null; + private PropertyContainer _propertyContainer = new PropertyContainer(); + private EDMView _edmView = null; + private object _selection = null; + + #endregion + + #region Properties + + public object Selection + { + get { return _selection; } + set + { + if (_selection == null) + _propertyContainer.Clear(); + else + _propertyContainer.SelectedObject = value; + + _selection = value; + } + } + + public Window Window + { + get { return Application.Current.MainWindow; } + } + + public EDMView EDMView + { + get { return _edmView; } + } + + public override object Control + { + get { return _designerCanvas; } + } + + #endregion + + #region Constructor + + public EDMDesignerViewContent(OpenedFile primaryFile) + : base(primaryFile) + { + if (primaryFile == null) + throw new ArgumentNullException("primaryFile"); + + primaryFile.ForceInitializeView(this); // call Load() + } + + #endregion + + #region Methods + + public override void Load(OpenedFile file, Stream stream) + { + Debug.Assert(file == this.PrimaryFile); + + XElement edmxElement = null; + Action readMoreAction = edmxElt => edmxElement = edmxElt; + _edmView = new EDMView(file.FileName, readMoreAction); + + EntityTypeDesigner.Init = true; + + DesignerIO.Read(_edmView, edmxElement.Element("DesignerViews"), entityType => new EntityTypeDesigner(entityType), complexType => new ComplexTypeDesigner(complexType)); + + EntityTypeDesigner.Init = false; + + VisualHelper.DoEvents(); + + _designerCanvas = DesignerCanvas.GetDesignerCanvas(this, _edmView, _edmView.DesignerViews.FirstOrDefault()); + + CSDLDatabaseTreeViewAdditionalNode.Instance.CSDLViews.Add(_edmView.CSDL); + } + + public override void Save(OpenedFile file, Stream stream) + { + Debug.Assert(file == this.PrimaryFile); + //Writer.Write(_designerCanvas.EDMView.EDM, EDMDesignerView.Writer.Write(_designerCanvas.EDMView)).Save(file.FileName); + } + + internal void ShowPropertiesTab() + { } + + internal void ShowPropertiesTab(IUIType type) + { } + + internal void ShowPropertiesTab(UIProperty property) + { } + + internal void ShowMappingTab() + { } + + internal void ShowMappingTab(IUIType type) + { } + + public override void Dispose() + { + if (CSDLDatabaseTreeViewAdditionalNode.Instance.CSDLViews.Contains(_edmView.CSDL)) + CSDLDatabaseTreeViewAdditionalNode.Instance.CSDLViews.Remove(_edmView.CSDL); + } + + #endregion + + #region IHasPropertyContainer + + public PropertyContainer PropertyContainer + { + get { return _propertyContainer; } + } + + #endregion + + #region IToolsHost + + object IToolsHost.ToolsContent + { + get { return null; } + } + + #endregion + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Helpers/ResourceDictionaryLoader.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Helpers/ResourceDictionaryLoader.cs new file mode 100644 index 0000000000..d026db6927 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Helpers/ResourceDictionaryLoader.cs @@ -0,0 +1,28 @@ +#region Usings + +using System; +using System.Linq; +using System.Windows; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Helpers +{ + internal class ResourceDictionaryLoader + { + public static void LoadResourceDictionary(string resourceDictionaryPath) + { + if (Application.Current == null || Application.Current.Resources == null || Application.Current.Resources.MergedDictionaries == null) + return; + + Uri resourceDictionaryUri = new Uri("/ICSharpCode.Data.EDMDesigner.Core.UI;component" + resourceDictionaryPath, UriKind.RelativeOrAbsolute); + + if (Application.Current.Resources.MergedDictionaries.FirstOrDefault(resourceDictionary => resourceDictionary.Source.OriginalString == resourceDictionaryUri.OriginalString) == null) + { + ResourceDictionary resourceDictionary = new ResourceDictionary(); + resourceDictionary.Source = resourceDictionaryUri; + Application.Current.Resources.MergedDictionaries.Add(resourceDictionary); + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Helpers/VisualHelper.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Helpers/VisualHelper.cs new file mode 100644 index 0000000000..57b981f93e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Helpers/VisualHelper.cs @@ -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.EDMDesigner.Core.UI.Helpers +{ + /// + /// Helperklasse, um das Navigieren durch Visual-Trees, suchen von Resourcen in den Visuals und etc... zu erleichtern + /// + public class VisualHelper + { + /// + /// Rekursiv durch den Baum des DependencyObjects durchgehen + /// + /// + /// + public static IEnumerable 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; + } + } + + /// + /// liefert das FrameworkElement mit angegebenen Namen + /// + /// + /// + /// + 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; + } + + /// + /// sucht ein SubElement eines 'templated' FrameworkElements + /// + /// + /// + /// + public static ElementType TryFindSubElement(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; + } + + /// + /// sucht ein SubElement eines 'templated' FrameworkElements + /// + /// + /// + /// + public static ElementType FindSubElement(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; + } + + /// + /// Sucht die Resource in dem FrameworkElement (dem 'hierarchischen Baum') aufwärts + /// + /// + /// + /// + /// + public static T FindResource(string key, FrameworkElement element) + { + try + { + T value = (T)element.FindResource(key); + return value; + } + catch (ResourceReferenceKeyNotFoundException) + { + throw new Exception("Control hat kein Template!"); + } + } + + /// + /// Sucht die Resource in dem FrameworkElement (dem 'hierarchischen Baum') aufwärts, + /// falls nicht gefunden, wird der Defaultwerte zurückgegeben + /// + /// + /// + /// + /// + /// + public static T FindResource(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!"); + } + } + + /// + /// Sucht das Element unter der Mouse mit dem Namen name + /// + /// + /// + /// + /// + 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; + } + } + + /// + /// Sucht das Element unter der Mouse des Typs type + /// + /// + /// + /// + /// + 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 GetElementsUnderPointer(Visual reference, Point mousePosition) + { + // Hit-test to find out the ItemsControl under the mouse-pointer. + _element = null; + _hittedElements = new List(); + _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 _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; + } + + /// + /// Gibt ein visuelles Child eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// + public static TChild GetVisualChild(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(child); + if (childOfChild != null) + return childOfChild; + } + } + return null; + } + + /// + /// Gibt ein visuelles Child mit einem bestimmten Namen eines DependencyObjects zurück. + /// + /// + /// + /// + /// + public static TChild GetVisualChild(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(child, name); + if (childOfChild != null) + return childOfChild; + } + } + return null; + } + + /// + /// Gibt ein visuelles Child mit einem bestimmten Namen eines DependencyObjects zurück. + /// + /// + /// + /// + /// Ich habe diese Methode hier aus Rückwärtskompatibilitätsgründen zurückgelassen. + public static FrameworkElement GetVisualChild(DependencyObject obj, string name) + { + return GetVisualChild(obj, name); + } + + /// + /// Gibt ein visuelles Child, welches eine übergebene Bedingung erfüllt zurück + /// + /// + /// + /// + /// + public static TChild GetVisualChild(DependencyObject obj, Func 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(child, comparePredicate); + if (childOfChild != null) + return childOfChild; + } + } + return null; + } + + /// + /// Gibt ein visuelles Child, welches eine übergebene Bedingung erfüllt zurück + /// + /// + /// + /// + /// Ich habe diese Methode hier aus Rückwärtskompatibilitätsgründen zurückgelassen. + public static FrameworkElement GetVisualChild(DependencyObject obj, Func comparePredicate) + { + return GetVisualChild(obj, comparePredicate); + } + + /// + /// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// + public static TParent GetVisualParent(DependencyObject obj) where TParent : DependencyObject + { + return GetVisualParent(obj, true); + } + + /// + /// Gibt einen visuellen Parent mit einem speziellen Namen eines DependencyObjects zurück. + /// + /// + /// + /// + /// + public static FrameworkElement GetVisualParent(DependencyObject obj, string parentName) + { + return GetVisualParent(obj, true, parent => ((FrameworkElement)parent).Name == parentName); + } + + /// + /// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// Gibt an, ob auch über einen PopupRoot weitergemacht werden soll. + /// + public static TParent GetVisualParent(DependencyObject obj, bool walkThroughPopupRoot) where TParent : DependencyObject + { + if (obj == null) + return null; + + return GetVisualParent(obj, walkThroughPopupRoot, + parent => parent != null && parent is TParent); + } + + /// + /// Gibt einen visuellen Parent eines bestimmten Typs eines DependencyObjects zurück. + /// + /// + /// + /// Gibt an, ob auch über einen PopupRoot weitergemacht werden soll. + /// Func mit dem Parent-Vergleich + /// + public static TParent GetVisualParent(DependencyObject obj, bool walkThroughPopupRoot, + Func 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(parent, walkThroughPopupRoot, comparePredicate); + } + + public static object GetVisualParentObject(DependencyObject obj, bool walkThroughPopupRoot, + Func 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); + } + + /// + /// Runs an Action in the current dispatcher. + /// + /// + public static void RunInDispatcher(Action actionToRun) + { + if (Application.Current != null) + RunInDispatcher(Application.Current.Dispatcher, actionToRun); + } + + /// + /// Runs an Action in a given dispatcher. + /// + /// + /// + public static void RunInDispatcher(Dispatcher dispatcher, Action actionToRun) + { + dispatcher.Invoke(DispatcherPriority.Background, actionToRun); + } + + /// + /// Runs through all items in the dispatcher. + /// + public static void DoEvents() + { + if (Application.Current != null) + DoEvents(Application.Current.Dispatcher); + } + + /// + /// Gives DispatcherFrames of the given Dispatcher priority, if + /// their DispatcherPriority is higher than "DispatcherPriority.Background". + /// + /// + public static void DoEvents(Dispatcher dispatcherToPause) + { + dispatcherToPause.Invoke(DispatcherPriority.Background, new System.Action(() => { })); + } + } +} + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/ICSharpCode.Data.EDMDesigner.Core.UI.csproj b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/ICSharpCode.Data.EDMDesigner.Core.UI.csproj new file mode 100644 index 0000000000..95465ec2eb --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/ICSharpCode.Data.EDMDesigner.Core.UI.csproj @@ -0,0 +1,382 @@ + + + + Debug + Any CPU + 10.0.20506 + 2.0 + {EEF5E054-4192-4A57-8FBF-E860D808A51D} + Library + Properties + ICSharpCode.Data.EDMDesigner.Core.UI + ICSharpCode.Data.EDMDesigner.Core.UI + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + x86 + False + False + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + 4.0 + + + 3.5 + + + 3.5 + + + 3.5 + + + 3.0 + + + 3.0 + + + 3.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + TypeBaseDesigner.xaml + + + + + + + + + + + + + AssociationMapping.xaml + + + ColumnComboBox.xaml + + + + + ComplexPropertiesMapping.xaml + + + + + EntityTableMapping.xaml + + + + Mapping.xaml + + + + PropertiesMapping.xaml + + + PropertyConditionComboBox.xaml + + + + + + + PropertyGrid.xaml + + + + Association.xaml + + + ComplexPropertyRelation.xaml + + + + InheritanceRelation.xaml + + + + RelationContener.xaml + + + + + + AddAssociationEnd.xaml + + + + AddAssociationWindow.xaml + + + + AddComplexPropertyWindow.xaml + + + AddComplexTypeWindow.xaml + + + AddEntityTypeWindow.xaml + + + + AddScalarPropertyWindow.xaml + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + Designer + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + {2748AD25-9C63-4E12-877B-4DCE96FBED54} + ICSharpCode.SharpDevelop + + + {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} + ICSharpCode.Core + + + {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9} + ICSharpCode.Core.Presentation + + + {BAD94D6E-4159-4CB6-B991-486F412D9BB6} + ICSharpCode.Data.Core.UI + + + {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} + ICSharpCode.Data.EDMDesigner.Core + + + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + False + .NET Framework 3.5 SP1 + false + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/AssemblyInfo.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d87ab745d3 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/AssemblyInfo.cs @@ -0,0 +1,68 @@ +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.Data.EDMDesigner.Core.UI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ICSharpCode.Data.EDMDesigner.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 +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.Converters")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.Helpers")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.UserControls")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations")] +[assembly: XmlnsDefinition("http://icsharpcode.net/data/edmdesigner/usercontrols", "ICSharpCode.Data.EDMDesigner.Core.UI.Windows")] diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Resources.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..44a6fe09f1 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ICSharpCode.Data.EDMDesigner.Core.UI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Resources.resx b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Resources.resx new file mode 100644 index 0000000000..af7dbebbac --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Settings.Designer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..8088af29f2 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ICSharpCode.Data.EDMDesigner.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; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Settings.settings b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Settings.settings new file mode 100644 index 0000000000..033d7a5e9e --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/ComplexTypeDesigner.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/ComplexTypeDesigner.cs new file mode 100644 index 0000000000..2425bf2ef3 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/ComplexTypeDesigner.cs @@ -0,0 +1,31 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType +{ + public class ComplexTypeDesigner : TypeBaseDesigner + { + public ComplexTypeDesigner(UIComplexType complexType) + : base(complexType) + { + ComplexType = complexType; + } + + public UIComplexType ComplexType { get; private set; } + + protected override void DrawRelation(UIRelatedProperty relatedProperty) + { + base.DrawRelation(relatedProperty); + foreach (var typeDesigner in Designer.Children.OfType().ToList()) + typeDesigner.DrawComplexPropertyRelation(this, relatedProperty); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/EntityTypeDesigner.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/EntityTypeDesigner.cs new file mode 100644 index 0000000000..778dcc763d --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/EntityTypeDesigner.cs @@ -0,0 +1,81 @@ +#region Usings + +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.UI.Converters; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType +{ + public class EntityTypeDesigner : TypeBaseDesigner + { + public EntityTypeDesigner(UIEntityType entityType) + : base(entityType) + { + EntityType = entityType; + entityType.BaseTypeChanged += + () => + { + if (EntityType.BusinessInstance.BaseType == null) + DeleteBaseInheritanceRelation(); + else if (_baseRelationContener == null) + DrawBaseInheritanceRelation(); + }; + entityTypeExpander.SetBinding(OpacityProperty, new Binding("IsCompletlyMapped") { Source = ((EntityType)UIType.BusinessInstance).Mapping, Converter = new BoolToOpacityConverter(), ConverterParameter = 0.75 }); + } + + public UIEntityType EntityType { get; private set; } + + private RelationContener _baseRelationContener; + + protected internal override void DrawRelations() + { + base.DrawRelations(); + DrawBaseInheritanceRelation(); + foreach (var entityTypeDesignerChild in Designer.Children.OfType().Where(etd => etd.EntityType.BusinessInstance.BaseType == EntityType.BusinessInstance).ToList()) + DrawInheritanceRelation(this, entityTypeDesignerChild); + } + + private void DrawBaseInheritanceRelation() + { + var baseEntityTypeDesigner = Designer.Children.OfType().FirstOrDefault(etd => etd.EntityType.BusinessInstance == EntityType.BusinessInstance.BaseType); + if (baseEntityTypeDesigner == null) + _baseRelationContener = null; + else + _baseRelationContener = DrawInheritanceRelation(baseEntityTypeDesigner, this); + } + + private RelationContener DrawInheritanceRelation(EntityTypeDesigner baseTypeDesigner, EntityTypeDesigner childTypeDesigner) + { + var relationContener = (from rc in Designer.Children.OfType() + let ir = rc.Content as InheritanceRelation + where ir != null && ir.FromTypeDesigner == childTypeDesigner && ir.ToTypeDesigner == baseTypeDesigner + select rc).FirstOrDefault(); + if (relationContener != null) + return relationContener; + var inheritanceRelation = new InheritanceRelation(Designer, childTypeDesigner, baseTypeDesigner, () => Designer.Children.OfType().FirstOrDefault(etd => etd.EntityType.BusinessInstance == EntityType.BusinessInstance.BaseType)); + relationContener = new RelationContener(inheritanceRelation); + Designer.Children.Add(relationContener); + relationContener.SetBinding(Canvas.LeftProperty, new Binding { Source = inheritanceRelation, Path = new PropertyPath("CanvasLeft") }); + relationContener.SetBinding(Canvas.TopProperty, new Binding { Source = inheritanceRelation, Path = new PropertyPath("CanvasTop") }); + baseTypeDesigner.AddRelationContenerWithoutRelatedProperty(relationContener); + childTypeDesigner.AddRelationContenerWithoutRelatedProperty(relationContener); + return relationContener; + } + + public void DeleteBaseInheritanceRelation() + { + if (_baseRelationContener != null) + { + Designer.Children.Remove(_baseRelationContener); + _baseRelationContener = null; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.Commands.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.Commands.cs new file mode 100644 index 0000000000..e30bc2b9b4 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.Commands.cs @@ -0,0 +1,745 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using System.Windows.Input; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Property; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu; +using ICSharpCode.Data.EDMDesigner.Core.UI.Windows; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Association; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType +{ + partial class TypeBaseDesigner + { + private const string CONTEXTMENU_RESOURCE_NAME = "ContextMenu"; + private const string MENUITEM_ADD = "addMenuItem"; + private const string MENUITEM_ADD_SCALAR_PROPERTY = "addScalarPropertyMenuItem"; + private const string MENUITEM_ADD_COMPLEX_PROPERTY = "addComplexPropertyMenuItem"; + private const string MENUITEM_ADD_NAVIGATION_PROPERTY = "addNavigationPropertyMenuItem"; + private const string MENUITEM_RENAME = "renameMenuItem"; + private const string MENUITEM_DELETE = "deleteMenuItem"; + private const string MENUITEM_REMOVE_FROM_DESIGNER = "removeFromDesignerMenuItem"; + private const string MENUITEM_CUT = "cutMenuItem"; + private const string MENUITEM_COPY = "copyMenuItem"; + private const string MENUITEM_PASTE = "pasteMenuItem"; + private const string MENUITEM_PROPERTIES = "propertiesMenuItem"; + private const string MENUITEM_MAPPING = "mappingMenuItem"; + private const string MENUITEM_SHOW_BASE_TYPE = "showBaseMenuItem"; + private const string MENUITEM_SHOW_RELATED_TYPE = "showRelatedMenuItem"; + private const string MENUITEM_SHOW_OTHER_TABS = "showOtherTabsMenuItem"; + + public static string AddPropertyText + { + get + { + return "Add"; + } + } + + private static RoutedCommand _addScalarPropertyCommand; + public static RoutedCommand AddScalarPropertyCommand + { + get + { + if (_addScalarPropertyCommand == null) + _addScalarPropertyCommand = new RoutedCommand(); + return _addScalarPropertyCommand; + } + } + public static string AddScalarPropertyText + { + get + { + return "Add scalar property"; + } + } + + private static RoutedCommand _addComplexPropertyCommand; + public static RoutedCommand AddComplexPropertyCommand + { + get + { + if (_addComplexPropertyCommand == null) + _addComplexPropertyCommand = new RoutedCommand(); + return _addComplexPropertyCommand; + } + } + public static string AddComplexPropertyText + { + get + { + return "Add complex property"; + } + } + + private static RoutedCommand _addNavigationPropertyCommand; + public static RoutedCommand AddNavigationPropertyCommand + { + get + { + if (_addNavigationPropertyCommand == null) + _addNavigationPropertyCommand = new RoutedCommand(); + return _addNavigationPropertyCommand; + } + } + public static string AddNavigationPropertyText + { + get + { + return "Add navigation property"; + } + } + + private static RoutedCommand _renameCommand; + public static RoutedCommand RenameCommand + { + get + { + if (_renameCommand == null) + _renameCommand = new RoutedCommand(); + return _renameCommand; + } + } + public static string RenameText + { + get + { + return "Rename"; + } + } + + private static RoutedCommand _deleteCommand; + public static RoutedCommand DeleteCommand + { + get + { + if (_deleteCommand == null) + _deleteCommand = new RoutedCommand(); + return _deleteCommand; + } + } + public static string DeleteText + { + get + { + return "Delete"; + } + } + + private static RoutedCommand _cutCommand; + public static RoutedCommand CutCommand + { + get + { + if (_cutCommand == null) + _cutCommand = new RoutedCommand(); + return _cutCommand; + } + } + public static string CutText + { + get + { + return "Cut"; + } + } + + private static RoutedCommand _copyCommand; + public static RoutedCommand CopyCommand + { + get + { + if (_copyCommand == null) + _copyCommand = new RoutedCommand(); + return _copyCommand; + } + } + public static string CopyText + { + get + { + return "Copy"; + } + } + + private static RoutedCommand _pasteCommand; + public static RoutedCommand PasteCommand + { + get + { + if (_pasteCommand == null) + _pasteCommand = new RoutedCommand(); + return _pasteCommand; + } + } + public static string PasteText + { + get + { + return "Paste"; + } + } + + private static RoutedCommand _propertiesCommand; + public static RoutedCommand PropertiesCommand + { + get + { + if (_propertiesCommand == null) + _propertiesCommand = new RoutedCommand(); + return _propertiesCommand; + } + } + public static string PropertiesText + { + get + { + return "Properties"; + } + } + + private static RoutedCommand _mappingCommand; + public static RoutedCommand MappingCommand + { + get + { + if (_mappingCommand == null) + _mappingCommand = new RoutedCommand(); + return _mappingCommand; + } + } + public static string MappingText + { + get + { + return "Mapping"; + } + } + + private static RoutedCommand _showBaseTypeCommand; + public static RoutedCommand ShowBaseTypeCommand + { + get + { + if (_showBaseTypeCommand == null) + _showBaseTypeCommand = new RoutedCommand(); + return _showBaseTypeCommand; + } + } + public static string ShowBaseText + { + get + { + return "Show base type"; + } + } + + private static RoutedCommand _showRelatedTypeCommand; + public static RoutedCommand ShowRelatedTypeCommand + { + get + { + if (_showRelatedTypeCommand == null) + _showRelatedTypeCommand = new RoutedCommand(); + return _showRelatedTypeCommand; + } + } + public static string ShowRelatedText + { + get + { + return "Show related type"; + } + } + + private static RoutedCommand _showOtherTabsCommand; + public static RoutedCommand ShowOtherTabsCommand + { + get + { + if (_showOtherTabsCommand == null) + _showOtherTabsCommand = new RoutedCommand(); + return _showOtherTabsCommand; + } + } + public static string ShowOtherTabsText + { + get + { + return "Show other tabs"; + } + } + + private static RoutedCommand _showOtherTabsItemCommand; + public static RoutedCommand ShowOtherTabsItemCommand + { + get + { + if (_showOtherTabsItemCommand == null) + _showOtherTabsItemCommand = new RoutedCommand(); + return _showOtherTabsItemCommand; + } + } + + private bool _groupRightClick; + + private new ContextMenu.ContextMenu ContextMenu + { + get + { + return FindResource(CONTEXTMENU_RESOURCE_NAME) as ContextMenu.ContextMenu; + } + } + + private void InitContextMenuCommandBindings() + { + CommandBindings.AddRange( + new[] + { + new CommandBinding(AddScalarPropertyCommand, + delegate + { + var addScalarPropertyWindow = new AddScalarPropertyWindow{ Owner = Application.Current.MainWindow}; + switch (addScalarPropertyWindow.ShowDialog()) + { + case true: + var uiScalarProperty = UIType.AddScalarProperty(addScalarPropertyWindow.PropertyName, addScalarPropertyWindow.PropertyType.Value); + SizeChangedEventHandler actionToDoWhenNewItemAdded = null; + actionToDoWhenNewItemAdded = + delegate + { + propertiesListView.SelectedValue = uiScalarProperty; + GetListViewItem(uiScalarProperty.BusinessInstance as ScalarProperty).Focus(); + propertiesListView.SizeChanged -= actionToDoWhenNewItemAdded; + }; + propertiesListView.SizeChanged += actionToDoWhenNewItemAdded; + break; + } + }, + (sender, e) => e.CanExecute = ApplyNotVisibleIfMoreThanOneTypeSelected(ContextMenu.GetMenuItem(MENUITEM_ADD, MENUITEM_ADD_SCALAR_PROPERTY)) + ), + new CommandBinding(AddComplexPropertyCommand, + delegate + { + var addComplexPropertyWindow = new AddComplexPropertyWindow(ComplexTypesAllowedForComplexProperty) { Owner = Application.Current.MainWindow, DataContext = UIType.View}; + switch (addComplexPropertyWindow.ShowDialog()) + { + case true: + var uiComplexType = addComplexPropertyWindow.PropertyType; + var businessComplexType = uiComplexType.BusinessInstance; + var uiComplexProperty = UIType.AddComplexProperty(addComplexPropertyWindow.PropertyName, businessComplexType); + DrawComplexPropertyRelationAfterAddedComplexProperty(uiComplexType, uiComplexProperty); + break; + } + }, + (sender, e) => e.CanExecute = ApplyNotVisibleIfMoreThanOneTypeSelected(ContextMenu.GetMenuItem(MENUITEM_ADD, MENUITEM_ADD_COMPLEX_PROPERTY)) && ComplexTypesAllowedForComplexProperty.Any() + ), + new CommandBinding(RenameCommand, + (sender, e) => Rename(e.OriginalSource), + (sender, e) => + { + var renameMenuItem = ContextMenu.GetMenuItem(MENUITEM_RENAME); + if (SetVisibility(renameMenuItem, () => ApplyNotVisibleIfMoreThanOneTypeSelected(renameMenuItem) && ! _groupRightClick)) + e.CanExecute = (e.OriginalSource == this || propertiesListView.SelectedItems.Count == 1); + else + e.CanExecute = false; + } + ), + new CommandBinding(DeleteCommand, + (sender, e) => Delete(e.OriginalSource), + (sender, e) => + { + var deleteMenuItem = ContextMenu.GetMenuItem(MENUITEM_DELETE); + if (SetVisibility(deleteMenuItem, () => AllowDelete(deleteMenuItem))) + e.CanExecute = true; + else + e.CanExecute = false; + } + ), + new CommandBinding(DesignerCanvas.RemoveFromDesignerCommand, + delegate { Designer.RemoveFromDesigner(); }, + (sender, e) => e.CanExecute = SetVisibility(ContextMenu.GetMenuItem(MENUITEM_REMOVE_FROM_DESIGNER), () => ! PropertiesTreeViewFocused) + ), + new CommandBinding(CutCommand, + delegate { CutSelectedProperties(); }, + (sender, e) => e.CanExecute = ApplyCutCopyVisible(ContextMenu.GetMenuItem(MENUITEM_CUT)) + ), + new CommandBinding(CopyCommand, + delegate { CopySelectedProperties(); }, + (sender, e) => e.CanExecute = ApplyCutCopyVisible(ContextMenu.GetMenuItem(MENUITEM_COPY)) + ), + new CommandBinding(PasteCommand, + delegate + { + PasteClipboardProperties(); + }, + (sender, e) => e.CanExecute = ApplyPasteVisible() && CanPaste() + ), + new CommandBinding(PropertiesCommand, + delegate + { + var focusedObject = VisualTreeHelperUtil.GetFocusedElement(this); + if (VisualTreeHelperUtil.IsAscendant(propertiesListView, focusedObject)) + Designer.Container.ShowPropertiesTab((UIProperty)propertiesListView.SelectedItem); + else + Designer.Container.ShowPropertiesTab(UIType); + }, + (sender, e) => + { + var propertiesMenuItem = ContextMenu.GetMenuItem(MENUITEM_PROPERTIES); + if (SetVisibility(propertiesMenuItem, () => ApplyNotVisibleIfMoreThanOneTypeSelected(propertiesMenuItem) && !_groupRightClick && (!PropertiesTreeViewFocused || propertiesListView.SelectedItems.Count == 1))) + e.CanExecute = true; + else + e.CanExecute = false; + } + ), + new CommandBinding(MappingCommand, + delegate + { + var focusedObject = VisualTreeHelperUtil.GetFocusedElement(this); + Designer.Container.ShowMappingTab(UIType); + }, + (sender, e) => + { + var mappingMenuItem = ContextMenu.GetMenuItem(MENUITEM_MAPPING); + if (SetVisibility(mappingMenuItem, () => ApplyNotVisibleIfMoreThanOneTypeSelected(mappingMenuItem) && !_groupRightClick && (!PropertiesTreeViewFocused || propertiesListView.SelectedItems.Count == 1))) + e.CanExecute = true; + else + e.CanExecute = false; + } + ), + new CommandBinding(ShowBaseTypeCommand, + delegate { Designer.UITypeToAdd = Designer.EDMView.CSDL.EntityTypes[((EntityType)UIType.BusinessInstance).BaseType]; }, + (sender, e) => + { + var showBaseMenuItem = ContextMenu.GetMenuItem(MENUITEM_SHOW_BASE_TYPE); + var entityType = UIType.BusinessInstance as EntityType; + if (SetVisibility(showBaseMenuItem, () => ApplyNotVisibleIfMoreThanOneTypeSelected(showBaseMenuItem) && !_groupRightClick && (!PropertiesTreeViewFocused || propertiesListView.SelectedItems.Count == 1) && entityType != null && entityType.BaseType != null)) + e.CanExecute = ! Designer.DesignerView.ContainsEntityType(entityType.BaseType); + else + e.CanExecute = false; + } + ), + new CommandBinding(ShowRelatedTypeCommand, + delegate { Designer.UITypeToAdd = ((UIRelatedProperty)propertiesListView.SelectedItem).RelatedType; }, + (sender, e) => + { + var showRelatedTypeMenuItem = ContextMenu.GetMenuItem(MENUITEM_SHOW_RELATED_TYPE); + if (SetVisibility(showRelatedTypeMenuItem, () => ApplyNotVisibleIfMoreThanOneTypeSelected(showRelatedTypeMenuItem) && propertiesListView.SelectedItems.Count == 1 && propertiesListView.SelectedItem is UIRelatedProperty && !_groupRightClick)) + e.CanExecute = !Designer.DesignerView.ContainsEntityType(((UIRelatedProperty)propertiesListView.SelectedItem).RelatedType); + else + e.CanExecute = false; + } + ), + new CommandBinding(ShowOtherTabsCommand, + delegate { }, + (sender, e) => + { + var showOtherTabsMenuItem = ContextMenu.GetMenuItem(MENUITEM_SHOW_OTHER_TABS); + var designerViews = Designer.EDMView.DesignerViews.Except(new []{ Designer.DesignerView}).Where(dv => dv.TypeDesignersLocations.Any(tdl => tdl.UIType.BusinessInstance == UIType.BusinessInstance)); + e.CanExecute = designerViews.Any(); + if (e.CanExecute) + ShowDesignerCanvasPreviews(Designer.EDMView, UIType, showOtherTabsMenuItem, designerViews); + else + showOtherTabsMenuItem.Items.Clear(); + } + ) + //new CommandBinding(ShowOtherTabsItemCommand, (sender, e) => ((IEDMDesignerWindow)VisualTreeHelperUtil.GetControlAscendant(this)).CurrentDesignerView = (DesignerView)e.Parameter) + } + ); + var uiEntityType = UIType as UIEntityType; + if (uiEntityType == null) + { + MenuItem addNavigationPropertyMenuItem = ContextMenu.GetMenuItem(MENUITEM_ADD, MENUITEM_ADD_NAVIGATION_PROPERTY); + if (addNavigationPropertyMenuItem != null) + addNavigationPropertyMenuItem.Visibility = Visibility.Collapsed; + } + else + { + CommandBindings.Add(new CommandBinding(AddNavigationPropertyCommand, + DesignerCanvas.AddAssociationExecuted(this, () => UIType.View, () => Designer.DesignerView, uiEntityType, + (UIAssociation uiAssociation) => + { + if (uiAssociation.NavigationProperty1.ParentType == UIType) + { + propertiesListView.SelectedValue = uiAssociation.NavigationProperty1; + GetListViewItem(uiAssociation.NavigationProperty1.BusinessInstance).Focus(); + } + } + ), + (sender, e) => e.CanExecute = ApplyNotVisibleIfMoreThanOneTypeSelected(ContextMenu.GetMenuItem(MENUITEM_ADD, MENUITEM_ADD_NAVIGATION_PROPERTY)) + )); + } + + ContextMenuOpening += + (sender, e) => + { + if (MoreThanOneTypeSelected && (_groupRightClick || PropertiesTreeViewFocused)) + e.Handled = true; + ApplyNotVisibleIfMoreThanOneTypeSelected(ContextMenu.GetMenuItem(MENUITEM_ADD)); + }; + } + + public static void ShowDesignerCanvasPreviews(EDMView edmView, IUIType uiType, MenuItem showOtherTabsMenuItem, IEnumerable designerViews) + { + if (showOtherTabsMenuItem.ItemsSource == null) + showOtherTabsMenuItem.Items.Add(new MenuItem()); + var designerCanvasPreviews = new List(); + Action designerCanvasPreviewCreated = dcp => designerCanvasPreviews.Add(dcp); + showOtherTabsMenuItem.SubmenuOpened += delegate + { + if (!designerCanvasPreviews.Any()) + DesignerCanvasPreview.DesignerCanvasPreviewCreated += designerCanvasPreviewCreated; + if (showOtherTabsMenuItem.ItemsSource == null) + showOtherTabsMenuItem.Items.Clear(); + showOtherTabsMenuItem.ItemsSource = designerViews; + Init = true; + DesignerCanvasPreview.EDMView = edmView; + DesignerCanvasPreview.UIType = uiType; + }; + showOtherTabsMenuItem.SubmenuClosed += delegate + { + Init = false; + DesignerCanvasPreview.DesignerCanvasPreviewCreated -= designerCanvasPreviewCreated; + }; + } + + private IEnumerable ComplexTypesAllowedForComplexProperty + { + get + { + IEnumerable value = UIType.View.ComplexTypes; + UIComplexType uiTypeAsComplexType; + if ((uiTypeAsComplexType = UIType as UIComplexType) != null) + value = value.Except(new[] { uiTypeAsComplexType }); + return value; + } + } + + private void DrawComplexPropertyRelationAfterAddedComplexProperty(UIComplexType uiComplexType, UIRelatedProperty uiComplexProperty) + { + SizeChangedEventHandler actionToDoWhenNewItemAdded = null; + actionToDoWhenNewItemAdded = + delegate + { + var complexProperty = uiComplexProperty.BusinessInstance as ComplexProperty; + if (Designer.DesignerView.ContainsEntityType(uiComplexType)) + DrawComplexPropertyRelation(GetRelatedTypeDesigner(uiComplexProperty), uiComplexProperty); + propertiesListView.SelectedValue = uiComplexProperty; + GetListViewItem(complexProperty).Focus(); + propertiesListView.SizeChanged -= actionToDoWhenNewItemAdded; + }; + propertiesListView.SizeChanged += actionToDoWhenNewItemAdded; + } + + private bool MoreThanOneTypeSelected + { + get { return Designer.TypesSelected.Skip(1).Any(); } + } + + private bool SetVisibility(MenuItem menuItem, Func visibilityFunc) + { + if (visibilityFunc()) + { + menuItem.Visibility = Visibility.Visible; + return true; + } + menuItem.Visibility = Visibility.Collapsed; + return false; + } + + private bool ApplyNotVisibleIfMoreThanOneTypeSelected(MenuItem menuItem) + { + var value = !MoreThanOneTypeSelected; + menuItem.Visibility = value ? Visibility.Visible : Visibility.Collapsed; + return value; + } + + private bool PropertiesTreeViewFocused + { + get { return VisualTreeHelperUtil.IsAscendant(propertiesListView, VisualTreeHelperUtil.GetFocusedElement(this)); } + } + + public bool CanCutCopy() + { + return !(MoreThanOneTypeSelected || propertiesListView.SelectedItems.OfType().Any(uire => uire.BusinessInstance is NavigationProperty)) && PropertiesTreeViewFocused; + } + + public bool CanPaste() + { + return !MoreThanOneTypeSelected && Clipboard.ContainsText() && Clipboard.GetText() == _clipBoardCache.Key.ToString(); + } + + private bool ApplyCutCopyVisible(MenuItem menuItem) + { + if (ApplyNotVisibleIfMoreThanOneTypeSelected(menuItem)) + { + var value = !_groupRightClick && CanCutCopy(); + menuItem.Visibility = value ? Visibility.Visible : Visibility.Collapsed; + return value; + } + return false; + } + private bool ApplyPasteVisible() + { + var pasteMenuItem = ContextMenu.GetMenuItem(MENUITEM_PASTE); + if (ApplyNotVisibleIfMoreThanOneTypeSelected(pasteMenuItem)) + { + var value = !_groupRightClick; + pasteMenuItem.Visibility = value ? Visibility.Visible : Visibility.Collapsed; + return value; + } + return false; + } + + protected virtual void Rename(object originalSource) + { + if (_groupRightClick) + return; + var editableTextBlock = originalSource as EditableTextBlock; + if (editableTextBlock != null) + { + editableTextBlock.Edit(); + return; + } + if (originalSource == this) + { + if (propertiesListView.SelectedItem != null) + { + var listViewItem = GetListViewItem(((UIProperty)propertiesListView.SelectedItem).BusinessInstance); + if (listViewItem.IsFocused && RenameProperty(listViewItem)) + return; + } + var selectedControl = VisualTreeHelperUtil.GetFocusedElement(this); + editableTextBlock = selectedControl as EditableTextBlock; + if (editableTextBlock != null) + { + editableTextBlock.Edit(); + return; + } + if (selectedControl is System.Windows.Controls.ListViewItem && RenameProperty(selectedControl)) + return; + entityHeaderEditableTextBlock.Edit(); + return; + } + if (originalSource is System.Windows.Controls.ListViewItem) + RenameProperty(originalSource); + } + + private bool RenameProperty(object listViewItem) + { + var editableTextBlock = VisualTreeHelperUtil.GetControlsDecendant(listViewItem).First(); + if (editableTextBlock != null) + { + editableTextBlock.Edit(); + return true; + } + return false; + } + + private bool AllowDelete() + { + return AllowDelete(ContextMenu.GetMenuItem(MENUITEM_DELETE)); + } + private bool AllowDelete(MenuItem deleteMenuItem) + { + return !_groupRightClick && (!PropertiesTreeViewFocused || ApplyNotVisibleIfMoreThanOneTypeSelected(deleteMenuItem)); + } + protected virtual void Delete(object originalSource) + { + if (!AllowDelete()) + return; + if (originalSource == this) + Designer.DeleteSelectedTypes(); + else + DeleteSelectedProperties(); + } + + private void DeleteSelectedProperties() + { + foreach (var uiProperty in propertiesListView.SelectedItems.OfType().ToList()) + { + var uiRelatedProperty = uiProperty as UIRelatedProperty; + if (uiRelatedProperty != null && RelationsContenerByRelatedProperty.ContainsKey(uiRelatedProperty)) + { + var relationContener = RelationsContenerByRelatedProperty[uiRelatedProperty]; + Designer.Children.Remove(relationContener); + relationContener.OnRemove(); + } + UIType.DeleteProperty(uiProperty); + } + } + + private static KeyValuePair> _clipBoardCache; + public void CopySelectedProperties() + { + Clipboard.Clear(); + var key = Guid.NewGuid(); + _clipBoardCache = new KeyValuePair>(key, propertiesListView.SelectedItems.OfType().Select(uip => uip.BusinessInstance).ToList()); + Clipboard.SetData(DataFormats.Text, key.ToString()); + } + + public void CutSelectedProperties() + { + CopySelectedProperties(); + DeleteSelectedProperties(); + } + + public void PasteClipboardProperties() + { + foreach (var property in _clipBoardCache.Value) + { + var duplicateProperty = UIType.BusinessInstance.DuplicateProperty(property); + if (property is ComplexProperty) + { + var uiComplexProperty = UIType.Properties.OfType().First(uirp => uirp.BusinessInstance == duplicateProperty); + DrawComplexPropertyRelationAfterAddedComplexProperty((UIComplexType)uiComplexProperty.RelatedType, uiComplexProperty); + } + } + } + + protected override void OnPreviewMouseDown(MouseButtonEventArgs e) + { + base.OnPreviewMouseDown(e); + Designer.UITypeToAdd = null; + if (!IsSelected) + Designer.UnselectOtherTypes(this); + } + protected override void OnMouseDown(MouseButtonEventArgs e) + { + base.OnMouseDown(e); + e.Handled = true; + } + + private void Grid_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) + { + _groupRightClick = true; + } + + private void UserControl_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) + { + _groupRightClick = false; + } + + private void UserControl_PreviewKeyDown(object sender, KeyEventArgs e) + { + switch (e.Key) + { + case Key.Delete: + Delete(e.OriginalSource); + e.Handled = true; + break; + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml new file mode 100644 index 0000000000..b982510913 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml.cs new file mode 100644 index 0000000000..db4333c698 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseDesigner.xaml.cs @@ -0,0 +1,343 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Input; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Association; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Property; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Property; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType +{ + public abstract partial class TypeBaseDesigner : UserControl, INotifyPropertyChanged, ITypeDesigner + { + protected TypeBaseDesigner(IUIType uiType) + { + InitializeComponent(); + UIType = uiType; + DataContext = UIType; + InitContextMenuCommandBindings(); + entityTypeExpander.PreviewMouseDown += + (sender, e) => + { + if (e.LeftButton == MouseButtonState.Pressed && (MoreThanOneTypeSelected || ! (VisualTreeHelperUtil.GetControlAscendant(e.OriginalSource) == propertiesListView))) + SelectOrUnselect(); + else if (!IsSelected) + IsSelected = true; + }; + if (!Init) + { + SizeChangedEventHandler sizeChangedHandler = null; + sizeChangedHandler = delegate + { + DrawRelations(); + SizeChanged -= sizeChangedHandler; + }; + SizeChanged += sizeChangedHandler; + } + SizeChanged += delegate { OnMove(); }; + uiType.RelatedPropertyDeleted += uiRelatedProperty => + { + if (RelationsContenerByRelatedProperty.ContainsKey(uiRelatedProperty)) + { + Designer.Children.Remove(RelationsContenerByRelatedProperty[uiRelatedProperty]); + RelationsContenerByRelatedProperty.Remove(uiRelatedProperty); + } + }; + var uiEntityType = uiType as UIEntityType; + if (uiEntityType != null) + uiEntityType.AbstractChanged += delegate { entityTypeExpander.GetBindingExpression(TypeBaseExpander.BorderBrushProperty).UpdateTarget(); }; + } + + public static bool Init { get; set; } + + protected internal DesignerCanvas Designer + { + get + { + return (DesignerCanvas)Parent; + } + } + + protected internal virtual void DrawRelations() + { + if (UIType is UIEntityType) + foreach (var relatedProperty in UIType.Properties.OfType().Where(uirp => !RelationsContenerByRelatedProperty.ContainsKey(uirp) && Designer.DesignerView.ContainsEntityType(uirp.RelatedType))) + DrawRelation(relatedProperty); + else if (UIType is UIComplexType) + { + foreach (var relatedProperty in Designer.DesignerView.SelectMany(dv => dv.UIType.Properties).OfType().Where(uirp => uirp.RelatedType == UIType && !RelationsContenerByRelatedProperty.ContainsKey(uirp))) + { + var otherType = Designer.Children.OfType().Where(td => td.UIType.Properties.Contains(relatedProperty)).FirstOrDefault(); + if (otherType != null) + otherType.DrawRelation(relatedProperty); + } + } + } + protected virtual void DrawRelation(UIRelatedProperty relatedProperty) + { + var otherTypeDesigner = GetRelatedTypeDesigner(relatedProperty); + + var navigationProperty = (relatedProperty.BusinessInstance as NavigationProperty); + if (navigationProperty != null) + DrawAssociation(otherTypeDesigner, navigationProperty); + + if (relatedProperty.BusinessInstance is ComplexProperty) + DrawComplexPropertyRelation(otherTypeDesigner, relatedProperty); + } + + internal void DrawAssociation(TypeBaseDesigner otherTypeDesigner, NavigationProperty navigationProperty) + { + var csdlAssociation = navigationProperty.Association; + int otherTypeDesignerItemIndex; + var otherNavigationProperty = csdlAssociation.PropertiesEnd.First(np => np != navigationProperty); + var otherListViewItem = otherTypeDesigner.GetListViewItem(otherNavigationProperty, out otherTypeDesignerItemIndex); + int typeDesignerItemIndex; + var typeDesignerListViewItem = GetListViewItem(navigationProperty, out typeDesignerItemIndex); + ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association association; + if (csdlAssociation.PropertyEnd1 == navigationProperty) + association = new ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association(csdlAssociation, Designer, this, otherTypeDesigner, typeDesignerListViewItem, otherListViewItem, typeDesignerItemIndex, otherTypeDesignerItemIndex); + else + association = new ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association(csdlAssociation, Designer, otherTypeDesigner, this, otherListViewItem, typeDesignerListViewItem, otherTypeDesignerItemIndex, typeDesignerItemIndex); + var relationContener = new RelationContener(association); + Designer.Children.Add(relationContener); + relationContener.SetBinding(Canvas.LeftProperty, new Binding { Source = association, Path = new PropertyPath("CanvasLeft") }); + relationContener.SetBinding(Canvas.TopProperty, new Binding { Source = association, Path = new PropertyPath("CanvasTop") }); + AddRelationContenerByRelatedProperty(UIType.Properties[navigationProperty], relationContener); + otherTypeDesigner.AddRelationContenerByRelatedProperty(otherTypeDesigner.UIType.Properties[otherNavigationProperty], relationContener); + NotifyCollectionChangedEventHandler mappingCollectionChanged = delegate + { + VisualTreeHelperUtil.GetControlsDecendant(otherListViewItem).First().GetBindingExpression(EditableTextBlock.OpacityProperty).UpdateTarget(); + VisualTreeHelperUtil.GetControlsDecendant(typeDesignerListViewItem).First().GetBindingExpression(EditableTextBlock.OpacityProperty).UpdateTarget(); + }; + csdlAssociation.PropertyEnd1.Mapping.CollectionChanged += mappingCollectionChanged; + csdlAssociation.PropertyEnd2.Mapping.CollectionChanged += mappingCollectionChanged; + } + + private TypeBaseDesigner GetRelatedTypeDesigner(UIRelatedProperty relatedProperty) + { + return GetTypeDesigner(relatedProperty.RelatedType); + } + private TypeBaseDesigner GetTypeDesigner(IUIType uiType) + { + return Designer.GetTypeDesigner(uiType); + } + + internal void DrawComplexPropertyRelation(TypeBaseDesigner otherTypeDesigner, UIRelatedProperty relatedProperty) + { + if (RelationsContenerByRelatedProperty.ContainsKey(relatedProperty) || otherTypeDesigner.RelationsContenerByRelatedProperty.ContainsKey(relatedProperty)) + return; + var complexProperty = (ComplexProperty)relatedProperty.BusinessInstance; + int typeDesignerItemIndex; + var complexPropertyRelation = new ComplexPropertyRelation(Designer, this, otherTypeDesigner, GetListViewItem(complexProperty, out typeDesignerItemIndex), typeDesignerItemIndex); + var relationContener = new RelationContener(complexPropertyRelation); + Designer.Children.Add(relationContener); + relationContener.SetBinding(Canvas.LeftProperty, new Binding { Source = complexPropertyRelation, Path = new PropertyPath("CanvasLeft") }); + relationContener.SetBinding(Canvas.TopProperty, new Binding { Source = complexPropertyRelation, Path = new PropertyPath("CanvasTop") }); + AddRelationContenerByRelatedProperty(UIType.Properties[complexProperty], relationContener); + otherTypeDesigner.AddRelationContenerWithoutRelatedProperty(relationContener); + } + + private Dictionary _relationsContenerByRelatedProperty; + private Dictionary RelationsContenerByRelatedProperty + { + get + { + if (_relationsContenerByRelatedProperty == null) + _relationsContenerByRelatedProperty = new Dictionary(); + return _relationsContenerByRelatedProperty; + } + } + protected void AddRelationContenerByRelatedProperty(UIProperty uiProperty, RelationContener relationContener) + { + var uiRelatedProperty = uiProperty as UIRelatedProperty; + if (!(uiRelatedProperty == null || RelationsContenerByRelatedProperty.ContainsKey(uiRelatedProperty))) + { + RelationsContenerByRelatedProperty.Add(uiRelatedProperty, relationContener); + relationContener.Removed += () => RelationsContenerByRelatedProperty.Remove(uiRelatedProperty); + } + } + private List _relationsContenerWithoutRelatedProperty; + private List RelationsContenerWithoutRelatedProperty + { + get + { + if (_relationsContenerWithoutRelatedProperty == null) + _relationsContenerWithoutRelatedProperty = new List(); + return _relationsContenerWithoutRelatedProperty; + } + } + protected void AddRelationContenerWithoutRelatedProperty(RelationContener relationContener) + { + if (!(relationContener == null || RelationsContenerWithoutRelatedProperty.Contains(relationContener))) + { + RelationsContenerWithoutRelatedProperty.Add(relationContener); + relationContener.Removed += () => RelationsContenerWithoutRelatedProperty.Remove(relationContener); + } + } + public IEnumerable RelationsContener + { + get + { + return RelationsContenerByRelatedProperty.Values.Union(RelationsContenerWithoutRelatedProperty).Distinct(); + } + } + + internal ListViewItem GetListViewItem(NavigationProperty navigationProperty, out int index) + { + var value = (from lvi in VisualTreeHelperUtil.GetControlsDecendant(propertiesListView) + let uiRelatedProperty = lvi.Content as UIRelatedProperty + where uiRelatedProperty != null + select new { ListViewItem = lvi, UIRelatedProperty = uiRelatedProperty }).Select((lvi, i) => new { ListViewItem = lvi, Index = i }).First(lvi => lvi.ListViewItem.UIRelatedProperty.BusinessInstance == navigationProperty); + index = value.Index; // +navigationProperty.EntityType.ComplexProperties.Count; + return value.ListViewItem.ListViewItem; + } + internal ListViewItem GetListViewItem(ComplexProperty complexProperty, out int index) + { + var value = (from lvi in VisualTreeHelperUtil.GetControlsDecendant(propertiesListView) + let uiRelatedProperty = lvi.Content as UIRelatedProperty + where uiRelatedProperty != null + select new { ListViewItem = lvi, UIRelatedProperty = uiRelatedProperty }).Select((lvi, i) => new { ListViewItem = lvi, Index = i }).First(lvi => lvi.ListViewItem.UIRelatedProperty.BusinessInstance == complexProperty); + index = value.Index; + return value.ListViewItem.ListViewItem; + } + internal ListViewItem GetListViewItem(PropertyBase property) + { + return (from lvi in VisualTreeHelperUtil.GetControlsDecendant(propertiesListView) + let uiProperty = lvi.Content as UIProperty + where uiProperty != null && uiProperty.BusinessInstance == property + select lvi).First(); + } + + internal void OnMove() + { + foreach (var relationContener in RelationsContener) + if (Designer.DesignerView.ContainsEntityType(relationContener.FromTypeDesigner.UIType) && Designer.DesignerView.ContainsEntityType(relationContener.ToTypeDesigner.UIType)) + relationContener.OnMove(); + } + + private void SelectOrUnselect() + { + if (KeyboardUtil.CtrlDown) + IsSelected ^= true; + else if (!IsSelected) + IsSelected = true; + } + + public IUIType UIType { get; private set; } + + public static TypeBaseDesigner Load(IUIType uiType) + { + var uiEntityType = uiType as UIEntityType; + if (uiEntityType != null) + return new EntityTypeDesigner(uiEntityType); + var uiComplexType = uiType as UIComplexType; + if (uiComplexType != null) + return new ComplexTypeDesigner(uiComplexType); + throw new NotImplementedException(); + } + + public bool IsSelected + { + get { return (bool)GetValue(IsSelectedProperty); } + set + { + SetValue(IsSelectedProperty, value); + if (value) + OnSelected(); + } + } + public static readonly DependencyProperty IsSelectedProperty = + DependencyProperty.Register("IsSelected", typeof(bool), typeof(TypeBaseDesigner), new UIPropertyMetadata(false, (sender, e) => ((TypeBaseDesigner)sender).Designer.OnSelectionChanged())); + + protected virtual void OnSelected() + { + if (Selected != null) + Selected(); + } + + public event Action Selected; + + public bool IsExpanded + { + get + { + return entityTypeExpander.IsExpanded; + } + set + { + entityTypeExpander.IsExpanded = value; + } + } + + private void EntityTypeExpander_Click() + { + Focus(); + } + + private void EntityTypeExpander_CollapsedOrExpand(object sender, RoutedEventArgs e) + { + OnPropertyChanged("IsExpanded"); + } + + public object Selection + { + get { return PropertiesTreeViewFocused && propertiesListView.SelectedValue != null ? (object)((UIProperty)propertiesListView.SelectedValue).BusinessInstance : (object)UIType.BusinessInstance; } + } + private void PropertiesListView_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (Designer != null) + Designer.OnSelectionChanged(); + } + private void PropertiesListView_GotFocus(object sender, RoutedEventArgs e) + { + if (propertiesListView.SelectedValue != null) + Designer.OnSelectionChanged(); + } + private void PropertiesListView_LostFocus(object sender, RoutedEventArgs e) + { + if (Designer.IsFocused || VisualTreeHelperUtil.GetFocusedElement(Designer) != null) + Designer.OnSelectionChanged(); + } + private void TypeBaseDesigner_GotFocus(object sender, RoutedEventArgs e) + { + Designer.OnSelectionChanged(); + } + + protected virtual void OnPropertyChanged(string propertyName) + { + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + public event PropertyChangedEventHandler PropertyChanged; + + IUIType ITypeDesigner.UIType + { + get { return UIType; } + set { UIType = value; } + } + + public double Left + { + get { return Canvas.GetLeft(this); } + set { Canvas.SetLeft(this, value); } + } + public double Top + { + get { return Canvas.GetTop(this); } + set { Canvas.SetTop(this, value); } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseExpander.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseExpander.cs new file mode 100644 index 0000000000..b2eee4a4c7 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseExpander.cs @@ -0,0 +1,38 @@ +#region Usings + +using System; +using System.Windows.Input; +using System.Windows.Controls; +using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType +{ + public class TypeBaseExpander : Expander + { + static TypeBaseExpander() + { + ResourceDictionaryLoader.LoadResourceDictionary("/UserControls/CSDLType/TypeBaseExpanderResourceDictionary.xaml"); + } + + protected override void ClickOnTheHeader() + { + base.ClickOnTheHeader(); + OnClick(); + } + protected override void OnMouseDown(MouseButtonEventArgs e) + { + base.OnMouseDown(e); + OnClick(); + } + + protected virtual void OnClick() + { + if (Click != null) + Click(); + } + + public event Action Click; + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseExpanderResourceDictionary.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseExpanderResourceDictionary.xaml new file mode 100644 index 0000000000..e2cdc3e3cf --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLType/TypeBaseExpanderResourceDictionary.xaml @@ -0,0 +1,134 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLTypeItem.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLTypeItem.cs new file mode 100644 index 0000000000..552d074b15 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLTypeItem.cs @@ -0,0 +1,44 @@ +#region Usings + +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Input; +using ICSharpCode.Data.EDMDesigner.Core.UI.Converters; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + public class CSDLTypeItem : TextBlock + { + static CSDLTypeItem() + { + ResourceDictionaryLoader.LoadResourceDictionary("/UserControls/CSDLTypeResourceDictionary.xaml"); + } + + public IUIType UIType + { + get { return (IUIType)GetValue(UITypeProperty); } + set { SetValue(UITypeProperty, value); } + } + + public static readonly DependencyProperty UITypeProperty = + DependencyProperty.Register("UIType", typeof(IUIType), typeof(CSDLTypeItem), new UIPropertyMetadata(null, + (sender, e) => + { + var entityType = e.NewValue as UIEntityType; + if (entityType != null) + ((CSDLTypeItem)sender).SetBinding(OpacityProperty, new Binding("IsCompletlyMapped") { Source = (entityType.BusinessInstance).Mapping, Converter = new BoolToOpacityConverter(), ConverterParameter = 0.5 }); + })); + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + if (e.LeftButton == MouseButtonState.Pressed) + DragDrop.DoDragDrop(this, UIType, DragDropEffects.Copy); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLTypeResourceDictionary.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLTypeResourceDictionary.xaml new file mode 100644 index 0000000000..831532510f --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/CSDLTypeResourceDictionary.xaml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ComboBoxEditableWhenFocused.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ComboBoxEditableWhenFocused.cs new file mode 100644 index 0000000000..c198b269db --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ComboBoxEditableWhenFocused.cs @@ -0,0 +1,62 @@ +using System; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; +using System.Windows.Data; + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + public class ComboBoxEditableWhenFocused : ComboBox + { + public ComboBoxEditableWhenFocused() + { + SetBinding(IsEditableProperty, new Binding("IsOrHisChildrenAreFocused") { Source = this }); + GotFocus += delegate { IsOrHisChildrenAreFocused = true; }; + } + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + TextBox textBox = null; + foreach (var tb in VisualTreeHelperUtil.GetControlsDecendant(this).Where(uie => uie.Focusable)) + { + textBox = tb; + tb.GotFocus += (sender, e) => OnControlGotFous((UIElement)sender); + tb.LostFocus += + delegate + { + IsOrHisChildrenAreFocused = IsOrHisChildrenAreFocused; + if (SelectedItem == null) + SelectedItem = Items[0]; + }; + } + if (textBox != null) + { + textBox.Focus(); + textBox.SelectAll(); + } + } + + internal void SelectNullItemItemIfSelectedItemIsNull() + { + if (SelectedItem == null && Items.Count > 0) + SelectedItem = Items[0]; + } + + public bool IsOrHisChildrenAreFocused + { + get { return IsFocused || VisualTreeHelperUtil.GetControlsDecendant(this).Any(uie => uie.IsFocused); } + set { SetValue(IsOrHisChildrenAreFocusedProperty, value); } + } + public static readonly DependencyProperty IsOrHisChildrenAreFocusedProperty = + DependencyProperty.Register("IsOrHisChildrenAreFocused", typeof(bool), typeof(ComboBoxEditableWhenFocused), new UIPropertyMetadata(false)); + + protected virtual void OnControlGotFous(UIElement control) + { + if (ControlGotFocus != null) + ControlGotFocus(control); + } + public event Action ControlGotFocus; + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/ComboBoxSelectedValueBindingWithNull.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/ComboBoxSelectedValueBindingWithNull.cs new file mode 100644 index 0000000000..9969dafe21 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/ComboBoxSelectedValueBindingWithNull.cs @@ -0,0 +1,43 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.ComponentModel; +using System.Windows; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common +{ + public class ComboBoxSelectedValueBindingWithNull where T : class + { + public ComboBoxSelectedValueBindingWithNull(object defaultValue, Action setProperty) + { + if (defaultValue != null) + ComboSelectedValue = defaultValue; + SetProperty = setProperty; + } + + public Action SetProperty { get; private set; } + + private object _comboSelectedValue; + public object ComboSelectedValue + { + get { return _comboSelectedValue; } + set + { + _comboSelectedValue = value; + if (SetProperty != null) + { + T t = value as T; + if (t != null) + SetProperty(t); + else if (value is NullValue) + SetProperty(null); + } + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/KeyboardUtil.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/KeyboardUtil.cs new file mode 100644 index 0000000000..72c9d96ad5 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/KeyboardUtil.cs @@ -0,0 +1,20 @@ +#region Usings + +using System.Windows.Input; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common +{ + public static class KeyboardUtil + { + public static bool CtrlDown + { + get { return Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl); } + } + public static bool ShiftDown + { + get { return Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift); } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/NullValue.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/NullValue.cs new file mode 100644 index 0000000000..b265a18658 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/NullValue.cs @@ -0,0 +1,30 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common +{ + internal class NullValue + { + private NullValue() + { + } + + internal static NullValue[] GetValues(string nullText) + { + return new[] { new NullValue { NullText = nullText } }; + } + + public string NullText { get; set; } + + public override string ToString() + { + return NullText; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/VisualTreeHelperUtil.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/VisualTreeHelperUtil.cs new file mode 100644 index 0000000000..6a6fd0e59c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Common/VisualTreeHelperUtil.cs @@ -0,0 +1,70 @@ +#region Usings + +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Media3D; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common +{ + public class VisualTreeHelperUtil + { + public static T GetControlAscendant(object reference) where T : DependencyObject + { + return GetControlAscendant(reference as DependencyObject); + } + public static T GetControlAscendant(DependencyObject reference) where T : DependencyObject + { + if (reference == null || !(reference is Visual || reference is Visual3D)) + return null; + DependencyObject parent = reference; + try + { + while (!((parent = VisualTreeHelper.GetParent(parent)) == null || parent is T)) ; + return (T)parent; + } + catch + { + return null; + } + } + + public static bool IsAscendant(DependencyObject parent, DependencyObject child) + { + if (parent == null || child == null) + return false; + DependencyObject parentTmp = child; + while (!((parentTmp = VisualTreeHelper.GetParent(parentTmp)) == null || parentTmp == parent)) ; + return parentTmp != null; + } + + public static IEnumerable GetControlsDecendant(object reference) where T : DependencyObject + { + return GetControlsDecendant(reference as DependencyObject); + } + public static IEnumerable GetControlsDecendant(DependencyObject reference) where T : DependencyObject + { + if (reference == null) + yield break; + int nbChildren = VisualTreeHelper.GetChildrenCount(reference); + for (int index = 0; index < nbChildren; index++) + { + var child = VisualTreeHelper.GetChild(reference, index); + T value = child as T; + if (value != null) + yield return value; + foreach (var childValue in GetControlsDecendant(child)) + yield return childValue; + } + yield break; + } + + public static FrameworkElement GetFocusedElement(DependencyObject reference) + { + return VisualTreeHelperUtil.GetControlsDecendant(reference).FirstOrDefault(fe => fe.IsFocused); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/ContextMenu.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/ContextMenu.cs new file mode 100644 index 0000000000..aea43ec4b0 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/ContextMenu.cs @@ -0,0 +1,33 @@ +#region Usings + +using System; +using System.Windows; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu +{ + public class ContextMenu : System.Windows.Controls.ContextMenu, IMenuContainer + { + public ContextMenu() + { + Loaded += + delegate + { + foreach (var item in Items) + MenuContainerBase.AddChild(item, () => OnItemVisibleChanged()); + }; + } + protected override void AddChild(object value) + { + base.AddChild(value); + MenuContainerBase.AddChild(value, () => OnItemVisibleChanged()); + } + protected virtual void OnItemVisibleChanged() + { + if (ItemVisibleChanged != null) + ItemVisibleChanged(); + } + public event Action ItemVisibleChanged; + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/IMenuContainer.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/IMenuContainer.cs new file mode 100644 index 0000000000..70f2621d0d --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/IMenuContainer.cs @@ -0,0 +1,13 @@ +#region Usings + +using System; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu +{ + public interface IMenuContainer + { + event Action ItemVisibleChanged; + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuContainerBase.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuContainerBase.cs new file mode 100644 index 0000000000..f1f93aab5a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuContainerBase.cs @@ -0,0 +1,53 @@ +#region Usings + +using System; +using System.Linq; +using System.Windows; +using System.Windows.Controls; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu +{ + public static class MenuContainerBase + { + internal static void AddChild(object child, Action onItemVisibleChanged) + { + var menuSeparator = child as MenuSeparator; + if (menuSeparator != null) + { + menuSeparator.SetVisibilityBinding(); + return; + } + var item = child as FrameworkElement; + if (item != null) + item.IsVisibleChanged += delegate { onItemVisibleChanged(); }; + } + + public static MenuItem GetMenuItem(this IMenuContainer menuContainer, params string[] menuNames) + { + if (menuContainer == null) + return null; + var itemsControl = (ItemsControl)menuContainer; + foreach (var menuName in menuNames) + { + itemsControl = itemsControl.Items.OfType().FirstOrDefault(mi => mi.Name == menuName); + if (itemsControl == null) + return null; + } + return itemsControl as MenuItem; + } + + public static Separator GetMenuSeparator(this IMenuContainer menuContainer, params string[] menuNames) + { + if (menuContainer == null) + return null; + ItemsControl itemsControl; + if (menuNames.Length == 1) + itemsControl = (ItemsControl)menuContainer; + else + itemsControl = menuContainer.GetMenuItem(menuNames.Take(menuNames.Length - 1).ToArray()); + return itemsControl.Items.OfType().FirstOrDefault(s => s.Name == menuNames[menuNames.Length - 1]); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuItem.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuItem.cs new file mode 100644 index 0000000000..4d9e97760f --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuItem.cs @@ -0,0 +1,24 @@ +#region Usings + +using System; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu +{ + public class MenuItem : System.Windows.Controls.MenuItem, IMenuContainer + { + protected override void AddChild(object value) + { + base.AddChild(value); + MenuContainerBase.AddChild(value, () => OnItemVisibleChanged()); + } + + protected virtual void OnItemVisibleChanged() + { + if (ItemVisibleChanged != null) + ItemVisibleChanged(); + } + public event Action ItemVisibleChanged; + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuSeparator.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuSeparator.cs new file mode 100644 index 0000000000..f1da5f5a12 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ContextMenu/MenuSeparator.cs @@ -0,0 +1,21 @@ +#region Usings + +using System.Windows.Controls; +using System.Windows.Data; +using ICSharpCode.Data.EDMDesigner.Core.UI.Converters; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.ContextMenu +{ + public class MenuSeparator : Separator + { + internal void SetVisibilityBinding() + { + var parent = Parent as IMenuContainer; + if (parent != null) + parent.ItemVisibleChanged += () => GetBindingExpression(VisibilityProperty).UpdateTarget(); + SetBinding(VisibilityProperty, new Binding { Source = this, Converter = new MenuSeparatorToMenuSeparatorVisibilityConverter() }); + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.Commands.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.Commands.cs new file mode 100644 index 0000000000..87551ce7ea --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.Commands.cs @@ -0,0 +1,286 @@ +#region Usings + +using System; +using System.Collections; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Input; +using ICSharpCode.Data.EDMDesigner.Core.UI.Windows; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; +using System.Windows.Media; +using ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Association; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Property; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + partial class DesignerCanvas + { + private const string CONTEXTMENU_RESOURCE_NAME = "ContextMenu"; + private const string ZOOM_STACKPANEL = "zoomStackPanel"; + private const string ZOOM_TEXTBOX = "zoomTextBox"; + + private static RoutedCommand _addEntityTypeCommand; + public static RoutedCommand AddEntityTypeCommand + { + get + { + if (_addEntityTypeCommand == null) + _addEntityTypeCommand = new RoutedCommand(); + return _addEntityTypeCommand; + } + } + public static string AddEntityTypeText + { + get + { + return "Add entity type"; + } + } + + private static RoutedCommand _addComplexTypeCommand; + public static RoutedCommand AddComplexTypeCommand + { + get + { + if (_addComplexTypeCommand == null) + _addComplexTypeCommand = new RoutedCommand(); + return _addComplexTypeCommand; + } + } + public static string AddComplexTypeText + { + get + { + return "Add complex type"; + } + } + + private static RoutedCommand _addAssociationCommand; + public static RoutedCommand AddAssociationCommand + { + get + { + if (_addAssociationCommand == null) + _addAssociationCommand = new RoutedCommand(); + return _addAssociationCommand; + } + } + public static string AddAssociationText + { + get + { + return "Add association"; + } + } + + private static RoutedCommand _removeFromDesignerCommand; + public static RoutedCommand RemoveFromDesignerCommand + { + get + { + if (_removeFromDesignerCommand == null) + _removeFromDesignerCommand = new RoutedCommand(); + return _removeFromDesignerCommand; + } + } + public static string RemoveFromDesignerText + { + get + { + return "Remove from designer"; + } + } + + private static RoutedCommand _selectAllCommand; + public static RoutedCommand SelectAllCommand + { + get + { + if (_selectAllCommand == null) + _selectAllCommand = new RoutedCommand(); + return _selectAllCommand; + } + } + public static string SelectAllText + { + get + { + return "Select all"; + } + } + + public static string ZoomText + { + get + { + return "Zoom"; + } + } + public int Zoom + { + get { return (int)GetValue(ZoomProperty); } + set { SetValue(ZoomProperty, value); } + } + public static readonly DependencyProperty ZoomProperty = + DependencyProperty.Register("Zoom", typeof(int), typeof(DesignerCanvas), + new UIPropertyMetadata(100, + (sender, e) => + { + var designerCanvas = (DesignerCanvas)sender; + if ((int)e.NewValue < 10) + designerCanvas.Zoom = 10; + else if ((int)e.NewValue > 1000) + designerCanvas.Zoom = 1000; + else + { + int zoom = (int)e.NewValue; + designerCanvas.DesignerView.Zoom = zoom; + var scale = (double)zoom / 100.0; + designerCanvas.LayoutTransform = new ScaleTransform(scale, scale); + designerCanvas.Resize(); + } + })); + + public new InputBindingCollection InputBindings + { + get { return base.InputBindings; } + set { } + } + public static readonly DependencyProperty InputBindingsProperty = DependencyProperty.RegisterAttached("InputBindings", typeof(InputBindingCollection), typeof(DesignerCanvas), new PropertyMetadata((sender, e) => ((DesignerCanvas)sender).InputBindings.AddRange((InputBindingCollection)e.NewValue))); + + private EDMDesignerViewContent _container; + internal EDMDesignerViewContent Container + { + get + { + return _container; + } + } + + private new ContextMenu.ContextMenu ContextMenu + { + get + { + return Style == null ? (ContextMenu.ContextMenu)null : (ContextMenu.ContextMenu)Style.Resources.OfType().FirstOrDefault(de => ((string)de.Key) == "ContextMenu").Value; + } + } + + private void InitContextMenuCommandBindings() + { + Loaded += + delegate + { + ContextMenu.ContextMenu contextMenu; + StackPanel stackPanel; + TextBox textBox; + if ((contextMenu = ContextMenu) != null && (stackPanel = contextMenu.Items.OfType().FirstOrDefault(sp => sp.Name == ZOOM_STACKPANEL)) != null && (textBox = stackPanel.Children.OfType().FirstOrDefault(etb => etb.Name == ZOOM_TEXTBOX)) != null) + textBox.SetBinding(TextBox.TextProperty, new Binding { Source = this, Path = new PropertyPath("Zoom") }); + }; + + CommandBindings.AddRange( + new[] + { + new CommandBinding(AddEntityTypeCommand, + delegate + { + var csdlView = EDMView.CSDL; + var addEntityTypeWindow = new AddEntityTypeWindow(csdlView) { Owner = Container.Window }; + switch (addEntityTypeWindow.ShowDialog()) + { + case true: + UITypeToAdd = csdlView.AddEntityType(addEntityTypeWindow.EntityTypeName, addEntityTypeWindow.BaseEntityType); + break; + } + } + ), + new CommandBinding(AddComplexTypeCommand, + delegate + { + var addComplexTypeWindow = new AddComplexTypeWindow { Owner = Container.Window }; + switch (addComplexTypeWindow.ShowDialog()) + { + case true: + UITypeToAdd = EDMView.CSDL.AddComplexType(addComplexTypeWindow.ComplexTypeName); + break; + } + } + ), + new CommandBinding(AddAssociationCommand, + AddAssociationExecuted(this, () => EDMView.CSDL, () => DesignerView, null, null) + ), + new CommandBinding(RemoveFromDesignerCommand, + delegate { RemoveFromDesigner(); }, + (sender, e) => e.CanExecute = TypesSelected.Any() + ), + new CommandBinding(SelectAllCommand, + delegate + { + foreach(var types in TypesVisibles) + types.IsSelected = true; + }, + (sender, e) => e.CanExecute = TypesVisibles.Any() + ) + } + ); + } + + protected override void OnMouseDown(MouseButtonEventArgs e) + { + base.OnMouseDown(e); + Focus(); + if (e.LeftButton == MouseButtonState.Pressed) + OnMouseLeftButtonDown(e); + else + OnMouseRightButtonDown(e); + e.Handled = true; + } + + public static ExecutedRoutedEventHandler AddAssociationExecuted(UIElement parent, Func getCSDLView, Func getDesignerView, UIEntityType defaultEntityType1, Action specialActionToDoWhenNewItemAdded) + { + return (object sender, ExecutedRoutedEventArgs e) => + { + var csdlView = getCSDLView(); + var designerView = getDesignerView(); + var addAssociationWindow = new AddAssociationWindow { Owner = VisualTreeHelperUtil.GetControlAscendant(parent), DataContext = csdlView, NavigationProperty1EntityType = defaultEntityType1 }; + switch (addAssociationWindow.ShowDialog()) + { + case true: + var uiAssociation = csdlView.AddAssociation(addAssociationWindow.AssociationName, addAssociationWindow.NavigationProperty1Name, addAssociationWindow.NavigationProperty1EntityType, addAssociationWindow.NavigationProperty1Cardinality.Value, addAssociationWindow.NavigationProperty2Name, addAssociationWindow.NavigationProperty2EntityType, addAssociationWindow.NavigationProperty2Cardinality.Value); + SizeChangedEventHandler actionToDoWhenNewItemAdded = null; + bool drawAssociation = false; + DesignerCanvas designerCanvas = parent as DesignerCanvas; + if (designerCanvas == null) + designerCanvas = VisualTreeHelperUtil.GetControlAscendant(parent); + var navigationProperty1EntityTypeDesigner = designerCanvas.GetTypeDesigner(uiAssociation.NavigationProperty1.ParentType); + var navigationProperty2EntityTypeDesigner = designerCanvas.GetTypeDesigner(uiAssociation.NavigationProperty2.ParentType); + actionToDoWhenNewItemAdded = + (object o, SizeChangedEventArgs scea) => + { + if (designerView.ContainsEntityType(uiAssociation.NavigationProperty1.ParentType) && designerView.ContainsEntityType(uiAssociation.NavigationProperty2.ParentType)) + { + if (drawAssociation) + navigationProperty1EntityTypeDesigner.DrawAssociation(navigationProperty2EntityTypeDesigner, uiAssociation.NavigationProperty1.BusinessInstance as NavigationProperty); + else + drawAssociation = true; + } + if (specialActionToDoWhenNewItemAdded != null) + specialActionToDoWhenNewItemAdded(uiAssociation); + ((ListView)o).SizeChanged -= actionToDoWhenNewItemAdded; + }; + navigationProperty1EntityTypeDesigner.propertiesListView.SizeChanged += actionToDoWhenNewItemAdded; + if (navigationProperty2EntityTypeDesigner != null) + navigationProperty2EntityTypeDesigner.propertiesListView.SizeChanged += actionToDoWhenNewItemAdded; + break; + } + }; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.cs new file mode 100644 index 0000000000..89ae1286ed --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvas.cs @@ -0,0 +1,508 @@ +#region Usings + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Shapes; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; +using ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding; +using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + public partial class DesignerCanvas : Canvas + { + static DesignerCanvas() + { + ResourceDictionaryLoader.LoadResourceDictionary("/UserControls/DesignerCanvasResourceDictionary.xaml"); + } + + public DesignerCanvas(EDMDesignerViewContent container) + { + _container = container; + AllowDrop = true; + InitContextMenuCommandBindings(); + } + + public EDMView EDMView + { + get { return (EDMView)GetValue(EDMViewProperty); } + set { SetValue(EDMViewProperty, value); } + } + public static readonly DependencyProperty EDMViewProperty = + DependencyProperty.Register("EDMView", typeof(EDMView), typeof(DesignerCanvas), new UIPropertyMetadata(null, + (sender, e) => + { + var designerCanvas = (DesignerCanvas)sender; + designerCanvas.EDMView.CSDL.TypeDeleted += uiType => + { + TypeBaseDesigner typeDesigner; + if ((typeDesigner = designerCanvas.Children.OfType().FirstOrDefault(tbd => tbd.UIType == uiType)) != null) + { + designerCanvas.Children.Remove(typeDesigner); + foreach (var relationContener in typeDesigner.RelationsContener) + designerCanvas.Children.Remove(relationContener); + } + }; + })); + + public DesignerView DesignerView + { + get { return (DesignerView)GetValue(DesignerViewProperty); } + set { SetValue(DesignerViewProperty, value); } + } + public static readonly DependencyProperty DesignerViewProperty = + DependencyProperty.Register("DesignerView", typeof(DesignerView), typeof(DesignerCanvas), new UIPropertyMetadata(null, (sender, e) => + { + var designerCanvas = (DesignerCanvas)sender; + var designerView = (DesignerView)e.NewValue; + foreach (TypeBaseDesigner typeBaseDesigner in designerView) + designerCanvas.Children.Add(typeBaseDesigner); + designerCanvas.Loaded += + delegate + { + foreach (TypeBaseDesigner typeBaseDesigner in designerView) + typeBaseDesigner.DrawRelations(); + designerCanvas.Zoom = designerView.Zoom; + }; + })); + + private static Dictionary _designerCanvas = new Dictionary(); + public static DesignerCanvas GetDesignerCanvas(EDMDesignerViewContent container, EDMView edmView, DesignerView designerView) + { + DesignerCanvas value; + if (_designerCanvas.ContainsKey(designerView)) + { + value = _designerCanvas[designerView]; + var parent = value.Parent as DesignerCanvasPreview; + if (parent != null) + parent.Content = null; + else + ((ContentControl)value.Parent).Content = null; + } + else + { + value = new DesignerCanvas(container) { EDMView = edmView, DesignerView = designerView, Background = Brushes.White }; + _designerCanvas.Add(designerView, value); + } + return value; + } + public static IEnumerable DesignerInCache + { + get + { + return _designerCanvas.Keys; + } + } + + private Rectangle _rectangle; + private Point _startSelectionPoint; + private bool _isSelecting; + + private Point _moveEntityTypeStartPoint; + private bool _moveEntityType = false; + + public void AddType(IUIType uiType, Point position) + { + AddType(TypeBaseDesigner.Load(uiType), position, uiType); + } + public void AddType(UIEntityType uiEntityType, Point position) + { + AddType(new EntityTypeDesigner(uiEntityType), position, uiEntityType); + } + public void AddType(UIComplexType uiComplexType, Point position) + { + AddType(new ComplexTypeDesigner(uiComplexType), position, uiComplexType); + } + private void AddType(TypeBaseDesigner typeDesigner, Point position, IUIType uiType) + { + Children.Add(typeDesigner); + Canvas.SetLeft(typeDesigner, position.X); + Canvas.SetTop(typeDesigner, position.Y); + DesignerView.AddTypeDesigner(typeDesigner); + typeDesigner.SizeChanged += delegate { Resize(); }; + typeDesigner.Selected += + () => + { + if (!_isSelecting) + UnselectOtherTypes(typeDesigner); + }; + } + + internal void UnselectOtherTypes(TypeBaseDesigner typeDesigner) + { + if (!KeyboardUtil.CtrlDown) + foreach (var selectedType in TypesSelected.Where(ts => ts != typeDesigner).ToList()) + selectedType.IsSelected = false; + } + + public void UnselectAllTypes() + { + foreach (var selectedType in TypesSelected.ToList()) + selectedType.IsSelected = false; + } + + public IEnumerable TypesVisibles + { + get + { + return Children.OfType(); + } + } + + public IEnumerable TypesSelected + { + get + { + return TypesVisibles.Where(tv => tv.IsSelected); + } + } + + protected override void OnDrop(DragEventArgs e) + { + base.OnDrop(e); + var uiEntityType = e.Data.GetData(typeof(UIEntityType)) as UIEntityType; + if (uiEntityType != null) + { + if (!DesignerView.ContainsEntityType(uiEntityType)) + AddType(uiEntityType, e.GetPosition(this)); + return; + } + var uiComplexType = e.Data.GetData(typeof(UIComplexType)) as UIComplexType; + if (uiComplexType != null) + { + if (!DesignerView.ContainsEntityType(uiComplexType)) + AddType(uiComplexType, e.GetPosition(this)); + } + } + + private void Resize() + { + var children = Children.OfType().ToArray(); + double xToTranslate; + double yToTranslate; + if (children.Any()) + { + xToTranslate = Math.Min(children.Min(fe => Canvas.GetLeft(fe)), 0.0); + yToTranslate = Math.Min(children.Min(fe => Canvas.GetTop(fe)), 0.0); + } + else + { + xToTranslate = 0.0; + yToTranslate = 0.0; + } + if (xToTranslate < 0 && yToTranslate < 0) + foreach (var typeDesigner in children.OfType()) + { + Canvas.SetLeft(typeDesigner, Canvas.GetLeft(typeDesigner) - xToTranslate); + Canvas.SetTop(typeDesigner, Canvas.GetTop(typeDesigner) - yToTranslate); + typeDesigner.OnMove(); + } + else if (xToTranslate < 0) + foreach (var typeDesigner in children.OfType()) + { + Canvas.SetLeft(typeDesigner, Canvas.GetLeft(typeDesigner) - xToTranslate); + typeDesigner.OnMove(); + } + else if (yToTranslate < 0) + foreach (var typeDesigner in children.OfType()) + { + Canvas.SetTop(typeDesigner, Canvas.GetTop(typeDesigner) - yToTranslate); + typeDesigner.OnMove(); + } + + var scale = (double)Zoom / 100.0; + var scrollViewer = Parent as ScrollViewer; + if (scrollViewer != null) + { + if (WidthNeed * scale > scrollViewer.ActualWidth) + { + scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; + Width = WidthNeed; + } + else + { + scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; + Width = scrollViewer.ActualWidth; + if (scale < 1) + Width /= scale; + } + if (HeightNeed * scale > scrollViewer.ActualHeight) + { + scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; + Height = HeightNeed; + } + else + { + scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; + Height = scrollViewer.ActualHeight; + if (scale < 1) + Height /= scale; + } + } + } + public double WidthNeed + { + get + { + double value = 0; + foreach (var control in Children.OfType()) + { + var left = Canvas.GetLeft(control); + double maxRight = 0; + if (left >= 0) + maxRight = left + control.ActualWidth; + double right = Canvas.GetRight(control); + if (right > maxRight) + maxRight = right; + if (maxRight > value) + value = maxRight; + } + return value; + } + } + public double HeightNeed + { + get + { + double value = 0; + foreach (var control in Children.OfType()) + { + var top = Canvas.GetTop(control); + double maxBottom = 0; + if (top >= 0) + maxBottom = top + control.ActualHeight; + double bottom = Canvas.GetBottom(control); + if (bottom > maxBottom) + maxBottom = bottom; + if (maxBottom > value) + value = maxBottom; + } + return value; + } + } + + protected override void OnPreviewMouseDown(MouseButtonEventArgs e) + { + base.OnPreviewMouseDown(e); + _isSelecting = false; + } + protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) + { + base.OnPreviewMouseLeftButtonDown(e); + + foreach (var relation in VisualTreeHelperUtil.GetControlsDecendant(this)) + relation.IsSelected = false; + + var typeDesigner = VisualTreeHelperUtil.GetControlAscendant(e.OriginalSource); + _moveEntityType = typeDesigner != null && VisualTreeHelperUtil.GetControlAscendant(e.OriginalSource) == null && VisualTreeHelperUtil.GetControlAscendant(e.OriginalSource) == null; + if (_moveEntityType) + { + _moveEntityTypeStartPoint = e.GetPosition(this); + Cursor = Cursors.ScrollAll; + } + } + + protected override void OnPreviewMouseMove(MouseEventArgs e) + { + base.OnPreviewMouseMove(e); + if (e.LeftButton == MouseButtonState.Pressed && _moveEntityType && TypesSelected.Any()) + { + var moveEntityTypeNewPosition = e.GetPosition(this); + var translationVectorX = moveEntityTypeNewPosition.X - _moveEntityTypeStartPoint.X; + if (translationVectorX < 0) + { + var minX = TypesSelected.Min(ts => Canvas.GetLeft(ts)); + if (minX < -translationVectorX) + translationVectorX = -minX; + } + var translationVectorY = moveEntityTypeNewPosition.Y - _moveEntityTypeStartPoint.Y; + if (translationVectorY < 0) + { + var minY = TypesSelected.Min(ts => Canvas.GetTop(ts)); + if (minY < -translationVectorY) + translationVectorY = -minY; + } + foreach (var entityTypeControl in TypesSelected) + { + Canvas.SetLeft(entityTypeControl, Canvas.GetLeft(entityTypeControl) + translationVectorX); + Canvas.SetTop(entityTypeControl, Canvas.GetTop(entityTypeControl) + translationVectorY); + entityTypeControl.OnMove(); + } + _moveEntityTypeStartPoint = moveEntityTypeNewPosition; + Resize(); + } + } + + protected override void OnPreviewMouseUp(MouseButtonEventArgs e) + { + base.OnPreviewMouseUp(e); + if (_moveEntityType) + { + _moveEntityType = false; + Cursor = Cursors.Arrow; + } + } + + protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) + { + base.OnMouseLeftButtonDown(e); + if (VisualTreeHelperUtil.GetControlAscendant(e.OriginalSource) == null) + { + if (UITypeToAdd == null) + { + UnselectAllTypes(); + _startSelectionPoint = e.GetPosition(this); + _isSelecting = true; + } + else + { + AddType(UITypeToAdd, e.GetPosition(this)); + UITypeToAdd = null; + } + } + else + UITypeToAdd = null; + Container.Selection = null; + } + protected override void OnMouseRightButtonDown(MouseButtonEventArgs e) + { + base.OnMouseRightButtonDown(e); + UITypeToAdd = null; + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + if (e.LeftButton == MouseButtonState.Pressed && _isSelecting) + { + var rectangleEndPoint = e.GetPosition(this); + if (_rectangle == null) + { + _rectangle = new Rectangle { Height = Math.Abs(_startSelectionPoint.Y - rectangleEndPoint.Y), Width = Math.Abs(_startSelectionPoint.X - rectangleEndPoint.X), Stroke = new SolidColorBrush(Color.FromRgb(0x47, 0x47, 0xF5)), Fill = new SolidColorBrush(Color.FromArgb(0x3F, 0xAD, 0xD8, 0xE6)), StrokeDashArray = new DoubleCollection() { 2 } }; + Children.Add(_rectangle); + } + else + { + _rectangle.Height = Math.Abs(_startSelectionPoint.Y - rectangleEndPoint.Y); + _rectangle.Width = Math.Abs(_startSelectionPoint.X - rectangleEndPoint.X); + } + Canvas.SetLeft(_rectangle, Math.Min(_startSelectionPoint.X, rectangleEndPoint.X)); + Canvas.SetTop(_rectangle, Math.Min(_startSelectionPoint.Y, rectangleEndPoint.Y)); + } + } + + public void SelectFromRectangle() + { + if (_rectangle != null) + { + var rectangleLeft = Canvas.GetLeft(_rectangle); + var rectangleRight = rectangleLeft + _rectangle.ActualWidth; + var rectangleTop = Canvas.GetTop(_rectangle); + var rectangleBottom = rectangleTop + _rectangle.ActualHeight; + foreach (var entityType in from etc in Children.OfType() + let entityTypeLeft = Canvas.GetLeft(etc) + let entityTypeRight = entityTypeLeft + etc.ActualWidth + let entityTypeTop = Canvas.GetTop(etc) + let entityTypeBottom = entityTypeTop + etc.ActualHeight + where ((entityTypeLeft > rectangleLeft && entityTypeLeft < rectangleRight) || (rectangleLeft > entityTypeLeft && rectangleLeft < entityTypeRight)) && ((entityTypeTop > rectangleTop && entityTypeTop < rectangleBottom) || (rectangleTop > entityTypeTop && rectangleTop < entityTypeBottom)) + select etc) + entityType.IsSelected = true; + Children.Remove(_rectangle); + _rectangle = null; + } + } + + public void OnBackSpaceDown() + { + DeleteSelectedTypesFromDesigner(false); + OnSelectionChanged(); + } + + private void DeleteSelectedTypesFromDesigner(bool deleteType) + { + foreach (var designerType in TypesSelected.ToList()) + { + foreach (var relationContener in designerType.RelationsContener.ToList()) + { + Children.Remove(relationContener); + relationContener.OnRemove(); + } + Children.Remove(designerType); + DesignerView.RemoveTypeDesigner(designerType); + if (deleteType) + designerType.UIType.View.DeleteType(designerType.UIType); + } + } + public void DeleteSelectedTypes() + { + DeleteSelectedTypesFromDesigner(true); + } + public void RemoveFromDesigner() + { + DeleteSelectedTypesFromDesigner(false); + } + + public bool OnDeleteDown(object originalSource) + { + if (originalSource is RelationBase) + return false; + var value = !(originalSource is ListViewItem); + if (value) + DeleteSelectedTypes(); + OnSelectionChanged(); + return value; + } + + public void OnEscapeDown() + { + UITypeToAdd = null; + } + private IUIType _uiTypeToAdd; + public IUIType UITypeToAdd + { + get { return _uiTypeToAdd; } + set + { + _uiTypeToAdd = value; + if (value == null) + Cursor = Cursors.Arrow; + else + Cursor = Cursors.Cross; + } + } + + internal TypeBaseDesigner GetTypeDesigner(IUIType uiType) + { + return Children.OfType().FirstOrDefault(tbd => tbd.UIType == uiType); + } + + public object Selection + { + get + { + var enumerator = TypesSelected.GetEnumerator(); + if (!enumerator.MoveNext()) + return null; + var typeBaseDesigner = enumerator.Current; + if (enumerator.MoveNext()) + return null; + return typeBaseDesigner.Selection; + } + } + internal void OnSelectionChanged() + { + Container.Selection = Selection; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvasPreview.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvasPreview.cs new file mode 100644 index 0000000000..ce84ffa944 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvasPreview.cs @@ -0,0 +1,100 @@ +#region Usings + +using System; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.CSDLType; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer; +using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type; +using ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding; + +#endregion + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + public class DesignerCanvasPreview : ContentControl + { + private EDMDesignerViewContent _container = null; + private DesignerCanvas _content; + private ListView _typebaseDesignerListView; + private int _zoom; + + public DesignerCanvasPreview() + { + if (DesignerCanvasPreviewCreated != null) + DesignerCanvasPreviewCreated(this); + } + + public DesignerCanvasPreview(EDMDesignerViewContent container) : this() + { + _container = container; + } + + internal static EDMView EDMView { get; set; } + internal static IUIType UIType { get; set; } + + public DesignerView DesignerView + { + get { return (DesignerView)GetValue(DesignerViewProperty); } + set { SetValue(DesignerViewProperty, value); } + } + public static readonly DependencyProperty DesignerViewProperty = + DependencyProperty.Register("DesignerView", typeof(DesignerView), typeof(DesignerCanvasPreview), new UIPropertyMetadata(null, (sender, e) => + { + var designerCanvasPreview = (DesignerCanvasPreview)sender; + designerCanvasPreview.Content = DesignerCanvas.GetDesignerCanvas(designerCanvasPreview._container, EDMView, (DesignerView)e.NewValue); + })); + + internal new DesignerCanvas Content + { + get + { + if (_content == null) + _content = (DesignerCanvas)base.Content; + return _content; + } + set + { + if (value == null) + { + Content.Zoom = _zoom; + Content.OnSelectionChanged(); + TypebaseDesignerListView.Background = Brushes.White; + } + else + { + value.UnselectAllTypes(); + value.TypesVisibles.First(t => t.UIType == UIType).IsSelected = true; + RoutedEventHandler loadHandler = null; + loadHandler = delegate + { + TypebaseDesignerListView.Background = Brushes.Yellow; + _zoom = Content.Zoom; + var widthZoom = (int)(Width * 100.0 / _content.WidthNeed); + var heightZoom = (int)(Height * 100.0 / _content.HeightNeed); + _content.Zoom = Math.Min(widthZoom, heightZoom); + value.Loaded -= loadHandler; + }; + value.Loaded += loadHandler; + } + _content = value; + base.Content = value; + } + } + + private ListView TypebaseDesignerListView + { + get + { + if (_typebaseDesignerListView == null) + _typebaseDesignerListView = VisualTreeHelperUtil.GetControlsDecendant(Content.Children.OfType().Where(tbd => tbd.UIType.BusinessInstance == UIType.BusinessInstance).First()).First(); + return _typebaseDesignerListView; + } + } + + public static event Action DesignerCanvasPreviewCreated; + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvasResourceDictionary.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvasResourceDictionary.xaml new file mode 100644 index 0000000000..75ea7ccab1 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/DesignerCanvasResourceDictionary.xaml @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/EditableTextBlock.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/EditableTextBlock.cs new file mode 100644 index 0000000000..639b88a570 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/EditableTextBlock.cs @@ -0,0 +1,130 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Input; +using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers; + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + /// + /// + /// This class is done using Thomas' one + /// + /// + /// + [TemplatePart(Type = typeof(Grid), Name = EditableTextBlock.GRID_NAME)] + [TemplatePart(Type = typeof(TextBlock), Name = EditableTextBlock.TEXTBLOCK_DISPLAYTEXT_NAME)] + [TemplatePart(Type = typeof(TextBox), Name = EditableTextBlock.TEXTBOX_EDITTEXT_NAME)] + public class EditableTextBlock : Control + { + private const string GRID_NAME = "PART_GridContainer"; + private const string TEXTBLOCK_DISPLAYTEXT_NAME = "PART_TbDisplayText"; + private const string TEXTBOX_EDITTEXT_NAME = "PART_TbEditText"; + + private Grid _gridContainer; + private TextBlock _textBlockDisplayText; + private TextBox _textBoxEditText; + + static EditableTextBlock() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(EditableTextBlock), new FrameworkPropertyMetadata(typeof(EditableTextBlock))); + } + + public EditableTextBlock() + { + Focusable = true; + ResourceDictionaryLoader.LoadResourceDictionary("/UserControls/EditableTextBlockResourceDictionary.xaml"); + } + + public string Text + { + get { return (string)GetValue(TextProperty); } + set { SetValue(TextProperty, value); } + } + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(EditableTextBlock), new UIPropertyMetadata(string.Empty)); + + public Brush TextBlockForegroundColor + { + get { return (Brush)GetValue(TextBlockForegroundColorProperty); } + set { SetValue(TextBlockForegroundColorProperty, value); } + } + public static readonly DependencyProperty TextBlockForegroundColorProperty = DependencyProperty.Register("TextBlockForegroundColor", typeof(Brush), typeof(EditableTextBlock), new UIPropertyMetadata(Brushes.Black)); + + public Brush TextBlockBackgroundColor + { + get { return (Brush)GetValue(TextBlockBackgroundColorProperty); } + set { SetValue(TextBlockBackgroundColorProperty, value); } + } + public static readonly DependencyProperty TextBlockBackgroundColorProperty = DependencyProperty.Register("TextBlockBackgroundColor", typeof(Brush), typeof(EditableTextBlock), new UIPropertyMetadata(null)); + + public Brush TextBoxForegroundColor + { + get { return (Brush)GetValue(TextBoxForegroundColorProperty); } + set { SetValue(TextBoxForegroundColorProperty, value); } + } + public static readonly DependencyProperty TextBoxForegroundColorProperty = DependencyProperty.Register("TextBoxForegroundColor", typeof(Brush), typeof(EditableTextBlock), new UIPropertyMetadata(Brushes.Black)); + + public Brush TextBoxBackgroundColor + { + get { return (Brush)GetValue(TextBoxBackgroundColorProperty); } + set { SetValue(TextBoxBackgroundColorProperty, value); } + } + public static readonly DependencyProperty TextBoxBackgroundColorProperty = DependencyProperty.Register("TextBoxBackgroundColor", typeof(Brush), typeof(EditableTextBlock), new UIPropertyMetadata(Brushes.White)); + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + _gridContainer = Template.FindName(GRID_NAME, this) as Grid; + if (_gridContainer != null) + { + _textBlockDisplayText = _gridContainer.Children[0] as TextBlock; + _textBoxEditText = _gridContainer.Children[1] as TextBox; + _textBoxEditText.LostFocus += delegate { EndEdit(); }; + _textBoxEditText.KeyDown += + (sender, e) => + { + switch (e.Key) + { + case Key.Enter: + EndEdit(); + break; + case Key.Escape: + _textBoxEditText.Text = _oldText; + EndEdit(); + break; + } + //e.Handled = true; + }; + } + } + + private string _oldText; + private bool _isEditing; + + public void Edit() + { + if (! _isEditing) + { + _isEditing = true; + _oldText = Text; + _textBlockDisplayText.Visibility = Visibility.Hidden; + _textBoxEditText.Visibility = Visibility.Visible; + _textBoxEditText.Focus(); + } + } + private void EndEdit() + { + _textBlockDisplayText.Visibility = Visibility.Visible; + _textBoxEditText.Visibility = Visibility.Hidden; + _isEditing = false; + } + + protected override void OnMouseDoubleClick(MouseButtonEventArgs e) + { + base.OnMouseDoubleClick(e); + Edit(); + e.Handled = true; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/EditableTextBlockResourceDictionary.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/EditableTextBlockResourceDictionary.xaml new file mode 100644 index 0000000000..715365ffd0 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/EditableTextBlockResourceDictionary.xaml @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Expander.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Expander.cs new file mode 100644 index 0000000000..a4c3771488 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Expander.cs @@ -0,0 +1,39 @@ +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Controls.Primitives; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; +using System.Windows; +using System.Windows.Automation.Peers; +using ICSharpCode.Data.EDMDesigner.Core.UI.Helpers; + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + public class Expander : System.Windows.Controls.Expander + { + protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) + { + base.OnPreviewMouseLeftButtonDown(e); + if (VisualTreeHelperUtil.GetControlAscendant(e.OriginalSource) == null || VisualTreeHelperUtil.GetControlAscendant(e.OriginalSource) == null) + { + if (!(e.OriginalSource is FrameworkElement)) + return; + + FrameworkElement control = (FrameworkElement)e.OriginalSource; + while ((control = VisualTreeHelperUtil.GetControlAscendant(control)) != null) + if (control.Name == "grdHeader") + { + ClickOnTheHeader(); + break; + } + } + } + + protected virtual void ClickOnTheHeader() + { + DesignerCanvas designerCanvas = VisualHelper.GetVisualParent(this); + + if (designerCanvas != null) + designerCanvas.Container.Selection = this.DataContext; + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ExtendedPanel.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ExtendedPanel.cs new file mode 100644 index 0000000000..76831b587a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/ExtendedPanel.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Common; + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + public class ExtendedPanel : Panel + { + public ExtendedPanel() + { + Focusable = true; + } + + private List _subElements; + public List SubElements + { + get + { + if (_subElements == null) + _subElements = new List(); + return _subElements; + } + } + + public void AddLogicalChild(UIElement uiElement) + { + SubElements.Add(uiElement); + uiElement.GotFocus += delegate { IsFocusedIncludingChildren = true; }; + uiElement.LostFocus += delegate { IsFocusedIncludingChildren = IsFocusedIncludingChildren; }; + } + + protected override void OnMouseDown(MouseButtonEventArgs e) + { + base.OnMouseDown(e); + Focus(); + e.Handled = true; + } + protected override void OnGotFocus(RoutedEventArgs e) + { + base.OnGotFocus(e); + SubElements.First(uie => uie.Focusable).Focus(); + } + + public bool IsFocusedIncludingChildren + { + get + { + return IsFocused || VisualTreeHelperUtil.GetFocusedElement(this) != null; + } + set { SetValue(IsFocusedIncludingChildrenProperty, value); } + } + public static readonly DependencyProperty IsFocusedIncludingChildrenProperty = + DependencyProperty.Register("IsFocusedIncludingChildren", typeof(bool), typeof(ExtendedPanel), new UIPropertyMetadata(false)); + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/GreyableImage.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/GreyableImage.cs new file mode 100644 index 0000000000..a81d18498a --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/GreyableImage.cs @@ -0,0 +1,103 @@ +using System; +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + /// + /// + /// Alex P's code + /// + /// + /// + public class GreyableImage : Image + { + // these are holding references to original and greyscale ImageSources + private ImageSource _sourceC, _sourceG; + // these are holding original and greyscale opacity masks + private Brush _opacityMaskC, _opacityMaskG; + + static GreyableImage() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(GreyableImage), new FrameworkPropertyMetadata(typeof(GreyableImage))); + } + + /// + /// Overwritten to handle changes of IsEnabled, Source and OpacityMask properties + /// + /// + protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) + { + if (e.Property.Name.Equals("IsEnabled")) + { + if ((e.NewValue as bool?) == false) + { + Source = _sourceG; + OpacityMask = _opacityMaskG; + } + else if ((e.NewValue as bool?) == true) + { + Source = _sourceC; + OpacityMask = _opacityMaskC; + } + } + else if (e.Property.Name.Equals("Source") && + !object.ReferenceEquals(Source, _sourceC) && + !object.ReferenceEquals(Source, _sourceG)) // only recache Source if it's the new one from outside + { + SetSources(); + } + else if (e.Property.Name.Equals("OpacityMask") && + !object.ReferenceEquals(OpacityMask, _opacityMaskC) && + !object.ReferenceEquals(OpacityMask, _opacityMaskG)) // only recache opacityMask if it's the new one from outside + { + _opacityMaskC = OpacityMask; + } + + base.OnPropertyChanged(e); + } + + /// + /// Cashes original ImageSource, creates and caches greyscale ImageSource and greyscale opacity mask + /// + private void SetSources() + { + // in case greyscale image cannot be created set greyscale source to original Source first + _sourceG = _sourceC = Source; + + // create Opacity Mask for greyscale image as FormatConvertedBitmap does not keep transparency info + _opacityMaskG = new ImageBrush(_sourceC); + _opacityMaskG.Opacity = 0.6; + + try + { + // get the string Uri for the original image source first + String stringUri = TypeDescriptor.GetConverter(Source).ConvertTo(Source, typeof(string)) as string; + Uri uri = null; + // try to resolve it as an absolute Uri (if it is relative and used it as is + // it is likely to point in a wrong direction) + if (!Uri.TryCreate(stringUri, UriKind.Absolute, out uri)) + { + // it seems that the Uri is relative, at this stage we can only assume that + // the image requested is in the same assembly as this oblect, + // so we modify the string Uri to make it absolute ... + stringUri = "pack://application:,,,/" + stringUri.TrimStart(new char[2] { System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar }); + + // ... and try to resolve again + uri = new Uri(stringUri); + } + + // create and cache greyscale ImageSource + _sourceG = new FormatConvertedBitmap(new BitmapImage(uri), PixelFormats.Gray8, null, 0); + } + catch (Exception e) + { + System.Diagnostics.Debug.Fail("The Image used cannot be greyed out.", + "Use BitmapImage or URI as a Source in order to allow greyscaling. Make sure the absolute Uri is used as relative Uri may sometimes resolve incorrectly.\n\nException: " + e.Message); + } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/InputBindingsContener.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/InputBindingsContener.cs new file mode 100644 index 0000000000..282fcd7c6c --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/InputBindingsContener.cs @@ -0,0 +1,20 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls +{ + public class InputBindingsContener : ContentControl + { + public static InputBindingCollection GetInputBindingsCollection(DependencyObject obj) + { + return (InputBindingCollection)obj.GetValue(InputBindingsProperty); + } + public static void SetInputBindingsCollection(DependencyObject obj, InputBindingCollection value) + { + obj.SetValue(InputBindingsProperty, value); + } + public static readonly DependencyProperty InputBindingsProperty = + DependencyProperty.RegisterAttached("InputBindingsCollection", typeof(InputBindingCollection), typeof(UIElement), new UIPropertyMetadata(null, (sender, e) => ((UIElement)sender).InputBindings.AddRange((InputBindingCollection)e.NewValue))); + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Mapping/AssociationMapping.Resources.cs b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Mapping/AssociationMapping.Resources.cs new file mode 100644 index 0000000000..52a3fc0c1d --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Mapping/AssociationMapping.Resources.cs @@ -0,0 +1,30 @@ +namespace ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Mapping +{ + partial class AssociationMapping + { + public static string Conditions + { + get { return "Conditions"; } + } + + public static string Column + { + get { return "Column"; } + } + + public static string Operator + { + get { return "Operator"; } + } + + public static string Value + { + get { return "Value"; } + } + + public static string AddColumnConditionMapping + { + get { return "Add column condition"; } + } + } +} diff --git a/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Mapping/AssociationMapping.xaml b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Mapping/AssociationMapping.xaml new file mode 100644 index 0000000000..0b461df775 --- /dev/null +++ b/src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/UserControls/Mapping/AssociationMapping.xaml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +