diff --git a/.gitmodules b/.gitmodules index d5e8eee9b0..418de9e68e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "src/Libraries/cecil"] path = src/Libraries/cecil url = https://github.com/jbevain/cecil.git +[submodule "src/Libraries/WpfDesigner"] + path = src/Libraries/WpfDesigner + url = https://github.com/icsharpcode/WpfDesigner.git diff --git a/SharpDevelop.Tests.sln b/SharpDevelop.Tests.sln index c0bdd72367..7437dbc313 100644 --- a/SharpDevelop.Tests.sln +++ b/SharpDevelop.Tests.sln @@ -182,15 +182,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.SQLServer" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WpfDesign", "WpfDesign", "{83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.AddIn", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.AddIn\WpfDesign.AddIn.csproj", "{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.Tests", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\Tests\WpfDesign.Tests.csproj", "{943DBBB3-E84E-4CF4-917C-C05AFA8743C1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\Libraries\WpfDesigner\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.Designer", "src\Libraries\WpfDesigner\WpfDesign.Designer\Project\WpfDesign.Designer.csproj", "{78CC29AC-CC79-4355-B1F2-97936DF198AC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.Designer", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\WpfDesign.Designer.csproj", "{78CC29AC-CC79-4355-B1F2-97936DF198AC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.XamlDom", "src\Libraries\WpfDesigner\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj", "{88DA149F-21B2-48AB-82C4-28FB6BDFD783}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.XamlDom", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj", "{88DA149F-21B2-48AB-82C4-28FB6BDFD783}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.Tests", "src\Libraries\WpfDesigner\WpfDesign.Designer\Tests\WpfDesign.Tests.csproj", "{943DBBB3-E84E-4CF4-917C-C05AFA8743C1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsEditor", "src\AddIns\DisplayBindings\SettingsEditor\Project\SettingsEditor.csproj", "{85226AFB-CE71-4851-9A75-7EEC663A8E8A}" EndProject @@ -546,18 +546,14 @@ Global {AFE34868-AFA1-4E1C-9450-47AB4BE329D5}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFE34868-AFA1-4E1C-9450-47AB4BE329D5}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFE34868-AFA1-4E1C-9450-47AB4BE329D5}.Release|Any CPU.Build.0 = Release|Any CPU - {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Release|Any CPU.Build.0 = Release|Any CPU {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Debug|Any CPU.Build.0 = Debug|Any CPU {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Release|Any CPU.ActiveCfg = Release|Any CPU {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Release|Any CPU.Build.0 = Release|Any CPU - {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Release|Any CPU.Build.0 = Release|Any CPU + {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Release|Any CPU.Build.0 = Release|Any CPU {78CC29AC-CC79-4355-B1F2-97936DF198AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {78CC29AC-CC79-4355-B1F2-97936DF198AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {78CC29AC-CC79-4355-B1F2-97936DF198AC}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -566,6 +562,10 @@ Global {88DA149F-21B2-48AB-82C4-28FB6BDFD783}.Debug|Any CPU.Build.0 = Debug|Any CPU {88DA149F-21B2-48AB-82C4-28FB6BDFD783}.Release|Any CPU.ActiveCfg = Release|Any CPU {88DA149F-21B2-48AB-82C4-28FB6BDFD783}.Release|Any CPU.Build.0 = Release|Any CPU + {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {943DBBB3-E84E-4CF4-917C-C05AFA8743C1}.Release|Any CPU.Build.0 = Release|Any CPU {85226AFB-CE71-4851-9A75-7EEC663A8E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {85226AFB-CE71-4851-9A75-7EEC663A8E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU {85226AFB-CE71-4851-9A75-7EEC663A8E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -741,11 +741,11 @@ Global {EEF5E054-4192-4A57-8FBF-E860D808A51D} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D} {AFE34868-AFA1-4E1C-9450-47AB4BE329D5} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D} {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {66A378A1-E9F4-4AD5-8946-D0EC06C2902F} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} - {943DBBB3-E84E-4CF4-917C-C05AFA8743C1} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} + {66A378A1-E9F4-4AD5-8946-D0EC06C2902F} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} {78CC29AC-CC79-4355-B1F2-97936DF198AC} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} {88DA149F-21B2-48AB-82C4-28FB6BDFD783} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} + {943DBBB3-E84E-4CF4-917C-C05AFA8743C1} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} {85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} diff --git a/SharpDevelop.sln b/SharpDevelop.sln index f1421112dd..4442f37122 100644 --- a/SharpDevelop.sln +++ b/SharpDevelop.sln @@ -151,13 +151,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.SQLServer" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WpfDesign", "WpfDesign", "{D54BEB89-8CBE-475C-8BB9-836D2FD71260}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\Libraries\WpfDesigner\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.AddIn", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.AddIn\WpfDesign.AddIn.csproj", "{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.XamlDom", "src\Libraries\WpfDesigner\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj", "{88DA149F-21B2-48AB-82C4-28FB6BDFD783}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.XamlDom", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj", "{88DA149F-21B2-48AB-82C4-28FB6BDFD783}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.Designer", "src\Libraries\WpfDesigner\WpfDesign.Designer\Project\WpfDesign.Designer.csproj", "{78CC29AC-CC79-4355-B1F2-97936DF198AC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.Designer", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\WpfDesign.Designer.csproj", "{78CC29AC-CC79-4355-B1F2-97936DF198AC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.AddIn", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign.AddIn\WpfDesign.AddIn.csproj", "{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "src\AddIns\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}" EndProject @@ -441,10 +441,6 @@ Global {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Debug|Any CPU.Build.0 = Debug|Any CPU {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Release|Any CPU.ActiveCfg = Release|Any CPU {66A378A1-E9F4-4AD5-8946-D0EC06C2902F}.Release|Any CPU.Build.0 = Release|Any CPU - {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Release|Any CPU.Build.0 = Release|Any CPU {88DA149F-21B2-48AB-82C4-28FB6BDFD783}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {88DA149F-21B2-48AB-82C4-28FB6BDFD783}.Debug|Any CPU.Build.0 = Debug|Any CPU {88DA149F-21B2-48AB-82C4-28FB6BDFD783}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -453,6 +449,10 @@ Global {78CC29AC-CC79-4355-B1F2-97936DF198AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {78CC29AC-CC79-4355-B1F2-97936DF198AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {78CC29AC-CC79-4355-B1F2-97936DF198AC}.Release|Any CPU.Build.0 = Release|Any CPU + {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}.Release|Any CPU.Build.0 = Release|Any CPU {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.Build.0 = Debug|Any CPU {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -588,9 +588,9 @@ Global {AFE34868-AFA1-4E1C-9450-47AB4BE329D5} = {5FB020B2-B64B-4016-999A-CB8FD9274D72} {D54BEB89-8CBE-475C-8BB9-836D2FD71260} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {66A378A1-E9F4-4AD5-8946-D0EC06C2902F} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} - {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} {88DA149F-21B2-48AB-82C4-28FB6BDFD783} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} {78CC29AC-CC79-4355-B1F2-97936DF198AC} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} + {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {7019F43E-DFD7-4D1C-8C96-E75D55646DE7} = {39327899-ED91-4F7F-988C-4FE4E17C014D} diff --git a/samples/XamlDesigner/App.xaml b/samples/XamlDesigner/App.xaml deleted file mode 100644 index 3a19748fc3..0000000000 --- a/samples/XamlDesigner/App.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/samples/XamlDesigner/App.xaml.cs b/samples/XamlDesigner/App.xaml.cs deleted file mode 100644 index 5d9484dadf..0000000000 --- a/samples/XamlDesigner/App.xaml.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Threading; -using System.Windows; -using System.Windows.Threading; - -using ICSharpCode.WpfDesign.Designer; -using ICSharpCode.XamlDesigner.Configuration; - -namespace ICSharpCode.XamlDesigner -{ - public partial class App - { - public static string[] Args; - - protected override void OnStartup(StartupEventArgs e) - { - AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AppDomain_CurrentDomain_AssemblyResolve); - AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_CurrentDomain_UnhandledException); - DragDropExceptionHandler.UnhandledException += new ThreadExceptionEventHandler(DragDropExceptionHandler_UnhandledException); - DispatcherUnhandledException += App_DispatcherUnhandledException; - Args = e.Args; - base.OnStartup(e); - } - - private static bool internalLoad = false; - private static string lastRequesting = null; - - Assembly AppDomain_CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - var assList = AppDomain.CurrentDomain.GetAssemblies(); - var loaded = assList.FirstOrDefault(x => x.FullName == args.Name); - if (loaded != null) - { - return loaded; - } - - if (internalLoad) - return null; - - if (args.Name.Split(new [] { ',' })[0].Trim().EndsWith(".resources")) - return null; - - internalLoad = true; - - Assembly ass = null; - try { - - ass = Assembly.Load(args.Name); - } - catch (Exception) { } - - if (ass == null && args.RequestingAssembly != null) { - lastRequesting = args.RequestingAssembly.Location; - var dir = Path.GetDirectoryName(args.RequestingAssembly.Location); - var file = args.Name.Split(new [] { ',' })[0].Trim() + ".dll"; - try { - ass = Assembly.LoadFrom(Path.Combine(dir, file)); - } - catch (Exception) { } - } - else if (lastRequesting != null) { - var dir = Path.GetDirectoryName(lastRequesting); - var file = args.Name.Split(new [] { ',' })[0].Trim() + ".dll"; - try { - ass = Assembly.LoadFrom(Path.Combine(dir, file)); - } - catch (Exception) { } - } - - internalLoad = false; - - return ass; - } - - void DragDropExceptionHandler_UnhandledException(object sender, ThreadExceptionEventArgs e) - { - Shell.ReportException(e.Exception); - - } - - void AppDomain_CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - Shell.ReportException(e.ExceptionObject as Exception); - } - - - void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) - { - Shell.ReportException(e.Exception); - e.Handled = true; - } - - protected override void OnExit(ExitEventArgs e) - { - Settings.Default.Save(); - base.OnExit(e); - } - } -} diff --git a/samples/XamlDesigner/BitmapButton.xaml b/samples/XamlDesigner/BitmapButton.xaml deleted file mode 100644 index 7c1a28bd96..0000000000 --- a/samples/XamlDesigner/BitmapButton.xaml +++ /dev/null @@ -1,32 +0,0 @@ - diff --git a/samples/XamlDesigner/BitmapButton.xaml.cs b/samples/XamlDesigner/BitmapButton.xaml.cs deleted file mode 100644 index 4200c1bc9d..0000000000 --- a/samples/XamlDesigner/BitmapButton.xaml.cs +++ /dev/null @@ -1,45 +0,0 @@ -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; - -namespace ICSharpCode.XamlDesigner -{ - public partial class BitmapButton - { - public BitmapButton() - { - InitializeComponent(); - DataContext = this; - } - - public string ImageHover { - get { return "Images/" + GetType().Name + ".Hover.png"; } - } - - public string ImageNormal { - get { return "Images/" + GetType().Name + ".Normal.png"; } - } - - public string ImagePressed { - get { return "Images/" + GetType().Name + ".Pressed.png"; } - } - - public string ImageDisabled { - get { return "Images/" + GetType().Name + ".Disabled.png"; } - } - } - - class CloseButton : BitmapButton - { - } -} diff --git a/samples/XamlDesigner/Configuration/AssemblyInfo.cs b/samples/XamlDesigner/Configuration/AssemblyInfo.cs deleted file mode 100644 index 651ee86e68..0000000000 --- a/samples/XamlDesigner/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -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("XamlDesigner")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -//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) -)] diff --git a/samples/XamlDesigner/Configuration/Settings.Designer.cs b/samples/XamlDesigner/Configuration/Settings.Designer.cs deleted file mode 100644 index 856ed1ff13..0000000000 --- a/samples/XamlDesigner/Configuration/Settings.Designer.cs +++ /dev/null @@ -1,119 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3031 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ICSharpCode.XamlDesigner.Configuration { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0,0,0,0")] - public global::System.Windows.Rect MainWindowRect { - get { - return ((global::System.Windows.Rect)(this["MainWindowRect"])); - } - set { - this["MainWindowRect"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute(@" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")] - public string AvalonDockLayout { - get { - return ((string)(this["AvalonDockLayout"])); - } - set { - this["AvalonDockLayout"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection RecentFiles { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["RecentFiles"])); - } - set { - this["RecentFiles"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute(@" - - %ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll -")] - public global::System.Collections.Specialized.StringCollection AssemblyList { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["AssemblyList"])); - } - set { - this["AssemblyList"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Maximized")] - public global::System.Windows.WindowState MainWindowState { - get { - return ((global::System.Windows.WindowState)(this["MainWindowState"])); - } - set { - this["MainWindowState"] = value; - } - } - } -} diff --git a/samples/XamlDesigner/Configuration/Settings.settings b/samples/XamlDesigner/Configuration/Settings.settings deleted file mode 100644 index 33f62b33b9..0000000000 --- a/samples/XamlDesigner/Configuration/Settings.settings +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - 0,0,0,0 - - - <DockingManager version="1.3.0"> - <ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="0,0" Orientation="Vertical"> - <ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1920,1153.04" Orientation="Horizontal"> - <ResizingPanel ResizeWidth="250" ResizeHeight="*" EffectiveSize="250,1153.04" Orientation="Vertical"> - <DockablePane ResizeWidth="0.742440632565806*" ResizeHeight="0.742440632565806*" EffectiveSize="250,851.609103178282" ID="bb7a5fd3-be24-4636-8fd6-a50a09e65e69" Anchor="Left" IsAutoHidden="false"> - <DockableContent Name="content1" FloatingWindowSize="250,400" ChildIndex="0" Width="315" Height="1153.04" Anchor="Right" State="Docked" /> - </DockablePane> - <DockablePane ResizeWidth="0.257559367434194*" ResizeHeight="0.257559367434194*" EffectiveSize="250,295.430896821718" ID="17cd1941-1004-4ed9-8cda-03c254681289" Anchor="Left" IsAutoHidden="false"> - <DockableContent Name="content2" FloatingWindowSize="250,400" ChildIndex="0" Width="328" Height="1153.04" Anchor="Right" State="Docked" /> - </DockablePane> - </ResizingPanel> - <ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1408,1153.04" Orientation="Vertical"> - <DocumentPaneResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1408,965.04" Orientation="Vertical"> - <DocumentPane IsMain="true" ResizeWidth="*" ResizeHeight="*" EffectiveSize="1408,965.04" /> - </DocumentPaneResizingPanel> - <DockablePane ResizeWidth="*" ResizeHeight="182" EffectiveSize="1408,182" ID="ebd34b7e-6a89-42c6-b172-0e666b0d8a0a" Anchor="Bottom" IsAutoHidden="false"> - <DockableContent Name="content3" FloatingWindowSize="250,400" ChildIndex="0" Width="1920" Height="400" Anchor="Bottom" State="Docked" /> - </DockablePane> - </ResizingPanel> - <ResizingPanel ResizeWidth="250" ResizeHeight="*" EffectiveSize="250,1153.04" Orientation="Vertical"> - <DockablePane ResizeWidth="0.145251345356991*" ResizeHeight="0.145251345356991*" EffectiveSize="250,166.609103178283" ID="aa545474-48b3-49a6-b76c-b0c625e79e4c" Anchor="Right" IsAutoHidden="false"> - <DockableContent Name="content5" FloatingWindowSize="250,400" ChildIndex="0" Width="550.666666666667" Height="1153.04" Anchor="Right" State="Docked" /> - </DockablePane> - <DockablePane ResizeWidth="0.854748654643009*" ResizeHeight="0.854748654643009*" EffectiveSize="250,980.430896821717" ID="64e5518b-2c83-4e22-908d-a510a6995c27" Anchor="Right" IsAutoHidden="false"> - <DockableContent Name="content4" FloatingWindowSize="250,400" ChildIndex="0" Width="399.967430639324" Height="1153.04" Anchor="Right" State="Docked" /> - </DockablePane> - </ResizingPanel> - </ResizingPanel> - </ResizingPanel> - <Hidden /> - <Windows /> -</DockingManager> - - - - - - <?xml version="1.0" encoding="utf-16"?> -<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <string>%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll</string> -</ArrayOfString> - - - Maximized - - - \ No newline at end of file diff --git a/samples/XamlDesigner/Configuration/app.config b/samples/XamlDesigner/Configuration/app.config deleted file mode 100644 index c49779f8d1..0000000000 --- a/samples/XamlDesigner/Configuration/app.config +++ /dev/null @@ -1,51 +0,0 @@ - - - - -
- - - - - - 0,0,0,0 - - - <DockingManager> - <ResizingPanel Orientation="Horizontal"> - <ResizingPanel ResizeWidth="200" Orientation="Vertical"> - <DockablePane ResizeHeight="441.36166666666668" Anchor="Left"> - <DockableContent Name="content1" AutoHide="false" /> - </DockablePane> - <DockablePane ResizeWidth="200" Anchor="Left"> - <DockableContent Name="content2" AutoHide="false" /> - </DockablePane> - </ResizingPanel> - <ResizingPanel Orientation="Vertical"> - <DocumentPanePlaceHolder /> - <DockablePane ResizeHeight="138" Anchor="Bottom"> - <DockableContent Name="content3" AutoHide="false" /> - </DockablePane> - </ResizingPanel> - <DockablePane ResizeWidth="271" Anchor="Right"> - <DockableContent Name="content4" AutoHide="false" /> - </DockablePane> - </ResizingPanel> - <Hidden /> - <Windows /> -</DockingManager> - - - - - %ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll - - - - - Maximized - - - - \ No newline at end of file diff --git a/samples/XamlDesigner/Configuration/app.manifest b/samples/XamlDesigner/Configuration/app.manifest deleted file mode 100644 index e82a10f183..0000000000 --- a/samples/XamlDesigner/Configuration/app.manifest +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/samples/XamlDesigner/Converters.cs b/samples/XamlDesigner/Converters.cs deleted file mode 100644 index feeb6d9d02..0000000000 --- a/samples/XamlDesigner/Converters.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Data; -using System.Globalization; -using System.Windows; -using System.Collections; - -namespace ICSharpCode.XamlDesigner.Converters -{ - public class EnumToIntConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return (int)value; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return value; - } - } - - public class CollapsedWhenFalse : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return (bool)value ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class FalseWhenZero : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value == null || (int)value == 0) { - return false; - } - return true; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class LevelConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return new Thickness(5 + 19 * (int)value, 0, 5, 0); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/samples/XamlDesigner/Document.cs b/samples/XamlDesigner/Document.cs deleted file mode 100644 index 705c1046de..0000000000 --- a/samples/XamlDesigner/Document.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.ComponentModel; -using System.IO; -using ICSharpCode.WpfDesign.Designer; -using ICSharpCode.WpfDesign.Designer.Xaml; -using ICSharpCode.WpfDesign.Designer.OutlineView; -using System.Xml; -using ICSharpCode.WpfDesign; -using ICSharpCode.WpfDesign.Designer.Services; -using System.Diagnostics; -using ICSharpCode.WpfDesign.XamlDom; - -namespace ICSharpCode.XamlDesigner -{ - public class Document : INotifyPropertyChanged - { - public Document(string tempName, string text) - { - this.tempName = tempName; - Text = text; - IsDirty = false; - } - - public Document(string filePath) - { - this.filePath = filePath; - ReloadFile(); - } - - string tempName; - DesignSurface designSurface = new DesignSurface(); - - string text; - - public string Text { - get { - return text; - } - set { - if (text != value) { - text = value; - IsDirty = true; - RaisePropertyChanged("Text"); - } - } - } - - DocumentMode mode; - - public DocumentMode Mode { - get { - return mode; - } - set { - mode = value; - if (InDesignMode) { - UpdateDesign(); - } - else { - UpdateXaml(); - } - RaisePropertyChanged("Mode"); - RaisePropertyChanged("InXamlMode"); - RaisePropertyChanged("InDesignMode"); - } - } - - public bool InXamlMode { - get { return Mode == DocumentMode.Xaml; } - } - - public bool InDesignMode { - get { return Mode == DocumentMode.Design; } - } - - string filePath; - - public string FilePath { - get { - return filePath; - } - private set { - filePath = value; - RaisePropertyChanged("FilePath"); - RaisePropertyChanged("FileName"); - RaisePropertyChanged("Title"); - RaisePropertyChanged("Name"); - } - } - - bool isDirty; - - public bool IsDirty { - get { - return isDirty; - } - private set { - isDirty = value; - RaisePropertyChanged("IsDirty"); - RaisePropertyChanged("Name"); - RaisePropertyChanged("Title"); - } - } - - public string FileName { - get { - if (FilePath == null) return null; - return Path.GetFileName(FilePath); - } - } - - public string Name { - get { - return FileName ?? tempName; - } - } - - public string Title { - get { - return IsDirty ? Name + "*" : Name; - } - } - - public DesignSurface DesignSurface { - get { return designSurface; } - } - - public DesignContext DesignContext { - get { return designSurface.DesignContext; } - } - - public UndoService UndoService { - get { return DesignContext.Services.GetService(); } - } - - public ISelectionService SelectionService { - get { - if (InDesignMode) { - return DesignContext.Services.Selection; - } - return null; - } - } - - public XamlErrorService XamlErrorService { - get { - if (DesignContext != null) { - return DesignContext.Services.GetService(); - } - return null; - } - } - - IOutlineNode outlineRoot; - - public IOutlineNode OutlineRoot { - get { - return outlineRoot; - } - private set { - outlineRoot = value; - RaisePropertyChanged("OutlineRoot"); - } - } - - void ReloadFile() - { - Text = File.ReadAllText(FilePath); - UpdateDesign(); - IsDirty = false; - } - - public void Save() - { - if (InDesignMode) { - UpdateXaml(); - } - File.WriteAllText(FilePath, Text); - IsDirty = false; - } - - public void SaveAs(string filePath) - { - FilePath = filePath; - Save(); - } - - public void Refresh() - { - UpdateXaml(); - UpdateDesign(); - } - - void UpdateXaml() - { - var sb = new StringBuilder(); - using (var xmlWriter = new XamlXmlWriter(sb)) { - DesignSurface.SaveDesigner(xmlWriter); - Text = XamlFormatter.Format(sb.ToString()); - } - } - - void UpdateDesign() - { - OutlineRoot = null; - using (var xmlReader = XmlReader.Create(new StringReader(Text))) { - XamlLoadSettings settings = new XamlLoadSettings(); - foreach (var assNode in Toolbox.Instance.AssemblyNodes) - { - settings.DesignerAssemblies.Add(assNode.Assembly); - } - settings.TypeFinder = MyTypeFinder.Instance; - - DesignSurface.LoadDesigner(xmlReader, settings); - } - if (DesignContext.RootItem != null) { - OutlineRoot = OutlineNode.Create(DesignContext.RootItem); - UndoService.UndoStackChanged += new EventHandler(UndoService_UndoStackChanged); - } - RaisePropertyChanged("SelectionService"); - RaisePropertyChanged("XamlErrorService"); - } - - void UndoService_UndoStackChanged(object sender, EventArgs e) - { - IsDirty = true; - if (InXamlMode) { - UpdateXaml(); - } - } - - #region INotifyPropertyChanged Members - - public event PropertyChangedEventHandler PropertyChanged; - - void RaisePropertyChanged(string name) - { - if (PropertyChanged != null) { - PropertyChanged(this, new PropertyChangedEventArgs(name)); - } - } - - #endregion - } - - public enum DocumentMode - { - Xaml, Design - } -} diff --git a/samples/XamlDesigner/DocumentView.xaml b/samples/XamlDesigner/DocumentView.xaml deleted file mode 100644 index 760bb699b9..0000000000 --- a/samples/XamlDesigner/DocumentView.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/samples/XamlDesigner/DocumentView.xaml.cs b/samples/XamlDesigner/DocumentView.xaml.cs deleted file mode 100644 index 755ba648d1..0000000000 --- a/samples/XamlDesigner/DocumentView.xaml.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -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.Windows.Threading; - -using ICSharpCode.WpfDesign.Designer.Services; - -namespace ICSharpCode.XamlDesigner -{ - public partial class DocumentView - { - public DocumentView(Document doc) - { - InitializeComponent(); - - Document = doc; - Shell.Instance.Views[doc] = this; - - //uxTextEditor.DataBindings.Add("Text", doc, "Text", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged); - Document.Mode = DocumentMode.Design; - Document.PropertyChanged += new PropertyChangedEventHandler(Document_PropertyChanged); - uxTextEditor.TextChanged += new EventHandler(uxTextEditor_TextChanged); - } - - void uxTextEditor_TextChanged(object sender, EventArgs e) - { - Document.Text = uxTextEditor.Text; - } - - void Document_PropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName == "Text" && Document.Text != uxTextEditor.Text) - uxTextEditor.Text = Document.Text; - } - - public Document Document { get; private set; } - - public void JumpToError(XamlError error) - { - Document.Mode = DocumentMode.Xaml; - try { - uxTextEditor.ScrollTo(error.Line, error.Column); - uxTextEditor.CaretOffset = uxTextEditor.Document.GetOffset(error.Line, error.Column); - - int n = 0; - char chr; - while ((chr = uxTextEditor.Document.GetCharAt(uxTextEditor.CaretOffset + n)) != ' ' && chr != '.' && chr != '<' && chr != '>' && chr != '"') - { n++; } - - uxTextEditor.SelectionLength = n; - } - catch (ArgumentException) { - // invalid line number - } - } - } -} diff --git a/samples/XamlDesigner/EnumBar.xaml b/samples/XamlDesigner/EnumBar.xaml deleted file mode 100644 index b47b79b00f..0000000000 --- a/samples/XamlDesigner/EnumBar.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/samples/XamlDesigner/EnumBar.xaml.cs b/samples/XamlDesigner/EnumBar.xaml.cs deleted file mode 100644 index 9d7e3c4ea5..0000000000 --- a/samples/XamlDesigner/EnumBar.xaml.cs +++ /dev/null @@ -1,72 +0,0 @@ -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.Windows.Controls.Primitives; - -namespace ICSharpCode.XamlDesigner -{ - public partial class EnumBar - { - public EnumBar() - { - InitializeComponent(); - } - - Type currentEnumType; - - public static readonly DependencyProperty ValueProperty = - DependencyProperty.Register("Value", typeof(object), typeof(EnumBar), - new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); - - public object Value { - get { return (object)GetValue(ValueProperty); } - set { SetValue(ValueProperty, value); } - } - - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - - if (e.Property == ValueProperty) { - var type = e.NewValue.GetType(); - - if (currentEnumType != type) { - currentEnumType = type; - uxPanel.Children.Clear(); - foreach (var v in Enum.GetValues(type)) { - var b = new EnumButton(); - b.Value = v; - b.Content = Enum.GetName(type, v); - b.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(button_PreviewMouseLeftButtonDown); - uxPanel.Children.Add(b); - } - } - - foreach (EnumButton c in uxPanel.Children) { - if (c.Value.Equals(Value)) { - c.IsChecked = true; - } - else { - c.IsChecked = false; - } - } - } - } - - void button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - Value = (sender as EnumButton).Value; - e.Handled = true; - } - } -} diff --git a/samples/XamlDesigner/EnumButton.cs b/samples/XamlDesigner/EnumButton.cs deleted file mode 100644 index a8a86d7d4a..0000000000 --- a/samples/XamlDesigner/EnumButton.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Controls.Primitives; -using System.Windows; - -namespace ICSharpCode.XamlDesigner -{ - public class EnumButton : ToggleButton - { - static EnumButton() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(EnumButton), - new FrameworkPropertyMetadata(typeof(EnumButton))); - } - - public static readonly DependencyProperty ValueProperty = - DependencyProperty.Register("Value", typeof(object), typeof(EnumButton)); - - public object Value { - get { return (object)GetValue(ValueProperty); } - set { SetValue(ValueProperty, value); } - } - } -} diff --git a/samples/XamlDesigner/ErrorListView.xaml b/samples/XamlDesigner/ErrorListView.xaml deleted file mode 100644 index 158a26f25e..0000000000 --- a/samples/XamlDesigner/ErrorListView.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/samples/XamlDesigner/ErrorListView.xaml.cs b/samples/XamlDesigner/ErrorListView.xaml.cs deleted file mode 100644 index 9d866bd82a..0000000000 --- a/samples/XamlDesigner/ErrorListView.xaml.cs +++ /dev/null @@ -1,33 +0,0 @@ -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.WpfDesign.Designer.Services; - -namespace ICSharpCode.XamlDesigner -{ - public partial class ErrorListView - { - public ErrorListView() - { - InitializeComponent(); - } - - protected override void OnMouseDoubleClick(MouseButtonEventArgs e) - { - var error = e.GetDataContext() as XamlError; - if (error != null) { - Shell.Instance.JumpToError(error); - } - } - } -} diff --git a/samples/XamlDesigner/ExtensionMethods.cs b/samples/XamlDesigner/ExtensionMethods.cs deleted file mode 100644 index 3c582b0adc..0000000000 --- a/samples/XamlDesigner/ExtensionMethods.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Documents; -using System.Windows.Media; -using System.IO; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.Collections; - -namespace ICSharpCode.XamlDesigner -{ - static class ExtensionMethods - { - public static IEnumerable Paths(this IDataObject data) - { - string[] paths = (string[])data.GetData(DataFormats.FileDrop); - if (paths != null) { - foreach (var path in paths) { - yield return path; - } - } - } - - public static T GetObject(this IDataObject data) - { - return (T)data.GetData(typeof(T).FullName); - } - - public static Stream ToStream(this string s) - { - return new MemoryStream(Encoding.UTF8.GetBytes(s)); - } - - public static void AddRange(this ObservableCollection col, IEnumerable items) - { - foreach (var item in items) { - col.Add(item); - } - } - - public static void KeepSyncronizedWith(this IList target, ObservableCollection source, Func convert) - { - target.Clear(); - foreach (var item in source) { - target.Add(convert(item)); - } - - source.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) { - switch (e.Action) { - case NotifyCollectionChangedAction.Add: - target.Add(convert((S)e.NewItems[0])); - break; - - case NotifyCollectionChangedAction.Remove: - target.RemoveAt(e.OldStartingIndex); - break; - - case NotifyCollectionChangedAction.Move: - target.RemoveAt(e.OldStartingIndex); - target.Insert(e.NewStartingIndex, e.NewItems[0]); - break; - - case NotifyCollectionChangedAction.Replace: - target[e.NewStartingIndex] = convert((S)e.NewItems[0]); - break; - - case NotifyCollectionChangedAction.Reset: - target.Clear(); - break; - } - }; - } - - public static object GetDataContext(this RoutedEventArgs e) - { - var f = e.OriginalSource as FrameworkElement; - if (f != null) return f.DataContext; - return null; - } - } -} diff --git a/samples/XamlDesigner/Images/Error.png b/samples/XamlDesigner/Images/Error.png deleted file mode 100644 index c37bd062e6..0000000000 Binary files a/samples/XamlDesigner/Images/Error.png and /dev/null differ diff --git a/samples/XamlDesigner/Images/Reference.png b/samples/XamlDesigner/Images/Reference.png deleted file mode 100644 index da47049481..0000000000 Binary files a/samples/XamlDesigner/Images/Reference.png and /dev/null differ diff --git a/samples/XamlDesigner/Images/Tag.png b/samples/XamlDesigner/Images/Tag.png deleted file mode 100644 index b7686f106b..0000000000 Binary files a/samples/XamlDesigner/Images/Tag.png and /dev/null differ diff --git a/samples/XamlDesigner/MainWindow.xaml b/samples/XamlDesigner/MainWindow.xaml deleted file mode 100644 index 881a18b050..0000000000 --- a/samples/XamlDesigner/MainWindow.xaml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/XamlDesigner/MainWindow.xaml.cs b/samples/XamlDesigner/MainWindow.xaml.cs deleted file mode 100644 index 6a83fde070..0000000000 --- a/samples/XamlDesigner/MainWindow.xaml.cs +++ /dev/null @@ -1,191 +0,0 @@ -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 ICSharpCode.XamlDesigner.Configuration; -using System.ComponentModel; -using Microsoft.Win32; -using AvalonDock; -using System.IO; -using System.Collections.Specialized; -using ICSharpCode.WpfDesign.Designer; - -namespace ICSharpCode.XamlDesigner -{ - public partial class MainWindow - { - public MainWindow() - { - Instance = this; - DataContext = Shell.Instance; - RenameCommands(); - BasicMetadata.Register(); - - InitializeComponent(); - - Shell.Instance.PropertyGrid = uxPropertyGridView.PropertyGrid; - AvalonDockWorkaround(); - RouteDesignSurfaceCommands(); - - this.AddCommandHandler(RefreshCommand, Shell.Instance.Refresh, Shell.Instance.CanRefresh); - - LoadSettings(); - ProcessPaths(App.Args); - - ApplicationCommands.New.Execute(null, this); - } - - public static MainWindow Instance; - - OpenFileDialog openFileDialog; - SaveFileDialog saveFileDialog; - - protected override void OnDragEnter(DragEventArgs e) - { - ProcessDrag(e); - } - - protected override void OnDragOver(DragEventArgs e) - { - ProcessDrag(e); - } - - protected override void OnDrop(DragEventArgs e) - { - ProcessPaths(e.Data.Paths()); - } - - protected override void OnClosing(CancelEventArgs e) - { - if (Shell.Instance.PrepareExit()) { - SaveSettings(); - } - else { - e.Cancel = true; - } - base.OnClosing(e); - } - - void RecentFiles_Click(object sender, RoutedEventArgs e) - { - var path = (string)(e.OriginalSource as MenuItem).Header; - Shell.Instance.Open(path); - } - - void ProcessDrag(DragEventArgs e) - { - e.Effects = DragDropEffects.None; - e.Handled = true; - - foreach (var path in e.Data.Paths()) { - if (path.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) || - path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase)) { - e.Effects = DragDropEffects.Copy; - break; - } - else if (path.EndsWith(".xaml", StringComparison.InvariantCultureIgnoreCase)) { - e.Effects = DragDropEffects.Copy; - break; - } - } - } - - void ProcessPaths(IEnumerable paths) - { - foreach (var path in paths) { - if (path.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) || - path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase)) { - Toolbox.Instance.AddAssembly(path); - } - else if (path.EndsWith(".xaml", StringComparison.InvariantCultureIgnoreCase)) { - Shell.Instance.Open(path); - } - } - } - - public string AskOpenFileName() - { - if (openFileDialog == null) { - openFileDialog = new OpenFileDialog(); - openFileDialog.Filter = "Xaml Documents (*.xaml)|*.xaml"; - } - if ((bool)openFileDialog.ShowDialog()) { - return openFileDialog.FileName; - } - return null; - } - - public string AskSaveFileName(string initName) - { - if (saveFileDialog == null) { - saveFileDialog = new SaveFileDialog(); - saveFileDialog.Filter = "Xaml Documents (*.xaml)|*.xaml"; - } - saveFileDialog.FileName = initName; - if ((bool)saveFileDialog.ShowDialog()) { - return saveFileDialog.FileName; - } - return null; - } - - void LoadSettings() - { - WindowState = Settings.Default.MainWindowState; - - Rect r = Settings.Default.MainWindowRect; - if (r != new Rect()) { - Left = r.Left; - Top = r.Top; - Width = r.Width; - Height = r.Height; - } - - uxDockingManager.Loaded += delegate { - if (Settings.Default.AvalonDockLayout != null) { - uxDockingManager.RestoreLayout(Settings.Default.AvalonDockLayout.ToStream()); - } - }; - } - - void SaveSettings() - { - Settings.Default.MainWindowState = WindowState; - if (WindowState == WindowState.Normal) { - Settings.Default.MainWindowRect = new Rect(Left, Top, Width, Height); - } - - var writer = new StringWriter(); - uxDockingManager.SaveLayout(writer); - Settings.Default.AvalonDockLayout = writer.ToString(); - - Shell.Instance.SaveSettings(); - } - - #region AvalonDockWorkaround - - void AvalonDockWorkaround() - { - uxDocumentPane.Items.KeepSyncronizedWith(Shell.Instance.Documents, d => CreateContentFor(d)); - } - - DocumentContent CreateContentFor(Document doc) - { - var content = new DocumentContent() { - DataContext = doc, - Content = new DocumentView(doc) - }; - content.SetBinding(DocumentContent.TitleProperty, "Title"); - return content; - } - - #endregion - } -} diff --git a/samples/XamlDesigner/MainWindow_Commands.cs b/samples/XamlDesigner/MainWindow_Commands.cs deleted file mode 100644 index bb6c0c7b5b..0000000000 --- a/samples/XamlDesigner/MainWindow_Commands.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Xml; - -using Microsoft.Win32; - -namespace ICSharpCode.XamlDesigner -{ - public partial class MainWindow - { - public static SimpleCommand CloseAllCommand = new SimpleCommand("Close All"); - public static SimpleCommand SaveAllCommand = new SimpleCommand("Save All", ModifierKeys.Control | ModifierKeys.Shift, Key.S); - public static SimpleCommand ExitCommand = new SimpleCommand("Exit"); - public static SimpleCommand RefreshCommand = new SimpleCommand("Refresh", Key.F5); - public static SimpleCommand RunCommand = new SimpleCommand("Run", ModifierKeys.Shift, Key.F5); - public static SimpleCommand RenderToBitmapCommand = new SimpleCommand("Render to Bitmap"); - - static void RenameCommands() - { - ApplicationCommands.Open.Text = "Open..."; - ApplicationCommands.SaveAs.Text = "Save As..."; - } - - void NewCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.New(); - } - - void OpenCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.Open(); - } - - void CloseCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.CloseCurrentDocument(); - } - - void CloseCommand_PreviewExecuted(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.CloseCurrentDocument(); - } - - void CloseAllCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.CloseAll(); - } - - void SaveCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.SaveCurrentDocument(); - } - - void SaveAsCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.SaveCurrentDocumentAs(); - } - - void SaveAllCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.SaveAll(); - } - - void RunCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - StringBuilder sb = new StringBuilder(); - var xmlWriter = XmlWriter.Create(new StringWriter(sb)); - Shell.Instance.CurrentDocument.DesignSurface.SaveDesigner(xmlWriter); - - var txt = sb.ToString(); - var xmlReader = XmlReader.Create(new StringReader(txt)); - - var ctl = XamlReader.Load(xmlReader); - - Window wnd = ctl as Window; - if (wnd == null) { - wnd = new Window(); - wnd.Content = ctl; - } - wnd.Show(); - } - - void RenderToBitmapCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - int desiredWidth = 300; - int desiredHeight = 300; - - StringBuilder sb = new StringBuilder(); - var xmlWriter = XmlWriter.Create(new StringWriter(sb)); - Shell.Instance.CurrentDocument.DesignSurface.SaveDesigner(xmlWriter); - - var txt = sb.ToString(); - var xmlReader = XmlReader.Create(new StringReader(txt)); - - var ctl = XamlReader.Load(xmlReader) as Control; - if (ctl is Window) { - var wnd = ctl as Window; - wnd.Width = desiredWidth; - wnd.Height = desiredHeight; - wnd.Top = -10000; - wnd.Left = -10000; - wnd.Show(); - } else { - ctl.Measure(new Size(desiredWidth, desiredHeight)); - ctl.Arrange(new Rect(new Size(desiredWidth, desiredHeight))); - } - - RenderTargetBitmap bmp = new RenderTargetBitmap(300, 300, 96, 96, PixelFormats.Default); - bmp.Render(ctl); - - var encoder = new PngBitmapEncoder(); - - encoder.Frames.Add(BitmapFrame.Create(bmp)); - - var dlg = new SaveFileDialog(); - dlg.Filter = "*.png|*.png"; - if (dlg.ShowDialog() == true) { - using (Stream stm = File.OpenWrite(dlg.FileName)) { - encoder.Save(stm); - stm.Flush(); - } - } - - if (ctl is Window) { - var wnd = ctl as Window; - wnd.Close(); - } - } - - void ExitCommand_Executed(object sender, ExecutedRoutedEventArgs e) - { - Shell.Instance.Exit(); - } - - void CurrentDocument_CanExecute(object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = Shell.Instance.CurrentDocument != null; - } - - void RouteDesignSurfaceCommands() - { - RouteDesignSurfaceCommand(ApplicationCommands.Undo); - RouteDesignSurfaceCommand(ApplicationCommands.Redo); - RouteDesignSurfaceCommand(ApplicationCommands.Copy); - RouteDesignSurfaceCommand(ApplicationCommands.Cut); - RouteDesignSurfaceCommand(ApplicationCommands.Paste); - RouteDesignSurfaceCommand(ApplicationCommands.SelectAll); - RouteDesignSurfaceCommand(ApplicationCommands.Delete); - } - - void RouteDesignSurfaceCommand(RoutedCommand command) - { - var cb = new CommandBinding(command); - cb.CanExecute += delegate(object sender, CanExecuteRoutedEventArgs e) { - if (Shell.Instance.CurrentDocument != null) { - Shell.Instance.CurrentDocument.DesignSurface.RaiseEvent(e); - }else { - e.CanExecute = false; - } - }; - cb.Executed += delegate(object sender, ExecutedRoutedEventArgs e) { - Shell.Instance.CurrentDocument.DesignSurface.RaiseEvent(e); - }; - CommandBindings.Add(cb); - } - } -} diff --git a/samples/XamlDesigner/MyTypeFinder.cs b/samples/XamlDesigner/MyTypeFinder.cs deleted file mode 100644 index 6f529d4514..0000000000 --- a/samples/XamlDesigner/MyTypeFinder.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Reflection; -using System.Text; -using ICSharpCode.WpfDesign.XamlDom; - -namespace ICSharpCode.XamlDesigner -{ - public class MyTypeFinder : XamlTypeFinder - { - public override Assembly LoadAssembly(string name) - { - foreach (var assemblyNode in Toolbox.Instance.AssemblyNodes) - { - if (assemblyNode.Name == name) - return assemblyNode.Assembly; - } - - return null; - } - - public override XamlTypeFinder Clone() - { - return _instance; - } - - private static object lockObj = new object(); - - private static MyTypeFinder _instance; - public static MyTypeFinder Instance - { - get - { - lock (lockObj) - { - if (_instance == null) - { - _instance = new MyTypeFinder(); - _instance.ImportFrom(CreateWpfTypeFinder()); - } - } - - return _instance; - } - } - } -} diff --git a/samples/XamlDesigner/NewFileTemplate.xaml b/samples/XamlDesigner/NewFileTemplate.xaml deleted file mode 100644 index 5241a58a98..0000000000 --- a/samples/XamlDesigner/NewFileTemplate.xaml +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/samples/XamlDesigner/Shell.cs b/samples/XamlDesigner/Shell.cs deleted file mode 100644 index fad5178762..0000000000 --- a/samples/XamlDesigner/Shell.cs +++ /dev/null @@ -1,260 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.ComponentModel; -using System.Collections.ObjectModel; -using ICSharpCode.WpfDesign.Designer.PropertyGrid; -using ICSharpCode.XamlDesigner.Configuration; -using System.Collections.Specialized; -using System.IO; -using System.Windows; -using System.Diagnostics; -using ICSharpCode.WpfDesign.Designer.Services; - -namespace ICSharpCode.XamlDesigner -{ - public class Shell : INotifyPropertyChanged - { - public Shell() - { - Documents = new ObservableCollection(); - RecentFiles = new ObservableCollection(); - Views = new Dictionary(); - - LoadSettings(); - } - - public static Shell Instance = new Shell(); - public const string ApplicationTitle = "Xaml Designer"; - - //public Toolbox Toolbox { get; set; } - //public SceneTree SceneTree { get; set; } - public IPropertyGrid PropertyGrid { get; internal set; } - //public ErrorList ErrorList { get; set; } - - public ObservableCollection Documents { get; private set; } - public ObservableCollection RecentFiles { get; private set; } - public Dictionary Views { get; private set; } - - Document currentDocument; - - public Document CurrentDocument { - get { - return currentDocument; - } - set { - currentDocument = value; - RaisePropertyChanged("CurrentDocument"); - RaisePropertyChanged("Title"); - } - } - - public string Title { - get { - if (CurrentDocument != null) { - return CurrentDocument.Title + " - " + ApplicationTitle; - } - return ApplicationTitle; - } - } - - void LoadSettings() - { - if (Settings.Default.RecentFiles != null) { - RecentFiles.AddRange(Settings.Default.RecentFiles.Cast()); - } - } - - public void SaveSettings() - { - if (Settings.Default.RecentFiles == null) { - Settings.Default.RecentFiles = new StringCollection(); - } - else { - Settings.Default.RecentFiles.Clear(); - } - foreach (var f in RecentFiles) { - Settings.Default.RecentFiles.Add(f); - } - } - - public static void ReportException(Exception x) - { - MessageBox.Show(x.ToString()); - } - - public void JumpToError(XamlError error) - { - if (CurrentDocument != null) { - (Views[CurrentDocument] as DocumentView).JumpToError(error); - } - } - - public bool CanRefresh() - { - return CurrentDocument != null; - } - - public void Refresh() - { - CurrentDocument.Refresh(); - } - - #region Files - - bool IsSomethingDirty { - get { - foreach (var doc in Shell.Instance.Documents) { - if (doc.IsDirty) return true; - } - return false; - } - } - - static int nonameIndex = 1; - - public void New() - { - Document doc = new Document("New" + nonameIndex++, File.ReadAllText("NewFileTemplate.xaml")); - Documents.Add(doc); - CurrentDocument = doc; - } - - public void Open() - { - var path = MainWindow.Instance.AskOpenFileName(); - if (path != null) { - Open(path); - } - } - - public void Open(string path) - { - path = Path.GetFullPath(path); - - if (RecentFiles.Contains(path)) { - RecentFiles.Remove(path); - } - RecentFiles.Insert(0, path); - - foreach (var doc in Documents) { - if (doc.FilePath == path) { - CurrentDocument = doc; - return; - } - } - - var newDoc = new Document(path); - Documents.Add(newDoc); - CurrentDocument = newDoc; - } - - public bool Save(Document doc) - { - if (doc.IsDirty) { - if (doc.FilePath == null) { - return SaveAs(doc); - } - doc.Save(); - } - return true; - } - - public bool SaveAs(Document doc) - { - var initName = doc.FileName ?? doc.Name + ".xaml"; - var path = MainWindow.Instance.AskSaveFileName(initName); - if (path != null) { - doc.SaveAs(path); - return true; - } - return false; - } - - public bool SaveAll() - { - foreach (var doc in Documents) { - if (!Save(doc)) return false; - } - return true; - } - - public bool Close(Document doc) - { - if (doc.IsDirty) { - var result = MessageBox.Show("Save \"" + doc.Name + "\" ?", Shell.ApplicationTitle, - MessageBoxButton.YesNoCancel, MessageBoxImage.Question); - - if (result == MessageBoxResult.Yes) { - if (!Save(doc)) return false; - } - else if (result == MessageBoxResult.Cancel) { - return false; - } - } - Documents.Remove(doc); - Views.Remove(doc); - return true; - } - - public bool CloseAll() - { - foreach (var doc in Documents.ToArray()) { - if (!Close(doc)) return false; - } - return true; - } - - public bool PrepareExit() - { - if (IsSomethingDirty) { - var result = MessageBox.Show("Save All?", Shell.ApplicationTitle, - MessageBoxButton.YesNoCancel, MessageBoxImage.Question); - - if (result == MessageBoxResult.Yes) { - if (!SaveAll()) return false; - } - else if (result == MessageBoxResult.Cancel) { - return false; - } - } - return true; - } - - public void Exit() - { - MainWindow.Instance.Close(); - } - - public void SaveCurrentDocument() - { - Save(CurrentDocument); - } - - public void SaveCurrentDocumentAs() - { - SaveAs(CurrentDocument); - } - - public void CloseCurrentDocument() - { - Close(CurrentDocument); - } - - #endregion - - #region INotifyPropertyChanged Members - - public event PropertyChangedEventHandler PropertyChanged; - - void RaisePropertyChanged(string name) - { - if (PropertyChanged != null) { - PropertyChanged(this, new PropertyChangedEventArgs(name)); - } - } - - #endregion - } -} diff --git a/samples/XamlDesigner/SimpleCommand.cs b/samples/XamlDesigner/SimpleCommand.cs deleted file mode 100644 index 3daea1f5f0..0000000000 --- a/samples/XamlDesigner/SimpleCommand.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Input; - -namespace ICSharpCode.XamlDesigner -{ - public class SimpleCommand : RoutedUICommand - { - public SimpleCommand(string text) - { - Text = text; - } - - public SimpleCommand(string text, ModifierKeys modifiers, Key key) - { - InputGestures.Add(new KeyGesture(key, modifiers)); - Text = text; - } - - public SimpleCommand(string text, Key key) - : this(text, ModifierKeys.None, key) - { - } - } -} diff --git a/samples/XamlDesigner/TestFiles/1.xaml b/samples/XamlDesigner/TestFiles/1.xaml deleted file mode 100644 index cca7754177..0000000000 --- a/samples/XamlDesigner/TestFiles/1.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/XamlDesigner/TestFiles/2.xaml b/samples/XamlDesigner/TestFiles/2.xaml deleted file mode 100644 index 1ecefb8e64..0000000000 --- a/samples/XamlDesigner/TestFiles/2.xaml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - -