From 2fdf0b903b455084c44c3a400199eb02804bb024 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Mon, 29 May 2017 17:01:20 +1200 Subject: [PATCH 001/142] #444 Remove unsupported projects from solution --- src/Caliburn.Micro.sln | 135 +---------------------------------------- 1 file changed, 2 insertions(+), 133 deletions(-) diff --git a/src/Caliburn.Micro.sln b/src/Caliburn.Micro.sln index 54869614..66a5147e 100644 --- a/src/Caliburn.Micro.sln +++ b/src/Caliburn.Micro.sln @@ -1,10 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.6 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.WIN81", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.WIN81.csproj", "{73A34351-FB6A-489E-82DC-5790AF7693E3}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro", "Caliburn.Micro\Caliburn.Micro.csproj", "{6D772B52-DA8F-4784-971A-4BF50CB6D306}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caliburn.Micro.Platform", "Caliburn.Micro.Platform", "{266A0FDB-CA59-4E27-B258-9552E368BE46}" @@ -13,20 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caliburn.Micro.Tests", "Cal EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.NET45", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.NET45.csproj", "{EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.SL5", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.SL5.csproj", "{7A82B446-E050-4373-AA06-F8B62EE1E40C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.WP8", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.WP8.csproj", "{50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Tests.NET45", "Caliburn.Micro.Tests.NET45\Caliburn.Micro.Tests.NET45.csproj", "{374C996D-59C3-426D-B6BD-D884348BE7C8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.SL5", "Caliburn.Micro\Caliburn.Micro.SL5.csproj", "{21935B00-9E24-46DF-AA7A-A0065010C594}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.WPA81", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.WPA81.csproj", "{7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.NET40", "Caliburn.Micro\Caliburn.Micro.NET40.csproj", "{5198B87D-8E7B-48D9-960D-63170A6956C5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.NET40", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.NET40.csproj", "{B633FE8C-B40E-4122-A763-F94C8B1A70F8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Android", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.Android.csproj", "{1647828F-AD5F-4CC3-8A27-11F06428B877}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.iOS", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.iOS.csproj", "{F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1}" @@ -49,22 +35,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|ARM.ActiveCfg = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|ARM.Build.0 = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|x64.ActiveCfg = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|x64.Build.0 = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|x86.ActiveCfg = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Debug|x86.Build.0 = Debug|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|Any CPU.Build.0 = Release|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|ARM.ActiveCfg = Release|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|ARM.Build.0 = Release|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|x64.ActiveCfg = Release|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|x64.Build.0 = Release|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|x86.ActiveCfg = Release|Any CPU - {73A34351-FB6A-489E-82DC-5790AF7693E3}.Release|x86.Build.0 = Release|Any CPU {6D772B52-DA8F-4784-971A-4BF50CB6D306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6D772B52-DA8F-4784-971A-4BF50CB6D306}.Debug|Any CPU.Build.0 = Debug|Any CPU {6D772B52-DA8F-4784-971A-4BF50CB6D306}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -97,38 +67,6 @@ Global {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x64.Build.0 = Release|Any CPU {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x86.ActiveCfg = Release|Any CPU {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x86.Build.0 = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|ARM.ActiveCfg = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|ARM.Build.0 = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|x64.ActiveCfg = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|x64.Build.0 = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|x86.ActiveCfg = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Debug|x86.Build.0 = Debug|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|Any CPU.Build.0 = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|ARM.ActiveCfg = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|ARM.Build.0 = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|x64.ActiveCfg = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|x64.Build.0 = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|x86.ActiveCfg = Release|Any CPU - {7A82B446-E050-4373-AA06-F8B62EE1E40C}.Release|x86.Build.0 = Release|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|ARM.ActiveCfg = Debug|ARM - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|ARM.Build.0 = Debug|ARM - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|x64.ActiveCfg = Debug|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|x64.Build.0 = Debug|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|x86.ActiveCfg = Debug|x86 - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Debug|x86.Build.0 = Debug|x86 - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|Any CPU.Build.0 = Release|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|ARM.ActiveCfg = Release|ARM - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|ARM.Build.0 = Release|ARM - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|x64.ActiveCfg = Release|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|x64.Build.0 = Release|Any CPU - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|x86.ActiveCfg = Release|x86 - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF}.Release|x86.Build.0 = Release|x86 {374C996D-59C3-426D-B6BD-D884348BE7C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -145,70 +83,6 @@ Global {374C996D-59C3-426D-B6BD-D884348BE7C8}.Release|x64.Build.0 = Release|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Release|x86.ActiveCfg = Release|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Release|x86.Build.0 = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|ARM.ActiveCfg = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|ARM.Build.0 = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|x64.ActiveCfg = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|x64.Build.0 = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|x86.ActiveCfg = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Debug|x86.Build.0 = Debug|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|Any CPU.ActiveCfg = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|Any CPU.Build.0 = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|ARM.ActiveCfg = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|ARM.Build.0 = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|x64.ActiveCfg = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|x64.Build.0 = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|x86.ActiveCfg = Release|Any CPU - {21935B00-9E24-46DF-AA7A-A0065010C594}.Release|x86.Build.0 = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|ARM.ActiveCfg = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|ARM.Build.0 = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|x64.ActiveCfg = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|x64.Build.0 = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|x86.ActiveCfg = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Debug|x86.Build.0 = Debug|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|Any CPU.Build.0 = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|ARM.ActiveCfg = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|ARM.Build.0 = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|x64.ActiveCfg = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|x64.Build.0 = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|x86.ActiveCfg = Release|Any CPU - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA}.Release|x86.Build.0 = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|ARM.ActiveCfg = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|ARM.Build.0 = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|x64.ActiveCfg = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|x64.Build.0 = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|x86.ActiveCfg = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Debug|x86.Build.0 = Debug|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|Any CPU.Build.0 = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|ARM.ActiveCfg = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|ARM.Build.0 = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|x64.ActiveCfg = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|x64.Build.0 = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|x86.ActiveCfg = Release|Any CPU - {5198B87D-8E7B-48D9-960D-63170A6956C5}.Release|x86.Build.0 = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|ARM.ActiveCfg = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|ARM.Build.0 = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|x64.ActiveCfg = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|x64.Build.0 = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|x86.ActiveCfg = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Debug|x86.Build.0 = Debug|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|Any CPU.Build.0 = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|ARM.ActiveCfg = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|ARM.Build.0 = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|x64.ActiveCfg = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|x64.Build.0 = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|x86.ActiveCfg = Release|Any CPU - {B633FE8C-B40E-4122-A763-F94C8B1A70F8}.Release|x86.Build.0 = Release|Any CPU {1647828F-AD5F-4CC3-8A27-11F06428B877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1647828F-AD5F-4CC3-8A27-11F06428B877}.Debug|Any CPU.Build.0 = Debug|Any CPU {1647828F-AD5F-4CC3-8A27-11F06428B877}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -294,13 +168,8 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {73A34351-FB6A-489E-82DC-5790AF7693E3} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809} = {266A0FDB-CA59-4E27-B258-9552E368BE46} - {7A82B446-E050-4373-AA06-F8B62EE1E40C} = {266A0FDB-CA59-4E27-B258-9552E368BE46} - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {374C996D-59C3-426D-B6BD-D884348BE7C8} = {75218E6C-3CF6-4A27-877B-5563A2BFB4A3} - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA} = {266A0FDB-CA59-4E27-B258-9552E368BE46} - {B633FE8C-B40E-4122-A763-F94C8B1A70F8} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {1647828F-AD5F-4CC3-8A27-11F06428B877} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {67F9D3A8-F71E-4428-913F-C37AE82CDB24} = {266A0FDB-CA59-4E27-B258-9552E368BE46} From 2b48d2a3fb786cbef60b9aad47fdd7540d96ad22 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Mon, 29 May 2017 17:03:59 +1200 Subject: [PATCH 002/142] #444 Remove unused projects Including packages.config --- .../Caliburn.Micro.NET40.csproj.DotSettings | 2 - .../Caliburn.Micro.Platform.NET40.csproj | 114 ------------- ...rn.Micro.Platform.NET40.csproj.DotSettings | 2 - ...burn.Micro.Platform.SL4.csproj.DotSettings | 2 - .../Caliburn.Micro.Platform.SL5.csproj | 140 ---------------- ...burn.Micro.Platform.SL5.csproj.DotSettings | 2 - ...urn.Micro.Platform.WIN8.csproj.DotSettings | 2 - .../Caliburn.Micro.Platform.WIN81.csproj | 126 -------------- ...rn.Micro.Platform.WIN81.csproj.DotSettings | 2 - .../Caliburn.Micro.Platform.WP8.csproj | 140 ---------------- ...burn.Micro.Platform.WP8.csproj.DotSettings | 2 - .../Caliburn.Micro.Platform.WPA81.csproj | 124 -------------- .../Caliburn.Micro.SL4.csproj.DotSettings | 2 - .../Caliburn.Micro.WIN8.csproj.DotSettings | 2 - ...kages.Caliburn.Micro.Platform.NET40.config | 4 - ...ackages.Caliburn.Micro.Platform.SL5.config | 4 - ...kages.Caliburn.Micro.Platform.WIN81.config | 4 - ...ackages.Caliburn.Micro.Platform.WP8.config | 4 - ...kages.Caliburn.Micro.Platform.WPA81.config | 4 - .../Caliburn.Micro.NET40.csproj | 133 --------------- src/Caliburn.Micro/Caliburn.Micro.SL5.csproj | 158 ------------------ 21 files changed, 973 deletions(-) delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.NET40.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL4.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN8.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WPA81.csproj delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.SL4.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.WIN8.csproj.DotSettings delete mode 100644 src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.NET40.config delete mode 100644 src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.SL5.config delete mode 100644 src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WIN81.config delete mode 100644 src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WP8.config delete mode 100644 src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WPA81.config delete mode 100644 src/Caliburn.Micro/Caliburn.Micro.NET40.csproj delete mode 100644 src/Caliburn.Micro/Caliburn.Micro.SL5.csproj diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.NET40.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.NET40.csproj.DotSettings deleted file mode 100644 index ebbbab04..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.NET40.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj deleted file mode 100644 index b6222629..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj +++ /dev/null @@ -1,114 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {B633FE8C-B40E-4122-A763-F94C8B1A70F8} - Library - Properties - Caliburn.Micro - Caliburn.Micro.Platform - v4.0 - 512 - Client - ..\..\obj\net40\ - - - true - full - false - ..\..\bin\net40\Debug\ - TRACE;DEBUG;NET - prompt - 4 - ..\..\bin\net40\Debug\Caliburn.Micro.Platform.xml - 1572 - - - pdbonly - true - ..\..\bin\net40\Release\ - TRACE;NET - prompt - 4 - ..\..\bin\net40\Release\Caliburn.Micro.Platform.xml - 1572 - - - true - - - ..\Caliburn.snk - - - - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caliburn.snk - - - - - - {5198b87d-8e7b-48d9-960d-63170a6956c5} - Caliburn.Micro.NET40 - False - - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj.DotSettings deleted file mode 100644 index ebbbab04..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET40.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL4.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL4.csproj.DotSettings deleted file mode 100644 index 66076be0..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL4.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj deleted file mode 100644 index 444e4790..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {7A82B446-E050-4373-AA06-F8B62EE1E40C} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Caliburn.Micro - Caliburn.Micro.Platform - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - true - true - ..\..\obj\sl5\ - - - - v3.5 - - - true - full - false - ..\..\bin\sl5\Debug\ - TRACE;DEBUG;SILVERLIGHT;SL5 - true - true - prompt - 4 - ..\..\bin\sl5\Debug\Caliburn.Micro.Platform.xml - 1572 - - - pdbonly - true - ..\..\bin\sl5\Release\ - TRACE;SILVERLIGHT;SL5 - true - true - prompt - 4 - ..\..\bin\sl5\Release\Caliburn.Micro.Platform.xml - 1572 - - - true - - - ..\Caliburn.snk - - - - - - - - False - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caliburn.snk - - - - - - {21935b00-9e24-46df-aa7a-a0065010c594} - Caliburn.Micro.SL5 - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj.DotSettings deleted file mode 100644 index 66076be0..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.SL5.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN8.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN8.csproj.DotSettings deleted file mode 100644 index 5f733d2b..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN8.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj deleted file mode 100644 index f48b563a..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {73A34351-FB6A-489E-82DC-5790AF7693E3} - Library - Properties - Caliburn.Micro - Caliburn.Micro.Platform - en-US - 8.1 - 12 - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - ..\..\obj\win81\ - - - true - full - false - ..\..\bin\win81\Debug\ - TRACE;DEBUG;NETFX_CORE;WinRT;WinRT81 - prompt - 4 - ..\..\bin\win81\Debug\Caliburn.Micro.Platform.XML - 1572 - - - pdbonly - true - ..\..\bin\win81\Release\ - TRACE;NETFX_CORE;WinRT;WinRT81 - prompt - 4 - ..\..\bin\win81\Release\Caliburn.Micro.Platform.XML - 1572 - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caliburn.snk - - - - - - - - - - - - - - - - - - - - - - {6d772b52-da8f-4784-971a-4bf50cb6d306} - Caliburn.Micro - - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} - Caliburn.Micro.Platform.Core - - - - - Behaviors SDK %28XAML%29 - - - - 12.0 - - - true - - - ..\Caliburn.snk - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj.DotSettings deleted file mode 100644 index 5f733d2b..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WIN81.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj deleted file mode 100644 index 26c158ec..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {50DAA3F0-3BAD-433A-B4B2-4A38DEF9DFAF} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Caliburn.Micro - Caliburn.Micro.Platform - v8.0 - - - - - WindowsPhone - false - true - true - 11.0 - ..\..\obj\wp8\ - - - true - full - false - ..\..\bin\wp8\Debug\ - TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;WP8 - true - true - prompt - 4 - ..\..\bin\wp8\Debug\Caliburn.Micro.Platform.xml - false - 1572 - - - pdbonly - true - ..\..\bin\wp8\Release\ - TRACE;SILVERLIGHT;WINDOWS_PHONE;WP8 - true - true - prompt - 4 - ..\..\bin\wp8\Release\Caliburn.Micro.Platform.xml - false - 1572 - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caliburn.snk - - - - - {6D772B52-DA8F-4784-971A-4BF50CB6D306} - Caliburn.Micro - - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} - Caliburn.Micro.Platform.Core - - - - - - - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj.DotSettings deleted file mode 100644 index 7d44f344..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WP8.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WPA81.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WPA81.csproj deleted file mode 100644 index 4de4323e..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.WPA81.csproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {7CBF76FE-E094-4DFE-B6E1-ABFCE98C78EA} - Library - Properties - Caliburn.Micro - Caliburn.Micro.Platform - en-US - 8.1 - 12 - 512 - {76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - ..\..\obj\wpa81\ - - - true - full - false - ..\..\bin\wpa81\Debug\ - TRACE;DEBUG;NETFX_CORE;WinRT;WinRT81;WP81; - prompt - 4 - ..\..\bin\wpa81\Debug\Caliburn.Micro.Platform.xml - 1572 - - - pdbonly - true - ..\..\bin\wpa81\Release\ - TRACE;NETFX_CORE;WinRT;WinRT81;WP81; - prompt - 4 - ..\..\bin\wpa81\Release\Caliburn.Micro.Platform.xml - 1572 - - - - - {6d772b52-da8f-4784-971a-4bf50cb6d306} - Caliburn.Micro - - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} - Caliburn.Micro.Platform.Core - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Behaviors SDK %28XAML%29 - - - - - Caliburn.snk - - - - - 12.0 - - - WindowsPhoneApp - - - true - - - ..\Caliburn.snk - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.SL4.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.SL4.csproj.DotSettings deleted file mode 100644 index 66076be0..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.SL4.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.WIN8.csproj.DotSettings b/src/Caliburn.Micro.Platform/Caliburn.Micro.WIN8.csproj.DotSettings deleted file mode 100644 index 5f733d2b..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.WIN8.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.NET40.config b/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.NET40.config deleted file mode 100644 index 6e623915..00000000 --- a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.NET40.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.SL5.config b/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.SL5.config deleted file mode 100644 index 6e623915..00000000 --- a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.SL5.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WIN81.config b/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WIN81.config deleted file mode 100644 index 6e623915..00000000 --- a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WIN81.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WP8.config b/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WP8.config deleted file mode 100644 index 6e623915..00000000 --- a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WP8.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WPA81.config b/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WPA81.config deleted file mode 100644 index 6e623915..00000000 --- a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.WPA81.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro/Caliburn.Micro.NET40.csproj b/src/Caliburn.Micro/Caliburn.Micro.NET40.csproj deleted file mode 100644 index 18dbbb0e..00000000 --- a/src/Caliburn.Micro/Caliburn.Micro.NET40.csproj +++ /dev/null @@ -1,133 +0,0 @@ - - - - - Debug - AnyCPU - {5198B87D-8E7B-48D9-960D-63170A6956C5} - Library - Properties - Caliburn.Micro - Caliburn.Micro - v4.0 - 512 - ..\..\obj\net40\ - - - true - full - false - ..\..\bin\net40\Debug\ - TRACE;DEBUG;NET - prompt - 4 - ..\..\bin\net40\Debug\Caliburn.Micro.XML - - - pdbonly - true - ..\..\bin\net40\Release\ - TRACE;NET - prompt - 4 - ..\..\bin\net40\Release\Caliburn.Micro.XML - - - true - - - ..\Caliburn.snk - - - - - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caliburn.snk - - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro/Caliburn.Micro.SL5.csproj b/src/Caliburn.Micro/Caliburn.Micro.SL5.csproj deleted file mode 100644 index 74c2af5b..00000000 --- a/src/Caliburn.Micro/Caliburn.Micro.SL5.csproj +++ /dev/null @@ -1,158 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {21935B00-9E24-46DF-AA7A-A0065010C594} - {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Caliburn.Micro - Caliburn.Micro - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - true - true - ..\..\obj\sl5\ - - - - v3.5 - - - true - full - false - ..\..\bin\sl5\Debug\ - DEBUG;TRACE;SILVERLIGHT - true - true - prompt - 4 - ..\..\bin\sl5\Debug\Caliburn.Micro.XML - - - pdbonly - true - ..\..\bin\sl5\Release\ - TRACE;SILVERLIGHT - true - true - prompt - 4 - ..\..\bin\sl5\Release\Caliburn.Micro.XML - - - true - - - ..\Caliburn.snk - - - - - - - - $(TargetFrameworkDirectory)System.Core.dll - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caliburn.snk - - - - - - - - - - - - \ No newline at end of file From 9c295f83e3f38757e6a589ea4ed7681f8310e97d Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 30 May 2017 22:05:00 +1200 Subject: [PATCH 003/142] #444 Remove SILVERLIGHT compilation symbol --- src/Caliburn.Micro.Platform/ActionMessage.cs | 4 +- src/Caliburn.Micro.Platform/BindingScope.cs | 6 +- .../BooleanToVisibilityConverter.cs | 45 +----------- src/Caliburn.Micro.Platform/Bootstrapper.cs | 43 +---------- .../Caliburn.Micro.Platform.NET45.csproj | 1 - .../Caliburn.Micro.Platform.UWP.csproj | 1 - .../ConventionManager.cs | 71 +++---------------- src/Caliburn.Micro.Platform/MessageBinder.cs | 2 - src/Caliburn.Micro.Platform/Parser.cs | 13 ---- .../Properties/AssemblyInfo.cs | 6 +- src/Caliburn.Micro.Platform/TypeDescriptor.cs | 37 ---------- src/Caliburn.Micro.Platform/View.cs | 9 +-- src/Caliburn.Micro.Platform/ViewLocator.cs | 4 +- .../ViewModelBinder.cs | 6 -- .../XamlPlatformProvider.cs | 6 +- src/Caliburn.Micro/PropertyChangedBase.cs | 2 +- 16 files changed, 25 insertions(+), 231 deletions(-) delete mode 100644 src/Caliburn.Micro.Platform/TypeDescriptor.cs diff --git a/src/Caliburn.Micro.Platform/ActionMessage.cs b/src/Caliburn.Micro.Platform/ActionMessage.cs index 34f325c0..ed5e00f8 100644 --- a/src/Caliburn.Micro.Platform/ActionMessage.cs +++ b/src/Caliburn.Micro.Platform/ActionMessage.cs @@ -351,7 +351,7 @@ public override string ToString() { } #endif -#if SILVERLIGHT || WinRT +#if WinRT var source = context.Source as Control; #else var source = context.Source; @@ -360,7 +360,7 @@ public override string ToString() { return true; } -#if SILVERLIGHT || WinRT +#if WinRT var hasBinding = ConventionManager.HasBinding(source, Control.IsEnabledProperty); #else var hasBinding = ConventionManager.HasBinding(source, UIElement.IsEnabledProperty); diff --git a/src/Caliburn.Micro.Platform/BindingScope.cs b/src/Caliburn.Micro.Platform/BindingScope.cs index b4c35ffa..f84f3528 100644 --- a/src/Caliburn.Micro.Platform/BindingScope.cs +++ b/src/Caliburn.Micro.Platform/BindingScope.cs @@ -26,7 +26,7 @@ static BindingScope() { AddChildResolver(e => new[] { e.Content as DependencyObject }); AddChildResolver(e => e.Items.OfType().ToArray() ); -#if !SILVERLIGHT && !WinRT +#if !WinRT AddChildResolver(e => new[] { e.Header as DependencyObject }); AddChildResolver(e => new[] { e.Header as DependencyObject }); #endif @@ -291,12 +291,12 @@ private static IEnumerable ResolveHub(Hub hub) { if (root is UserControl) break; -#if !SILVERLIGHT + if (root is Page) { root = ((Page) root).Content as DependencyObject ?? root; break; } -#endif + if ((bool) root.GetValue(View.IsScopeRootProperty)) break; diff --git a/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs b/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs index 98ed1312..9f35f122 100644 --- a/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs +++ b/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs @@ -1,47 +1,4 @@ -#if SILVERLIGHT -namespace Caliburn.Micro -{ - using System; - using System.Globalization; - using System.Windows; - using System.Windows.Data; - - /// - /// An which converts to . - /// - public class BooleanToVisibilityConverter : IValueConverter { - /// - /// Converts a boolean value to a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return ((bool)value) ? Visibility.Visible : Visibility.Collapsed; - } - - /// - /// Converts a value value to a boolean value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - return ((Visibility)value) == Visibility.Visible; - } - } -} -#endif - -#if WinRT +#if WinRT namespace Caliburn.Micro { using System; diff --git a/src/Caliburn.Micro.Platform/Bootstrapper.cs b/src/Caliburn.Micro.Platform/Bootstrapper.cs index 249f81d7..7f7bc6bc 100644 --- a/src/Caliburn.Micro.Platform/Bootstrapper.cs +++ b/src/Caliburn.Micro.Platform/Bootstrapper.cs @@ -119,11 +119,9 @@ protected virtual void StartRuntime() { /// protected virtual void PrepareApplication() { Application.Startup += OnStartup; -#if SILVERLIGHT - Application.UnhandledException += OnUnhandledException; -#else + Application.DispatcherUnhandledException += OnUnhandledException; -#endif + Application.Exit += OnExit; } @@ -184,49 +182,13 @@ protected virtual void OnStartup(object sender, StartupEventArgs e) { } /// The event args. protected virtual void OnExit(object sender, EventArgs e) { } -#if SILVERLIGHT - /// - /// Override this to add custom behavior for unhandled exceptions. - /// - /// The sender. - /// The event args. - protected virtual void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { } -#else /// /// Override this to add custom behavior for unhandled exceptions. /// /// The sender. /// The event args. protected virtual void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { } -#endif -#if SILVERLIGHT && !WINDOWS_PHONE - /// - /// Locates the view model, locates the associate view, binds them and shows it as the root view. - /// - /// The view model type. - protected void DisplayRootViewFor(Type viewModelType) { - var viewModel = IoC.GetInstance(viewModelType, null); - var view = ViewLocator.LocateForModel(viewModel, null, null); - - ViewModelBinder.Bind(viewModel, view, null); - - var activator = viewModel as IActivate; - if(activator != null) - activator.Activate(); - - Mouse.Initialize(view); - Application.RootVisual = view; - } - - /// - /// Locates the view model, locates the associate view, binds them and shows it as the root view. - /// - /// The view model type. - protected void DisplayRootViewFor() { - DisplayRootViewFor(typeof(TViewModel)); - } -#elif NET /// /// Locates the view model, locates the associate view, binds them and shows it as the root view. /// @@ -245,6 +207,5 @@ protected void DisplayRootViewFor(Type viewModelType, IDictionary(IDictionary settings = null) { DisplayRootViewFor(typeof(TViewModel), settings); } -#endif } } diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj index ff0e30ca..c3bf5db2 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj @@ -83,7 +83,6 @@ Code - diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj index 10728526..130029e6 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj @@ -148,7 +148,6 @@ - diff --git a/src/Caliburn.Micro.Platform/ConventionManager.cs b/src/Caliburn.Micro.Platform/ConventionManager.cs index 49ae5c29..f2ef12cc 100644 --- a/src/Caliburn.Micro.Platform/ConventionManager.cs +++ b/src/Caliburn.Micro.Platform/ConventionManager.cs @@ -21,7 +21,7 @@ using System.Windows.Shapes; using EventTrigger = System.Windows.Interactivity.EventTrigger; #endif -#if !SILVERLIGHT && !WinRT +#if !WinRT using System.Windows.Documents; #endif @@ -52,7 +52,7 @@ public static class ConventionManager { /// The default DataTemplate used for ItemsControls when required. /// public static DataTemplate DefaultItemTemplate = (DataTemplate) -#if SILVERLIGHT || WinRT +#if WinRT XamlReader.Load( #else XamlReader.Parse( @@ -73,7 +73,7 @@ public static class ConventionManager { /// The default DataTemplate used for Headered controls when required. /// public static DataTemplate DefaultHeaderTemplate = (DataTemplate) -#if SILVERLIGHT || WinRT +#if WinRT XamlReader.Load( #else XamlReader.Parse( @@ -147,7 +147,7 @@ public static class ConventionManager { /// Determines whether or not and what type of validation to enable on the binding. /// public static Action ApplyValidation = (binding, viewModelType, property) => { -#if SILVERLIGHT || NET45 +#if NET45 if (typeof(INotifyDataErrorInfo).IsAssignableFrom(viewModelType)) { binding.ValidatesOnNotifyDataErrors = true; binding.ValidatesOnExceptions = true; @@ -183,15 +183,7 @@ public static class ConventionManager { /// Determines whether a custom update source trigger should be applied to the binding. /// public static Action ApplyUpdateSourceTrigger = (bindableProperty, element, binding, info) => { -#if SILVERLIGHT && !SL5 - ApplySilverlightTriggers( - element, - bindableProperty, - x => x.GetBindingExpression(bindableProperty), - info, - binding - ); -#elif WinRT81 || NET +#if WinRT81 || NET binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; #endif }; @@ -245,7 +237,7 @@ static ConventionManager() { return true; }; #endif -#if SILVERLIGHT || WinRT +#if WinRT AddElementConvention(HyperlinkButton.ContentProperty, "DataContext", "Click"); AddElementConvention(PasswordBox.PasswordProperty, "Password", "PasswordChanged"); #else @@ -323,11 +315,9 @@ static ConventionManager() { if (element.Content is DependencyObject && !OverwriteContent) return null; -#if SILVERLIGHT - var useViewModel = element.ContentTemplate == null; -#else + var useViewModel = element.ContentTemplate == null && element.ContentTemplateSelector == null; -#endif + if (useViewModel) { Log.Info("ViewModel bound on {0}.", element.Name); return View.ModelProperty; @@ -462,15 +452,10 @@ public static void ApplyItemTemplate(ItemsControl itemsControl, PropertyInfo pro } #endif -#if !SILVERLIGHT if (itemsControl.ItemTemplateSelector == null){ itemsControl.ItemTemplate = DefaultItemTemplate; Log.Info("ItemTemplate applied to {0}.", itemsControl.Name); } -#else - itemsControl.ItemTemplate = DefaultItemTemplate; - Log.Info("ItemTemplate applied to {0}.", itemsControl.Name); -#endif } /// @@ -581,45 +566,5 @@ public static PropertyInfo GetPropertyCaseInsensitive(this Type type, string pro .FirstOrDefault(property => property != null); #endif } - -#if (SILVERLIGHT && !SL5) - /// - /// Accounts for the lack of UpdateSourceTrigger in silverlight. - /// - /// The element to wire for change events on. - /// The property that is being bound. - /// Gets the the binding expression that needs to be updated. - /// The property being bound to if available. - /// The binding if available. - public static void ApplySilverlightTriggers(DependencyObject element, DependencyProperty dependencyProperty, Func expressionSource, PropertyInfo property, Binding binding){ - var textBox = element as TextBox; - if (textBox != null && dependencyProperty == TextBox.TextProperty) { - if (property != null) { - var typeCode = Type.GetTypeCode(property.PropertyType); - if (typeCode == TypeCode.Single || typeCode == TypeCode.Double || typeCode == TypeCode.Decimal) { - binding.UpdateSourceTrigger = UpdateSourceTrigger.Explicit; - textBox.KeyUp += delegate { - var start = textBox.SelectionStart; - var text = textBox.Text; - - expressionSource(textBox).UpdateSource(); - - textBox.Text = text; - textBox.SelectionStart = start; - }; - return; - } - } - - textBox.TextChanged += delegate { expressionSource(textBox).UpdateSource(); }; - return; - } - - var passwordBox = element as PasswordBox; - if (passwordBox != null && dependencyProperty == PasswordBox.PasswordProperty) { - passwordBox.PasswordChanged += delegate { expressionSource(passwordBox).UpdateSource(); }; - } - } -#endif } } diff --git a/src/Caliburn.Micro.Platform/MessageBinder.cs b/src/Caliburn.Micro.Platform/MessageBinder.cs index 037b794b..f9047e15 100644 --- a/src/Caliburn.Micro.Platform/MessageBinder.cs +++ b/src/Caliburn.Micro.Platform/MessageBinder.cs @@ -9,9 +9,7 @@ namespace Caliburn.Micro using System.Linq; using System.Reflection; using System.Collections.Generic; -#if !SILVERLIGHT using System.ComponentModel; -#endif #if WinRT using Windows.UI.Xaml.Controls; #endif diff --git a/src/Caliburn.Micro.Platform/Parser.cs b/src/Caliburn.Micro.Platform/Parser.cs index b325198e..84b818cf 100644 --- a/src/Caliburn.Micro.Platform/Parser.cs +++ b/src/Caliburn.Micro.Platform/Parser.cs @@ -348,24 +348,11 @@ public static void BindParameter(FrameworkElement target, Parameter parameter, s }; #endif -#if (SILVERLIGHT && !SL5) - var expression = (BindingExpression)BindingOperations.SetBinding(parameter, Parameter.ValueProperty, binding); - - var field = element.GetType().GetField(path + "Property", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); - if (field == null) { - return; - } - - ConventionManager.ApplySilverlightTriggers(element, (DependencyProperty)field.GetValue(null), x => expression, null, null); -#else - #if !WinRT binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; #endif BindingOperations.SetBinding(parameter, Parameter.ValueProperty, binding); - -#endif #endif } } diff --git a/src/Caliburn.Micro.Platform/Properties/AssemblyInfo.cs b/src/Caliburn.Micro.Platform/Properties/AssemblyInfo.cs index a3b0adc5..ad367380 100644 --- a/src/Caliburn.Micro.Platform/Properties/AssemblyInfo.cs +++ b/src/Caliburn.Micro.Platform/Properties/AssemblyInfo.cs @@ -1,20 +1,20 @@ using System; using System.Reflection; using System.Runtime.InteropServices; -#if NET || SILVERLIGHT +#if NET using System.Windows.Markup; #endif [assembly: AssemblyTitle("Caliburn Micro Platform")] [assembly: AssemblyDescription("A small, yet powerful framework designed for Xaml platforms, Caliburn.Micro implements a variety of UI patterns for solving real-world problems. Patterns that are highlighted include MVVM (Presentation Model), MVP and MVC.")] -#if NET || SILVERLIGHT +#if NET [assembly: CLSCompliant(true)] #endif [assembly: ComVisible(false)] -#if NET || SILVERLIGHT +#if NET [assembly: Guid("6449e9cb-4d4d-4d79-8f73-71a2fc647109")] [assembly: XmlnsDefinition("http://www.caliburnproject.org", "Caliburn.Micro")] [assembly: XmlnsPrefix("http://www.caliburnproject.org", "cal")] diff --git a/src/Caliburn.Micro.Platform/TypeDescriptor.cs b/src/Caliburn.Micro.Platform/TypeDescriptor.cs deleted file mode 100644 index 6bc20d48..00000000 --- a/src/Caliburn.Micro.Platform/TypeDescriptor.cs +++ /dev/null @@ -1,37 +0,0 @@ -#if SILVERLIGHT -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - - /// - /// Provides information about the characteristics for a component, such as its attributes, properties, and events. This class cannot be inherited. - /// - public static class TypeDescriptor { - static readonly Dictionary Cache = new Dictionary(); - - /// - /// Returns a type converter for the specified type. - /// - /// The System.Type of the target component. - /// A System.ComponentModel.TypeConverter for the specified type. - public static TypeConverter GetConverter(Type type) { - TypeConverter converter; - - if(!Cache.TryGetValue(type, out converter)) { - var customAttributes = type.GetAttributes(true); - - if (!customAttributes.Any()) { - return new TypeConverter(); - } - - converter = Activator.CreateInstance(Type.GetType(customAttributes.First().ConverterTypeName)) as TypeConverter; - Cache[type] = converter; - } - - return converter; - } - } -} -#endif \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/View.cs b/src/Caliburn.Micro.Platform/View.cs index 1fe83c25..4bd16f48 100644 --- a/src/Caliburn.Micro.Platform/View.cs +++ b/src/Caliburn.Micro.Platform/View.cs @@ -117,9 +117,7 @@ public static bool ExecuteOnLoad(FrameworkElement element, RoutedEventHandler ha handler(element, new RoutedEventArgs()); return true; #else -#if SILVERLIGHT - if ((bool)element.GetValue(IsLoadedProperty)) { -#elif WinRT +#if WinRT if (IsElementLoaded(element)) { #else if(element.IsLoaded) { @@ -131,9 +129,6 @@ public static bool ExecuteOnLoad(FrameworkElement element, RoutedEventHandler ha RoutedEventHandler loaded = null; loaded = (s, e) => { element.Loaded -= loaded; -#if SILVERLIGHT - element.SetValue(IsLoadedProperty, true); -#endif handler(s, e); }; element.Loaded += loaded; @@ -426,8 +421,6 @@ public static bool InDesignMode inDesignMode = false; #elif WinRT inDesignMode = DesignMode.DesignModeEnabled; -#elif SILVERLIGHT - inDesignMode = DesignerProperties.IsInDesignTool; #else var descriptor = DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)); inDesignMode = (bool)descriptor.Metadata.DefaultValue; diff --git a/src/Caliburn.Micro.Platform/ViewLocator.cs b/src/Caliburn.Micro.Platform/ViewLocator.cs index 508638ef..5d63b692 100644 --- a/src/Caliburn.Micro.Platform/ViewLocator.cs +++ b/src/Caliburn.Micro.Platform/ViewLocator.cs @@ -22,7 +22,7 @@ namespace Caliburn.Micro using Windows.UI.Xaml.Controls; #endif -#if !SILVERLIGHT && !WinRT && !XFORMS +#if !WinRT && !XFORMS using System.Windows.Interop; #endif @@ -396,7 +396,7 @@ public static void AddSubNamespaceMapping(string nsSource, string nsTarget, stri if (viewAware != null) { var view = viewAware.GetView(context) as UIElement; if (view != null) { -#if !SILVERLIGHT && !WinRT && !XFORMS +#if !WinRT && !XFORMS var windowCheck = view as Window; if (windowCheck == null || (!windowCheck.IsLoaded && !(new WindowInteropHelper(windowCheck).Handle == IntPtr.Zero))) { Log.Info("Using cached view for {0}.", model); diff --git a/src/Caliburn.Micro.Platform/ViewModelBinder.cs b/src/Caliburn.Micro.Platform/ViewModelBinder.cs index eaccb773..6bc732c7 100644 --- a/src/Caliburn.Micro.Platform/ViewModelBinder.cs +++ b/src/Caliburn.Micro.Platform/ViewModelBinder.cs @@ -262,12 +262,6 @@ static bool IsAsyncMethod(MethodInfo method) { IEnumerable namedElements = new List(); #else var namedElements = BindingScope.GetNamedElements(element); -#endif -#if SILVERLIGHT - namedElements.Apply(x => x.SetValue( - View.IsLoadedProperty, - element.GetValue(View.IsLoadedProperty)) - ); #endif namedElements = BindActions(namedElements, viewModelType); namedElements = BindProperties(namedElements, viewModelType); diff --git a/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs b/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs index 7022e01f..e014c958 100644 --- a/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs +++ b/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs @@ -25,9 +25,7 @@ public class XamlPlatformProvider : IPlatformProvider { /// Initializes a new instance of the class. /// public XamlPlatformProvider() { -#if SILVERLIGHT - dispatcher = System.Windows.Deployment.Current.Dispatcher; -#elif WinRT +#if WinRT dispatcher = Window.Current.Dispatcher; #else dispatcher = Dispatcher.CurrentDispatcher; @@ -215,7 +213,7 @@ public System.Action GetViewCloseAction(object viewModel, ICollection vi #endif if (closeMethod != null) return () => { -#if !SILVERLIGHT && !WinRT +#if !WinRT var isClosed = false; if (dialogResult != null) { var resultProperty = contextualView.GetType().GetProperty("DialogResult"); diff --git a/src/Caliburn.Micro/PropertyChangedBase.cs b/src/Caliburn.Micro/PropertyChangedBase.cs index 7bda19a9..ce2b62f7 100644 --- a/src/Caliburn.Micro/PropertyChangedBase.cs +++ b/src/Caliburn.Micro/PropertyChangedBase.cs @@ -38,7 +38,7 @@ public virtual void Refresh() { /// Notifies subscribers of the property change. /// /// Name of the property. -#if NET || SILVERLIGHT +#if NET public virtual void NotifyOfPropertyChange(string propertyName) { #else public virtual void NotifyOfPropertyChange([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) { From 4254cb253a159bda221feb55aa8769938ff271ad Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 30 May 2017 22:06:17 +1200 Subject: [PATCH 004/142] #444 Remove SL5 compilation symbol --- src/Caliburn.Micro.Platform/ViewModelBinder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Caliburn.Micro.Platform/ViewModelBinder.cs b/src/Caliburn.Micro.Platform/ViewModelBinder.cs index 6bc732c7..24338d03 100644 --- a/src/Caliburn.Micro.Platform/ViewModelBinder.cs +++ b/src/Caliburn.Micro.Platform/ViewModelBinder.cs @@ -252,7 +252,7 @@ static bool IsAsyncMethod(MethodInfo method) { } var viewModelType = viewModel.GetType(); -#if SL5 || NET45 +#if NET45 var viewModelTypeProvider = viewModel as ICustomTypeProvider; if (viewModelTypeProvider != null) { viewModelType = viewModelTypeProvider.GetCustomType(); From 30574d8ee06540029cd45b123462ddfb00ac13f5 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 30 May 2017 22:11:46 +1200 Subject: [PATCH 005/142] #444 Remove WINDOWS_PHONE compilation symbol --- src/Caliburn.Micro.Platform/ActionMessage.cs | 13 ----- .../ConventionManager.cs | 2 +- .../ViewModelBinder.cs | 58 ------------------- 3 files changed, 1 insertion(+), 72 deletions(-) diff --git a/src/Caliburn.Micro.Platform/ActionMessage.cs b/src/Caliburn.Micro.Platform/ActionMessage.cs index ed5e00f8..d1869eec 100644 --- a/src/Caliburn.Micro.Platform/ActionMessage.cs +++ b/src/Caliburn.Micro.Platform/ActionMessage.cs @@ -39,10 +39,6 @@ public class ActionMessage : TriggerAction, IHaveParameters { static readonly ILog Log = LogManager.GetLog(typeof(ActionMessage)); ActionExecutionContext context; -#if WINDOWS_PHONE - internal Microsoft.Phone.Shell.IApplicationBarMenuItem applicationBarSource; -#endif - internal static readonly DependencyProperty HandlerProperty = DependencyProperty.RegisterAttached( "Handler", typeof(object), @@ -341,15 +337,6 @@ public override string ToString() { /// /// Returns a value indicating whether or not the action is available. public static Func ApplyAvailabilityEffect = context => { -#if WINDOWS_PHONE - var message = context.Message; - if (message != null && message.applicationBarSource != null) { - if (context.CanExecute != null) { - message.applicationBarSource.IsEnabled = context.CanExecute(); - } - return message.applicationBarSource.IsEnabled; - } -#endif #if WinRT var source = context.Source as Control; diff --git a/src/Caliburn.Micro.Platform/ConventionManager.cs b/src/Caliburn.Micro.Platform/ConventionManager.cs index f2ef12cc..e9f689ca 100644 --- a/src/Caliburn.Micro.Platform/ConventionManager.cs +++ b/src/Caliburn.Micro.Platform/ConventionManager.cs @@ -202,7 +202,7 @@ static ConventionManager() { return View.ModelProperty; }; #endif -#if !WINDOWS_PHONE && !WinRT +#if !WinRT AddElementConvention(DatePicker.SelectedDateProperty, "SelectedDate", "SelectedDateChanged"); #endif #if WinRT81 diff --git a/src/Caliburn.Micro.Platform/ViewModelBinder.cs b/src/Caliburn.Micro.Platform/ViewModelBinder.cs index 24338d03..7bbba87a 100644 --- a/src/Caliburn.Micro.Platform/ViewModelBinder.cs +++ b/src/Caliburn.Micro.Platform/ViewModelBinder.cs @@ -22,10 +22,6 @@ namespace Caliburn.Micro using System.Windows.Interactivity; #endif -#if WINDOWS_PHONE - using Microsoft.Phone.Controls; -#endif - /// /// Binds a view to a view model. /// @@ -239,15 +235,8 @@ static bool IsAsyncMethod(MethodInfo method) { return; } -#if WINDOWS_PHONE - BindAppBar(view); -#endif - if (!ShouldApplyConventions(element)) { Log.Info("Skipping conventions for {0} and {1}.", element, viewModel); -#if WINDOWS_PHONE - view.SetValue(ConventionsAppliedProperty, true); // we always apply the AppBar conventions -#endif return; } @@ -269,52 +258,5 @@ static bool IsAsyncMethod(MethodInfo method) { view.SetValue(ConventionsAppliedProperty, true); }; - -#if WINDOWS_PHONE - static void BindAppBar(DependencyObject view) { - var page = view as PhoneApplicationPage; - if (page == null || page.ApplicationBar == null) { - return; - } - - var triggers = Interaction.GetTriggers(view); - - foreach(var item in page.ApplicationBar.Buttons) { - var button = item as IAppBarActionMessage; - if (button == null || string.IsNullOrEmpty(button.Message)) { - continue; - } - - var parsedTrigger = Parser.Parse(view, button.Message).First(); - var trigger = new AppBarItemTrigger(button); - var actionMessages = parsedTrigger.Actions.OfType().ToList(); - actionMessages.Apply(x => { - x.applicationBarSource = button; - parsedTrigger.Actions.Remove(x); - trigger.Actions.Add(x); - }); - - triggers.Add(trigger); - } - - foreach (var item in page.ApplicationBar.MenuItems) { - var menuItem = item as IAppBarActionMessage; - if (menuItem == null || string.IsNullOrEmpty(menuItem.Message)) { - continue; - } - - var parsedTrigger = Parser.Parse(view, menuItem.Message).First(); - var trigger = new AppBarItemTrigger(menuItem); - var actionMessages = parsedTrigger.Actions.OfType().ToList(); - actionMessages.Apply(x => { - x.applicationBarSource = menuItem; - parsedTrigger.Actions.Remove(x); - trigger.Actions.Add(x); - }); - - triggers.Add(trigger); - } - } -#endif } } From a09739c22d6eba80f1112e3fa92c6b0aff8c0082 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 30 May 2017 22:21:16 +1200 Subject: [PATCH 006/142] #444 Remove WP81 compilation symbol --- .../ConventionManager.cs | 4 +- .../win8/INavigationService.cs | 46 ++----------------- .../win8/WinRTContainer.cs | 2 +- 3 files changed, 6 insertions(+), 46 deletions(-) diff --git a/src/Caliburn.Micro.Platform/ConventionManager.cs b/src/Caliburn.Micro.Platform/ConventionManager.cs index e9f689ca..7593225e 100644 --- a/src/Caliburn.Micro.Platform/ConventionManager.cs +++ b/src/Caliburn.Micro.Platform/ConventionManager.cs @@ -213,7 +213,7 @@ static ConventionManager() { AddElementConvention(MenuFlyoutItem.TextProperty, "Text", "Click"); AddElementConvention(ToggleMenuFlyoutItem.IsCheckedProperty, "IsChecked", "Click"); #endif -#if WinRT81 && !WP81 +#if WinRT81 AddElementConvention(SearchBox.QueryTextProperty, "QueryText", "QuerySubmitted"); #endif #if WinRT @@ -222,7 +222,7 @@ static ConventionManager() { AddElementConvention(Slider.ValueProperty, "Value", "ValueChanged"); AddElementConvention(RichEditBox.DataContextProperty, "DataContext", "TextChanged"); #endif -#if WP81 || WINDOWS_UWP +#if WINDOWS_UWP AddElementConvention(Pivot.ItemsSourceProperty, "SelectedItem", "SelectionChanged") .ApplyBinding = (viewModelType, path, property, element, convention) => { diff --git a/src/Caliburn.Micro.Platform/win8/INavigationService.cs b/src/Caliburn.Micro.Platform/win8/INavigationService.cs index 560ab27b..57f9cab1 100644 --- a/src/Caliburn.Micro.Platform/win8/INavigationService.cs +++ b/src/Caliburn.Micro.Platform/win8/INavigationService.cs @@ -10,10 +10,6 @@ namespace Caliburn.Micro { using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; -#if WP81 - using Windows.Phone.UI.Input; -#endif - /// /// Implemented by services that provide ( based) navigation. /// @@ -95,12 +91,7 @@ public interface INavigationService { IList ForwardStack { get; } #endif -#if WP81 - /// - /// Occurs when the user presses the hardware Back button. - /// - event EventHandler BackRequested; -#elif WINDOWS_UWP +#if WINDOWS_UWP /// /// Occurs when the user requests a back navigation via hardware back button or gesture or voice. /// @@ -148,13 +139,7 @@ public FrameAdapter(Frame frame, bool treatViewAsLoaded = false) { this.frame.Navigating += OnNavigating; this.frame.Navigated += OnNavigated; -#if WP81 - // This could be a potential bug if we're registering the navigation service - // after the frame is loaded. Unlikely scenario given normal WP8.1 app structure - - this.frame.Loaded += (sender, args) => { HardwareButtons.BackPressed += OnBackRequested; }; - this.frame.Unloaded += (sender, args) => { HardwareButtons.BackPressed -= OnBackRequested; }; -#elif WINDOWS_UWP +#if WINDOWS_UWP // This could leak memory if we're creating and destorying navigation services regularly. // Another unlikely scenario though @@ -487,32 +472,7 @@ public virtual bool ResumeState() { return true; } -#if WP81 - /// - /// Occurs when the user presses the hardware Back button. - /// - public event EventHandler BackRequested = delegate { }; - - /// - /// Occurs when the user presses the hardware Back button. Allows the handlers to cancel the default behavior. - /// - /// The event arguments - protected virtual void OnBackRequested(BackPressedEventArgs e) { - BackRequested(this, e); - } - - private void OnBackRequested(object sender, BackPressedEventArgs e) { - OnBackRequested(e); - - if (e.Handled) - return; - - if (CanGoBack) { - e.Handled = true; - GoBack(); - } - } -#elif WINDOWS_UWP +#if WINDOWS_UWP /// /// Occurs when the user presses the hardware Back button. /// diff --git a/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs b/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs index bceb4a04..68234be8 100644 --- a/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs +++ b/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs @@ -57,7 +57,7 @@ public ISharingService RegisterSharingService() { return sharingService; } -#if !WP81 && !WINDOWS_UWP +#if !WINDOWS_UWP /// /// Registers the Caliburn.Micro settings service with the container. /// From 3d9bea1f40e2eaf1801332c4f45728cbf15a31f8 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 30 May 2017 22:56:36 +1200 Subject: [PATCH 007/142] #444 Rename WinRT and WinRT81 to WINDOWS_UWP --- src/Caliburn.Micro.Platform/Action.cs | 4 +- .../ActionExecutionContext.cs | 2 +- src/Caliburn.Micro.Platform/ActionMessage.cs | 20 ++++----- src/Caliburn.Micro.Platform/AssemblySource.cs | 2 +- src/Caliburn.Micro.Platform/Bind.cs | 2 +- src/Caliburn.Micro.Platform/BindingScope.cs | 18 ++++---- .../BooleanToVisibilityConverter.cs | 2 +- src/Caliburn.Micro.Platform/ChildResolver.cs | 2 +- .../ConventionManager.cs | 42 ++++++++----------- .../DependencyPropertyHelper.cs | 2 +- .../ElementConvention.cs | 2 +- .../ExtensionMethods.cs | 4 +- src/Caliburn.Micro.Platform/Message.cs | 4 +- src/Caliburn.Micro.Platform/MessageBinder.cs | 10 ++--- src/Caliburn.Micro.Platform/Parser.cs | 10 ++--- src/Caliburn.Micro.Platform/StringSplitter.cs | 4 +- src/Caliburn.Micro.Platform/View.cs | 18 ++++---- src/Caliburn.Micro.Platform/ViewLocator.cs | 14 +++---- .../ViewModelBinder.cs | 8 ++-- .../ViewModelLocator.cs | 2 +- .../XamlPlatformProvider.cs | 20 ++++----- .../win8/CachingFrameAdapter.cs | 2 +- .../win8/INavigationService.cs | 6 +-- .../win8/NavigateHelper.cs | 4 +- src/Caliburn.Micro.Platform/win8/Parameter.cs | 6 +-- .../win8/WinRTContainer.cs | 4 +- .../xforms/ConventionManager.cs | 2 +- .../xforms/Parameter.cs | 6 +-- 28 files changed, 105 insertions(+), 117 deletions(-) diff --git a/src/Caliburn.Micro.Platform/Action.cs b/src/Caliburn.Micro.Platform/Action.cs index 38a5a99b..a7ed7b5c 100644 --- a/src/Caliburn.Micro.Platform/Action.cs +++ b/src/Caliburn.Micro.Platform/Action.cs @@ -4,7 +4,7 @@ namespace Caliburn.Micro.Xamarin.Forms namespace Caliburn.Micro #endif { -#if WinRT +#if WINDOWS_UWP using System.Linq; using Windows.UI.Xaml; using System.Reflection; @@ -122,7 +122,7 @@ public static void Invoke(object target, string methodName, DependencyObject vie var context = new ActionExecutionContext { Target = target, -#if WinRT +#if WINDOWS_UWP Method = target.GetType().GetRuntimeMethods().Single(m => m.Name == methodName), #else Method = target.GetType().GetMethod(methodName), diff --git a/src/Caliburn.Micro.Platform/ActionExecutionContext.cs b/src/Caliburn.Micro.Platform/ActionExecutionContext.cs index e01dcebb..57df00c9 100644 --- a/src/Caliburn.Micro.Platform/ActionExecutionContext.cs +++ b/src/Caliburn.Micro.Platform/ActionExecutionContext.cs @@ -7,7 +7,7 @@ namespace Caliburn.Micro using System; using System.Collections.Generic; using System.Reflection; -#if WinRT +#if WINDOWS_UWP using Windows.UI.Xaml; #elif XFORMS using global::Xamarin.Forms; diff --git a/src/Caliburn.Micro.Platform/ActionMessage.cs b/src/Caliburn.Micro.Platform/ActionMessage.cs index d1869eec..c51e54de 100644 --- a/src/Caliburn.Micro.Platform/ActionMessage.cs +++ b/src/Caliburn.Micro.Platform/ActionMessage.cs @@ -4,7 +4,7 @@ using System.ComponentModel; using System.Linq; using System.Reflection; -#if WinRT81 +#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Markup; @@ -27,7 +27,7 @@ /// /// Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. /// -#if WinRT +#if WINDOWS_UWP [ContentProperty(Name = "Parameters")] #else [ContentProperty("Parameters")] @@ -91,7 +91,7 @@ public ActionMessage() { /// Gets or sets the name of the method to be invoked on the presentation model class. /// /// The name of the method. -#if !WinRT +#if !WINDOWS_UWP [Category("Common Properties")] #endif public string MethodName { @@ -103,7 +103,7 @@ public string MethodName { /// Gets the parameters to pass as part of the method invocation. /// /// The parameters. -#if !WinRT +#if !WINDOWS_UWP [Category("Common Properties")] #endif public AttachedCollection Parameters { @@ -118,7 +118,7 @@ public AttachedCollection Parameters { /// /// Called after the action is attached to an AssociatedObject. /// -#if WinRT81 +#if WINDOWS_UWP protected override void OnAttached() { if (!View.InDesignMode) { Parameters.Attach(AssociatedObject); @@ -198,7 +198,7 @@ void ElementLoaded(object sender, RoutedEventArgs e) { Path = new PropertyPath(Message.HandlerProperty), Source = currentElement }; -#elif WinRT +#elif WINDOWS_UWP var binding = new Binding { Source = currentElement }; @@ -338,7 +338,7 @@ public override string ToString() { /// Returns a value indicating whether or not the action is available. public static Func ApplyAvailabilityEffect = context => { -#if WinRT +#if WINDOWS_UWP var source = context.Source as Control; #else var source = context.Source; @@ -347,7 +347,7 @@ public override string ToString() { return true; } -#if WinRT +#if WINDOWS_UWP var hasBinding = ConventionManager.HasBinding(source, Control.IsEnabledProperty); #else var hasBinding = ConventionManager.HasBinding(source, UIElement.IsEnabledProperty); @@ -366,7 +366,7 @@ public override string ToString() { /// The message. /// The matching method, if available. public static Func GetTargetMethod = (message, target) => { -#if WinRT +#if WINDOWS_UWP return (from method in target.GetType().GetRuntimeMethods() where method.Name == message.MethodName let methodParameters = method.GetParameters() @@ -543,7 +543,7 @@ static MethodInfo TryFindGuardMethod(ActionExecutionContext context, IEnumerable static MethodInfo GetMethodInfo(Type t, string methodName) { -#if WinRT +#if WINDOWS_UWP return t.GetRuntimeMethods().SingleOrDefault(m => m.Name == methodName); #else return t.GetMethod(methodName); diff --git a/src/Caliburn.Micro.Platform/AssemblySource.cs b/src/Caliburn.Micro.Platform/AssemblySource.cs index 4b9dd6fc..d454648d 100644 --- a/src/Caliburn.Micro.Platform/AssemblySource.cs +++ b/src/Caliburn.Micro.Platform/AssemblySource.cs @@ -5,7 +5,7 @@ using System.ComponentModel; using System.Linq; using System.Reflection; -#if !WinRT +#if !WINDOWS_UWP using System.Windows; #else using Windows.UI.Xaml; diff --git a/src/Caliburn.Micro.Platform/Bind.cs b/src/Caliburn.Micro.Platform/Bind.cs index a0234008..918da846 100644 --- a/src/Caliburn.Micro.Platform/Bind.cs +++ b/src/Caliburn.Micro.Platform/Bind.cs @@ -5,7 +5,7 @@ namespace Caliburn.Micro #endif { using System; -#if WinRT +#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Data; #elif XFORMS diff --git a/src/Caliburn.Micro.Platform/BindingScope.cs b/src/Caliburn.Micro.Platform/BindingScope.cs index f84f3528..1f06e2cf 100644 --- a/src/Caliburn.Micro.Platform/BindingScope.cs +++ b/src/Caliburn.Micro.Platform/BindingScope.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; -#if WinRT +#if WINDOWS_UWP using System.ServiceModel; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -26,15 +26,15 @@ static BindingScope() { AddChildResolver(e => new[] { e.Content as DependencyObject }); AddChildResolver(e => e.Items.OfType().ToArray() ); -#if !WinRT +#if !WINDOWS_UWP AddChildResolver(e => new[] { e.Header as DependencyObject }); AddChildResolver(e => new[] { e.Header as DependencyObject }); #endif -#if WinRT +#if WINDOWS_UWP AddChildResolver(e => new[] { e.ZoomedInView as DependencyObject, e.ZoomedOutView as DependencyObject }); AddChildResolver(e => new[] { e.Header as DependencyObject }); #endif -#if WinRT81 +#if WINDOWS_UWP AddChildResolver(e => new[] { e.Footer as DependencyObject }); AddChildResolver(ResolveHub); AddChildResolver(e => new[] { e.Header as DependencyObject }); @@ -54,7 +54,7 @@ static BindingScope() /// The name to search for. /// The named element or null if not found. public static FrameworkElement FindName(this IEnumerable elementsToSearch, string name) { -#if WinRT +#if WINDOWS_UWP return elementsToSearch.FirstOrDefault(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); #else return elementsToSearch.FirstOrDefault(x => x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); @@ -183,7 +183,7 @@ public static bool RemoveChildResolver(ChildResolver resolver) { queue.Enqueue(childDo); } -#if WinRT +#if WINDOWS_UWP var page = current as Page; if (page != null) { @@ -217,7 +217,7 @@ public static bool RemoveChildResolver(ChildResolver resolver) { return descendants; }; -#if WinRT81 +#if WINDOWS_UWP private static IEnumerable ResolveFlyoutBase(FlyoutBase flyoutBase) { if (flyoutBase == null) yield break; @@ -240,7 +240,6 @@ private static IEnumerable ResolveFlyoutBase(FlyoutBase flyout private static IEnumerable ResolveMenuFlyoutItems(MenuFlyoutItemBase item) { yield return item; -#if WINDOWS_UWP var subItem = item as MenuFlyoutSubItem; if (subItem != null && subItem.Items != null) { @@ -248,7 +247,6 @@ private static IEnumerable ResolveMenuFlyoutItems(MenuFlyoutIt yield return subSubItem; } } -#endif } private static IEnumerable ResolveCommandBar(CommandBar commandBar) { @@ -300,7 +298,7 @@ private static IEnumerable ResolveHub(Hub hub) { if ((bool) root.GetValue(View.IsScopeRootProperty)) break; -#if WinRT +#if WINDOWS_UWP if (root is AppBar) { var frame = Window.Current.Content as Frame; var page = (frame != null) ? frame.Content as Page : null; diff --git a/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs b/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs index 9f35f122..2b559ee1 100644 --- a/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs +++ b/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs @@ -1,4 +1,4 @@ -#if WinRT +#if WINDOWS_UWP namespace Caliburn.Micro { using System; diff --git a/src/Caliburn.Micro.Platform/ChildResolver.cs b/src/Caliburn.Micro.Platform/ChildResolver.cs index 41c58fc3..9197c852 100644 --- a/src/Caliburn.Micro.Platform/ChildResolver.cs +++ b/src/Caliburn.Micro.Platform/ChildResolver.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -#if WinRT +#if WINDOWS_UWP using Windows.UI.Xaml; #else using System.Windows; diff --git a/src/Caliburn.Micro.Platform/ConventionManager.cs b/src/Caliburn.Micro.Platform/ConventionManager.cs index 7593225e..784434c0 100644 --- a/src/Caliburn.Micro.Platform/ConventionManager.cs +++ b/src/Caliburn.Micro.Platform/ConventionManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -#if WinRT81 +#if WINDOWS_UWP using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; @@ -21,7 +21,7 @@ using System.Windows.Shapes; using EventTrigger = System.Windows.Interactivity.EventTrigger; #endif -#if !WinRT +#if !WINDOWS_UWP using System.Windows.Documents; #endif @@ -52,12 +52,12 @@ public static class ConventionManager { /// The default DataTemplate used for ItemsControls when required. /// public static DataTemplate DefaultItemTemplate = (DataTemplate) -#if WinRT +#if WINDOWS_UWP XamlReader.Load( #else XamlReader.Parse( #endif -#if WinRT +#if WINDOWS_UWP "" + "" + "" @@ -73,7 +73,7 @@ public static class ConventionManager { /// The default DataTemplate used for Headered controls when required. /// public static DataTemplate DefaultHeaderTemplate = (DataTemplate) -#if WinRT +#if WINDOWS_UWP XamlReader.Load( #else XamlReader.Parse( @@ -115,7 +115,7 @@ public static class ConventionManager { /// public static Action SetBinding = (viewModelType, path, property, element, convention, bindableProperty) => { -#if WinRT +#if WINDOWS_UWP var binding = new Binding { Path = new PropertyPath(path) }; #else var binding = new Binding(path); @@ -134,7 +134,7 @@ public static class ConventionManager { /// Applies the appropriate binding mode to the binding. /// public static Action ApplyBindingMode = (binding, property) => { -#if WinRT +#if WINDOWS_UWP var setMethod = property.SetMethod; binding.Mode = (property.CanWrite && setMethod != null && setMethod.IsPublic) ? BindingMode.TwoWay : BindingMode.OneWay; #else @@ -153,7 +153,7 @@ public static class ConventionManager { binding.ValidatesOnExceptions = true; } #endif -#if !WinRT +#if !WINDOWS_UWP if (typeof(IDataErrorInfo).IsAssignableFrom(viewModelType)) { binding.ValidatesOnDataErrors = true; binding.ValidatesOnExceptions = true; @@ -173,8 +173,8 @@ public static class ConventionManager { /// Determines whether a custom string format is needed and applies it to the binding. /// public static Action ApplyStringFormat = (binding, convention, property) => { -#if !WinRT - if(typeof(DateTime).IsAssignableFrom(property.PropertyType)) +#if !WINDOWS_UWP + if (typeof(DateTime).IsAssignableFrom(property.PropertyType)) binding.StringFormat = "{0:d}"; #endif }; @@ -183,7 +183,7 @@ public static class ConventionManager { /// Determines whether a custom update source trigger should be applied to the binding. /// public static Action ApplyUpdateSourceTrigger = (bindableProperty, element, binding, info) => { -#if WinRT81 || NET +#if WINDOWS_UWP || NET binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; #endif }; @@ -202,27 +202,21 @@ static ConventionManager() { return View.ModelProperty; }; #endif -#if !WinRT +#if !WINDOWS_UWP AddElementConvention(DatePicker.SelectedDateProperty, "SelectedDate", "SelectedDateChanged"); #endif -#if WinRT81 +#if WINDOWS_UWP AddElementConvention(DatePicker.DateProperty, "Date", "DateChanged"); AddElementConvention(TimePicker.TimeProperty, "Time", "TimeChanged"); AddElementConvention(Hub.HeaderProperty, "Header", "Loaded"); AddElementConvention(HubSection.HeaderProperty, "Header", "SectionsInViewChanged"); AddElementConvention(MenuFlyoutItem.TextProperty, "Text", "Click"); AddElementConvention(ToggleMenuFlyoutItem.IsCheckedProperty, "IsChecked", "Click"); -#endif -#if WinRT81 AddElementConvention(SearchBox.QueryTextProperty, "QueryText", "QuerySubmitted"); -#endif -#if WinRT AddElementConvention(ToggleSwitch.IsOnProperty, "IsOn", "Toggled"); AddElementConvention(ProgressRing.IsActiveProperty, "IsActive", "Loaded"); AddElementConvention(Slider.ValueProperty, "Value", "ValueChanged"); AddElementConvention(RichEditBox.DataContextProperty, "DataContext", "TextChanged"); -#endif -#if WINDOWS_UWP AddElementConvention(Pivot.ItemsSourceProperty, "SelectedItem", "SelectionChanged") .ApplyBinding = (viewModelType, path, property, element, convention) => { @@ -236,8 +230,6 @@ static ConventionManager() { return true; }; -#endif -#if WinRT AddElementConvention(HyperlinkButton.ContentProperty, "DataContext", "Click"); AddElementConvention(PasswordBox.PasswordProperty, "Password", "PasswordChanged"); #else @@ -366,7 +358,7 @@ public static ElementConvention GetElementConvention(Type elementType) { ElementConvention propertyConvention; ElementConventions.TryGetValue(elementType, out propertyConvention); -#if WinRT +#if WINDOWS_UWP return propertyConvention ?? GetElementConvention(elementType.GetTypeInfo().BaseType); #else return propertyConvention ?? GetElementConvention(elementType.BaseType); @@ -436,7 +428,7 @@ public static void ApplyItemTemplate(ItemsControl itemsControl, PropertyInfo pro return; } -#if !WinRT +#if !WINDOWS_UWP if (property.PropertyType.IsGenericType) { var itemType = property.PropertyType.GetGenericArguments().First(); if (itemType.IsValueType || typeof(string).IsAssignableFrom(itemType)) { @@ -478,7 +470,7 @@ public static void ApplyItemTemplate(ItemsControl itemsControl, PropertyInfo pro foreach (var potentialName in DerivePotentialSelectionNames(baseName)) { if (viewModelType.GetPropertyCaseInsensitive(potentialName) != null) { var selectionPath = path.Replace(baseName, potentialName); -#if WinRT +#if WINDOWS_UWP var binding = new Binding { Mode = BindingMode.TwoWay, Path = new PropertyPath(selectionPath) }; #else var binding = new Binding(selectionPath) { Mode = BindingMode.TwoWay }; @@ -537,7 +529,7 @@ public static void ApplyHeaderTemplate(FrameworkElement element, DependencyPrope /// The property to search for. /// The property or null if not found. public static PropertyInfo GetPropertyCaseInsensitive(this Type type, string propertyName) { -#if WinRT +#if WINDOWS_UWP var typeInfo = type.GetTypeInfo(); var typeList = new List { type }; diff --git a/src/Caliburn.Micro.Platform/DependencyPropertyHelper.cs b/src/Caliburn.Micro.Platform/DependencyPropertyHelper.cs index 46a7aef7..93481bff 100644 --- a/src/Caliburn.Micro.Platform/DependencyPropertyHelper.cs +++ b/src/Caliburn.Micro.Platform/DependencyPropertyHelper.cs @@ -2,7 +2,7 @@ #if XFORMS using Xamarin.Forms; using DependencyProperty = Xamarin.Forms.BindableProperty; -#elif WinRT +#elif WINDOWS_UWP using Windows.UI.Xaml; #else using System.Windows; diff --git a/src/Caliburn.Micro.Platform/ElementConvention.cs b/src/Caliburn.Micro.Platform/ElementConvention.cs index 55226f6f..ab296301 100644 --- a/src/Caliburn.Micro.Platform/ElementConvention.cs +++ b/src/Caliburn.Micro.Platform/ElementConvention.cs @@ -6,7 +6,7 @@ namespace Caliburn.Micro { using System; using System.Reflection; -#if WinRT81 +#if WINDOWS_UWP using Windows.UI.Xaml; using TriggerBase = Microsoft.Xaml.Interactivity.IBehavior; #elif XFORMS diff --git a/src/Caliburn.Micro.Platform/ExtensionMethods.cs b/src/Caliburn.Micro.Platform/ExtensionMethods.cs index 717c7ada..e36a213b 100644 --- a/src/Caliburn.Micro.Platform/ExtensionMethods.cs +++ b/src/Caliburn.Micro.Platform/ExtensionMethods.cs @@ -25,14 +25,14 @@ public static string GetAssemblyName(this Assembly assembly) { /// Whether or not to search for inherited attributes. /// The list of attributes found. public static IEnumerable GetAttributes(this MemberInfo member, bool inherit) { -#if WinRT || CORE +#if WINDOWS_UWP || CORE return member.GetCustomAttributes(inherit).OfType(); #else return Attribute.GetCustomAttributes(member, inherit).OfType(); #endif } -#if WinRT || CORE +#if WINDOWS_UWP || CORE /// /// Gets a collection of the public types defined in this assembly that are visible outside the assembly. /// diff --git a/src/Caliburn.Micro.Platform/Message.cs b/src/Caliburn.Micro.Platform/Message.cs index a7e99c70..d704ddb1 100644 --- a/src/Caliburn.Micro.Platform/Message.cs +++ b/src/Caliburn.Micro.Platform/Message.cs @@ -7,7 +7,7 @@ namespace Caliburn.Micro using System; using System.Collections.Generic; using System.Linq; -#if WinRT81 +#if WINDOWS_UWP using Windows.UI.Xaml; using Microsoft.Xaml.Interactivity; using TriggerBase = Microsoft.Xaml.Interactivity.IBehavior; @@ -99,7 +99,7 @@ static void OnAttachChanged(DependencyObject d, DependencyPropertyChangedEventAr var messageTriggers = (TriggerBase[])d.GetValue(MessageTriggersProperty); -#if WinRT81 +#if WINDOWS_UWP var allTriggers = Interaction.GetBehaviors(d); if (messageTriggers != null) diff --git a/src/Caliburn.Micro.Platform/MessageBinder.cs b/src/Caliburn.Micro.Platform/MessageBinder.cs index f9047e15..f5a357ad 100644 --- a/src/Caliburn.Micro.Platform/MessageBinder.cs +++ b/src/Caliburn.Micro.Platform/MessageBinder.cs @@ -10,7 +10,7 @@ namespace Caliburn.Micro using System.Reflection; using System.Collections.Generic; using System.ComponentModel; -#if WinRT +#if WINDOWS_UWP using Windows.UI.Xaml.Controls; #endif @@ -32,7 +32,7 @@ public static class MessageBinder { #else {"$datacontext", c => c.Source.DataContext}, #endif -#if WinRT +#if WINDOWS_UWP {"$clickeditem", c => ((ItemClickEventArgs)c.EventArgs).ClickedItem}, #endif {"$source", c => c.Source}, @@ -111,7 +111,7 @@ public static object CoerceValue(Type destinationType, object providedValue, obj } try { -#if !WinRT && !XFORMS +#if !WINDOWS_UWP && !XFORMS var converter = TypeDescriptor.GetConverter(destinationType); if (converter.CanConvertFrom(providedType)) { @@ -124,7 +124,7 @@ public static object CoerceValue(Type destinationType, object providedValue, obj return converter.ConvertTo(providedValue, destinationType); } #endif -#if WinRT || XFORMS +#if WINDOWS_UWP || XFORMS if (destinationType.GetTypeInfo().IsEnum) { #else if (destinationType.IsEnum) { @@ -162,7 +162,7 @@ public static object CoerceValue(Type destinationType, object providedValue, obj /// The type. /// The default value. public static object GetDefaultValue(Type type) { -#if WinRT || XFORMS +#if WINDOWS_UWP || XFORMS var typeInfo = type.GetTypeInfo(); return typeInfo.IsClass || typeInfo.IsInterface ? null : System.Activator.CreateInstance(type); #else diff --git a/src/Caliburn.Micro.Platform/Parser.cs b/src/Caliburn.Micro.Platform/Parser.cs index 84b818cf..8f9d316d 100644 --- a/src/Caliburn.Micro.Platform/Parser.cs +++ b/src/Caliburn.Micro.Platform/Parser.cs @@ -7,7 +7,7 @@ namespace Caliburn.Micro using System; using System.Collections.Generic; using System.Linq; -#if WinRT81 +#if WINDOWS_UWP using System.Reflection; using Windows.UI.Xaml; using Microsoft.Xaml.Interactivity; @@ -72,7 +72,7 @@ public static IEnumerable Parse(DependencyObject target, string tex var trigger = CreateTrigger(target, triggerPlusMessage.Length == 1 ? null : triggerPlusMessage[0]); var message = CreateMessage(target, messageDetail); -#if WinRT81 || XFORMS +#if WINDOWS_UWP || XFORMS AddActionToTrigger(target, message, trigger); #else trigger.Actions.Add(message); @@ -110,7 +110,7 @@ private static void AddActionToTrigger(DependencyObject target, TriggerAction me } #endif -#if WinRT81 +#if WINDOWS_UWP private static void AddActionToTrigger(DependencyObject target, TriggerAction message, TriggerBase trigger) { @@ -334,7 +334,7 @@ public static void BindParameter(FrameworkElement target, Parameter parameter, s { path = ConventionManager.GetElementConvention(element.GetType()).ParameterProperty; } -#if WinRT +#if WINDOWS_UWP var binding = new Binding { Path = new PropertyPath(path), @@ -348,7 +348,7 @@ public static void BindParameter(FrameworkElement target, Parameter parameter, s }; #endif -#if !WinRT +#if !WINDOWS_UWP binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; #endif diff --git a/src/Caliburn.Micro.Platform/StringSplitter.cs b/src/Caliburn.Micro.Platform/StringSplitter.cs index afa048fa..5cdaab86 100644 --- a/src/Caliburn.Micro.Platform/StringSplitter.cs +++ b/src/Caliburn.Micro.Platform/StringSplitter.cs @@ -24,11 +24,11 @@ public static string[] Split(string message, char separator) var builder = new StringBuilder(); int squareBrackets = 0; -#if WinRT +#if WINDOWS_UWP foreach (var current in message.ToCharArray()) { #else - foreach(var current in message) { + foreach (var current in message) { #endif //Square brackets are used as delimiters, so only separators outside them count... if (current == '[') diff --git a/src/Caliburn.Micro.Platform/View.cs b/src/Caliburn.Micro.Platform/View.cs index 4bd16f48..1a662f9f 100644 --- a/src/Caliburn.Micro.Platform/View.cs +++ b/src/Caliburn.Micro.Platform/View.cs @@ -6,7 +6,7 @@ namespace Caliburn.Micro { using System; using System.Linq; -#if WinRT +#if WINDOWS_UWP using System.Reflection; using Windows.ApplicationModel; using Windows.UI.Xaml; @@ -33,7 +33,7 @@ namespace Caliburn.Micro /// public static class View { static readonly ILog Log = LogManager.GetLog(typeof(View)); -#if WinRT || XFORMS +#if WINDOWS_UWP || XFORMS const string DefaultContentPropertyName = "Content"; #else static readonly ContentPropertyAttribute DefaultContentProperty = new ContentPropertyAttribute("Content"); @@ -117,10 +117,10 @@ public static bool ExecuteOnLoad(FrameworkElement element, RoutedEventHandler ha handler(element, new RoutedEventArgs()); return true; #else -#if WinRT +#if WINDOWS_UWP if (IsElementLoaded(element)) { #else - if(element.IsLoaded) { + if (element.IsLoaded) { #endif handler(element, new RoutedEventArgs()); return true; @@ -153,7 +153,7 @@ public static void ExecuteOnUnload(FrameworkElement element, RoutedEventHandler #endif } -#if WinRT +#if WINDOWS_UWP /// /// Determines whether the specified is loaded. /// @@ -190,7 +190,7 @@ public static bool IsElementLoaded(FrameworkElement element) { /// /// The element. /// The handler. -#if WinRT +#if WINDOWS_UWP public static void ExecuteOnLayoutUpdated(FrameworkElement element, EventHandler handler) { EventHandler onLayoutUpdate = null; #else @@ -226,7 +226,7 @@ public static void ExecuteOnLayoutUpdated(FrameworkElement element, EventHandler if (dependencyObject is ContentControl) { return ((ContentControl)dependencyObject).Content; } -#if WinRT || XFORMS +#if WINDOWS_UWP || XFORMS var type = dependencyObject.GetType(); var contentPropertyName = GetContentPropertyName(type); @@ -362,7 +362,7 @@ static bool SetContentProperty(object targetLocation, object view) { return SetContentPropertyCore(targetLocation, view); } -#if WinRT || XFORMS +#if WINDOWS_UWP || XFORMS static bool SetContentPropertyCore(object targetLocation, object view) { try { var type = targetLocation.GetType(); @@ -419,7 +419,7 @@ public static bool InDesignMode { #if XFORMS inDesignMode = false; -#elif WinRT +#elif WINDOWS_UWP inDesignMode = DesignMode.DesignModeEnabled; #else var descriptor = DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof(FrameworkElement)); diff --git a/src/Caliburn.Micro.Platform/ViewLocator.cs b/src/Caliburn.Micro.Platform/ViewLocator.cs index 5d63b692..aa0fa8cd 100644 --- a/src/Caliburn.Micro.Platform/ViewLocator.cs +++ b/src/Caliburn.Micro.Platform/ViewLocator.cs @@ -14,7 +14,7 @@ namespace Caliburn.Micro using UIElement = global::Xamarin.Forms.Element; using TextBlock = global::Xamarin.Forms.Label; using DependencyObject = global::Xamarin.Forms.BindableObject; -#elif !WinRT +#elif !WINDOWS_UWP using System.Windows; using System.Windows.Controls; #else @@ -22,7 +22,7 @@ namespace Caliburn.Micro using Windows.UI.Xaml.Controls; #endif -#if !WinRT && !XFORMS +#if !WINDOWS_UWP && !XFORMS using System.Windows.Interop; #endif @@ -268,8 +268,8 @@ public static void AddSubNamespaceMapping(string nsSource, string nsTarget, stri return view; } -#if !WinRT && !XFORMS - if(viewType.IsInterface || viewType.IsAbstract || !typeof(UIElement).IsAssignableFrom(viewType)) +#if !WINDOWS_UWP && !XFORMS + if (viewType.IsInterface || viewType.IsAbstract || !typeof(UIElement).IsAssignableFrom(viewType)) return new TextBlock { Text = string.Format("Cannot create {0}.", viewType.FullName) }; #else var viewTypeInfo = viewType.GetTypeInfo(); @@ -396,7 +396,7 @@ public static void AddSubNamespaceMapping(string nsSource, string nsTarget, stri if (viewAware != null) { var view = viewAware.GetView(context) as UIElement; if (view != null) { -#if !WinRT && !XFORMS +#if !WINDOWS_UWP && !XFORMS var windowCheck = view as Window; if (windowCheck == null || (!windowCheck.IsLoaded && !(new WindowInteropHelper(windowCheck).Handle == IntPtr.Zero))) { Log.Info("Using cached view for {0}.", model); @@ -416,7 +416,7 @@ public static void AddSubNamespaceMapping(string nsSource, string nsTarget, stri /// Transforms a view type into a pack uri. /// public static Func DeterminePackUriFromType = (viewModelType, viewType) => { -#if !WinRT && !XFORMS +#if !WINDOWS_UWP && !XFORMS var assemblyName = viewType.Assembly.GetAssemblyName(); var applicationAssemblyName = Application.Current.GetType().Assembly.GetAssemblyName(); #else @@ -444,7 +444,7 @@ public static void AddSubNamespaceMapping(string nsSource, string nsTarget, stri public static void InitializeComponent(object element) { #if XFORMS return; -#elif !WinRT +#elif !WINDOWS_UWP var method = element.GetType() .GetMethod("InitializeComponent", BindingFlags.Public | BindingFlags.Instance); diff --git a/src/Caliburn.Micro.Platform/ViewModelBinder.cs b/src/Caliburn.Micro.Platform/ViewModelBinder.cs index 7bbba87a..bc726da4 100644 --- a/src/Caliburn.Micro.Platform/ViewModelBinder.cs +++ b/src/Caliburn.Micro.Platform/ViewModelBinder.cs @@ -14,7 +14,7 @@ namespace Caliburn.Micro using FrameworkElement = global::Xamarin.Forms.VisualElement; using DependencyProperty = global::Xamarin.Forms.BindableProperty; using DependencyObject = global::Xamarin.Forms.BindableObject; -#elif WinRT81 +#elif WINDOWS_UWP using Windows.UI.Xaml; using Microsoft.Xaml.Interactivity; #else @@ -121,7 +121,7 @@ public static bool ShouldApplyConventions(FrameworkElement view) { public static Func, Type, IEnumerable> BindActions = (namedElements, viewModelType) => { var unmatchedElements = namedElements.ToList(); #if !XFORMS -#if WinRT || XFORMS +#if WINDOWS_UWP || XFORMS var methods = viewModelType.GetRuntimeMethods(); #else var methods = viewModelType.GetMethods(); @@ -142,7 +142,7 @@ public static bool ShouldApplyConventions(FrameworkElement view) { unmatchedElements.Remove(foundControl); -#if WinRT81 +#if WINDOWS_UWP var triggers = Interaction.GetBehaviors(foundControl); if (triggers != null && triggers.Count > 0) { @@ -193,7 +193,7 @@ static bool IsAsyncMethod(MethodInfo method) { /// ///Passes the the view model, view and creation context (or null for default) to use in applying binding. public static Action Bind = (viewModel, view, context) => { -#if !WinRT && !XFORMS +#if !WINDOWS_UWP && !XFORMS // when using d:DesignInstance, Blend tries to assign the DesignInstanceExtension class as the DataContext, // so here we get the actual ViewModel which is in the Instance property of DesignInstanceExtension if (View.InDesignMode) { diff --git a/src/Caliburn.Micro.Platform/ViewModelLocator.cs b/src/Caliburn.Micro.Platform/ViewModelLocator.cs index f9b98671..9c7ed7b3 100644 --- a/src/Caliburn.Micro.Platform/ViewModelLocator.cs +++ b/src/Caliburn.Micro.Platform/ViewModelLocator.cs @@ -10,7 +10,7 @@ namespace Caliburn.Micro using System.Windows; using System.Collections.Generic; -#if WinRT +#if WINDOWS_UWP using Windows.UI.Xaml; #endif diff --git a/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs b/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs index e014c958..237ebad0 100644 --- a/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs +++ b/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -#if WinRT +#if WINDOWS_UWP using System.Reflection; using Windows.UI.Core; using Windows.UI.Xaml; @@ -15,7 +15,7 @@ /// A implementation for the XAML platfrom. /// public class XamlPlatformProvider : IPlatformProvider { -#if WinRT +#if WINDOWS_UWP private CoreDispatcher dispatcher; #else private Dispatcher dispatcher; @@ -25,7 +25,7 @@ public class XamlPlatformProvider : IPlatformProvider { /// Initializes a new instance of the class. /// public XamlPlatformProvider() { -#if WinRT +#if WINDOWS_UWP dispatcher = Window.Current.Dispatcher; #else dispatcher = Dispatcher.CurrentDispatcher; @@ -45,7 +45,7 @@ private void ValidateDispatcher() { } private bool CheckAccess() { -#if WinRT +#if WINDOWS_UWP return dispatcher == null || Window.Current != null; #else return dispatcher == null || dispatcher.CheckAccess(); @@ -58,7 +58,7 @@ private bool CheckAccess() { /// The action to execute. public void BeginOnUIThread(System.Action action) { ValidateDispatcher(); -#if WinRT +#if WINDOWS_UWP var dummy = dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => action()); #else dispatcher.BeginInvoke(action); @@ -72,7 +72,7 @@ public void BeginOnUIThread(System.Action action) { /// public Task OnUIThreadAsync(System.Action action) { ValidateDispatcher(); -#if WinRT +#if WINDOWS_UWP return dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => action()).AsTask(); #elif NET45 return dispatcher.InvokeAsync(action).Task; @@ -101,7 +101,7 @@ public void OnUIThread(System.Action action) { if (CheckAccess()) action(); else { -#if WinRT +#if WINDOWS_UWP dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => action()).AsTask().Wait(); #elif NET Exception exception = null; @@ -206,14 +206,14 @@ public System.Action GetViewCloseAction(object viewModel, ICollection vi foreach (var contextualView in views) { var viewType = contextualView.GetType(); -#if WinRT +#if WINDOWS_UWP var closeMethod = viewType.GetRuntimeMethod("Close", new Type[0]); #else var closeMethod = viewType.GetMethod("Close"); #endif if (closeMethod != null) return () => { -#if !WinRT +#if !WINDOWS_UWP var isClosed = false; if (dialogResult != null) { var resultProperty = contextualView.GetType().GetProperty("DialogResult"); @@ -231,7 +231,7 @@ public System.Action GetViewCloseAction(object viewModel, ICollection vi #endif }; -#if WinRT +#if WINDOWS_UWP var isOpenProperty = viewType.GetRuntimeProperty("IsOpen"); #else var isOpenProperty = viewType.GetProperty("IsOpen"); diff --git a/src/Caliburn.Micro.Platform/win8/CachingFrameAdapter.cs b/src/Caliburn.Micro.Platform/win8/CachingFrameAdapter.cs index ea858fd0..b36cce10 100644 --- a/src/Caliburn.Micro.Platform/win8/CachingFrameAdapter.cs +++ b/src/Caliburn.Micro.Platform/win8/CachingFrameAdapter.cs @@ -148,7 +148,7 @@ private static T PopOffStack(IList stack) { return value; } -#if WinRT81 +#if WINDOWS_UWP /// /// Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. /// diff --git a/src/Caliburn.Micro.Platform/win8/INavigationService.cs b/src/Caliburn.Micro.Platform/win8/INavigationService.cs index 57f9cab1..0240e132 100644 --- a/src/Caliburn.Micro.Platform/win8/INavigationService.cs +++ b/src/Caliburn.Micro.Platform/win8/INavigationService.cs @@ -79,7 +79,7 @@ public interface INavigationService { /// void GoBack(); -#if WinRT81 +#if WINDOWS_UWP /// /// Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. /// @@ -89,9 +89,7 @@ public interface INavigationService { /// Gets a collection of PageStackEntry instances representing the forward navigation history of the Frame. /// IList ForwardStack { get; } -#endif -#if WINDOWS_UWP /// /// Occurs when the user requests a back navigation via hardware back button or gesture or voice. /// @@ -400,7 +398,7 @@ public virtual bool CanGoBack { get { return frame.CanGoBack; } } -#if WinRT81 +#if WINDOWS_UWP /// /// Gets a collection of PageStackEntry instances representing the backward navigation history of the Frame. /// diff --git a/src/Caliburn.Micro.Platform/win8/NavigateHelper.cs b/src/Caliburn.Micro.Platform/win8/NavigateHelper.cs index 8015d216..b0a6cbd6 100644 --- a/src/Caliburn.Micro.Platform/win8/NavigateHelper.cs +++ b/src/Caliburn.Micro.Platform/win8/NavigateHelper.cs @@ -46,7 +46,7 @@ public void Navigate() { if (navigationService == null) { throw new InvalidOperationException("Cannot navigate without attaching an INavigationService. Call AttachTo first."); } -#if WinRT +#if WINDOWS_UWP navigationService.NavigateToViewModel(uri.AbsoluteUri); #else navigationService.Navigate(uri); @@ -65,7 +65,7 @@ public Uri BuildUri() { var packUri = ViewLocator.DeterminePackUriFromType(typeof(TViewModel), viewType); var qs = BuildQueryString(); -#if WinRT +#if WINDOWS_UWP // We need a value uri here otherwise there are problems using uri as a parameter return new Uri("caliburn://" + packUri + qs, UriKind.Absolute); #else diff --git a/src/Caliburn.Micro.Platform/win8/Parameter.cs b/src/Caliburn.Micro.Platform/win8/Parameter.cs index f2b3e4e2..8a99b408 100644 --- a/src/Caliburn.Micro.Platform/win8/Parameter.cs +++ b/src/Caliburn.Micro.Platform/win8/Parameter.cs @@ -5,7 +5,7 @@ /// /// Represents a parameter of an . /// -#if WinRT81 +#if WINDOWS_UWP public class Parameter : DependencyObject, IAttachedObject { DependencyObject associatedObject; #else @@ -34,7 +34,7 @@ public object Value { set { SetValue(ValueProperty, value); } } -#if WinRT81 +#if WINDOWS_UWP DependencyObject IAttachedObject.AssociatedObject { #else FrameworkElement IAttachedObject.AssociatedObject { @@ -51,7 +51,7 @@ protected ActionMessage Owner { set { owner = new WeakReference(value); } } -#if WinRT81 +#if WINDOWS_UWP void IAttachedObject.Attach(DependencyObject dependencyObject) { #else void IAttachedObject.Attach(FrameworkElement dependencyObject) { diff --git a/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs b/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs index 68234be8..1ca19659 100644 --- a/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs +++ b/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs @@ -30,7 +30,7 @@ public INavigationService RegisterNavigationService(Frame rootFrame, bool treatV if (rootFrame == null) throw new ArgumentNullException("rootFrame"); -#if WinRT81 +#if WINDOWS_UWP var frameAdapter = cacheViewModels ? (INavigationService) new CachingFrameAdapter(rootFrame, treatViewAsLoaded) : new FrameAdapter(rootFrame, treatViewAsLoaded); @@ -67,7 +67,7 @@ public ISettingsService RegisterSettingsService() { return this.GetInstance(null); if (!HasHandler(typeof (ISettingsWindowManager), null)) -#if WinRT81 +#if WINDOWS_UWP RegisterInstance(typeof (ISettingsWindowManager), null, new SettingsWindowManager()); #else RegisterInstance(typeof(ISettingsWindowManager), null, new CallistoSettingsWindowManager()); diff --git a/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs b/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs index 60071971..8fa4b5fe 100644 --- a/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs +++ b/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs @@ -141,7 +141,7 @@ public static class ConventionManager /// public static Action ApplyStringFormat = (binding, convention, property) => { -#if !WinRT +#if !WINDOWS_UWP if (typeof(DateTime).IsAssignableFrom(property.PropertyType)) binding.StringFormat = "{0:d}"; #endif diff --git a/src/Caliburn.Micro.Platform/xforms/Parameter.cs b/src/Caliburn.Micro.Platform/xforms/Parameter.cs index d6533d82..dc0a021f 100644 --- a/src/Caliburn.Micro.Platform/xforms/Parameter.cs +++ b/src/Caliburn.Micro.Platform/xforms/Parameter.cs @@ -17,7 +17,7 @@ namespace Caliburn.Micro /// /// Represents a parameter of an . /// -#if WinRT81 || XFORMS +#if WINDOWS_UWP || XFORMS public class Parameter : DependencyObject, IAttachedObject { DependencyObject associatedObject; #else @@ -49,7 +49,7 @@ public object Value set { SetValue(ValueProperty, value); } } -#if WinRT81 || XFORMS +#if WINDOWS_UWP || XFORMS DependencyObject IAttachedObject.AssociatedObject { #else FrameworkElement IAttachedObject.AssociatedObject @@ -68,7 +68,7 @@ protected ActionMessage Owner set { owner = new WeakReference(value); } } -#if WinRT81 || XFORMS +#if WINDOWS_UWP || XFORMS void IAttachedObject.Attach(DependencyObject dependencyObject) { #else void IAttachedObject.Attach(FrameworkElement dependencyObject) From 1c0ac452b02aa7b2d82d381f0137c10212bbef23 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 30 May 2017 22:57:02 +1200 Subject: [PATCH 008/142] #444 Remove WinRT and WinRT81 symbols from project --- .../Caliburn.Micro.Platform.UWP.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj index 130029e6..499e08e8 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj @@ -24,7 +24,7 @@ full false ..\..\bin\uwp\Debug\ - TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;WinRT;WinRT81 + TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP prompt 4 ..\..\bin\uwp\Debug\Caliburn.Micro.Platform.UWP.XML @@ -35,7 +35,7 @@ pdbonly true ..\..\bin\uwp\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP;WinRT;WinRT81 + TRACE;NETFX_CORE;WINDOWS_UWP prompt 4 ..\..\bin\uwp\Release\Caliburn.Micro.Platform.UWP.XML From ecc07662a1477028546c083692590f9b5c033d1c Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Tue, 30 May 2017 22:58:56 +1200 Subject: [PATCH 009/142] #44 Remove unused platform code --- .../sl4/AttachedCollection.cs | 82 ---- .../sl4/INavigationService.cs | 345 ------------- src/Caliburn.Micro.Platform/sl4/Mouse.cs | 21 - .../sl4/NavigationExtensions.cs | 21 - .../sl4/NavigationHelper.cs | 91 ---- src/Caliburn.Micro.Platform/sl4/Parameter.cs | 72 --- .../sl4/WindowManager.cs | 273 ----------- .../win8/AttachedCollection.cs | 82 ---- .../win8/CallistoSettingsWindowManager.cs | 93 ---- .../win8/FlyoutSettingsCommand.cs | 53 -- .../win8/ISettingsService.cs | 35 -- .../win8/ISettingsWindowManager.cs | 29 -- .../win8/SettingsCommandBase.cs | 30 -- .../win8/SettingsService.cs | 81 ---- .../win8/SettingsWindowManager.cs | 96 ---- .../win8/UriSettingsCommand.cs | 34 -- .../wp71/AppSettingsStorageMechanism.cs | 97 ---- .../wp71/CustomAppBar.cs | 46 -- .../wp71/INavigationService.cs | 340 ------------- .../wp71/IPhoneContainer.cs | 29 -- .../wp71/IPhoneService.cs | 200 -------- .../wp71/IStorageHandler.cs | 40 -- .../wp71/IStorageMechanism.cs | 59 --- .../wp71/NavigationExtensions.cs | 29 -- .../wp71/NavigationHelper.cs | 80 --- .../wp71/PhoneBootstrapper.cs | 85 ---- .../wp71/PhoneContainer.cs | 131 ----- .../wp71/PhoneStateStorageMechanism.cs | 99 ---- .../wp71/SoundEffectPlayer.cs | 52 -- .../wp71/StorageCoordinator.cs | 138 ------ .../wp71/StorageHandler.cs | 162 ------- .../wp71/StorageInstruction.cs | 85 ---- .../wp71/StorageInstructionBuilder.cs | 29 -- .../wp71/StorageInstructionExtensions.cs | 135 ------ .../wp71/StorageMode.cs | 26 - .../wp71/TaskCompleted.cs | 17 - .../wp71/TaskController.cs | 145 ------ .../wp71/TaskExecutionRequested.cs | 16 - .../wp71/TaskExtensionMethods.cs | 29 -- .../wp71/UIElementExtensions.cs | 33 -- .../wp71/VibrateController.cs | 40 -- .../wp71/WindowManager.cs | 454 ------------------ .../wp71/WindowManagerExtensions.cs | 28 -- 43 files changed, 4062 deletions(-) delete mode 100644 src/Caliburn.Micro.Platform/sl4/AttachedCollection.cs delete mode 100644 src/Caliburn.Micro.Platform/sl4/INavigationService.cs delete mode 100644 src/Caliburn.Micro.Platform/sl4/Mouse.cs delete mode 100644 src/Caliburn.Micro.Platform/sl4/NavigationExtensions.cs delete mode 100644 src/Caliburn.Micro.Platform/sl4/NavigationHelper.cs delete mode 100644 src/Caliburn.Micro.Platform/sl4/Parameter.cs delete mode 100644 src/Caliburn.Micro.Platform/sl4/WindowManager.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/AttachedCollection.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/CallistoSettingsWindowManager.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/FlyoutSettingsCommand.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/ISettingsService.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/ISettingsWindowManager.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/SettingsCommandBase.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/SettingsService.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/SettingsWindowManager.cs delete mode 100644 src/Caliburn.Micro.Platform/win8/UriSettingsCommand.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/AppSettingsStorageMechanism.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/CustomAppBar.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/INavigationService.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/IPhoneContainer.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/IPhoneService.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/IStorageHandler.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/IStorageMechanism.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/NavigationExtensions.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/NavigationHelper.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/PhoneBootstrapper.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/PhoneContainer.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/PhoneStateStorageMechanism.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/SoundEffectPlayer.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/StorageCoordinator.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/StorageHandler.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/StorageInstruction.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/StorageInstructionBuilder.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/StorageInstructionExtensions.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/StorageMode.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/TaskCompleted.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/TaskController.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/TaskExecutionRequested.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/TaskExtensionMethods.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/UIElementExtensions.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/VibrateController.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/WindowManager.cs delete mode 100644 src/Caliburn.Micro.Platform/wp71/WindowManagerExtensions.cs diff --git a/src/Caliburn.Micro.Platform/sl4/AttachedCollection.cs b/src/Caliburn.Micro.Platform/sl4/AttachedCollection.cs deleted file mode 100644 index 70fafc5b..00000000 --- a/src/Caliburn.Micro.Platform/sl4/AttachedCollection.cs +++ /dev/null @@ -1,82 +0,0 @@ -namespace Caliburn.Micro { - using System.Collections.Specialized; - using System.Linq; - using System.Windows; - using System.Windows.Interactivity; - - /// - /// A collection that can exist as part of a behavior. - /// - /// The type of item in the attached collection. - public class AttachedCollection : DependencyObjectCollection, IAttachedObject - where T : DependencyObject, IAttachedObject { - DependencyObject associatedObject; - - /// - /// Creates an instance of - /// - public AttachedCollection() { - CollectionChanged += OnCollectionChanged; - } - - /// - /// Attached the collection. - /// - /// The dependency object to attach the collection to. - public void Attach(DependencyObject dependencyObject) { - associatedObject = dependencyObject; - this.Apply(x => x.Attach(associatedObject)); - } - - /// - /// Detaches the collection. - /// - public void Detach() { - this.Apply(x => x.Detach()); - associatedObject = null; - } - - DependencyObject IAttachedObject.AssociatedObject { - get { return associatedObject; } - } - - /// - /// Called when an item is added from the collection. - /// - /// The item that was added. - protected virtual void OnItemAdded(T item) { - if (associatedObject != null) { - item.Attach(associatedObject); - } - } - - /// - /// Called when an item is removed from the collection. - /// - /// The item that was removed. - protected virtual void OnItemRemoved(T item) { - if (item.AssociatedObject != null) { - item.Detach(); - } - } - - void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - switch (e.Action) { - case NotifyCollectionChangedAction.Add: - e.NewItems.OfType().Where(x => !Contains(x)).Apply(OnItemAdded); - break; - case NotifyCollectionChangedAction.Remove: - e.OldItems.OfType().Apply(OnItemRemoved); - break; - case NotifyCollectionChangedAction.Replace: - e.OldItems.OfType().Apply(OnItemRemoved); - e.NewItems.OfType().Where(x => !Contains(x)).Apply(OnItemAdded); - break; - case NotifyCollectionChangedAction.Reset: - this.Apply(OnItemRemoved); - this.Apply(OnItemAdded); - break; - } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/sl4/INavigationService.cs b/src/Caliburn.Micro.Platform/sl4/INavigationService.cs deleted file mode 100644 index e85317a1..00000000 --- a/src/Caliburn.Micro.Platform/sl4/INavigationService.cs +++ /dev/null @@ -1,345 +0,0 @@ -namespace Caliburn.Micro -{ - using System; - using System.Collections.Generic; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Navigation; - - /// - /// Implemented by services that provide based navigation. - /// - public interface INavigationService : INavigate - { - /// - /// The source. - /// - Uri Source { get; set; } - - /// - /// Indicates whether the navigator can navigate back. - /// - bool CanGoBack { get; } - - /// - /// Indicates whether the navigator can navigate forward. - /// - bool CanGoForward { get; } - - /// - /// The current source. - /// - Uri CurrentSource { get; } - - /// - /// The current content. - /// - object CurrentContent { get; } - - /// - /// Stops the loading process. - /// - void StopLoading(); - - /// - /// Navigates back. - /// - void GoBack(); - - /// - /// Navigates forward. - /// - void GoForward(); - - /// - /// Raised after navigation. - /// - event NavigatedEventHandler Navigated; - - /// - /// Raised prior to navigation. - /// - event NavigatingCancelEventHandler Navigating; - - /// - /// Raised when navigation fails. - /// - event NavigationFailedEventHandler NavigationFailed; - - /// - /// Raised when navigation is stopped. - /// - event NavigationStoppedEventHandler NavigationStopped; - - /// - /// Raised when a fragment navigation occurs. - /// - event FragmentNavigationEventHandler FragmentNavigation; - } - - /// - /// A basic implementation of designed to adapt the control. - /// - public class FrameAdapter : INavigationService - { - readonly Frame frame; - readonly bool treatViewAsLoaded; - event NavigatingCancelEventHandler ExternalNavigatingHandler = delegate { }; - - /// - /// Creates an instance of - /// - /// The frame to represent as a . - /// Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. - public FrameAdapter(Frame frame, bool treatViewAsLoaded = false) - { - this.frame = frame; - this.treatViewAsLoaded = treatViewAsLoaded; - this.frame.Navigating += OnNavigating; - this.frame.Navigated += OnNavigated; - } - - /// - /// Occurs before navigation - /// - /// The event sender. - /// The event args. - protected virtual void OnNavigating(object sender, NavigatingCancelEventArgs e) - { - ExternalNavigatingHandler(sender, e); - if (e.Cancel) - { - return; - } - - var fe = frame.Content as FrameworkElement; - if (fe == null) - { - return; - } - - var guard = fe.DataContext as IGuardClose; - if (guard != null && !e.Uri.IsAbsoluteUri) - { - var shouldCancel = false; - var runningAsync = true; - guard.CanClose(result => { runningAsync = false; shouldCancel = !result; }); - if (runningAsync) - throw new NotSupportedException("Async CanClose is not supported."); - - if (shouldCancel) - { - e.Cancel = true; - return; - } - } - - var deactivator = fe.DataContext as IDeactivate; - - // If we are navigating to the same page there is no need to deactivate - // e.g. When the app is activated with Fast Switch - if (deactivator != null && frame.CurrentSource != e.Uri) - { - deactivator.Deactivate(CanCloseOnNavigating(sender, e)); - } - } - - /// - /// Called to check whether or not to close current instance on navigating. - /// - /// The event sender from OnNavigating event. - /// The event args from OnNavigating event. - protected virtual bool CanCloseOnNavigating(object sender, NavigatingCancelEventArgs e) - { - return false; - } - - /// - /// Occurs after navigation - /// - /// The event sender. - /// The event args. - protected virtual void OnNavigated(object sender, NavigationEventArgs e) - { - if (e.Uri.IsAbsoluteUri || e.Content == null) - { - return; - } - - ViewLocator.InitializeComponent(e.Content); - - var viewModel = ViewModelLocator.LocateForView(e.Content); - if (viewModel == null) - { - return; - } - - var page = e.Content as Page; - if (page == null) - { - throw new ArgumentException("View '" + e.Content.GetType().FullName + "' should inherit from Page or one of its descendents."); - } - - if (treatViewAsLoaded) - { - page.SetValue(View.IsLoadedProperty, true); - } - - TryInjectQueryString(viewModel, page); - ViewModelBinder.Bind(viewModel, page, null); - - var activator = viewModel as IActivate; - if (activator != null) - { - activator.Activate(); - } - - GC.Collect(); - } - - /// - /// Attempts to inject query string parameters from the view into the view model. - /// - /// The view model. - /// The page. - protected virtual void TryInjectQueryString(object viewModel, Page page) - { - var viewModelType = viewModel.GetType(); - - foreach (var pair in page.NavigationContext.QueryString) - { - var property = viewModelType.GetPropertyCaseInsensitive(pair.Key); - if (property == null) - { - continue; - } - - property.SetValue( - viewModel, - MessageBinder.CoerceValue(property.PropertyType, pair.Value, page.NavigationContext), - null - ); - } - } - - /// - /// The source. - /// - public Uri Source - { - get { return frame.Source; } - set { frame.Source = value; } - } - - /// - /// Indicates whether the navigator can navigate back. - /// - public bool CanGoBack - { - get { return frame.CanGoBack; } - } - - /// - /// Indicates whether the navigator can navigate forward. - /// - public bool CanGoForward - { - get { return frame.CanGoForward; } - } - - /// - /// The current source. - /// - public Uri CurrentSource - { - get { return frame.CurrentSource; } - } - - /// - /// The current content. - /// - public object CurrentContent - { - get { return frame.Content; } - } - - /// - /// Stops the loading process. - /// - public void StopLoading() - { - frame.StopLoading(); - } - - /// - /// Navigates back. - /// - public void GoBack() - { - frame.GoBack(); - } - - /// - /// Navigates forward. - /// - public void GoForward() - { - frame.GoForward(); - } - - /// - /// Navigates to the specified . - /// - /// The to navigate to. - /// Whether or not navigation succeeded. - public bool Navigate(Uri source) - { - return frame.Navigate(source); - } - - /// - /// Raised after navigation. - /// - public event NavigatedEventHandler Navigated - { - add { frame.Navigated += value; } - remove { frame.Navigated -= value; } - } - - /// - /// Raised prior to navigation. - /// - public event NavigatingCancelEventHandler Navigating - { - add { ExternalNavigatingHandler += value; } - remove { ExternalNavigatingHandler -= value; } - } - - /// - /// Raised when navigation fails. - /// - public event NavigationFailedEventHandler NavigationFailed - { - add { frame.NavigationFailed += value; } - remove { frame.NavigationFailed -= value; } - } - - /// - /// Raised when navigation is stopped. - /// - public event NavigationStoppedEventHandler NavigationStopped - { - add { frame.NavigationStopped += value; } - remove { frame.NavigationStopped -= value; } - } - - /// - /// Raised when a fragment navigation occurs. - /// - public event FragmentNavigationEventHandler FragmentNavigation - { - add { frame.FragmentNavigation += value; } - remove { frame.FragmentNavigation -= value; } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/sl4/Mouse.cs b/src/Caliburn.Micro.Platform/sl4/Mouse.cs deleted file mode 100644 index 8dc65e27..00000000 --- a/src/Caliburn.Micro.Platform/sl4/Mouse.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Caliburn.Micro { - using System.Windows; - - /// - /// A mouse helper utility. - /// - public static class Mouse { - /// - /// The current position of the mouse. - /// - public static Point Position { get; set; } - - /// - /// Initializes the mouse helper with the UIElement to use in mouse tracking. - /// - /// The UIElement to use for mouse tracking. - public static void Initialize(UIElement element) { - element.MouseMove += (s, e) => { Position = e.GetPosition(null); }; - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/sl4/NavigationExtensions.cs b/src/Caliburn.Micro.Platform/sl4/NavigationExtensions.cs deleted file mode 100644 index 13f7e629..00000000 --- a/src/Caliburn.Micro.Platform/sl4/NavigationExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Caliburn.Micro -{ - /// - /// Extension methods related to navigation. - /// - public static class NavigationExtensions - { - /// - /// Creates a Uri builder based on a view model type. - /// - /// The type of the view model. - /// The navigation service. - /// The builder. - public static NavigationHelper For(this INavigationService navigationService) - { - return new NavigationHelper().AttachTo(navigationService); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/sl4/NavigationHelper.cs b/src/Caliburn.Micro.Platform/sl4/NavigationHelper.cs deleted file mode 100644 index 0b78dcbe..00000000 --- a/src/Caliburn.Micro.Platform/sl4/NavigationHelper.cs +++ /dev/null @@ -1,91 +0,0 @@ -namespace Caliburn.Micro -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - - /// - /// Builds a Uri in a strongly typed fashion, based on a ViewModel. - /// - /// - public class NavigationHelper - { - readonly Dictionary queryString = new Dictionary(); - INavigationService navigationService; - - /// - /// Adds a query string parameter to the Uri. - /// - /// The type of the value. - /// The property. - /// The property value. - /// Itself - public NavigationHelper WithParam(Expression> property, TValue value) - { - if (value is ValueType || !ReferenceEquals(null, value)) - { - queryString[property.GetMemberInfo().Name] = value.ToString(); - } - - return this; - } - - /// - /// Attaches a navigation servies to this builder. - /// - /// The navigation service. - /// Itself - public NavigationHelper AttachTo(INavigationService navigationService) - { - this.navigationService = navigationService; - return this; - } - - /// - /// Navigates to the Uri represented by this builder. - /// - public void Navigate() - { - var uri = BuildUri(); - - if (navigationService == null) - { - throw new InvalidOperationException("Cannot navigate without attaching an INavigationService. Call AttachTo first."); - } - - navigationService.Navigate(uri); - } - - /// - /// Builds the URI. - /// - /// A uri constructed with the current configuration information. - public Uri BuildUri() - { - var viewType = ViewLocator.LocateTypeForModelType(typeof(TViewModel), null, null); - if (viewType == null) - { - throw new InvalidOperationException(string.Format("No view was found for {0}. See the log for searched views.", typeof(TViewModel).FullName)); - } - - var packUri = ViewLocator.DeterminePackUriFromType(typeof(TViewModel), viewType); - var qs = BuildQueryString(); - - return new Uri(packUri + qs, UriKind.Relative); - } - - string BuildQueryString() - { - if (queryString.Count < 1) - { - return string.Empty; - } - - var result = queryString - .Aggregate("?", (current, pair) => current + (pair.Key + "=" + Uri.EscapeDataString(pair.Value) + "&")); - - return result.Remove(result.Length - 1); - } - } -} diff --git a/src/Caliburn.Micro.Platform/sl4/Parameter.cs b/src/Caliburn.Micro.Platform/sl4/Parameter.cs deleted file mode 100644 index 1b48f713..00000000 --- a/src/Caliburn.Micro.Platform/sl4/Parameter.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.ComponentModel; - using System.Windows; - using System.Windows.Interactivity; - - /// - /// Represents a parameter of an . - /// - public class Parameter : DependencyObject, IAttachedObject { - DependencyObject associatedObject; - WeakReference owner; - - /// - /// A dependency property representing the parameter's value. - /// - public static readonly DependencyProperty ValueProperty = - DependencyProperty.Register( - "Value", - typeof(object), - typeof(Parameter), - new PropertyMetadata(OnValueChanged) - ); - - /// - /// Gets or sets the value of the parameter. - /// - /// The value. - [Category("Common Properties")] - public object Value { - get { return GetValue(ValueProperty); } - set { SetValue(ValueProperty, value); } - } - - DependencyObject IAttachedObject.AssociatedObject { - get { return associatedObject; } - } - - /// - /// Gets or sets the owner. - /// - protected ActionMessage Owner { - get { return owner == null ? null : owner.Target as ActionMessage; } - set { owner = new WeakReference(value); } - } - - void IAttachedObject.Attach(DependencyObject dependencyObject) { - associatedObject = dependencyObject; - } - - void IAttachedObject.Detach() { - associatedObject = null; - } - - /// - /// Makes the parameter aware of the that it's attached to. - /// - /// The action message. - internal void MakeAwareOf(ActionMessage owner) { - Owner = owner; - } - - static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var parameter = (Parameter)d; - var owner = parameter.Owner; - - if (owner != null) { - owner.UpdateAvailability(); - } - } - } -} diff --git a/src/Caliburn.Micro.Platform/sl4/WindowManager.cs b/src/Caliburn.Micro.Platform/sl4/WindowManager.cs deleted file mode 100644 index 3cf21e97..00000000 --- a/src/Caliburn.Micro.Platform/sl4/WindowManager.cs +++ /dev/null @@ -1,273 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Controls.Primitives; - using System.Windows.Data; - - /// - /// A service that manages windows. - /// - public interface IWindowManager { - /// - /// Shows a modal dialog for the specified model. - /// - /// The root model. - /// The optional dialog settings. - /// The context. - void ShowDialog(object rootModel, object context = null, IDictionary settings = null); - - /// - /// Shows a toast notification for the specified model. - /// - /// The root model. - /// How long the notification should appear for. - /// The optional notification settings. - /// The context. - void ShowNotification(object rootModel, int durationInMilliseconds, object context = null, IDictionary settings = null); - - /// - /// Shows a popup at the current mouse position. - /// - /// The root model. - /// The view context. - /// The optional popup settings. - void ShowPopup(object rootModel, object context = null, IDictionary settings = null); - } - - /// - /// A service that manages windows. - /// - public class WindowManager : IWindowManager { - /// - /// Shows a modal dialog for the specified model. - /// - /// The root model. - /// The context. - /// The optional dialog settings. - public virtual void ShowDialog(object rootModel, object context = null, IDictionary settings = null) { - var view = EnsureWindow(rootModel, ViewLocator.LocateForModel(rootModel, null, context)); - ViewModelBinder.Bind(rootModel, view, context); - - var haveDisplayName = rootModel as IHaveDisplayName; - if(haveDisplayName != null && !ConventionManager.HasBinding(view, ChildWindow.TitleProperty)) { - var binding = new Binding("DisplayName") { Mode = BindingMode.TwoWay }; - view.SetBinding(ChildWindow.TitleProperty, binding); - } - - ApplySettings(view, settings); - - new WindowConductor(rootModel, view); - - view.Show(); - } - - /// - /// Shows a toast notification for the specified model. - /// - /// The root model. - /// How long the notification should appear for. - /// The context. - /// The optional notification settings. - public virtual void ShowNotification(object rootModel, int durationInMilliseconds, object context = null, IDictionary settings = null){ - var window = new NotificationWindow(); - var view = ViewLocator.LocateForModel(rootModel, window, context); - - ViewModelBinder.Bind(rootModel, view, null); - window.Content = (FrameworkElement)view; - - ApplySettings(window, settings); - - var activator = rootModel as IActivate; - if (activator != null) { - activator.Activate(); - } - - var deactivator = rootModel as IDeactivate; - if (deactivator != null) { - window.Closed += delegate { deactivator.Deactivate(true); }; - } - - window.Show(durationInMilliseconds); - } - - /// - /// Shows a popup at the current mouse position. - /// - /// The root model. - /// The view context. - /// The optional popup settings. - public virtual void ShowPopup(object rootModel, object context = null, IDictionary settings = null) { - var popup = CreatePopup(rootModel, settings); - var view = ViewLocator.LocateForModel(rootModel, popup, context); - - popup.Child = view; - popup.SetValue(View.IsGeneratedProperty, true); - - ViewModelBinder.Bind(rootModel, popup, null); - Action.SetTargetWithoutContext(view, rootModel); - - var activatable = rootModel as IActivate; - if (activatable != null) { - activatable.Activate(); - } - - var deactivator = rootModel as IDeactivate; - if (deactivator != null) { - popup.Closed += delegate { deactivator.Deactivate(true); }; - } - - popup.IsOpen = true; - popup.CaptureMouse(); - } - - /// - /// Creates a popup for hosting a popup window. - /// - /// The model. - /// The optional popup settings. - /// The popup. - protected virtual Popup CreatePopup(object rootModel, IDictionary settings) { - var popup = new Popup { - HorizontalOffset = Mouse.Position.X, - VerticalOffset = Mouse.Position.Y - }; - - ApplySettings(popup, settings); - - return popup; - } - - /// - /// Ensures that the view is a or is wrapped by one. - /// - /// The view model. - /// The view. - /// The window. - protected virtual ChildWindow EnsureWindow(object model, object view) { - var window = view as ChildWindow; - - if(window == null) { - window = new ChildWindow { Content = view }; - window.SetValue(View.IsGeneratedProperty, true); - } - - return window; - } - - bool ApplySettings(object target, IEnumerable> settings) { - if(settings != null) { - var type = target.GetType(); - - foreach(var pair in settings) { - var propertyInfo = type.GetProperty(pair.Key); - - if(propertyInfo != null) - propertyInfo.SetValue(target, pair.Value, null); - } - - return true; - } - - return false; - } - - class WindowConductor { - bool deactivatingFromView; - bool deactivateFromViewModel; - bool actuallyClosing; - readonly ChildWindow view; - readonly object model; - - public WindowConductor(object model, ChildWindow view) { - this.model = model; - this.view = view; - - var activatable = model as IActivate; - if (activatable != null) { - activatable.Activate(); - } - - var deactivatable = model as IDeactivate; - if (deactivatable != null) { - view.Closed += Closed; - deactivatable.Deactivated += Deactivated; - } - - var guard = model as IGuardClose; - if (guard != null) { - view.Closing += Closing; - } - } - - void Closed(object sender, EventArgs e) { - view.Closed -= Closed; - view.Closing -= Closing; - - if (deactivateFromViewModel) { - return; - } - - var deactivatable = (IDeactivate)model; - - deactivatingFromView = true; - deactivatable.Deactivate(true); - deactivatingFromView = false; - } - - void Deactivated(object sender, DeactivationEventArgs e) { - if(!e.WasClosed) - return; - - ((IDeactivate)model).Deactivated -= Deactivated; - - if (deactivatingFromView) { - return; - } - - deactivateFromViewModel = true; - actuallyClosing = true; - view.Close(); - actuallyClosing = false; - deactivateFromViewModel = false; - } - - void Closing(object sender, CancelEventArgs e) { - if (e.Cancel) { - return; - } - - var guard = (IGuardClose)model; - - if (actuallyClosing) { - actuallyClosing = false; - return; - } - - bool runningAsync = false, shouldEnd = false; - - guard.CanClose(canClose => { - Execute.OnUIThread(() => { - if(runningAsync && canClose) { - actuallyClosing = true; - view.Close(); - } - else { - e.Cancel = !canClose; - } - - shouldEnd = true; - }); - }); - - if (shouldEnd) { - return; - } - - runningAsync = e.Cancel = true; - } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/win8/AttachedCollection.cs b/src/Caliburn.Micro.Platform/win8/AttachedCollection.cs deleted file mode 100644 index b73910e3..00000000 --- a/src/Caliburn.Micro.Platform/win8/AttachedCollection.cs +++ /dev/null @@ -1,82 +0,0 @@ -namespace Caliburn.Micro { - using System.Collections.Specialized; - using System.Linq; - using Windows.UI.Interactivity; - using Windows.UI.Xaml; - - /// - /// A collection that can exist as part of a behavior. - /// - /// The type of item in the attached collection. - public class AttachedCollection : FrameworkElementCollection, IAttachedObject - where T : FrameworkElement, IAttachedObject { - private FrameworkElement associatedObject; - - /// - /// Creates an instance of - /// - public AttachedCollection() { - CollectionChanged += OnCollectionChanged; - } - - /// - /// Attached the collection. - /// - /// The dependency object to attach the collection to. - public void Attach(FrameworkElement dependencyObject) { - associatedObject = dependencyObject; - this.Apply(x => x.Attach(associatedObject)); - } - - /// - /// Detaches the collection. - /// - public void Detach() { - this.Apply(x => x.Detach()); - associatedObject = null; - } - - FrameworkElement IAttachedObject.AssociatedObject { - get { return associatedObject; } - } - - /// - /// Called when an item is added from the collection. - /// - /// The item that was added. - protected virtual void OnItemAdded(T item) { - if (associatedObject != null) { - item.Attach(associatedObject); - } - } - - /// - /// Called when an item is removed from the collection. - /// - /// The item that was removed. - protected virtual void OnItemRemoved(T item) { - if (item.AssociatedObject != null) { - item.Detach(); - } - } - - private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { - switch (e.Action) { - case NotifyCollectionChangedAction.Add: - e.NewItems.OfType().Where(x => !Contains(x)).Apply(OnItemAdded); - break; - case NotifyCollectionChangedAction.Remove: - e.OldItems.OfType().Apply(OnItemRemoved); - break; - case NotifyCollectionChangedAction.Replace: - e.OldItems.OfType().Apply(OnItemRemoved); - e.NewItems.OfType().Where(x => !Contains(x)).Apply(OnItemAdded); - break; - case NotifyCollectionChangedAction.Reset: - this.Apply(OnItemRemoved); - this.Apply(OnItemAdded); - break; - } - } - } -} diff --git a/src/Caliburn.Micro.Platform/win8/CallistoSettingsWindowManager.cs b/src/Caliburn.Micro.Platform/win8/CallistoSettingsWindowManager.cs deleted file mode 100644 index 86a7bea8..00000000 --- a/src/Caliburn.Micro.Platform/win8/CallistoSettingsWindowManager.cs +++ /dev/null @@ -1,93 +0,0 @@ -namespace Caliburn.Micro { - using Callisto.Controls; - using System; - using System.Collections.Generic; - using System.Reflection; - using Windows.UI.Xaml.Media; - using Windows.UI.Xaml.Media.Imaging; - - /// - /// An implementation of the using Callisto - /// - public class CallistoSettingsWindowManager : ISettingsWindowManager { - /// - /// Shows a settings flyout panel for the specified model. - /// - /// The settings view model. - /// The settings command label. - /// The optional dialog settings. - public async void ShowSettingsFlyout(object viewModel, string commandLabel, IDictionary viewSettings = null) { - var view = ViewLocator.LocateForModel(viewModel, null, null); - ViewModelBinder.Bind(viewModel, view, null); - - viewSettings = viewSettings ?? new Dictionary(); - - var width = viewSettings.ContainsKey("width") - ? (SettingsFlyout.SettingsFlyoutWidth) viewSettings["width"] - : SettingsFlyout.SettingsFlyoutWidth.Narrow; - - // extract the header color/logo from the appmanifest.xml - var visualElements = await Callisto.Controls.Common.AppManifestHelper.GetManifestVisualElementsAsync(); - - // enable the overriding of these, but default to manifest - var headerBackground = viewSettings.ContainsKey("headerbackground") - ? (SolidColorBrush) viewSettings["headerbackground"] - : new SolidColorBrush(visualElements.BackgroundColor); - - var smallLogoUri = viewSettings.ContainsKey("smalllogouri") - ? (Uri) viewSettings["smalllogouri"] - : visualElements.SmallLogoUri; - - var smallLogo = new BitmapImage(smallLogoUri); - - // use real property names for ApplySettings - if (!viewSettings.ContainsKey("FlyoutWidth")) - viewSettings["FlyoutWidth"] = width; - if (!viewSettings.ContainsKey("HeaderBrush")) - viewSettings["HeaderBrush"] = headerBackground; - if (!viewSettings.ContainsKey("SmallLogoImageSource")) - viewSettings["SmallLogoImageSource"] = smallLogo; - - var settingsFlyout = new SettingsFlyout - { - HeaderText = commandLabel, - Content = view, - }; - - ApplySettings(settingsFlyout, viewSettings); - settingsFlyout.IsOpen = true; - - var deactivator = viewModel as IDeactivate; - if (deactivator != null) { - EventHandler closed = null; - closed = (s, e) => { - settingsFlyout.Closed -= closed; - deactivator.Deactivate(true); - }; - - settingsFlyout.Closed += closed; - } - - var activator = viewModel as IActivate; - if (activator != null) { - activator.Activate(); - } - } - - static bool ApplySettings(object target, IEnumerable> settings) { - if (settings == null) - return false; - - var type = target.GetType(); - - foreach (var pair in settings) { - var propertyInfo = type.GetRuntimeProperty(pair.Key); - - if (propertyInfo != null) - propertyInfo.SetValue(target, pair.Value, null); - } - - return true; - } - } -} diff --git a/src/Caliburn.Micro.Platform/win8/FlyoutSettingsCommand.cs b/src/Caliburn.Micro.Platform/win8/FlyoutSettingsCommand.cs deleted file mode 100644 index d889e62c..00000000 --- a/src/Caliburn.Micro.Platform/win8/FlyoutSettingsCommand.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - - /// - /// Represents a flyout command registered with the . - /// - public class FlyoutSettingsCommand : SettingsCommandBase { - private readonly ISettingsWindowManager settingsWindowManager; - private readonly Type viewModelType; - private readonly IDictionary viewSettings; - - /// - /// Initializes a new instance of the class. - /// - /// - /// The label to use in the settings charm. - /// The view model to display. - /// Additional settings to pass to the . - public FlyoutSettingsCommand(ISettingsWindowManager settingsWindowManager, string label, Type viewModelType, - IDictionary viewSettings) - : base(label) { - this.settingsWindowManager = settingsWindowManager; - this.viewModelType = viewModelType; - this.viewSettings = viewSettings; - } - - /// - /// The view model to display. - /// - public Type ViewModelType { - get { return viewModelType; } - } - - /// - /// Additional settings to pass to the . - /// - public IDictionary ViewSettings { - get { return viewSettings; } - } - - /// - /// Called when the command was selected in the Settings Charm. - /// - public override void OnSelected() { - var viewModel = IoC.GetInstance(ViewModelType, null); - if (viewModel == null) - return; - - settingsWindowManager.ShowSettingsFlyout(viewModel, Label, ViewSettings); - } - } -} diff --git a/src/Caliburn.Micro.Platform/win8/ISettingsService.cs b/src/Caliburn.Micro.Platform/win8/ISettingsService.cs deleted file mode 100644 index faeafb35..00000000 --- a/src/Caliburn.Micro.Platform/win8/ISettingsService.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - - /// - /// Service that handles the Settings Charm. - /// - public interface ISettingsService { - /// - /// Displays the Settings Charm pane to the user. - /// - void ShowSettingsUI(); - - /// - /// Registers a flyout command with the service. - /// - /// The commands view model. - /// The command label. - /// The optional flyout view settings. - void RegisterFlyoutCommand(string label, IDictionary viewSettings = null); - - /// - /// Registers a URI command with the service. - /// - /// The label. - /// The URI. - void RegisterUriCommand(string label, Uri uri); - - /// - /// Registers a settings command with the service. - /// - /// The command to register. - void RegisterCommand(SettingsCommandBase command); - } -} diff --git a/src/Caliburn.Micro.Platform/win8/ISettingsWindowManager.cs b/src/Caliburn.Micro.Platform/win8/ISettingsWindowManager.cs deleted file mode 100644 index d012a2c6..00000000 --- a/src/Caliburn.Micro.Platform/win8/ISettingsWindowManager.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Caliburn.Micro { - using System.Collections.Generic; - - /// - /// The settings window manager. - /// - public interface ISettingsWindowManager { - -#if WinRT81 - /// - /// Shows a settings flyout panel for the specified model. - /// - /// The settings view model. - /// The settings command label. - /// The optional dialog settings. - /// Whether to show the settings flyout as an independent one. - void ShowSettingsFlyout(object viewModel, string commandLabel, IDictionary viewSettings = null, bool independent = false); - -#else - /// - /// Shows a settings flyout panel for the specified model. - /// - /// The settings view model. - /// The settings command label. - /// The optional dialog settings. - void ShowSettingsFlyout(object viewModel, string commandLabel, IDictionary viewSettings = null); -#endif - } -} diff --git a/src/Caliburn.Micro.Platform/win8/SettingsCommandBase.cs b/src/Caliburn.Micro.Platform/win8/SettingsCommandBase.cs deleted file mode 100644 index c67e261e..00000000 --- a/src/Caliburn.Micro.Platform/win8/SettingsCommandBase.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Caliburn.Micro { - /// - /// Represents a command registered with the - /// - public abstract class SettingsCommandBase { - private readonly string label; - - /// - /// Initializes a new instance of the class. - /// - /// The label. - protected SettingsCommandBase(string label) { - this.label = label; - } - - /// - /// Gets the label. - /// - public string Label { - get { - return label; - } - } - - /// - /// Called when the command was selected in the Settings Charm. - /// - public abstract void OnSelected(); - } -} diff --git a/src/Caliburn.Micro.Platform/win8/SettingsService.cs b/src/Caliburn.Micro.Platform/win8/SettingsService.cs deleted file mode 100644 index b1915425..00000000 --- a/src/Caliburn.Micro.Platform/win8/SettingsService.cs +++ /dev/null @@ -1,81 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Linq; - using Windows.UI.ApplicationSettings; - - /// - /// Serivce tha handles the settings charm - /// - public class SettingsService : ISettingsService { - private readonly ISettingsWindowManager settingsWindowManager; - private readonly SettingsPane settingsPane; - private readonly List commands; - - /// - /// Initializes a new instance of the class. - /// - /// The window manager used to open the settings views. - public SettingsService(ISettingsWindowManager settingsWindowManager) { - this.settingsWindowManager = settingsWindowManager; - - commands = new List(); - - settingsPane = SettingsPane.GetForCurrentView(); - settingsPane.CommandsRequested += OnCommandsRequested; - } - - /// - /// Displays the Settings Charm pane to the user. - /// - public void ShowSettingsUI() { - SettingsPane.Show(); - } - - /// - /// Registers a flyout command with the service. - /// - /// The commands view model. - /// The command label. - /// The optional flyout view settings. - public void RegisterFlyoutCommand(string label, IDictionary viewSettings = null) { - commands.Add(new FlyoutSettingsCommand(settingsWindowManager, label, typeof (TViewModel), viewSettings)); - } - - /// - /// Registers a URI command with the service. - /// - /// The label. - /// The URI. - public void RegisterUriCommand(string label, Uri uri) { - commands.Add(new UriSettingsCommand(label, uri)); - } - - /// - /// Registers a settings command with the service. - /// - /// The command to register. - public void RegisterCommand(SettingsCommandBase command) { - commands.Add(command); - } - - /// - /// Occurs when the user opens the settings pane. - /// - /// The sender. - /// The instance containing the event data. - protected virtual void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { - var settingsCommands = commands.Select(c => new SettingsCommand(Guid.NewGuid(), c.Label, h => OnCommandSelected(c))); - - settingsCommands.Apply(args.Request.ApplicationCommands.Add); - } - - /// - /// Called when a settings command was selected in the Settings Charm. - /// - /// The settings command. - protected virtual void OnCommandSelected(SettingsCommandBase command) { - command.OnSelected(); - } - } -} diff --git a/src/Caliburn.Micro.Platform/win8/SettingsWindowManager.cs b/src/Caliburn.Micro.Platform/win8/SettingsWindowManager.cs deleted file mode 100644 index 40722391..00000000 --- a/src/Caliburn.Micro.Platform/win8/SettingsWindowManager.cs +++ /dev/null @@ -1,96 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Reflection; - using Windows.UI.Xaml; - using Windows.UI.Xaml.Controls; - using Windows.UI.Xaml.Media; - using Windows.UI.Xaml.Media.Imaging; - - /// - /// An implementation of the using the default Windows 8.1 controls - /// - public class SettingsWindowManager : ISettingsWindowManager { - /// - /// Shows a settings flyout panel for the specified model. - /// - /// The settings view model. - /// The settings command label. - /// The optional dialog settings. - /// Show settings independent from . - public async void ShowSettingsFlyout(object viewModel, string commandLabel, - IDictionary viewSettings = null, bool independent = false) { - var view = ViewLocator.LocateForModel(viewModel, null, null); - ViewModelBinder.Bind(viewModel, view, null); - - viewSettings = viewSettings ?? new Dictionary(); - - var settingsFlyout = new SettingsFlyout - { - Title = commandLabel, - Content = view, - HorizontalContentAlignment = HorizontalAlignment.Stretch - }; - - // extract the header color/logo from the appmanifest.xml - var visualElements = await AppManifestHelper.GetManifestVisualElementsAsync(); - - // enable the overriding of these, but default to manifest - var headerBackground = viewSettings.ContainsKey("headerbackground") - ? (SolidColorBrush) viewSettings["headerbackground"] - : new SolidColorBrush(visualElements.BackgroundColor); - - var smallLogoUri = viewSettings.ContainsKey("smalllogouri") - ? (Uri) viewSettings["smalllogouri"] - : visualElements.SmallLogoUri; - - var smallLogo = new BitmapImage(smallLogoUri); - - // use real property names for ApplySettings - if (!viewSettings.ContainsKey("HeaderBackground")) - viewSettings["HeaderBackground"] = headerBackground; - - if (!viewSettings.ContainsKey("IconSource")) - viewSettings["IconSource"] = smallLogo; - - ApplySettings(settingsFlyout, viewSettings); - - var deactivator = viewModel as IDeactivate; - if (deactivator != null) { - RoutedEventHandler closed = null; - closed = (s, e) => { - settingsFlyout.Unloaded -= closed; - deactivator.Deactivate(true); - }; - - settingsFlyout.Unloaded += closed; - } - - var activator = viewModel as IActivate; - if (activator != null) { - activator.Activate(); - } - - if (independent) - settingsFlyout.ShowIndependent(); - else - settingsFlyout.Show(); - } - - private static bool ApplySettings(object target, IEnumerable> settings) { - if (settings == null) - return false; - - var type = target.GetType(); - - foreach (var pair in settings) { - var propertyInfo = type.GetRuntimeProperty(pair.Key); - - if (propertyInfo != null) - propertyInfo.SetValue(target, pair.Value, null); - } - - return true; - } - } -} diff --git a/src/Caliburn.Micro.Platform/win8/UriSettingsCommand.cs b/src/Caliburn.Micro.Platform/win8/UriSettingsCommand.cs deleted file mode 100644 index c90e1db9..00000000 --- a/src/Caliburn.Micro.Platform/win8/UriSettingsCommand.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace Caliburn.Micro { - using System; - using Windows.System; - - /// - /// Represents a URI command registered with the . - /// - public class UriSettingsCommand : SettingsCommandBase { - private readonly Uri uri; - - /// - /// Initializes a new instance of the class. - /// - /// The label. - /// The URI. - public UriSettingsCommand(string label, Uri uri) : base(label) { - this.uri = uri; - } - - /// - /// Gets the URI. - /// - public Uri Uri { - get { return uri; } - } - - /// - /// Called when the command was selected in the Settings Charm. - /// - public override async void OnSelected() { - await Launcher.LaunchUriAsync(Uri); - } - } -} diff --git a/src/Caliburn.Micro.Platform/wp71/AppSettingsStorageMechanism.cs b/src/Caliburn.Micro.Platform/wp71/AppSettingsStorageMechanism.cs deleted file mode 100644 index 006ade15..00000000 --- a/src/Caliburn.Micro.Platform/wp71/AppSettingsStorageMechanism.cs +++ /dev/null @@ -1,97 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.IO.IsolatedStorage; - - /// - /// Stores data in the application settings. - /// - public class AppSettingsStorageMechanism : IStorageMechanism { - readonly IPhoneContainer container; - List keys; - - /// - /// Initializes a new instance of the class. - /// - /// The container. - public AppSettingsStorageMechanism(IPhoneContainer container) { - this.container = container; - } - - /// - /// Indicates what storage modes this mechanism provides. - /// - /// The storage mode to check. - /// - /// Whether or not it is supported. - /// - public bool Supports(StorageMode mode) { - return (mode & StorageMode.Permanent) == StorageMode.Permanent; - } - - /// - /// Begins the storage transaction. - /// - public void BeginStoring() { - keys = new List(); - } - - /// - /// Stores the value with the specified key. - /// - /// The key. - /// The data. - public void Store(string key, object data) { - if (!IsolatedStorageSettings.ApplicationSettings.Contains(key)) { - keys.Add(key); - } - - IsolatedStorageSettings.ApplicationSettings[key] = data; - } - - /// - /// Ends the storage transaction. - /// - public void EndStoring() { - IsolatedStorageSettings.ApplicationSettings.Save(); - } - - /// - /// Tries to get the data previously stored with the specified key. - /// - /// The key. - /// The value. - /// true if found; false otherwise - public bool TryGet(string key, out object value) { - return IsolatedStorageSettings.ApplicationSettings.TryGetValue(key, out value); - } - - /// - /// Deletes the data with the specified key. - /// - /// The key. - public void Delete(string key) { - IsolatedStorageSettings.ApplicationSettings.Remove(key); - } - - /// - /// Clears the data stored in the last storage transaction. - /// - public void ClearLastSession() { - if (keys != null) { - keys.Apply(x => IsolatedStorageSettings.ApplicationSettings.Remove(x)); - keys = null; - } - } - - /// - /// Registers service with the storage mechanism as a singleton. - /// - /// The service. - /// The key. - /// The implementation. - public void RegisterSingleton(Type service, string key, Type implementation) { - container.RegisterWithAppSettings(service, key, implementation); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/CustomAppBar.cs b/src/Caliburn.Micro.Platform/wp71/CustomAppBar.cs deleted file mode 100644 index aa1a4b72..00000000 --- a/src/Caliburn.Micro.Platform/wp71/CustomAppBar.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Windows.Interactivity; - using Microsoft.Phone.Controls; - using Microsoft.Phone.Shell; - - /// - /// The interface for AppBar items capable of triggering action messages. - /// - public interface IAppBarActionMessage : IApplicationBarMenuItem { - /// - /// The action message. - /// - string Message { get; set; } - } - - /// - /// An capable of triggering action messages. - /// - public class AppBarButton : ApplicationBarIconButton, IAppBarActionMessage { - /// - /// The action message. - /// - public string Message { get; set; } - } - - /// - /// An capable of triggering action messages. - /// - public class AppBarMenuItem : ApplicationBarMenuItem, IAppBarActionMessage { - /// - /// The action message. - /// - public string Message { get; set; } - } - - class AppBarItemTrigger : TriggerBase { - public AppBarItemTrigger(IApplicationBarMenuItem button) { - button.Click += ButtonClicked; - } - - void ButtonClicked(object sender, EventArgs e) { - InvokeActions(e); - } - } -} diff --git a/src/Caliburn.Micro.Platform/wp71/INavigationService.cs b/src/Caliburn.Micro.Platform/wp71/INavigationService.cs deleted file mode 100644 index f28719cb..00000000 --- a/src/Caliburn.Micro.Platform/wp71/INavigationService.cs +++ /dev/null @@ -1,340 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Navigation; - using Microsoft.Phone.Controls; - - /// - /// Implemented by services that provide based navigation. - /// - public interface INavigationService : INavigate { - /// - /// The source. - /// - Uri Source { get; set; } - - /// - /// Indicates whether the navigator can navigate back. - /// - bool CanGoBack { get; } - - /// - /// Indicates whether the navigator can navigate forward. - /// - bool CanGoForward { get; } - - /// - /// The current source. - /// - Uri CurrentSource { get; } - - /// - /// The current content. - /// - object CurrentContent { get; } - - /// - /// Stops the loading process. - /// - void StopLoading(); - - /// - /// Navigates back. - /// - void GoBack(); - - /// - /// Navigates forward. - /// - void GoForward(); - - /// - /// Removes the most recent entry from the back stack. - /// - /// The entry that was removed. - JournalEntry RemoveBackEntry(); - - /// - /// Gets an IEnumerable that you use to enumerate the entries in back navigation history. - /// - /// List of entries in the back stack. - IEnumerable BackStack { get; } - - /// - /// Raised after navigation. - /// - event NavigatedEventHandler Navigated; - - /// - /// Raised prior to navigation. - /// - event NavigatingCancelEventHandler Navigating; - - /// - /// Raised when navigation fails. - /// - event NavigationFailedEventHandler NavigationFailed; - - /// - /// Raised when navigation is stopped. - /// - event NavigationStoppedEventHandler NavigationStopped; - - /// - /// Raised when a fragment navigation occurs. - /// - event FragmentNavigationEventHandler FragmentNavigation; - } - - /// - /// A basic implementation of designed to adapt the control. - /// - public class FrameAdapter : INavigationService { - readonly Frame frame; - readonly bool treatViewAsLoaded; - event NavigatingCancelEventHandler ExternalNavigatingHandler = delegate { }; - - /// - /// Creates an instance of - /// - /// The frame to represent as a . - /// Tells the frame adapter to assume that the view has already been loaded by the time OnNavigated is called. This is necessary when using the TransitionFrame. - public FrameAdapter(Frame frame, bool treatViewAsLoaded = false) { - this.frame = frame; - this.treatViewAsLoaded = treatViewAsLoaded; - this.frame.Navigating += OnNavigating; - this.frame.Navigated += OnNavigated; - } - - /// - /// Occurs before navigation - /// - /// The event sender. - /// The event args. - protected virtual void OnNavigating(object sender, NavigatingCancelEventArgs e) { - ExternalNavigatingHandler(sender, e); - if(e.Cancel) { - return; - } - - var fe = frame.Content as FrameworkElement; - if(fe == null) { - return; - } - - var guard = fe.DataContext as IGuardClose; - if(guard != null && !e.Uri.IsAbsoluteUri) { - var shouldCancel = false; - var runningAsync = true; - guard.CanClose(result => { runningAsync = false; shouldCancel = !result; }); - if (runningAsync) - throw new NotSupportedException("Async CanClose is not supported."); - - if(shouldCancel) { - e.Cancel = true; - return; - } - } - - var deactivator = fe.DataContext as IDeactivate; - - // If we are navigating to the same page there is no need to deactivate - // e.g. When the app is activated with Fast Switch - if(deactivator != null && frame.CurrentSource != e.Uri) { - deactivator.Deactivate(CanCloseOnNavigating(sender, e)); - } - } - - /// - /// Called to check whether or not to close current instance on navigating. - /// - /// The event sender from OnNavigating event. - /// The event args from OnNavigating event. - protected virtual bool CanCloseOnNavigating(object sender, NavigatingCancelEventArgs e) { - return false; - } - - /// - /// Occurs after navigation - /// - /// The event sender. - /// The event args. - protected virtual void OnNavigated(object sender, NavigationEventArgs e) { - if (e.Uri.IsAbsoluteUri || e.Content == null) { - return; - } - - ViewLocator.InitializeComponent(e.Content); - - var viewModel = ViewModelLocator.LocateForView(e.Content); - if (viewModel == null) { - return; - } - - var page = e.Content as PhoneApplicationPage; - if (page == null) { - throw new ArgumentException("View '" + e.Content.GetType().FullName + "' should inherit from PhoneApplicationPage or one of its descendents."); - } - - if (treatViewAsLoaded) { - page.SetValue(View.IsLoadedProperty, true); - } - - TryInjectQueryString(viewModel, page); - ViewModelBinder.Bind(viewModel, page, null); - - var activator = viewModel as IActivate; - if (activator != null) { - activator.Activate(); - } - - GC.Collect(); - } - - /// - /// Attempts to inject query string parameters from the view into the view model. - /// - /// The view model. - /// The page. - protected virtual void TryInjectQueryString(object viewModel, Page page) { - var viewModelType = viewModel.GetType(); - - foreach(var pair in page.NavigationContext.QueryString) { - var property = viewModelType.GetPropertyCaseInsensitive(pair.Key); - if(property == null) { - continue; - } - - property.SetValue( - viewModel, - MessageBinder.CoerceValue(property.PropertyType, pair.Value, page.NavigationContext), - null - ); - } - } - - /// - /// The source. - /// - public Uri Source { - get { return frame.Source; } - set { frame.Source = value; } - } - - /// - /// Indicates whether the navigator can navigate back. - /// - public bool CanGoBack { - get { return frame.CanGoBack; } - } - - /// - /// Indicates whether the navigator can navigate forward. - /// - public bool CanGoForward { - get { return frame.CanGoForward; } - } - - /// - /// The current source. - /// - public Uri CurrentSource { - get { return frame.CurrentSource; } - } - - /// - /// The current content. - /// - public object CurrentContent { - get { return frame.Content; } - } - - /// - /// Stops the loading process. - /// - public void StopLoading() { - frame.StopLoading(); - } - - /// - /// Navigates back. - /// - public void GoBack() { - frame.GoBack(); - } - - /// - /// Navigates forward. - /// - public void GoForward() { - frame.GoForward(); - } - - /// - /// Navigates to the specified . - /// - /// The to navigate to. - /// Whether or not navigation succeeded. - public bool Navigate(Uri source) { - return frame.Navigate(source); - } - - /// - /// Removes the most recent entry from the back stack. - /// - /// The entry that was removed. - public JournalEntry RemoveBackEntry() { - return ((Page)frame.Content).NavigationService.RemoveBackEntry(); - } - - /// - /// Gets an IEnumerable that you use to enumerate the entries in back navigation history. - /// - /// List of entries in the back stack. - public IEnumerable BackStack { - get { return ((Page)frame.Content).NavigationService.BackStack; } - } - - /// - /// Raised after navigation. - /// - public event NavigatedEventHandler Navigated { - add { frame.Navigated += value; } - remove { frame.Navigated -= value; } - } - - /// - /// Raised prior to navigation. - /// - public event NavigatingCancelEventHandler Navigating { - add { ExternalNavigatingHandler += value; } - remove { ExternalNavigatingHandler -= value; } - } - - /// - /// Raised when navigation fails. - /// - public event NavigationFailedEventHandler NavigationFailed { - add { frame.NavigationFailed += value; } - remove { frame.NavigationFailed -= value; } - } - - /// - /// Raised when navigation is stopped. - /// - public event NavigationStoppedEventHandler NavigationStopped { - add { frame.NavigationStopped += value; } - remove { frame.NavigationStopped -= value; } - } - - /// - /// Raised when a fragment navigation occurs. - /// - public event FragmentNavigationEventHandler FragmentNavigation { - add { frame.FragmentNavigation += value; } - remove { frame.FragmentNavigation -= value; } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/IPhoneContainer.cs b/src/Caliburn.Micro.Platform/wp71/IPhoneContainer.cs deleted file mode 100644 index f459440b..00000000 --- a/src/Caliburn.Micro.Platform/wp71/IPhoneContainer.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Caliburn.Micro { - using System; - - /// - /// Defines an interface through which the storage system can communicate with an IoC container. - /// - public interface IPhoneContainer { - /// - /// Occurs when a new instance is created. - /// - event Action Activated; - - /// - /// Registers the service as a singleton stored in the phone state. - /// - /// The service. - /// The phone state key. - /// The implementation. - void RegisterWithPhoneService(Type service, string phoneStateKey, Type implementation); - - /// - /// Registers the service as a singleton stored in the app settings. - /// - /// The service. - /// The app settings key. - /// The implementation. - void RegisterWithAppSettings(Type service, string appSettingsKey, Type implementation); - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/IPhoneService.cs b/src/Caliburn.Micro.Platform/wp71/IPhoneService.cs deleted file mode 100644 index 919d4518..00000000 --- a/src/Caliburn.Micro.Platform/wp71/IPhoneService.cs +++ /dev/null @@ -1,200 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Windows.Controls; - using System.Windows.Navigation; - using Microsoft.Phone.Shell; - - /// - /// Implemented by services that provide access to the basic phone capabilities. - /// - public interface IPhoneService { - /// - /// The state that is persisted during the tombstoning process. - /// - IDictionary State { get; } - - /// - /// Gets the mode in which the application was started. - /// - StartupMode StartupMode { get; } - - /// - /// Occurs when a fresh instance of the application is launching. - /// - event EventHandler Launching; - - /// - /// Occurs when a previously paused/tombstoned app is resumed/resurrected. - /// - event EventHandler Activated; - - /// - /// Occurs when the application is being paused or tombstoned. - /// - event EventHandler Deactivated; - - /// - /// Occurs when the application is closing. - /// - event EventHandler Closing; - - /// - /// Occurs when the app is continuing from a temporarily paused state. - /// - event System.Action Continuing; - - /// - /// Occurs after the app has continued from a temporarily paused state. - /// - event System.Action Continued; - - /// - /// Occurs when the app is "resurrecting" from a tombstoned state. - /// - event System.Action Resurrecting; - - /// - /// Occurs after the app has "resurrected" from a tombstoned state. - /// - event System.Action Resurrected; - - /// - /// Gets or sets whether user idle detection is enabled. - /// - IdleDetectionMode UserIdleDetectionMode { get; set; } - - /// - /// Gets or sets whether application idle detection is enabled. - /// - IdleDetectionMode ApplicationIdleDetectionMode { get; set; } - - /// - /// Gets if the app is currently resurrecting. - /// - bool IsResurrecting { get; } - } - - /// - /// An implementation of that adapts . - /// - public class PhoneApplicationServiceAdapter : IPhoneService { - readonly PhoneApplicationService service; - - /// - /// Creates an instance of . - /// - public PhoneApplicationServiceAdapter(PhoneApplicationService phoneApplicationServiceservice, Frame rootFrame) { - service = phoneApplicationServiceservice; - service.Activated += (sender, args) => { - if(!args.IsApplicationInstancePreserved) { - IsResurrecting = true; - Resurrecting(); - NavigatedEventHandler onNavigated = null; - onNavigated = (s2, e2) => { - IsResurrecting = false; - Resurrected(); - rootFrame.Navigated -= onNavigated; - }; - rootFrame.Navigated += onNavigated; - } - else { - Continuing(); - NavigatedEventHandler onNavigated = null; - onNavigated = (s2, e2) => { - Continued(); - rootFrame.Navigated -= onNavigated; - }; - rootFrame.Navigated += onNavigated; - } - }; - } - - /// - /// Gets if the app is currently resurrecting. - /// - public bool IsResurrecting { get; private set; } - - /// - /// The state that is persisted during the tombstoning process. - /// - public IDictionary State { - get { return service.State; } - } - - /// - /// Gets the mode in which the application was started. - /// - public StartupMode StartupMode { - get { return service.StartupMode; } - } - - /// - /// Occurs when a fresh instance of the application is launching. - /// - public event EventHandler Launching { - add { service.Launching += value; } - remove { service.Launching -= value; } - } - - /// - /// Occurs when a previously paused/tombstoned application instance is resumed/resurrected. - /// - public event EventHandler Activated { - add { service.Activated += value; } - remove { service.Activated -= value; } - } - - /// - /// Occurs when the application is being paused or tombstoned. - /// - public event EventHandler Deactivated { - add { service.Deactivated += value; } - remove { service.Deactivated -= value; } - } - - /// - /// Occurs when the application is closing. - /// - public event EventHandler Closing { - add { service.Closing += value; } - remove { service.Closing -= value; } - } - - /// - /// Occurs when the app is continuing from a temporarily paused state. - /// - public event System.Action Continuing = delegate { }; - - /// - /// Occurs after the app has continued from a temporarily paused state. - /// - public event System.Action Continued = delegate { }; - - /// - /// Occurs when the app is "resurrecting" from a tombstoned state. - /// - public event System.Action Resurrecting = delegate { }; - - /// - /// Occurs after the app has "resurrected" from a tombstoned state. - /// - public event System.Action Resurrected = delegate { }; - - /// - /// Gets or sets whether user idle detection is enabled. - /// - public IdleDetectionMode UserIdleDetectionMode { - get { return service.UserIdleDetectionMode; } - set { service.UserIdleDetectionMode = value; } - } - - /// - /// Gets or sets whether application idle detection is enabled. - /// - public IdleDetectionMode ApplicationIdleDetectionMode { - get { return service.ApplicationIdleDetectionMode; } - set { service.ApplicationIdleDetectionMode = value; } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/IStorageHandler.cs b/src/Caliburn.Micro.Platform/wp71/IStorageHandler.cs deleted file mode 100644 index 80016a4f..00000000 --- a/src/Caliburn.Micro.Platform/wp71/IStorageHandler.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Caliburn.Micro { - /// - /// Handles the storage of an object instance. - /// - public interface IStorageHandler { - /// - /// Gets or sets the coordinator. - /// - /// - /// The coordinator. - /// - StorageCoordinator Coordinator { get; set; } - - /// - /// Overrided by inheritors to configure the handler for use. - /// - void Configure(); - - /// - /// Indicates whether the specified instance can be stored by this handler. - /// - /// The instance. - /// - bool Handles(object instance); - - /// - /// Saves the specified instance. - /// - /// The instance. - /// The mode. - void Save(object instance, StorageMode mode); - - /// - /// Restores the specified instance. - /// - /// The instance. - /// The mode. - void Restore(object instance, StorageMode mode); - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/IStorageMechanism.cs b/src/Caliburn.Micro.Platform/wp71/IStorageMechanism.cs deleted file mode 100644 index f6c325a2..00000000 --- a/src/Caliburn.Micro.Platform/wp71/IStorageMechanism.cs +++ /dev/null @@ -1,59 +0,0 @@ -namespace Caliburn.Micro { - using System; - - /// - /// Implemented by classes that know how to store data. - /// - public interface IStorageMechanism { - /// - /// Indicates what storage modes this mechanism provides. - /// - /// The storage mode to check. - /// Whether or not it is supported. - bool Supports(StorageMode mode); - - /// - /// Begins the storage transaction. - /// - void BeginStoring(); - - /// - /// Stores the value with the specified key. - /// - /// The key. - /// The data. - void Store(string key, object data); - - /// - /// Ends the storage transaction. - /// - void EndStoring(); - - /// - /// Tries to get the data previously stored with the specified key. - /// - /// The key. - /// The value. - /// true if found; false otherwise - bool TryGet(string key, out object value); - - /// - /// Deletes the data with the specified key. - /// - /// The key. - void Delete(string key); - - /// - /// Clears the data stored in the last storage transaction. - /// - void ClearLastSession(); - - /// - /// Registers service with the storage mechanism as a singleton. - /// - /// The service. - /// The key. - /// The implementation. - void RegisterSingleton(Type service, string key, Type implementation); - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/NavigationExtensions.cs b/src/Caliburn.Micro.Platform/wp71/NavigationExtensions.cs deleted file mode 100644 index 02427223..00000000 --- a/src/Caliburn.Micro.Platform/wp71/NavigationExtensions.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace Caliburn.Micro { - /// - /// Extension methods related to navigation. - /// - public static class NavigationExtensions { - /// - /// Creates a Uri builder based on a view model type. - /// - /// The type of the view model. - /// The navigation service. - /// The builder. - [Obsolete("Use For instead of UriFor")] - public static NavigationHelper UriFor(this INavigationService navigationService) { - return navigationService.For(); - } - - /// - /// Creates a Uri builder based on a view model type. - /// - /// The type of the view model. - /// The navigation service. - /// The builder. - public static NavigationHelper For(this INavigationService navigationService) { - return new NavigationHelper().AttachTo(navigationService); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/NavigationHelper.cs b/src/Caliburn.Micro.Platform/wp71/NavigationHelper.cs deleted file mode 100644 index 8483e8a3..00000000 --- a/src/Caliburn.Micro.Platform/wp71/NavigationHelper.cs +++ /dev/null @@ -1,80 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Linq.Expressions; - - /// - /// Builds a Uri in a strongly typed fashion, based on a ViewModel. - /// - /// - public class NavigationHelper { - readonly Dictionary queryString = new Dictionary(); - INavigationService navigationService; - - /// - /// Adds a query string parameter to the Uri. - /// - /// The type of the value. - /// The property. - /// The property value. - /// Itself - public NavigationHelper WithParam(Expression> property, TValue value) { - if (value is ValueType || !ReferenceEquals(null, value)) { - queryString[property.GetMemberInfo().Name] = value.ToString(); - } - - return this; - } - - /// - /// Attaches a navigation servies to this builder. - /// - /// The navigation service. - /// Itself - public NavigationHelper AttachTo(INavigationService navigationService) { - this.navigationService = navigationService; - return this; - } - - /// - /// Navigates to the Uri represented by this builder. - /// - public void Navigate() { - var uri = BuildUri(); - - if (navigationService == null) { - throw new InvalidOperationException("Cannot navigate without attaching an INavigationService. Call AttachTo first."); - } - - navigationService.Navigate(uri); - } - - /// - /// Builds the URI. - /// - /// A uri constructed with the current configuration information. - public Uri BuildUri() { - var viewType = ViewLocator.LocateTypeForModelType(typeof(TViewModel), null, null); - if(viewType == null) { - throw new InvalidOperationException(string.Format("No view was found for {0}. See the log for searched views.", typeof(TViewModel).FullName)); - } - - var packUri = ViewLocator.DeterminePackUriFromType(typeof(TViewModel), viewType); - var qs = BuildQueryString(); - - return new Uri(packUri + qs, UriKind.Relative); - } - - string BuildQueryString() { - if (queryString.Count < 1) { - return string.Empty; - } - - var result = queryString - .Aggregate("?", (current, pair) => current + (pair.Key + "=" + Uri.EscapeDataString(pair.Value) + "&")); - - return result.Remove(result.Length - 1); - } - } -} diff --git a/src/Caliburn.Micro.Platform/wp71/PhoneBootstrapper.cs b/src/Caliburn.Micro.Platform/wp71/PhoneBootstrapper.cs deleted file mode 100644 index 73d39a91..00000000 --- a/src/Caliburn.Micro.Platform/wp71/PhoneBootstrapper.cs +++ /dev/null @@ -1,85 +0,0 @@ -namespace Caliburn.Micro { - using System.Windows.Navigation; - using Microsoft.Phone.Controls; - using Microsoft.Phone.Shell; - - /// - /// A custom bootstrapper designed to setup phone applications. - /// - public abstract class PhoneBootstrapperBase : BootstrapperBase { - bool phoneApplicationInitialized; - - /// - /// The phone application service. - /// - protected PhoneApplicationService PhoneService { get; private set; } - - /// - /// The root frame used for navigation. - /// - protected PhoneApplicationFrame RootFrame { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - protected PhoneBootstrapperBase() : base(true) { } - - /// - /// Provides an opportunity to hook into the application object. - /// - protected override void PrepareApplication() { - base.PrepareApplication(); - - PhoneService = new PhoneApplicationService(); - PhoneService.Activated += OnActivate; - PhoneService.Deactivated += OnDeactivate; - PhoneService.Launching += OnLaunch; - PhoneService.Closing += OnClose; - - Application.ApplicationLifetimeObjects.Add(PhoneService); - - if (phoneApplicationInitialized) { - return; - } - - RootFrame = CreatePhoneApplicationFrame(); - RootFrame.Navigated += OnNavigated; - - phoneApplicationInitialized = true; - } - - void OnNavigated(object sender, NavigationEventArgs e) { - if (Application.RootVisual != RootFrame) { - Application.RootVisual = RootFrame; - } - } - - /// - /// Creates the root frame used by the application. - /// - /// The frame. - protected virtual PhoneApplicationFrame CreatePhoneApplicationFrame() { - return new PhoneApplicationFrame(); - } - - /// - /// Occurs when a fresh instance of the application is launching. - /// - protected virtual void OnLaunch(object sender, LaunchingEventArgs e) { } - - /// - /// Occurs when a previously tombstoned or paused application is resurrected/resumed. - /// - protected virtual void OnActivate(object sender, ActivatedEventArgs e) { } - - /// - /// Occurs when the application is being tombstoned or paused. - /// - protected virtual void OnDeactivate(object sender, DeactivatedEventArgs e) { } - - /// - /// Occurs when the application is closing. - /// - protected virtual void OnClose(object sender, ClosingEventArgs e) { } - } -} diff --git a/src/Caliburn.Micro.Platform/wp71/PhoneContainer.cs b/src/Caliburn.Micro.Platform/wp71/PhoneContainer.cs deleted file mode 100644 index 56404b68..00000000 --- a/src/Caliburn.Micro.Platform/wp71/PhoneContainer.cs +++ /dev/null @@ -1,131 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.IO.IsolatedStorage; - using System.Linq; - using System.Windows.Controls; - using Microsoft.Phone.Shell; - - /// - /// A custom IoC container which integrates with the phone and properly registers all Caliburn.Micro services. - /// - public class PhoneContainer : SimpleContainer, IPhoneContainer { - /// - /// Registers the service as a singleton stored in the phone state. - /// - /// The service. - /// The phone state key. - /// The implementation. - public void RegisterWithPhoneService(Type service, string phoneStateKey, Type implementation) { - var pservice = (IPhoneService)GetInstance(typeof(IPhoneService), null); - if (pservice == null) - throw new InvalidOperationException("IPhoneService instance cannot be found."); - - if(!pservice.State.ContainsKey(phoneStateKey ?? service.FullName)) { - pservice.State[phoneStateKey ?? service.FullName] = BuildInstance(implementation); - } - - RegisterHandler(service, phoneStateKey, container => { - var phoneService = (IPhoneService)container.GetInstance(typeof(IPhoneService), null); - - if(phoneService.State.ContainsKey(phoneStateKey ?? service.FullName)) { - return phoneService.State[phoneStateKey ?? service.FullName]; - } - - return BuildInstance(implementation); - }); - } - - /// - /// Registers the service as a singleton stored in the app settings. - /// - /// The service. - /// The app settings key. - /// The implementation. - public void RegisterWithAppSettings(Type service, string appSettingsKey, Type implementation) { - if(!IsolatedStorageSettings.ApplicationSettings.Contains(appSettingsKey ?? service.FullName)) { - IsolatedStorageSettings.ApplicationSettings[appSettingsKey ?? service.FullName] = BuildInstance(implementation); - } - - RegisterHandler(service, appSettingsKey, container => { - if(IsolatedStorageSettings.ApplicationSettings.Contains(appSettingsKey ?? service.FullName)) { - return IsolatedStorageSettings.ApplicationSettings[appSettingsKey ?? service.FullName]; - } - - return BuildInstance(implementation); - }); - } - - /// - /// Registers the Caliburn.Micro services with the container. - /// - /// The root frame of the application. - /// if set to true [treat view as loaded]. - public virtual void RegisterPhoneServices(Frame rootFrame, bool treatViewAsLoaded = false) { - RegisterInstance(typeof(SimpleContainer), null, this); - RegisterInstance(typeof(PhoneContainer), null, this); - RegisterInstance(typeof(IPhoneContainer), null, this); - - if (!HasHandler(typeof(INavigationService), null)) { - if (rootFrame == null) - throw new ArgumentNullException("rootFrame"); - - RegisterInstance(typeof(INavigationService), null, new FrameAdapter(rootFrame, treatViewAsLoaded)); - } - - if (!HasHandler(typeof(IPhoneService), null)) { - if (rootFrame == null) - throw new ArgumentNullException("rootFrame"); - var service = PhoneApplicationService.Current; - if (service == null) - throw new InvalidOperationException("PhoneApplicationService is not yet initialized."); - - RegisterInstance(typeof(IPhoneService), null, new PhoneApplicationServiceAdapter(service, rootFrame)); - } - - if (!HasHandler(typeof(IEventAggregator), null)) { - RegisterSingleton(typeof(IEventAggregator), null, typeof(EventAggregator)); - } - - if (!HasHandler(typeof(IWindowManager), null)) { - RegisterSingleton(typeof(IWindowManager), null, typeof(WindowManager)); - } - - if (!HasHandler(typeof(IVibrateController), null)) { - RegisterSingleton(typeof(IVibrateController), null, typeof(SystemVibrateController)); - } - - if (!HasHandler(typeof(ISoundEffectPlayer), null)) { - RegisterSingleton(typeof(ISoundEffectPlayer), null, typeof(XnaSoundEffectPlayer)); - } - - EnableStorageCoordinator(); - EnableTaskController(); - } - - /// - /// Enable the . - /// - protected void EnableStorageCoordinator() { - var toSearch = AssemblySource.Instance.ToArray() - .Union(new[] { typeof(IStorageMechanism).Assembly }); - - foreach(var assembly in toSearch) { - this.AllTypesOf(assembly); - this.AllTypesOf(assembly); - } - - RegisterSingleton(typeof(StorageCoordinator), null, typeof(StorageCoordinator)); - var coordinator = (StorageCoordinator)GetInstance(typeof(StorageCoordinator), null); - coordinator.Start(); - } - - /// - /// Enable the . - /// - protected void EnableTaskController() { - RegisterSingleton(typeof(TaskController), null, typeof(TaskController)); - var taskController = (TaskController)GetInstance(typeof(TaskController), null); - taskController.Start(); - } - } -} diff --git a/src/Caliburn.Micro.Platform/wp71/PhoneStateStorageMechanism.cs b/src/Caliburn.Micro.Platform/wp71/PhoneStateStorageMechanism.cs deleted file mode 100644 index 456dc3ac..00000000 --- a/src/Caliburn.Micro.Platform/wp71/PhoneStateStorageMechanism.cs +++ /dev/null @@ -1,99 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - - /// - /// Stores data in the phone state. - /// - public class PhoneStateStorageMechanism : IStorageMechanism { - readonly IPhoneContainer container; - readonly IPhoneService phoneService; - List keys; - - /// - /// Initializes a new instance of the class. - /// - /// The container. - /// The phone service. - public PhoneStateStorageMechanism(IPhoneContainer container, IPhoneService phoneService) { - this.container = container; - this.phoneService = phoneService; - } - - /// - /// Indicates what storage modes this mechanism provides. - /// - /// The storage mode to check. - /// - /// Whether or not it is supported. - /// - public bool Supports(StorageMode mode) { - return (mode & StorageMode.Temporary) == StorageMode.Temporary; - } - - /// - /// Begins the storage transaction. - /// - public void BeginStoring() { - keys = new List(); - } - - /// - /// Stores the value with the specified key. - /// - /// The key. - /// The data. - public void Store(string key, object data) { - if (!phoneService.State.ContainsKey(key)) { - keys.Add(key); - } - - phoneService.State[key] = data; - } - - /// - /// Ends the storage transaction. - /// - public void EndStoring() { } - - /// - /// Tries to get the data previously stored with the specified key. - /// - /// The key. - /// The value. - /// - /// true if found; false otherwise - /// - public bool TryGet(string key, out object value) { - return phoneService.State.TryGetValue(key, out value); - } - - /// - /// Deletes the data with the specified key. - /// - /// The key. - public void Delete(string key) { - phoneService.State.Remove(key); - } - - /// - /// Clears the data stored in the last storage transaction. - /// - public void ClearLastSession() { - if(keys != null) { - keys.Apply(x => phoneService.State.Remove(x)); - keys = null; - } - } - - /// - /// Registers service with the storage mechanism as a singleton. - /// - /// The service. - /// The key. - /// The implementation. - public void RegisterSingleton(Type service, string key, Type implementation) { - container.RegisterWithPhoneService(service, key, implementation); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/SoundEffectPlayer.cs b/src/Caliburn.Micro.Platform/wp71/SoundEffectPlayer.cs deleted file mode 100644 index 0064badc..00000000 --- a/src/Caliburn.Micro.Platform/wp71/SoundEffectPlayer.cs +++ /dev/null @@ -1,52 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Windows; - using System.Windows.Threading; - using Microsoft.Xna.Framework; - using Microsoft.Xna.Framework.Audio; - - /// - /// Service allowing to play a .wav sound effect - /// - public interface ISoundEffectPlayer { - /// - /// Plays a sound effect - /// - /// The uri of the resource containing the .wav file - void Play(Uri wavResource); - } - - /// - /// Default implementation, using Xna Framework. The sound effect is played without interrupting the music playback on the phone (which is required for the app certification in the WP7 Marketplace. Also note that using the Xna Framework in a WP7 Silverlight app is explicitly allowed for this very purpose. - /// - public class XnaSoundEffectPlayer : ISoundEffectPlayer { - static readonly XNAFrameworkDispatcherUpdater updater = new XNAFrameworkDispatcherUpdater(); - - /// - /// Plays a sound effect - /// - /// The uri of the resource containing the .wav file - public void Play(Uri wavResource) { - var type = updater.GetType(); // dummy call so updater is created - var res = Application.GetResourceStream(wavResource); - using(var stream = res.Stream) { - var effect = SoundEffect.FromStream(stream); - effect.Play(); - } - } - - class XNAFrameworkDispatcherUpdater { - readonly DispatcherTimer timer; - - public XNAFrameworkDispatcherUpdater() { - timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; - timer.Tick += OnTick; - FrameworkDispatcher.Update(); - } - - void OnTick(object sender, EventArgs e) { - FrameworkDispatcher.Update(); - } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/StorageCoordinator.cs b/src/Caliburn.Micro.Platform/wp71/StorageCoordinator.cs deleted file mode 100644 index ec3e2989..00000000 --- a/src/Caliburn.Micro.Platform/wp71/StorageCoordinator.cs +++ /dev/null @@ -1,138 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Linq; - using Microsoft.Phone.Shell; - - /// - /// Coordinates the saving and loading of objects based on application lifecycle events. - /// - public class StorageCoordinator { - readonly List handlers = new List(); - readonly IPhoneContainer container; - readonly IPhoneService phoneService; - readonly List storageMechanisms; - readonly List tracked = new List(); - StorageMode currentRestoreMode = StorageMode.Permanent; - - /// - /// Initializes a new instance of the class. - /// - /// The container. - /// The phone service. - /// The storage mechanisms. - /// The handlers. - public StorageCoordinator(IPhoneContainer container, IPhoneService phoneService, IEnumerable storageMechanisms, IEnumerable handlers) { - this.container = container; - this.phoneService = phoneService; - this.storageMechanisms = storageMechanisms.ToList(); - - handlers.Apply(x => AddStorageHandler(x)); - - phoneService.Resurrecting += () => currentRestoreMode = StorageMode.Any; - phoneService.Continuing += () => storageMechanisms.Apply(x => x.ClearLastSession()); - } - - /// - /// Starts monitoring application and container events. - /// - public void Start() { - phoneService.Closing += OnClosing; - phoneService.Deactivated += OnDeactivated; - container.Activated += OnContainerActivated; - } - - /// - /// Stops monitoring application and container events. - /// - public void Stop() { - phoneService.Closing -= OnClosing; - phoneService.Deactivated -= OnDeactivated; - container.Activated -= OnContainerActivated; - } - - /// - /// Gets the storage mechanism. - /// - /// The type of storage mechanism to get. - /// The storage mechanism. - public T GetStorageMechanism() where T : IStorageMechanism { - return storageMechanisms.OfType().FirstOrDefault(); - } - - /// - /// Adds the storage mechanism. - /// - /// The storage mechanism. - public void AddStorageMechanism(IStorageMechanism storageMechanism) { - storageMechanisms.Add(storageMechanism); - } - - /// - /// Adds the storage handler. - /// - /// The handler. - /// Itself - public StorageCoordinator AddStorageHandler(IStorageHandler handler) { - handler.Coordinator = this; - handler.Configure(); - handlers.Add(handler); - return this; - } - - /// - /// Gets the storage handler for a paricular instance. - /// - /// The instance. - /// The storage handler. - public IStorageHandler GetStorageHandlerFor(object instance) { - return handlers.FirstOrDefault(x => x.Handles(instance)); - } - - /// - /// Saves all monitored instances according to the provided mode. - /// - /// The save mode. - public void Save(StorageMode saveMode) { - var toSave = tracked.Select(x => x.Target).Where(x => x != null); - var mechanisms = storageMechanisms.Where(x => x.Supports(saveMode)); - - mechanisms.Apply(x => x.BeginStoring()); - - foreach(var item in toSave) { - var handler = GetStorageHandlerFor(item); - handler.Save(item, saveMode); - } - - mechanisms.Apply(x => x.EndStoring()); - } - - /// - /// Restores the specified instance. - /// - /// The instance. - /// The restore mode. - public void Restore(object instance, StorageMode restoreMode = StorageMode.Automatic) { - var handler = GetStorageHandlerFor(instance); - if (handler == null) { - return; - } - - tracked.Add(new WeakReference(instance)); - - handler.Restore(instance, restoreMode == StorageMode.Automatic ? currentRestoreMode : restoreMode); - } - - void OnDeactivated(object sender, DeactivatedEventArgs e) { - Save(StorageMode.Any); - } - - void OnClosing(object sender, ClosingEventArgs e) { - Save(StorageMode.Permanent); - } - - void OnContainerActivated(object instance) { - Restore(instance); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/StorageHandler.cs b/src/Caliburn.Micro.Platform/wp71/StorageHandler.cs deleted file mode 100644 index 097dbe81..00000000 --- a/src/Caliburn.Micro.Platform/wp71/StorageHandler.cs +++ /dev/null @@ -1,162 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Linq.Expressions; - using System.Reflection; - - /// - /// Handles the storage of a pariticular class. - /// - /// The type that this class handles. - public abstract class StorageHandler : IStorageHandler { - readonly List> instructions = new List>(); - Func getId = instance => null; - - /// - /// Provides a mechanism for obtaining an instance's unique id. - /// - /// The getter. - public void Id(Func getter) { - getId = getter; - } - - /// - /// Gets or sets the coordinator. - /// - /// - /// The coordinator. - /// - public StorageCoordinator Coordinator { get; set; } - - /// - /// Overrided by inheritors to configure the handler for use. - /// - public abstract void Configure(); - - /// - /// Instructs the handler to store the entire object graph, rather than individual properties. - /// - /// The type of the service. - /// The optional storage key. - /// The builder. - public StorageInstructionBuilder EntireGraph(string storageKey = "ObjectGraph") { - return AddInstruction().Configure(x => { - x.Key = storageKey; - x.Save = (instance, getKey, mode) => x.StorageMechanism.Store(getKey(), instance); - x.Restore = (instance, getKey, mode) => { }; - x.PropertyChanged += (s, e) => { - if(e.PropertyName == "StorageMechanism" && x.StorageMechanism != null) { - x.StorageMechanism.RegisterSingleton(typeof(TService), GetKey(default(T), x.Key), typeof(T)); - } - }; - }); - } - - /// - /// Instructs the handler to store a property. - /// - /// The property. - /// The builder. - public StorageInstructionBuilder Property(Expression> property) { - var info = (PropertyInfo)property.GetMemberInfo(); - - return AddInstruction().Configure(x => { - x.Key = info.Name; - x.Save = (instance, getKey, mode) => x.StorageMechanism.Store(getKey(), info.GetValue(instance, null)); - x.Restore = (instance, getKey, mode) => { - object value; - var key = getKey(); - if(x.StorageMechanism.TryGet(key, out value)) { - x.StorageMechanism.Delete(key); - info.SetValue(instance, value, null); - } - }; - }); - } - - /// - /// Instructs the handler to store a child object's properties. - /// - /// The property. - /// The builder. - /// This assumes that the parent instance provides the child instance, but that the child instance's properties are handled by a unique handler. - public StorageInstructionBuilder Child(Expression> property) { - var info = (PropertyInfo)property.GetMemberInfo(); - - return AddInstruction().Configure(x => { - x.Key = info.Name; - x.Save = (instance, getKey, mode) => { - var child = info.GetValue(instance, null); - if(child == null) - return; - - var handler = Coordinator.GetStorageHandlerFor(child); - handler.Save(child, mode); - }; - x.Restore = (instance, getKey, mode) => { - var child = info.GetValue(instance, null); - if(child == null) - return; - - var handler = Coordinator.GetStorageHandlerFor(child); - handler.Restore(child, mode); - }; - }); - } - - /// - /// Adds a new storage instruction. - /// - /// The builder. - public StorageInstructionBuilder AddInstruction() { - var instruction = new StorageInstruction { Owner = this }; - instructions.Add(instruction); - return new StorageInstructionBuilder(instruction); - } - - /// - /// Uses this handler to save a particular instance using instructions that support the provided mode. - /// - /// The instance. - /// The storage mode. - public virtual void Save(T instance, StorageMode mode) { - foreach(var instruction in instructions) { - var key = instruction.Key; - if (instruction.StorageMechanism.Supports(mode)) { - instruction.Save(instance, () => GetKey(instance, key), mode); - } - } - } - - /// - /// Uses this handler to restore a particular instance using instructions that support the provided mode. - /// - /// The instance. - /// The mode. - public virtual void Restore(T instance, StorageMode mode) { - foreach(var instruction in instructions) { - var key = instruction.Key; - if (instruction.StorageMechanism.Supports(mode)) { - instruction.Restore(instance, () => GetKey(instance, key), mode); - } - } - } - - string GetKey(T instance, string detailKey) { - var id = getId(instance); - return typeof(T).FullName + (id == null ? "" : "_" + id) + "_" + detailKey; - } - - bool IStorageHandler.Handles(object instance) { - return instance is T; - } - - void IStorageHandler.Save(object instance, StorageMode mode) { - Save((T)instance, mode); - } - - void IStorageHandler.Restore(object instance, StorageMode mode) { - Restore((T)instance, mode); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/StorageInstruction.cs b/src/Caliburn.Micro.Platform/wp71/StorageInstruction.cs deleted file mode 100644 index a9b7bd36..00000000 --- a/src/Caliburn.Micro.Platform/wp71/StorageInstruction.cs +++ /dev/null @@ -1,85 +0,0 @@ -namespace Caliburn.Micro { - using System; - - /// - /// An instruction for saving/loading data. - /// - /// The model type. - public class StorageInstruction : PropertyChangedBase { - IStorageHandler owner; - IStorageMechanism storageMechanism; - string key; - Action, StorageMode> save; - Action, StorageMode> restore; - - /// - /// Gets or sets the owner. - /// - /// - /// The owner. - /// - public IStorageHandler Owner { - get { return owner; } - set { - owner = value; - NotifyOfPropertyChange("Owner"); - } - } - - /// - /// Gets or sets the storage mechanism. - /// - /// - /// The storage mechanism. - /// - public IStorageMechanism StorageMechanism { - get { return storageMechanism; } - set { - storageMechanism = value; - NotifyOfPropertyChange("StorageMechanism"); - } - } - - /// - /// Gets or sets the persistence key. - /// - /// - /// The key. - /// - public string Key { - get { return key; } - set { - key = value; - NotifyOfPropertyChange("Key"); - } - } - - /// - /// Gets or sets the save action. - /// - /// - /// The save action. - /// - public Action, StorageMode> Save { - get { return save; } - set { - save = value; - NotifyOfPropertyChange("Save"); - } - } - - /// - /// Gets or sets the restore action. - /// - /// - /// The restore action. - /// - public Action, StorageMode> Restore { - get { return restore; } - set { - restore = value; - NotifyOfPropertyChange("Restore"); - } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/StorageInstructionBuilder.cs b/src/Caliburn.Micro.Platform/wp71/StorageInstructionBuilder.cs deleted file mode 100644 index 99be8bed..00000000 --- a/src/Caliburn.Micro.Platform/wp71/StorageInstructionBuilder.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Caliburn.Micro { - using System; - - /// - /// Used to create a fluent interface for building up a storage instruction. - /// - /// - public class StorageInstructionBuilder { - readonly StorageInstruction storageInstruction; - - /// - /// Initializes a new instance of the class. - /// - /// The storage instruction. - public StorageInstructionBuilder(StorageInstruction storageInstruction) { - this.storageInstruction = storageInstruction; - } - - /// - /// Configures the instruction with the specified behavior. - /// - /// The configuration callback. - /// Itself - public StorageInstructionBuilder Configure(Action> configure) { - configure(storageInstruction); - return this; - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/StorageInstructionExtensions.cs b/src/Caliburn.Micro.Platform/wp71/StorageInstructionExtensions.cs deleted file mode 100644 index e05c0e04..00000000 --- a/src/Caliburn.Micro.Platform/wp71/StorageInstructionExtensions.cs +++ /dev/null @@ -1,135 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Linq; - using System.Windows; - - /// - /// Extension methods for configuring storage instructions. - /// - public static class StorageInstructionExtensions { - /// - /// Stores the data in the transient phone State. - /// - /// The model type. - /// The builder. - /// The builder. - public static StorageInstructionBuilder InPhoneState(this StorageInstructionBuilder builder) { - return builder.Configure(x => { x.StorageMechanism = x.Owner.Coordinator.GetStorageMechanism(); }); - } - - /// - /// Stores the data in the permanent ApplicationSettings. - /// - /// The model type. - /// The builder. - /// The builder. - public static StorageInstructionBuilder InAppSettings(this StorageInstructionBuilder builder) { - return builder.Configure(x => { x.StorageMechanism = x.Owner.Coordinator.GetStorageMechanism(); }); - } - - /// - /// Restores the data when IActivate.Activated is raised. - /// - /// The model type. - /// The builder. - /// The builder. - public static StorageInstructionBuilder RestoreAfterActivation(this StorageInstructionBuilder builder) - where T : IActivate { - return builder.Configure(x => { - var original = x.Restore; - - x.Restore = (instance, getKey, mode) => { - if(instance.IsActive) - original(instance, getKey, mode); - else { - EventHandler onActivate = null; - onActivate = (s, e) => { - original(instance, getKey, mode); - instance.Activated -= onActivate; - }; - instance.Activated += onActivate; - } - }; - }); - } - - /// - /// Restores the data after view's Loaded event is raised. - /// - /// The model type. - /// The builder. - /// The builder. - public static StorageInstructionBuilder RestoreAfterViewLoad(this StorageInstructionBuilder builder) - where T : IViewAware { - return builder.Configure(x => { - var original = x.Restore; - - x.Restore = (instance, getKey, mode) => { - EventHandler onViewAttached = null; - onViewAttached = (s, e) => { - var fe = (FrameworkElement)e.View; - View.ExecuteOnLoad(fe, (s2, e2) => { original(instance, getKey, mode); }); - instance.ViewAttached -= onViewAttached; - }; - instance.ViewAttached += onViewAttached; - }; - }); - } - - /// - /// Restores the data after view's LayoutUpdated event is raised. - /// - /// The model type. - /// The builder. - /// The builder. - public static StorageInstructionBuilder RestoreAfterViewReady(this StorageInstructionBuilder builder) - where T : IViewAware { - return builder.Configure(x => { - var original = x.Restore; - - x.Restore = (instance, getKey, mode) => { - EventHandler onViewAttached = null; - onViewAttached = (s, e) => { - var fe = (FrameworkElement)e.View; - instance.ViewAttached -= onViewAttached; - EventHandler handler = null; - handler = (s2, e2) => { - original(instance, getKey, mode); - fe.LayoutUpdated -= handler; - }; - fe.LayoutUpdated += handler; - }; - instance.ViewAttached += onViewAttached; - }; - }); - } - - /// - /// Stores the index of the Conductor's ActiveItem. - /// - /// The model type. - /// The handler. - /// The builder. - public static StorageInstructionBuilder ActiveItemIndex(this StorageHandler handler) - where T : IParent, IHaveActiveItem, IActivate { - return handler.AddInstruction().Configure(x => { - x.Key = "ActiveItemIndex"; - x.Save = (instance, getKey, mode) => { - var children = instance.GetChildren().OfType().ToList(); - var index = children.IndexOf(instance.ActiveItem); - x.StorageMechanism.Store(getKey(), index); - }; - x.Restore = (instance, getKey, mode) => { - object value; - var key = getKey(); - if(x.StorageMechanism.TryGet(key, out value)) { - x.StorageMechanism.Delete(key); - var index = Convert.ToInt32(value); - var activeItem = instance.GetChildren().OfType().ElementAtOrDefault(index); - instance.ActiveItem = activeItem; - } - }; - }); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/StorageMode.cs b/src/Caliburn.Micro.Platform/wp71/StorageMode.cs deleted file mode 100644 index 3d7a49d6..00000000 --- a/src/Caliburn.Micro.Platform/wp71/StorageMode.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace Caliburn.Micro { - using System; - - /// - /// The mode used to save/restore data. - /// - [Flags] - public enum StorageMode { - /// - /// Automatic Determine the Mode - /// - Automatic = 0, - /// - /// Use Temporary storage. - /// - Temporary = 2, - /// - /// Use Permenent storage. - /// - Permanent = 4, - /// - /// Use any storage mechanism available. - /// - Any = Temporary | Permanent - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/TaskCompleted.cs b/src/Caliburn.Micro.Platform/wp71/TaskCompleted.cs deleted file mode 100644 index 45d7721d..00000000 --- a/src/Caliburn.Micro.Platform/wp71/TaskCompleted.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Caliburn.Micro { - /// - /// A message which is published when a task completes. - /// - /// The type of the task event args. - public class TaskCompleted { - /// - /// Optional state provided by the original sender. - /// - public object State; - - /// - /// The results of the task. - /// - public TTaskEventArgs Result; - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/TaskController.cs b/src/Caliburn.Micro.Platform/wp71/TaskController.cs deleted file mode 100644 index 63a52854..00000000 --- a/src/Caliburn.Micro.Platform/wp71/TaskController.cs +++ /dev/null @@ -1,145 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Reflection; - using System.Threading.Tasks; - using Microsoft.Phone.Shell; - using Microsoft.Phone.Tasks; - - /// - /// Handles messages and ensures that the property handler receives the completion message. - /// - public class TaskController : IHandle { - const string TaskTypeKey = "Caliburn.Micro.TaskType"; - const string TaskSateKey = "Caliburn.Micro.TaskState"; - readonly IPhoneService phoneService; - readonly IEventAggregator events; - TaskExecutionRequested request; - bool isResurrecting; - object continueWithMessage; - - /// - /// Initializes a new instance of the class. - /// - /// The phone service. - /// The event aggregator. - public TaskController(IPhoneService phoneService, IEventAggregator events) { - this.phoneService = phoneService; - this.events = events; - } - - /// - /// Starts monitoring for task requests and controlling completion messages. - /// - public void Start() { - phoneService.Deactivated += OnDeactivated; - phoneService.Resurrected += OnResurrected; - phoneService.Continued += OnContinued; - events.Subscribe(this); - } - - /// - /// Stops monitoring for task requests and controlling completion messages. - /// - public void Stop() { - events.Unsubscribe(this); - phoneService.Deactivated -= OnDeactivated; - phoneService.Resurrected -= OnResurrected; - phoneService.Continued -= OnContinued; - } - - void IHandle.Handle(TaskExecutionRequested message) { - var taskType = message.Task.GetType(); - - var @event = taskType.GetEvent("Completed"); - if(@event != null) { - request = message; - @event.AddEventHandler(request.Task, CreateOnTaskCompletedDelegate(@event)); - } - - var showMethod = taskType.GetMethod("Show"); - showMethod.Invoke(message.Task, null); - } - - void OnDeactivated(object sender, DeactivatedEventArgs e) { - if (request == null) { - return; - } - - phoneService.State[TaskTypeKey] = request.Task.GetType().FullName; - phoneService.State[TaskSateKey] = request.State ?? string.Empty; - } - - void OnContinued() { - if(continueWithMessage == null) { - return; - } - - events.PublishOnUIThread(continueWithMessage); - continueWithMessage = null; - } - - void OnResurrected() { - if (!phoneService.State.ContainsKey(TaskTypeKey)) { - return; - } - - isResurrecting = true; - - var taskTypeName = (string)phoneService.State[TaskTypeKey]; - phoneService.State.Remove(TaskTypeKey); - - object taskState; - if (phoneService.State.TryGetValue(TaskSateKey, out taskState)) - phoneService.State.Remove(TaskSateKey); - - var taskType = typeof(TaskEventArgs).Assembly.GetType(taskTypeName); - var taskInstance = Activator.CreateInstance(taskType); - - request = new TaskExecutionRequested { - State = taskState, - Task = taskInstance - }; - - var @event = taskType.GetEvent("Completed"); - if(@event != null) { - @event.AddEventHandler(request.Task, CreateOnTaskCompletedDelegate(@event)); - } - } - - Delegate CreateOnTaskCompletedDelegate(EventInfo @event) { - var methodInfo = typeof(TaskController).GetMethod("OnTaskComplete", BindingFlags.Instance | BindingFlags.NonPublic); - var handler = Delegate.CreateDelegate(@event.EventHandlerType, this, methodInfo); - return handler; - } - - /// - /// Called when the task is compled. - /// - /// The sender. - /// The instance containing the event data. - protected void OnTaskComplete(object sender, EventArgs e) { - var genericMessageType = typeof(TaskCompleted<>); - var argsType = e.GetType(); - var messageType = genericMessageType.MakeGenericType(argsType); - var message = Activator.CreateInstance(messageType); - - if (request.State != null) { - messageType.GetField("State").SetValue(message, request.State); - } - - messageType.GetField("Result").SetValue(message, e); - request = null; - - if(isResurrecting) { - Task.Delay(500) - .ContinueWith(t => { - events.PublishOnUIThread(message); - isResurrecting = false; - }); - } - else { - continueWithMessage = message; - } - } - } -} diff --git a/src/Caliburn.Micro.Platform/wp71/TaskExecutionRequested.cs b/src/Caliburn.Micro.Platform/wp71/TaskExecutionRequested.cs deleted file mode 100644 index 22304d28..00000000 --- a/src/Caliburn.Micro.Platform/wp71/TaskExecutionRequested.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Caliburn.Micro { - /// - /// A message that is published to signify a components request for the execution of a particular task. - /// - public class TaskExecutionRequested { - /// - /// Optional state to be passed along to the task completion message. - /// - public object State; - - /// - /// The task instance. - /// - public object Task; - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/TaskExtensionMethods.cs b/src/Caliburn.Micro.Platform/wp71/TaskExtensionMethods.cs deleted file mode 100644 index fb76cf94..00000000 --- a/src/Caliburn.Micro.Platform/wp71/TaskExtensionMethods.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Caliburn.Micro { - using System; - - /// - /// Extension methods related to phone tasks. - /// - public static class TaskExtensionMethods { - /// - /// Creates a task and publishes it using the . - /// - /// The task to create. - /// The event aggregator. - /// Optional configuration for the task. - /// Optional state to be passed along to the task completion message. - public static void RequestTask(this IEventAggregator events, Action configure = null, object state = null) - where TTask : new() { - var task = new TTask(); - - if(configure != null) { - configure(task); - } - - events.PublishOnUIThread(new TaskExecutionRequested { - State = state, - Task = task - }); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/UIElementExtensions.cs b/src/Caliburn.Micro.Platform/wp71/UIElementExtensions.cs deleted file mode 100644 index d750ef5c..00000000 --- a/src/Caliburn.Micro.Platform/wp71/UIElementExtensions.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Media; - -namespace Caliburn.Micro -{ - /// - /// Extension methods for - /// - public static class UIElementExtensions { - static readonly ILog Log = LogManager.GetLog(typeof(UIElementExtensions)); - - /// - /// Calls TransformToVisual on the specified element for the specified visual, suppressing the ArgumentException that can occur in some cases. - /// - /// Element on which to call TransformToVisual. - /// Visual to pass to the call to TransformToVisual. - /// Resulting GeneralTransform object. - public static GeneralTransform SafeTransformToVisual(this UIElement element, UIElement visual) - { - GeneralTransform result; - try { - result = element.TransformToVisual(visual); - } catch (ArgumentException ex) { - Log.Error(ex); - - // Not perfect, but better than throwing an exception - result = new TranslateTransform(); - } - return result; - } - } -} diff --git a/src/Caliburn.Micro.Platform/wp71/VibrateController.cs b/src/Caliburn.Micro.Platform/wp71/VibrateController.cs deleted file mode 100644 index 84d9b3a5..00000000 --- a/src/Caliburn.Micro.Platform/wp71/VibrateController.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Caliburn.Micro { - using System; - using Microsoft.Devices; - - /// - /// Allows applications to start and stop vibration on the device. - /// - public interface IVibrateController { - /// - /// Starts vibration on the device. - /// - /// A TimeSpan object specifying the amount of time for which the phone vibrates. - void Start(TimeSpan duration); - - /// - /// Stops vibration on the device. - /// - void Stop(); - } - - /// - /// The default implementation of , using the system controller. - /// - public class SystemVibrateController : IVibrateController { - /// - /// Starts vibration on the device. - /// - /// A TimeSpan object specifying the amount of time for which the phone vibrates. - public void Start(TimeSpan duration) { - VibrateController.Default.Start(duration); - } - - /// - /// Stops vibration on the device. - /// - public void Stop() { - VibrateController.Default.Stop(); - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/WindowManager.cs b/src/Caliburn.Micro.Platform/wp71/WindowManager.cs deleted file mode 100644 index 6388f8e8..00000000 --- a/src/Caliburn.Micro.Platform/wp71/WindowManager.cs +++ /dev/null @@ -1,454 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Controls.Primitives; - using System.Windows.Markup; - using System.Windows.Media; - using System.Windows.Media.Animation; - using Microsoft.Phone.Controls; - using Microsoft.Phone.Shell; - - /// - /// A service that manages windows. - /// - public interface IWindowManager { - /// - /// Shows a modal dialog for the specified model. - /// - /// The root model. - /// The optional dialog settings. - /// The context. - void ShowDialog(object rootModel, object context = null, IDictionary settings = null); - - /// - /// Shows a popup at the current mouse position. - /// - /// The root model. - /// The view context. - /// The optional popup settings. - void ShowPopup(object rootModel, object context = null, IDictionary settings = null); - } - - /// - /// A service that manages windows. - /// - public class WindowManager : IWindowManager { - /// - /// Predicate used to determine whether a page being navigated is actually a system dialog, which should - /// cause a temporary dialog disappearance. - /// - /// - /// The default implementation just take into account DatePicker and TimePicker pages from WP7 toolkit. - /// - /// /// The destination page to check - public static Func IsSystemDialogNavigation = uri => { - return uri != null && uri.ToString().StartsWith("/Microsoft.Phone.Controls.Toolkit"); - }; - - /// - /// Shows a modal dialog for the specified model. - /// - /// The root model. - /// The context. - /// The optional dialog settings. - public virtual void ShowDialog(object rootModel, object context = null, IDictionary settings = null) { - var navigationSvc = IoC.Get(); - - var host = new DialogHost(navigationSvc); - var view = ViewLocator.LocateForModel(rootModel, host, context); - host.Content = view; - host.SetValue(View.IsGeneratedProperty, true); - - ViewModelBinder.Bind(rootModel, host, null); - host.SetActionTarget(rootModel); - - ApplySettings(host, settings); - - var activatable = rootModel as IActivate; - if (activatable != null) { - activatable.Activate(); - } - - var deactivator = rootModel as IDeactivate; - if (deactivator != null) { - host.Closed += delegate { deactivator.Deactivate(true); }; - } - - host.Open(); - } - - /// - /// Shows a popup at the current mouse position. - /// - /// The root model. - /// The view context. - /// The optional popup settings. - public virtual void ShowPopup(object rootModel, object context = null, IDictionary settings = null) { - var popup = CreatePopup(rootModel, settings); - var view = ViewLocator.LocateForModel(rootModel, popup, context); - - popup.Child = view; - popup.SetValue(View.IsGeneratedProperty, true); - - ViewModelBinder.Bind(rootModel, popup, null); - - var activatable = rootModel as IActivate; - if (activatable != null) { - activatable.Activate(); - } - - var deactivator = rootModel as IDeactivate; - if (deactivator != null) { - popup.Closed += delegate { deactivator.Deactivate(true); }; - } - - popup.IsOpen = true; - } - - /// - /// Creates a popup for hosting a popup window. - /// - /// The model. - /// The optional popup settings. - /// The popup. - protected virtual Popup CreatePopup(object rootModel, IDictionary settings) { - var popup = new Popup(); - ApplySettings(popup, settings); - return popup; - } - - static bool ApplySettings(object target, IEnumerable> settings) { - if(settings != null) { - var type = target.GetType(); - - foreach(var pair in settings) { - var propertyInfo = type.GetProperty(pair.Key); - - if(propertyInfo != null) - propertyInfo.SetValue(target, pair.Value, null); - } - - return true; - } - - return false; - } - - [ContentProperty("Content")] - internal class DialogHost : FrameworkElement { - INavigationService navigationSvc; - PhoneApplicationPage currentPage; - - Popup hostPopup; - bool isOpen = false; - ContentControl viewContainer; - Border pageFreezingLayer; - Border maskingLayer; - IElementPlacementAnimator elementPlacementAnimator; - Dictionary appBarButtonsStatus = new Dictionary(); - bool appBarMenuEnabled; - - public DialogHost(INavigationService navigationSvc) { - this.navigationSvc = navigationSvc; - - currentPage = navigationSvc.CurrentContent as PhoneApplicationPage; - if (currentPage == null) { - throw new InvalidOperationException( - string.Format("In order to use ShowDialog the view currently loaded in the application frame ({0})" - + " should inherit from PhoneApplicationPage or one of its descendents.", navigationSvc.CurrentContent.GetType())); - } - - navigationSvc.Navigating += OnNavigating; - navigationSvc.Navigated += OnNavigated; - - CreateUIElements(); - elementPlacementAnimator = CreateElementsAnimator(); - } - - public EventHandler Closed = delegate { }; - - public void SetActionTarget(object target) { - Action.SetTarget(viewContainer, target); - } - - public virtual UIElement Content { - get { return (UIElement)viewContainer.Content; } - set { viewContainer.Content = value; } - } - - public void Open() { - if (isOpen) { - return; - } - - isOpen = true; - - if(currentPage.ApplicationBar != null) { - DisableAppBar(); - } - - ArrangePlacement(); - - currentPage.BackKeyPress += CurrentPageBackKeyPress; - currentPage.OrientationChanged += CurrentPageOrientationChanged; - - hostPopup.IsOpen = true; - } - - public void Close() { - Close(reopenOnBackNavigation:false); - } - - void Close(bool reopenOnBackNavigation) { - if (!isOpen) { - return; - } - - isOpen = false; - elementPlacementAnimator.Exit(() => { hostPopup.IsOpen = false; }); - - if(currentPage.ApplicationBar != null) { - RestoreAppBar(); - } - - currentPage.BackKeyPress -= CurrentPageBackKeyPress; - currentPage.OrientationChanged -= CurrentPageOrientationChanged; - - if(!reopenOnBackNavigation) { - navigationSvc.Navigating -= OnNavigating; - navigationSvc.Navigated -= OnNavigated; - - Closed(this, EventArgs.Empty); - } - } - - protected virtual IElementPlacementAnimator CreateElementsAnimator() { - return new DefaultElementPlacementAnimator(maskingLayer, viewContainer); - } - - protected virtual void CreateUIElements() { - viewContainer = new ContentControl { - HorizontalContentAlignment = HorizontalAlignment.Stretch, - VerticalContentAlignment = VerticalAlignment.Top, - }; - maskingLayer = new Border { - Child = viewContainer, - Background = new SolidColorBrush(Color.FromArgb(170, 0, 0, 0)), - VerticalAlignment = VerticalAlignment.Top, - HorizontalAlignment = HorizontalAlignment.Left - }; - pageFreezingLayer = new Border { - Background = new SolidColorBrush(Colors.Transparent), - Width = Application.Current.Host.Content.ActualWidth, - Height = Application.Current.Host.Content.ActualHeight - }; - - var panel = new Canvas(); - panel.Children.Add(pageFreezingLayer); - panel.Children.Add(maskingLayer); - - hostPopup = new Popup { Child = panel }; - } - - void DisableAppBar() { - appBarMenuEnabled = currentPage.ApplicationBar.IsMenuEnabled; - appBarButtonsStatus.Clear(); - currentPage.ApplicationBar.Buttons.Cast() - .Apply(b => { - appBarButtonsStatus.Add(b, b.IsEnabled); - b.IsEnabled = false; - }); - - currentPage.ApplicationBar.IsMenuEnabled = false; - } - - void RestoreAppBar() { - currentPage.ApplicationBar.IsMenuEnabled = appBarMenuEnabled; - currentPage.ApplicationBar.Buttons.Cast() - .Apply(b => { - bool status; - if(appBarButtonsStatus.TryGetValue(b, out status)) - b.IsEnabled = status; - }); - } - - void ArrangePlacement() { - maskingLayer.Dispatcher.BeginInvoke(() => { - var placement = new ElementPlacement { - Transform = currentPage.SafeTransformToVisual(null) as Transform ?? new TranslateTransform(), - Orientation = currentPage.Orientation, - Size = new Size(currentPage.ActualWidth, currentPage.ActualHeight) - }; - - elementPlacementAnimator.AnimateTo(placement); - }); - } - - Uri currentPageUri; - void OnNavigating(object sender, System.Windows.Navigation.NavigatingCancelEventArgs e) { - if (IsSystemDialogNavigation(e.Uri)) { - currentPageUri = navigationSvc.CurrentSource; - } - } - - void OnNavigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { - if(IsSystemDialogNavigation(e.Uri)) { - Close(currentPageUri != null); - } - else if(e.Uri.Equals(currentPageUri)) { - currentPageUri = null; - //refreshes the page instance - currentPage = (PhoneApplicationPage)navigationSvc.CurrentContent; - - Open(); - } - else { - Close(reopenOnBackNavigation:false); - } - } - - void CurrentPageBackKeyPress(object sender, CancelEventArgs e) { - e.Cancel = true; - Close(); - } - - void CurrentPageOrientationChanged(object sender, OrientationChangedEventArgs e) { - ArrangePlacement(); - } - - public class ElementPlacement { - public Transform Transform; - public PageOrientation Orientation; - public Size Size; - - public double AngleFromDefault { - get { - if ((Orientation & PageOrientation.Landscape) == 0) { - return 0; - } - - return Orientation == PageOrientation.LandscapeRight ? 90 : -90; - } - } - } - - public interface IElementPlacementAnimator { - void Enter(ElementPlacement initialPlacement); - void AnimateTo(ElementPlacement newPlacement); - void Exit(System.Action onCompleted); - } - - public class DefaultElementPlacementAnimator : IElementPlacementAnimator { - FrameworkElement maskingLayer; - FrameworkElement viewContainer; - Storyboard storyboard = new Storyboard(); - ElementPlacement currentPlacement; - - public DefaultElementPlacementAnimator(FrameworkElement maskingLayer, FrameworkElement viewContainer) { - this.maskingLayer = maskingLayer; - this.viewContainer = viewContainer; - } - - public void Enter(ElementPlacement initialPlacement) { - currentPlacement = initialPlacement; - - //size - maskingLayer.Width = currentPlacement.Size.Width; - maskingLayer.Height = currentPlacement.Size.Height; - - //position and orientation - maskingLayer.RenderTransform = currentPlacement.Transform; - - //enter animation - var projection = new PlaneProjection { CenterOfRotationY = 0.1 }; - viewContainer.Projection = projection; - AddDoubleAnimation(projection, "RotationX", from:-90, to:0, ms:400); - AddDoubleAnimation(maskingLayer, "Opacity", from:0, to:1, ms:400); - - storyboard.Begin(); - } - - public void AnimateTo(ElementPlacement newPlacement) { - storyboard.Stop(); - storyboard.Children.Clear(); - - if(currentPlacement == null) { - Enter(newPlacement); - return; - } - - //size - AddDoubleAnimation(maskingLayer, "Width", from:currentPlacement.Size.Width, to:newPlacement.Size.Width, ms:200); - AddDoubleAnimation(maskingLayer, "Height", from:currentPlacement.Size.Height, to:newPlacement.Size.Height, ms:200); - - //rotation at orientation change - var transformGroup = new TransformGroup(); - var rotation = new RotateTransform { - CenterX = Application.Current.Host.Content.ActualWidth / 2, - CenterY = Application.Current.Host.Content.ActualHeight / 2 - }; - transformGroup.Children.Add(newPlacement.Transform); - transformGroup.Children.Add(rotation); - maskingLayer.RenderTransform = transformGroup; - AddDoubleAnimation(rotation, "Angle", from:newPlacement.AngleFromDefault - currentPlacement.AngleFromDefault, to:0.0); - - //slight fading at orientation change - AddFading(maskingLayer); - - currentPlacement = newPlacement; - storyboard.Begin(); - } - - public void Exit(System.Action onCompleted) { - storyboard.Stop(); - storyboard.Children.Clear(); - - //exit animation - var projection = new PlaneProjection { CenterOfRotationY = 0.1 }; - viewContainer.Projection = projection; - AddDoubleAnimation(projection, "RotationX", from:0, to:90, ms:250); - AddDoubleAnimation(maskingLayer, "Opacity", from:1, to:0, ms:350); - - EventHandler handler = null; - handler = (o, e) => { - storyboard.Completed -= handler; - onCompleted(); - currentPlacement = null; - }; - storyboard.Completed += handler; - storyboard.Begin(); - } - - void AddDoubleAnimation(DependencyObject target, string property, double from, double to, int ms = 500) { - var timeline = new DoubleAnimation { - From = from, - To = to, - EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 4 }, - Duration = new Duration(TimeSpan.FromMilliseconds(ms)) - }; - - Storyboard.SetTarget(timeline, target); - Storyboard.SetTargetProperty(timeline, new PropertyPath(property)); - storyboard.Children.Add(timeline); - } - - void AddFading(FrameworkElement target) { - var timeline = new DoubleAnimationUsingKeyFrames { - Duration = new Duration(TimeSpan.FromMilliseconds(500)) - }; - timeline.KeyFrames.Add(new LinearDoubleKeyFrame { Value = 1, KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0)) }); - timeline.KeyFrames.Add(new LinearDoubleKeyFrame { Value = 0.5, KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(150)) }); - timeline.KeyFrames.Add(new LinearDoubleKeyFrame { Value = 1, KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(300)) }); - - Storyboard.SetTarget(timeline, target); - Storyboard.SetTargetProperty(timeline, new PropertyPath("Opacity")); - storyboard.Children.Add(timeline); - } - } - } - } -} \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/wp71/WindowManagerExtensions.cs b/src/Caliburn.Micro.Platform/wp71/WindowManagerExtensions.cs deleted file mode 100644 index efb6a258..00000000 --- a/src/Caliburn.Micro.Platform/wp71/WindowManagerExtensions.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace Caliburn.Micro { - using System; - - /// - /// WindowManager extensions - /// - public static class WindowManagerExtensions { - /// - /// Shows a modal dialog for the specified model, using vibrate and audio feedback - /// - /// The WindowManager instance. - /// The root model. - /// The context. - /// If not null, use the specified .wav as opening sound - /// If true, use a vibration feedback on dialog opening - public static void ShowDialogWithFeedback(this IWindowManager windowManager, object rootModel, object context = null, Uri wavOpeningSound= null, bool vibrate = true) { - if (wavOpeningSound != null) { - IoC.Get().Play(wavOpeningSound); - } - - if (vibrate) { - IoC.Get().Start(TimeSpan.FromMilliseconds(200)); - } - - windowManager.ShowDialog(rootModel, context); - } - } -} \ No newline at end of file From f6582e431ed75c48fd9e2104a3ce591d1c336841 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Wed, 31 May 2017 23:40:17 +1200 Subject: [PATCH 010/142] #371 Migrate Caliburn.Micro.Core to .NET Standard --- .../Caliburn.Micro.Platform.Android.csproj | 11 +- .../Caliburn.Micro.Platform.Core.csproj | 13 +- .../Caliburn.Micro.Platform.NET45.csproj | 6 +- .../Caliburn.Micro.Platform.UWP.csproj | 6 +- ...liburn.Micro.Platform.Xamarin.Forms.csproj | 6 +- .../Caliburn.Micro.Platform.iOS.csproj | 6 +- .../Caliburn.Micro.Tests.NET45.csproj | 6 +- src/Caliburn.Micro.sln | 36 ++--- src/Caliburn.Micro/Caliburn.Micro.Core.csproj | 26 ++++ src/Caliburn.Micro/Caliburn.Micro.csproj | 127 ------------------ .../ConductorWithCollectionAllActive.cs | 8 +- src/Caliburn.Micro/ContainerExtensions.cs | 12 +- src/Caliburn.Micro/EventAggregator.cs | 12 +- .../NonPortableReflectionExtensions.cs | 28 ---- .../PortableReflectionExtensions.cs | 53 -------- src/Caliburn.Micro/SimpleContainer.cs | 16 +-- 16 files changed, 93 insertions(+), 279 deletions(-) create mode 100644 src/Caliburn.Micro/Caliburn.Micro.Core.csproj delete mode 100644 src/Caliburn.Micro/Caliburn.Micro.csproj delete mode 100644 src/Caliburn.Micro/NonPortableReflectionExtensions.cs delete mode 100644 src/Caliburn.Micro/PortableReflectionExtensions.cs diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj index 4284ec3d..43fb96c3 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj @@ -42,12 +42,7 @@ - - - - - @@ -63,9 +58,9 @@ - - {6d772b52-da8f-4784-971a-4bf50cb6d306} - Caliburn.Micro + + {614e1789-d938-4c8b-9d46-ba99160d22e0} + Caliburn.Micro.Core {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj index 491b7a5d..70c11186 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj @@ -42,13 +42,6 @@ Caliburn.snk - - - - {6d772b52-da8f-4784-971a-4bf50cb6d306} - Caliburn.Micro - - @@ -64,6 +57,12 @@ + + + {614e1789-d938-4c8b-9d46-ba99160d22e0} + Caliburn.Micro.Core + + - - Caliburn.snk - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro/ConductorWithCollectionAllActive.cs b/src/Caliburn.Micro/ConductorWithCollectionAllActive.cs index 851ce4a3..68a3ded3 100644 --- a/src/Caliburn.Micro/ConductorWithCollectionAllActive.cs +++ b/src/Caliburn.Micro/ConductorWithCollectionAllActive.cs @@ -1,4 +1,6 @@ -namespace Caliburn.Micro { +using System.Reflection; + +namespace Caliburn.Micro { using System; using System.Collections.Generic; using System.Collections.Specialized; @@ -93,8 +95,8 @@ public override void CanClose(Action callback) { /// protected override void OnInitialize() { if (openPublicItems) { - GetType().GetProperties() - .Where(x => x.Name != "Parent" && typeof (T).IsAssignableFrom(x.PropertyType)) + GetType().GetRuntimeProperties() + .Where(x => x.Name != "Parent" && typeof (T).GetTypeInfo().IsAssignableFrom(x.PropertyType.GetTypeInfo())) .Select(x => x.GetValue(this, null)) .Cast() .Apply(ActivateItem); diff --git a/src/Caliburn.Micro/ContainerExtensions.cs b/src/Caliburn.Micro/ContainerExtensions.cs index 8039536b..6726bd65 100644 --- a/src/Caliburn.Micro/ContainerExtensions.cs +++ b/src/Caliburn.Micro/ContainerExtensions.cs @@ -97,15 +97,15 @@ public static SimpleContainer AllTypesOf(this SimpleContainer containe filter = type => true; var serviceType = typeof (TService); - var types = from type in assembly.GetTypes() - where serviceType.IsAssignableFrom(type) - && !type.IsAbstract() - && !type.IsInterface() - && filter(type) + var types = from type in assembly.DefinedTypes + where serviceType.GetTypeInfo().IsAssignableFrom(type) + && !type.IsAbstract + && !type.IsInterface + && filter(type.AsType()) select type; foreach (var type in types) { - container.RegisterSingleton(typeof (TService), null, type); + container.RegisterSingleton(typeof (TService), null, type.AsType()); } return container; diff --git a/src/Caliburn.Micro/EventAggregator.cs b/src/Caliburn.Micro/EventAggregator.cs index 4a86c1c6..8cf175fa 100644 --- a/src/Caliburn.Micro/EventAggregator.cs +++ b/src/Caliburn.Micro/EventAggregator.cs @@ -103,12 +103,12 @@ public bool IsDead { public Handler(object handler) { reference = new WeakReference(handler); - var interfaces = handler.GetType().GetInterfaces() - .Where(x => typeof(IHandle).IsAssignableFrom(x) && x.IsGenericType()); + var interfaces = handler.GetType().GetTypeInfo().ImplementedInterfaces + .Where(x => typeof(IHandle).GetTypeInfo().IsAssignableFrom(x.GetTypeInfo()) && x.GetTypeInfo().IsGenericType); foreach(var @interface in interfaces) { - var type = @interface.GetGenericArguments()[0]; - var method = @interface.GetMethod("Handle", new Type[] { type }); + var type = @interface.GetTypeInfo().GenericTypeArguments[0]; + var method = @interface.GetRuntimeMethod("Handle", new Type[] { type }); if (method != null) { supportedHandlers[type] = method; @@ -127,7 +127,7 @@ public bool Handle(Type messageType, object message) { } foreach(var pair in supportedHandlers) { - if(pair.Key.IsAssignableFrom(messageType)) { + if(pair.Key.GetTypeInfo().IsAssignableFrom(messageType.GetTypeInfo())) { var result = pair.Value.Invoke(target, new[] { message }); if (result != null) { HandlerResultProcessing(target, result); @@ -139,7 +139,7 @@ public bool Handle(Type messageType, object message) { } public bool Handles(Type messageType) { - return supportedHandlers.Any(pair => pair.Key.IsAssignableFrom(messageType)); + return supportedHandlers.Any(pair => pair.Key.GetTypeInfo().IsAssignableFrom(messageType.GetTypeInfo())); } } } diff --git a/src/Caliburn.Micro/NonPortableReflectionExtensions.cs b/src/Caliburn.Micro/NonPortableReflectionExtensions.cs deleted file mode 100644 index 98b19a53..00000000 --- a/src/Caliburn.Micro/NonPortableReflectionExtensions.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace Caliburn.Micro -{ - /// - /// A collection of extension methods to help with differing reflection between the portable library and SL5 - /// - internal static class NonPortableReflectionExtensions - { - public static bool IsAbstract(this Type t) - { - return t.IsAbstract; - } - - public static bool IsInterface(this Type t) - { - return t.IsInterface; - } - - public static bool IsGenericType(this Type t) - { - return t.IsGenericType; - } - } -} diff --git a/src/Caliburn.Micro/PortableReflectionExtensions.cs b/src/Caliburn.Micro/PortableReflectionExtensions.cs deleted file mode 100644 index d5a965f4..00000000 --- a/src/Caliburn.Micro/PortableReflectionExtensions.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace Caliburn.Micro -{ - /// - /// A collection of extension methods to help with differing reflection between the portable library and SL5 - /// - internal static class PortableReflectionExtensions { - - public static bool IsAssignableFrom(this Type t, Type c) { - return t.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo()); - } - - public static Type[] GetGenericArguments(this Type t) { - return t.GetTypeInfo().GenericTypeArguments; - } - - public static IEnumerable GetProperties(this Type t) { - return t.GetRuntimeProperties(); - } - - public static IEnumerable GetConstructors(this Type t) { - return t.GetTypeInfo().DeclaredConstructors; - } - - public static IEnumerable GetInterfaces(this Type t) { - return t.GetTypeInfo().ImplementedInterfaces; - } - - public static IEnumerable GetTypes(this Assembly a) { - return a.DefinedTypes.Select(t => t.AsType()); - } - - public static bool IsAbstract(this Type t) { - return t.GetTypeInfo().IsAbstract; - } - - public static bool IsInterface(this Type t) { - return t.GetTypeInfo().IsInterface; - } - - public static bool IsGenericType(this Type t) { - return t.GetTypeInfo().IsGenericType; - } - - public static MethodInfo GetMethod(this Type t, string name, Type[] parameters) { - return t.GetRuntimeMethod(name, parameters); - } - } -} diff --git a/src/Caliburn.Micro/SimpleContainer.cs b/src/Caliburn.Micro/SimpleContainer.cs index ad588c95..23dd53ed 100644 --- a/src/Caliburn.Micro/SimpleContainer.cs +++ b/src/Caliburn.Micro/SimpleContainer.cs @@ -94,16 +94,16 @@ public object GetInstance(Type service, string key) { return null; } - if (delegateType.IsAssignableFrom(service)) { - var typeToCreate = service.GetGenericArguments()[0]; + if (delegateType.GetTypeInfo().IsAssignableFrom(service.GetTypeInfo())) { + var typeToCreate = service.GetTypeInfo().GenericTypeArguments[0]; var factoryFactoryType = typeof(FactoryFactory<>).MakeGenericType(typeToCreate); var factoryFactoryHost = Activator.CreateInstance(factoryFactoryType); - var factoryFactoryMethod = factoryFactoryType.GetMethod("Create", new Type[] { typeof(SimpleContainer) }); + var factoryFactoryMethod = factoryFactoryType.GetRuntimeMethod("Create", new Type[] { typeof(SimpleContainer) }); return factoryFactoryMethod.Invoke(factoryFactoryHost, new object[] { this }); } - if (enumerableType.IsAssignableFrom(service) && service.IsGenericType()) { - var listType = service.GetGenericArguments()[0]; + if (enumerableType.GetTypeInfo().IsAssignableFrom(service.GetTypeInfo()) && service.GetTypeInfo().IsGenericType) { + var listType = service.GetTypeInfo().GenericTypeArguments[0]; var instances = GetAllInstances(listType).ToList(); var array = Array.CreateInstance(listType, instances.Count); @@ -142,8 +142,8 @@ public IEnumerable GetAllInstances(Type service) { /// /// The instance. public void BuildUp(object instance) { - var injectables = from property in instance.GetType().GetProperties() - where property.CanRead && property.CanWrite && property.PropertyType.IsInterface() + var injectables = from property in instance.GetType().GetRuntimeProperties() + where property.CanRead && property.CanWrite && property.PropertyType.GetTypeInfo().IsInterface select property; foreach (var propertyInfo in injectables) { @@ -223,7 +223,7 @@ object[] DetermineConstructorArgs(Type implementation) { } static ConstructorInfo SelectEligibleConstructor(Type type) { - return (from c in type.GetConstructors().Where(c => c.IsPublic) + return (from c in type.GetTypeInfo().DeclaredConstructors.Where(c => c.IsPublic) orderby c.GetParameters().Length descending select c).FirstOrDefault(); } From b77c6bbc64f60ccac2ed0fdc874fc1ca0e34c117 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Thu, 1 Jun 2017 22:48:54 +1200 Subject: [PATCH 011/142] #371 Rename folder for Caliburn.Micro.Core --- .../ActivationEventArgs.cs | 0 .../ActivationProcessedEventArgs.cs | 0 .../BindableCollection.cs | 0 .../Caliburn.Micro.Core.csproj | 0 .../Conductor.cs | 0 .../ConductorBase.cs | 0 .../ConductorBaseWithActiveItem.cs | 0 .../ConductorWithCollectionAllActive.cs | 0 .../ConductorWithCollectionOneActive.cs | 0 .../ContainerExtensions.cs | 0 .../ContinueResultDecorator.cs | 0 .../Coroutine.cs | 0 .../CoroutineExecutionContext.cs | 0 .../DeactivationEventArgs.cs | 0 .../DebugLog.cs | 0 .../DefaultCloseStrategy.cs | 0 .../DefaultPlatformProvider.cs | 0 .../DelegateResult.cs | 0 .../EnumerableExtensions.cs | 0 .../EventAggregator.cs | 0 .../EventAggregatorExtensions.cs | 0 .../Execute.cs | 0 .../ExpressionExtensions.cs | 0 .../IActivate.cs | 0 .../IChild.cs | 0 .../IClose.cs | 0 .../ICloseStrategy.cs | 0 .../IConductor.cs | 0 .../IDeactivate.cs | 0 .../IEventAggregator.cs | 0 .../IGuardClose.cs | 0 .../IHandle.cs | 0 .../IHandleWithCoroutine.cs | 0 .../IHandleWithTask.cs | 0 .../IHaveActiveItem.cs | 0 .../IHaveDisplayName.cs | 0 .../ILog.cs | 0 .../INotifyPropertyChangedEx.cs | 0 .../IObservableCollection.cs | 0 .../IParent.cs | 0 .../IPlatformProvider.cs | 0 .../IResult.cs | 0 .../IScreen.cs | 0 .../IViewAware.cs | 0 .../IoC.cs | 0 .../LogManager.cs | 0 .../OverrideCancelResultDecorator.cs | 0 .../PlatformProvider.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../PropertyChangedBase.cs | 0 .../RescueResultDecorator.cs | 0 .../ResultCompletionEventArgs.cs | 0 .../ResultDecoratorBase.cs | 0 .../ResultExtensions.cs | 0 .../Screen.cs | 0 .../ScreenExtensions.cs | 0 .../SequentialResult.cs | 0 .../SimpleContainer.cs | 0 .../SimpleResult.cs | 0 .../TaskExtensions.cs | 0 .../TaskResult.cs | 0 .../ViewAttachedEventArgs.cs | 0 .../ViewAware.cs | 0 .../WeakValueDictionary.cs | 0 .../Caliburn.Micro.Platform.Android.csproj | 3 +-- .../Caliburn.Micro.Platform.Core.csproj | 4 ++-- .../Caliburn.Micro.Platform.NET45.csproj | 4 ++-- .../Caliburn.Micro.Platform.UWP.csproj | 8 ++++---- ...liburn.Micro.Platform.Xamarin.Forms.csproj | 4 ++-- .../Caliburn.Micro.Platform.iOS.csproj | 4 ++-- .../Caliburn.Micro.Tests.NET45.csproj | 8 ++++---- src/Caliburn.Micro.sln | 19 +------------------ 72 files changed, 18 insertions(+), 36 deletions(-) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ActivationEventArgs.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ActivationProcessedEventArgs.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/BindableCollection.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/Caliburn.Micro.Core.csproj (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/Conductor.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ConductorBase.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ConductorBaseWithActiveItem.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ConductorWithCollectionAllActive.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ConductorWithCollectionOneActive.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ContainerExtensions.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ContinueResultDecorator.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/Coroutine.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/CoroutineExecutionContext.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/DeactivationEventArgs.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/DebugLog.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/DefaultCloseStrategy.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/DefaultPlatformProvider.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/DelegateResult.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/EnumerableExtensions.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/EventAggregator.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/EventAggregatorExtensions.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/Execute.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ExpressionExtensions.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IActivate.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IChild.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IClose.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ICloseStrategy.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IConductor.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IDeactivate.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IEventAggregator.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IGuardClose.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IHandle.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IHandleWithCoroutine.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IHandleWithTask.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IHaveActiveItem.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IHaveDisplayName.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ILog.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/INotifyPropertyChangedEx.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IObservableCollection.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IParent.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IPlatformProvider.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IResult.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IScreen.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IViewAware.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/IoC.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/LogManager.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/OverrideCancelResultDecorator.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/PlatformProvider.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/Properties/AssemblyInfo.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/PropertyChangedBase.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/RescueResultDecorator.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ResultCompletionEventArgs.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ResultDecoratorBase.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ResultExtensions.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/Screen.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ScreenExtensions.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/SequentialResult.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/SimpleContainer.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/SimpleResult.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/TaskExtensions.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/TaskResult.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ViewAttachedEventArgs.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/ViewAware.cs (100%) rename src/{Caliburn.Micro => Caliburn.Micro.Core}/WeakValueDictionary.cs (100%) diff --git a/src/Caliburn.Micro/ActivationEventArgs.cs b/src/Caliburn.Micro.Core/ActivationEventArgs.cs similarity index 100% rename from src/Caliburn.Micro/ActivationEventArgs.cs rename to src/Caliburn.Micro.Core/ActivationEventArgs.cs diff --git a/src/Caliburn.Micro/ActivationProcessedEventArgs.cs b/src/Caliburn.Micro.Core/ActivationProcessedEventArgs.cs similarity index 100% rename from src/Caliburn.Micro/ActivationProcessedEventArgs.cs rename to src/Caliburn.Micro.Core/ActivationProcessedEventArgs.cs diff --git a/src/Caliburn.Micro/BindableCollection.cs b/src/Caliburn.Micro.Core/BindableCollection.cs similarity index 100% rename from src/Caliburn.Micro/BindableCollection.cs rename to src/Caliburn.Micro.Core/BindableCollection.cs diff --git a/src/Caliburn.Micro/Caliburn.Micro.Core.csproj b/src/Caliburn.Micro.Core/Caliburn.Micro.Core.csproj similarity index 100% rename from src/Caliburn.Micro/Caliburn.Micro.Core.csproj rename to src/Caliburn.Micro.Core/Caliburn.Micro.Core.csproj diff --git a/src/Caliburn.Micro/Conductor.cs b/src/Caliburn.Micro.Core/Conductor.cs similarity index 100% rename from src/Caliburn.Micro/Conductor.cs rename to src/Caliburn.Micro.Core/Conductor.cs diff --git a/src/Caliburn.Micro/ConductorBase.cs b/src/Caliburn.Micro.Core/ConductorBase.cs similarity index 100% rename from src/Caliburn.Micro/ConductorBase.cs rename to src/Caliburn.Micro.Core/ConductorBase.cs diff --git a/src/Caliburn.Micro/ConductorBaseWithActiveItem.cs b/src/Caliburn.Micro.Core/ConductorBaseWithActiveItem.cs similarity index 100% rename from src/Caliburn.Micro/ConductorBaseWithActiveItem.cs rename to src/Caliburn.Micro.Core/ConductorBaseWithActiveItem.cs diff --git a/src/Caliburn.Micro/ConductorWithCollectionAllActive.cs b/src/Caliburn.Micro.Core/ConductorWithCollectionAllActive.cs similarity index 100% rename from src/Caliburn.Micro/ConductorWithCollectionAllActive.cs rename to src/Caliburn.Micro.Core/ConductorWithCollectionAllActive.cs diff --git a/src/Caliburn.Micro/ConductorWithCollectionOneActive.cs b/src/Caliburn.Micro.Core/ConductorWithCollectionOneActive.cs similarity index 100% rename from src/Caliburn.Micro/ConductorWithCollectionOneActive.cs rename to src/Caliburn.Micro.Core/ConductorWithCollectionOneActive.cs diff --git a/src/Caliburn.Micro/ContainerExtensions.cs b/src/Caliburn.Micro.Core/ContainerExtensions.cs similarity index 100% rename from src/Caliburn.Micro/ContainerExtensions.cs rename to src/Caliburn.Micro.Core/ContainerExtensions.cs diff --git a/src/Caliburn.Micro/ContinueResultDecorator.cs b/src/Caliburn.Micro.Core/ContinueResultDecorator.cs similarity index 100% rename from src/Caliburn.Micro/ContinueResultDecorator.cs rename to src/Caliburn.Micro.Core/ContinueResultDecorator.cs diff --git a/src/Caliburn.Micro/Coroutine.cs b/src/Caliburn.Micro.Core/Coroutine.cs similarity index 100% rename from src/Caliburn.Micro/Coroutine.cs rename to src/Caliburn.Micro.Core/Coroutine.cs diff --git a/src/Caliburn.Micro/CoroutineExecutionContext.cs b/src/Caliburn.Micro.Core/CoroutineExecutionContext.cs similarity index 100% rename from src/Caliburn.Micro/CoroutineExecutionContext.cs rename to src/Caliburn.Micro.Core/CoroutineExecutionContext.cs diff --git a/src/Caliburn.Micro/DeactivationEventArgs.cs b/src/Caliburn.Micro.Core/DeactivationEventArgs.cs similarity index 100% rename from src/Caliburn.Micro/DeactivationEventArgs.cs rename to src/Caliburn.Micro.Core/DeactivationEventArgs.cs diff --git a/src/Caliburn.Micro/DebugLog.cs b/src/Caliburn.Micro.Core/DebugLog.cs similarity index 100% rename from src/Caliburn.Micro/DebugLog.cs rename to src/Caliburn.Micro.Core/DebugLog.cs diff --git a/src/Caliburn.Micro/DefaultCloseStrategy.cs b/src/Caliburn.Micro.Core/DefaultCloseStrategy.cs similarity index 100% rename from src/Caliburn.Micro/DefaultCloseStrategy.cs rename to src/Caliburn.Micro.Core/DefaultCloseStrategy.cs diff --git a/src/Caliburn.Micro/DefaultPlatformProvider.cs b/src/Caliburn.Micro.Core/DefaultPlatformProvider.cs similarity index 100% rename from src/Caliburn.Micro/DefaultPlatformProvider.cs rename to src/Caliburn.Micro.Core/DefaultPlatformProvider.cs diff --git a/src/Caliburn.Micro/DelegateResult.cs b/src/Caliburn.Micro.Core/DelegateResult.cs similarity index 100% rename from src/Caliburn.Micro/DelegateResult.cs rename to src/Caliburn.Micro.Core/DelegateResult.cs diff --git a/src/Caliburn.Micro/EnumerableExtensions.cs b/src/Caliburn.Micro.Core/EnumerableExtensions.cs similarity index 100% rename from src/Caliburn.Micro/EnumerableExtensions.cs rename to src/Caliburn.Micro.Core/EnumerableExtensions.cs diff --git a/src/Caliburn.Micro/EventAggregator.cs b/src/Caliburn.Micro.Core/EventAggregator.cs similarity index 100% rename from src/Caliburn.Micro/EventAggregator.cs rename to src/Caliburn.Micro.Core/EventAggregator.cs diff --git a/src/Caliburn.Micro/EventAggregatorExtensions.cs b/src/Caliburn.Micro.Core/EventAggregatorExtensions.cs similarity index 100% rename from src/Caliburn.Micro/EventAggregatorExtensions.cs rename to src/Caliburn.Micro.Core/EventAggregatorExtensions.cs diff --git a/src/Caliburn.Micro/Execute.cs b/src/Caliburn.Micro.Core/Execute.cs similarity index 100% rename from src/Caliburn.Micro/Execute.cs rename to src/Caliburn.Micro.Core/Execute.cs diff --git a/src/Caliburn.Micro/ExpressionExtensions.cs b/src/Caliburn.Micro.Core/ExpressionExtensions.cs similarity index 100% rename from src/Caliburn.Micro/ExpressionExtensions.cs rename to src/Caliburn.Micro.Core/ExpressionExtensions.cs diff --git a/src/Caliburn.Micro/IActivate.cs b/src/Caliburn.Micro.Core/IActivate.cs similarity index 100% rename from src/Caliburn.Micro/IActivate.cs rename to src/Caliburn.Micro.Core/IActivate.cs diff --git a/src/Caliburn.Micro/IChild.cs b/src/Caliburn.Micro.Core/IChild.cs similarity index 100% rename from src/Caliburn.Micro/IChild.cs rename to src/Caliburn.Micro.Core/IChild.cs diff --git a/src/Caliburn.Micro/IClose.cs b/src/Caliburn.Micro.Core/IClose.cs similarity index 100% rename from src/Caliburn.Micro/IClose.cs rename to src/Caliburn.Micro.Core/IClose.cs diff --git a/src/Caliburn.Micro/ICloseStrategy.cs b/src/Caliburn.Micro.Core/ICloseStrategy.cs similarity index 100% rename from src/Caliburn.Micro/ICloseStrategy.cs rename to src/Caliburn.Micro.Core/ICloseStrategy.cs diff --git a/src/Caliburn.Micro/IConductor.cs b/src/Caliburn.Micro.Core/IConductor.cs similarity index 100% rename from src/Caliburn.Micro/IConductor.cs rename to src/Caliburn.Micro.Core/IConductor.cs diff --git a/src/Caliburn.Micro/IDeactivate.cs b/src/Caliburn.Micro.Core/IDeactivate.cs similarity index 100% rename from src/Caliburn.Micro/IDeactivate.cs rename to src/Caliburn.Micro.Core/IDeactivate.cs diff --git a/src/Caliburn.Micro/IEventAggregator.cs b/src/Caliburn.Micro.Core/IEventAggregator.cs similarity index 100% rename from src/Caliburn.Micro/IEventAggregator.cs rename to src/Caliburn.Micro.Core/IEventAggregator.cs diff --git a/src/Caliburn.Micro/IGuardClose.cs b/src/Caliburn.Micro.Core/IGuardClose.cs similarity index 100% rename from src/Caliburn.Micro/IGuardClose.cs rename to src/Caliburn.Micro.Core/IGuardClose.cs diff --git a/src/Caliburn.Micro/IHandle.cs b/src/Caliburn.Micro.Core/IHandle.cs similarity index 100% rename from src/Caliburn.Micro/IHandle.cs rename to src/Caliburn.Micro.Core/IHandle.cs diff --git a/src/Caliburn.Micro/IHandleWithCoroutine.cs b/src/Caliburn.Micro.Core/IHandleWithCoroutine.cs similarity index 100% rename from src/Caliburn.Micro/IHandleWithCoroutine.cs rename to src/Caliburn.Micro.Core/IHandleWithCoroutine.cs diff --git a/src/Caliburn.Micro/IHandleWithTask.cs b/src/Caliburn.Micro.Core/IHandleWithTask.cs similarity index 100% rename from src/Caliburn.Micro/IHandleWithTask.cs rename to src/Caliburn.Micro.Core/IHandleWithTask.cs diff --git a/src/Caliburn.Micro/IHaveActiveItem.cs b/src/Caliburn.Micro.Core/IHaveActiveItem.cs similarity index 100% rename from src/Caliburn.Micro/IHaveActiveItem.cs rename to src/Caliburn.Micro.Core/IHaveActiveItem.cs diff --git a/src/Caliburn.Micro/IHaveDisplayName.cs b/src/Caliburn.Micro.Core/IHaveDisplayName.cs similarity index 100% rename from src/Caliburn.Micro/IHaveDisplayName.cs rename to src/Caliburn.Micro.Core/IHaveDisplayName.cs diff --git a/src/Caliburn.Micro/ILog.cs b/src/Caliburn.Micro.Core/ILog.cs similarity index 100% rename from src/Caliburn.Micro/ILog.cs rename to src/Caliburn.Micro.Core/ILog.cs diff --git a/src/Caliburn.Micro/INotifyPropertyChangedEx.cs b/src/Caliburn.Micro.Core/INotifyPropertyChangedEx.cs similarity index 100% rename from src/Caliburn.Micro/INotifyPropertyChangedEx.cs rename to src/Caliburn.Micro.Core/INotifyPropertyChangedEx.cs diff --git a/src/Caliburn.Micro/IObservableCollection.cs b/src/Caliburn.Micro.Core/IObservableCollection.cs similarity index 100% rename from src/Caliburn.Micro/IObservableCollection.cs rename to src/Caliburn.Micro.Core/IObservableCollection.cs diff --git a/src/Caliburn.Micro/IParent.cs b/src/Caliburn.Micro.Core/IParent.cs similarity index 100% rename from src/Caliburn.Micro/IParent.cs rename to src/Caliburn.Micro.Core/IParent.cs diff --git a/src/Caliburn.Micro/IPlatformProvider.cs b/src/Caliburn.Micro.Core/IPlatformProvider.cs similarity index 100% rename from src/Caliburn.Micro/IPlatformProvider.cs rename to src/Caliburn.Micro.Core/IPlatformProvider.cs diff --git a/src/Caliburn.Micro/IResult.cs b/src/Caliburn.Micro.Core/IResult.cs similarity index 100% rename from src/Caliburn.Micro/IResult.cs rename to src/Caliburn.Micro.Core/IResult.cs diff --git a/src/Caliburn.Micro/IScreen.cs b/src/Caliburn.Micro.Core/IScreen.cs similarity index 100% rename from src/Caliburn.Micro/IScreen.cs rename to src/Caliburn.Micro.Core/IScreen.cs diff --git a/src/Caliburn.Micro/IViewAware.cs b/src/Caliburn.Micro.Core/IViewAware.cs similarity index 100% rename from src/Caliburn.Micro/IViewAware.cs rename to src/Caliburn.Micro.Core/IViewAware.cs diff --git a/src/Caliburn.Micro/IoC.cs b/src/Caliburn.Micro.Core/IoC.cs similarity index 100% rename from src/Caliburn.Micro/IoC.cs rename to src/Caliburn.Micro.Core/IoC.cs diff --git a/src/Caliburn.Micro/LogManager.cs b/src/Caliburn.Micro.Core/LogManager.cs similarity index 100% rename from src/Caliburn.Micro/LogManager.cs rename to src/Caliburn.Micro.Core/LogManager.cs diff --git a/src/Caliburn.Micro/OverrideCancelResultDecorator.cs b/src/Caliburn.Micro.Core/OverrideCancelResultDecorator.cs similarity index 100% rename from src/Caliburn.Micro/OverrideCancelResultDecorator.cs rename to src/Caliburn.Micro.Core/OverrideCancelResultDecorator.cs diff --git a/src/Caliburn.Micro/PlatformProvider.cs b/src/Caliburn.Micro.Core/PlatformProvider.cs similarity index 100% rename from src/Caliburn.Micro/PlatformProvider.cs rename to src/Caliburn.Micro.Core/PlatformProvider.cs diff --git a/src/Caliburn.Micro/Properties/AssemblyInfo.cs b/src/Caliburn.Micro.Core/Properties/AssemblyInfo.cs similarity index 100% rename from src/Caliburn.Micro/Properties/AssemblyInfo.cs rename to src/Caliburn.Micro.Core/Properties/AssemblyInfo.cs diff --git a/src/Caliburn.Micro/PropertyChangedBase.cs b/src/Caliburn.Micro.Core/PropertyChangedBase.cs similarity index 100% rename from src/Caliburn.Micro/PropertyChangedBase.cs rename to src/Caliburn.Micro.Core/PropertyChangedBase.cs diff --git a/src/Caliburn.Micro/RescueResultDecorator.cs b/src/Caliburn.Micro.Core/RescueResultDecorator.cs similarity index 100% rename from src/Caliburn.Micro/RescueResultDecorator.cs rename to src/Caliburn.Micro.Core/RescueResultDecorator.cs diff --git a/src/Caliburn.Micro/ResultCompletionEventArgs.cs b/src/Caliburn.Micro.Core/ResultCompletionEventArgs.cs similarity index 100% rename from src/Caliburn.Micro/ResultCompletionEventArgs.cs rename to src/Caliburn.Micro.Core/ResultCompletionEventArgs.cs diff --git a/src/Caliburn.Micro/ResultDecoratorBase.cs b/src/Caliburn.Micro.Core/ResultDecoratorBase.cs similarity index 100% rename from src/Caliburn.Micro/ResultDecoratorBase.cs rename to src/Caliburn.Micro.Core/ResultDecoratorBase.cs diff --git a/src/Caliburn.Micro/ResultExtensions.cs b/src/Caliburn.Micro.Core/ResultExtensions.cs similarity index 100% rename from src/Caliburn.Micro/ResultExtensions.cs rename to src/Caliburn.Micro.Core/ResultExtensions.cs diff --git a/src/Caliburn.Micro/Screen.cs b/src/Caliburn.Micro.Core/Screen.cs similarity index 100% rename from src/Caliburn.Micro/Screen.cs rename to src/Caliburn.Micro.Core/Screen.cs diff --git a/src/Caliburn.Micro/ScreenExtensions.cs b/src/Caliburn.Micro.Core/ScreenExtensions.cs similarity index 100% rename from src/Caliburn.Micro/ScreenExtensions.cs rename to src/Caliburn.Micro.Core/ScreenExtensions.cs diff --git a/src/Caliburn.Micro/SequentialResult.cs b/src/Caliburn.Micro.Core/SequentialResult.cs similarity index 100% rename from src/Caliburn.Micro/SequentialResult.cs rename to src/Caliburn.Micro.Core/SequentialResult.cs diff --git a/src/Caliburn.Micro/SimpleContainer.cs b/src/Caliburn.Micro.Core/SimpleContainer.cs similarity index 100% rename from src/Caliburn.Micro/SimpleContainer.cs rename to src/Caliburn.Micro.Core/SimpleContainer.cs diff --git a/src/Caliburn.Micro/SimpleResult.cs b/src/Caliburn.Micro.Core/SimpleResult.cs similarity index 100% rename from src/Caliburn.Micro/SimpleResult.cs rename to src/Caliburn.Micro.Core/SimpleResult.cs diff --git a/src/Caliburn.Micro/TaskExtensions.cs b/src/Caliburn.Micro.Core/TaskExtensions.cs similarity index 100% rename from src/Caliburn.Micro/TaskExtensions.cs rename to src/Caliburn.Micro.Core/TaskExtensions.cs diff --git a/src/Caliburn.Micro/TaskResult.cs b/src/Caliburn.Micro.Core/TaskResult.cs similarity index 100% rename from src/Caliburn.Micro/TaskResult.cs rename to src/Caliburn.Micro.Core/TaskResult.cs diff --git a/src/Caliburn.Micro/ViewAttachedEventArgs.cs b/src/Caliburn.Micro.Core/ViewAttachedEventArgs.cs similarity index 100% rename from src/Caliburn.Micro/ViewAttachedEventArgs.cs rename to src/Caliburn.Micro.Core/ViewAttachedEventArgs.cs diff --git a/src/Caliburn.Micro/ViewAware.cs b/src/Caliburn.Micro.Core/ViewAware.cs similarity index 100% rename from src/Caliburn.Micro/ViewAware.cs rename to src/Caliburn.Micro.Core/ViewAware.cs diff --git a/src/Caliburn.Micro/WeakValueDictionary.cs b/src/Caliburn.Micro.Core/WeakValueDictionary.cs similarity index 100% rename from src/Caliburn.Micro/WeakValueDictionary.cs rename to src/Caliburn.Micro.Core/WeakValueDictionary.cs diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj index 43fb96c3..76227539 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj @@ -58,8 +58,7 @@ - - {614e1789-d938-4c8b-9d46-ba99160d22e0} + Caliburn.Micro.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj index 70c11186..d83fb377 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj @@ -58,8 +58,8 @@ - - {614e1789-d938-4c8b-9d46-ba99160d22e0} + + {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj index 195b0f57..b44667f6 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj @@ -96,8 +96,8 @@ - - {614e1789-d938-4c8b-9d46-ba99160d22e0} + + {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj index 5c0a572a..fb2b593c 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj @@ -117,14 +117,14 @@ + + {026678e0-a3e4-4760-a277-87352392fb6e} + Caliburn.Micro.Core + {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} Caliburn.Micro.Platform.Core - - {614e1789-d938-4c8b-9d46-ba99160d22e0} - Caliburn.Micro.Core - diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj index 837a1004..a0f0baab 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj @@ -78,8 +78,8 @@ - - {614e1789-d938-4c8b-9d46-ba99160d22e0} + + {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj index d9a2c327..e80a0192 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj @@ -48,8 +48,8 @@ - - {614e1789-d938-4c8b-9d46-ba99160d22e0} + + {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core diff --git a/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj b/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj index 98bfe2e1..8492c319 100644 --- a/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj +++ b/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj @@ -73,6 +73,10 @@ + + {026678e0-a3e4-4760-a277-87352392fb6e} + Caliburn.Micro.Core + {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} Caliburn.Micro.Platform.Core @@ -81,10 +85,6 @@ {ef2c0c7d-3ffe-4884-9aac-7622fee66809} Caliburn.Micro.Platform.NET45 - - {614e1789-d938-4c8b-9d46-ba99160d22e0} - Caliburn.Micro.Core - diff --git a/src/Caliburn.Micro.sln b/src/Caliburn.Micro.sln index 3525b97b..fe7fd1fa 100644 --- a/src/Caliburn.Micro.sln +++ b/src/Caliburn.Micro.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26430.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caliburn.Micro.Platform", "Caliburn.Micro.Platform", "{266A0FDB-CA59-4E27-B258-9552E368BE46}" EndProject @@ -21,7 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Cor EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.UWP", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.UWP.csproj", "{94D9A9C6-44C1-4E5A-877B-5761C963B2F6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Caliburn.Micro.Core", "Caliburn.Micro\Caliburn.Micro.Core.csproj", "{614E1789-D938-4C8B-9D46-BA99160D22E0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -147,22 +146,6 @@ Global {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x64.Build.0 = Release|x64 {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x86.ActiveCfg = Release|x86 {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x86.Build.0 = Release|x86 - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|ARM.ActiveCfg = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|ARM.Build.0 = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|x64.ActiveCfg = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|x64.Build.0 = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|x86.ActiveCfg = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Debug|x86.Build.0 = Debug|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|Any CPU.Build.0 = Release|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|ARM.ActiveCfg = Release|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|ARM.Build.0 = Release|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|x64.ActiveCfg = Release|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|x64.Build.0 = Release|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|x86.ActiveCfg = Release|Any CPU - {614E1789-D938-4C8B-9D46-BA99160D22E0}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From caf6634517373c1a2d96c5e394dbbbcea7ab4c73 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Thu, 1 Jun 2017 23:18:36 +1200 Subject: [PATCH 012/142] #371 Extract Caliburn.Micro.Platform.Core --- .../AssemblySource.cs | 14 +--- .../Caliburn.Micro.Platform.Core.csproj | 21 ++++++ .../ExtensionMethods.cs | 33 +++++++++ .../NameTransformer.cs | 5 +- .../RegExHelper.cs | 0 .../StringSplitter.cs | 6 +- .../TypeMappingConfiguration.cs | 0 .../Caliburn.Micro.Platform.Android.csproj | 5 +- .../Caliburn.Micro.Platform.Core.csproj | 74 ------------------- .../Caliburn.Micro.Platform.NET45.csproj | 4 +- .../Caliburn.Micro.Platform.UWP.csproj | 4 +- ...liburn.Micro.Platform.Xamarin.Forms.csproj | 4 +- .../Caliburn.Micro.Platform.iOS.csproj | 4 +- src/Caliburn.Micro.Platform/ChildResolver.cs | 1 + .../ExtensionMethods.cs | 73 ------------------ src/Caliburn.Micro.Platform/MessageBinder.cs | 4 +- src/Caliburn.Micro.Platform/View.cs | 6 +- .../ViewModelBinder.cs | 2 +- .../xforms/ConventionManager.cs | 6 +- .../xforms/FormsApplication.cs | 5 +- .../Caliburn.Micro.Tests.NET45.csproj | 4 +- src/Caliburn.Micro.sln | 54 +++++++++----- 22 files changed, 121 insertions(+), 208 deletions(-) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Core}/AssemblySource.cs (88%) create mode 100644 src/Caliburn.Micro.Platform.Core/Caliburn.Micro.Platform.Core.csproj create mode 100644 src/Caliburn.Micro.Platform.Core/ExtensionMethods.cs rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Core}/NameTransformer.cs (98%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Core}/RegExHelper.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Core}/StringSplitter.cs (97%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Core}/TypeMappingConfiguration.cs (100%) delete mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj delete mode 100644 src/Caliburn.Micro.Platform/ExtensionMethods.cs diff --git a/src/Caliburn.Micro.Platform/AssemblySource.cs b/src/Caliburn.Micro.Platform.Core/AssemblySource.cs similarity index 88% rename from src/Caliburn.Micro.Platform/AssemblySource.cs rename to src/Caliburn.Micro.Platform.Core/AssemblySource.cs index d454648d..2c5dd1b8 100644 --- a/src/Caliburn.Micro.Platform/AssemblySource.cs +++ b/src/Caliburn.Micro.Platform.Core/AssemblySource.cs @@ -5,11 +5,6 @@ using System.ComponentModel; using System.Linq; using System.Reflection; -#if !WINDOWS_UWP - using System.Windows; -#else - using Windows.UI.Xaml; -#endif /// /// A source of assemblies that are inspectable by the framework. @@ -29,7 +24,7 @@ public static class AssemblySource { } var type = names - .Join(Instance.SelectMany(a => a.GetExportedTypes()), n => n, t => t.FullName, (n, t) => t) + .Join(Instance.SelectMany(a => a.ExportedTypes), n => n, t => t.FullName, (n, t) => t) .FirstOrDefault(); return type; }; @@ -46,12 +41,9 @@ public static class AssemblySourceCache { /// Extracts the types from the spezified assembly for storing in the cache. /// public static Func> ExtractTypes = assembly => - assembly.GetExportedTypes() + assembly.ExportedTypes .Where(t => -#if !CORE - typeof(UIElement).IsAssignableFrom(t) || -#endif - typeof(INotifyPropertyChanged).IsAssignableFrom(t)); + typeof(INotifyPropertyChanged).GetTypeInfo().IsAssignableFrom(t.GetTypeInfo())); /// /// Installs the caching subsystem. diff --git a/src/Caliburn.Micro.Platform.Core/Caliburn.Micro.Platform.Core.csproj b/src/Caliburn.Micro.Platform.Core/Caliburn.Micro.Platform.Core.csproj new file mode 100644 index 00000000..4fb7075f --- /dev/null +++ b/src/Caliburn.Micro.Platform.Core/Caliburn.Micro.Platform.Core.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.0 + Caliburn.Micro.Platform.Core + Caliburn.Micro + + + + ..\..\bin\netstandard\Debug + + + + ..\..\bin\netstandard\Release + + + + + + + \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform.Core/ExtensionMethods.cs b/src/Caliburn.Micro.Platform.Core/ExtensionMethods.cs new file mode 100644 index 00000000..d6bccced --- /dev/null +++ b/src/Caliburn.Micro.Platform.Core/ExtensionMethods.cs @@ -0,0 +1,33 @@ +namespace Caliburn.Micro { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + + /// + /// Generic extension methods used by the framework. + /// + public static class ExtensionMethods { + /// + /// Get's the name of the assembly. + /// + /// The assembly. + /// The assembly's name. + public static string GetAssemblyName(this Assembly assembly) { + return assembly.FullName.Remove(assembly.FullName.IndexOf(',')); + } + + /// + /// Gets the value for a key. If the key does not exist, return default(TValue); + /// + /// The type of the keys in the dictionary. + /// The type of the values in the dictionary. + /// The dictionary to call this method on. + /// The key to look up. + /// The key value. default(TValue) if this key is not in the dictionary. + public static TValue GetValueOrDefault(this IDictionary dictionary, TKey key) { + TValue result; + return dictionary.TryGetValue(key, out result) ? result : default(TValue); + } + } +} diff --git a/src/Caliburn.Micro.Platform/NameTransformer.cs b/src/Caliburn.Micro.Platform.Core/NameTransformer.cs similarity index 98% rename from src/Caliburn.Micro.Platform/NameTransformer.cs rename to src/Caliburn.Micro.Platform.Core/NameTransformer.cs index 91eb65a7..8fd720b7 100644 --- a/src/Caliburn.Micro.Platform/NameTransformer.cs +++ b/src/Caliburn.Micro.Platform.Core/NameTransformer.cs @@ -9,11 +9,8 @@ /// public class NameTransformer : BindableCollection { -#if NET - private const RegexOptions options = RegexOptions.Compiled; -#else private const RegexOptions options = RegexOptions.None; -#endif + bool useEagerRuleSelection = true; diff --git a/src/Caliburn.Micro.Platform/RegExHelper.cs b/src/Caliburn.Micro.Platform.Core/RegExHelper.cs similarity index 100% rename from src/Caliburn.Micro.Platform/RegExHelper.cs rename to src/Caliburn.Micro.Platform.Core/RegExHelper.cs diff --git a/src/Caliburn.Micro.Platform/StringSplitter.cs b/src/Caliburn.Micro.Platform.Core/StringSplitter.cs similarity index 97% rename from src/Caliburn.Micro.Platform/StringSplitter.cs rename to src/Caliburn.Micro.Platform.Core/StringSplitter.cs index 5cdaab86..a4f84970 100644 --- a/src/Caliburn.Micro.Platform/StringSplitter.cs +++ b/src/Caliburn.Micro.Platform.Core/StringSplitter.cs @@ -24,12 +24,8 @@ public static string[] Split(string message, char separator) var builder = new StringBuilder(); int squareBrackets = 0; -#if WINDOWS_UWP - foreach (var current in message.ToCharArray()) - { -#else + foreach (var current in message) { -#endif //Square brackets are used as delimiters, so only separators outside them count... if (current == '[') { diff --git a/src/Caliburn.Micro.Platform/TypeMappingConfiguration.cs b/src/Caliburn.Micro.Platform.Core/TypeMappingConfiguration.cs similarity index 100% rename from src/Caliburn.Micro.Platform/TypeMappingConfiguration.cs rename to src/Caliburn.Micro.Platform.Core/TypeMappingConfiguration.cs diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj index 76227539..f8b8c671 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj @@ -59,10 +59,11 @@ + {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} + + {04c6555d-50be-40be-9b3f-74fac0f73fa2} Caliburn.Micro.Platform.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj deleted file mode 100644 index d83fb377..00000000 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Core.csproj +++ /dev/null @@ -1,74 +0,0 @@ - - - - - 10.0 - Debug - AnyCPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A} - Library - Properties - Caliburn.Micro - Caliburn.Micro.Platform.Core - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile259 - v4.5 - ..\..\obj\portable-core\ - - - true - full - false - ..\..\bin\portable-core\Debug\ - TRACE;DEBUG;CORE - prompt - 4 - ..\..\bin\portable-mobile\Debug\Caliburn.Micro.Platform.Core.xml - - - pdbonly - true - ..\..\bin\portable-core\Release\ - TRACE;CORE - prompt - 4 - ..\..\bin\portable-mobile\Release\Caliburn.Micro.Platform.Core.xml - - - true - - - Caliburn.snk - - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - - {026678e0-a3e4-4760-a277-87352392fb6e} - Caliburn.Micro.Core - - - - - \ No newline at end of file diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj index b44667f6..dc63b86a 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj @@ -100,8 +100,8 @@ {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} + + {04c6555d-50be-40be-9b3f-74fac0f73fa2} Caliburn.Micro.Platform.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj index fb2b593c..08918ee7 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj @@ -121,8 +121,8 @@ {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} + + {04c6555d-50be-40be-9b3f-74fac0f73fa2} Caliburn.Micro.Platform.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj index a0f0baab..7250e4e5 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj @@ -82,8 +82,8 @@ {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} + + {04c6555d-50be-40be-9b3f-74fac0f73fa2} Caliburn.Micro.Platform.Core diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj index e80a0192..73352831 100644 --- a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj +++ b/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj @@ -52,8 +52,8 @@ {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} + + {04c6555d-50be-40be-9b3f-74fac0f73fa2} Caliburn.Micro.Platform.Core diff --git a/src/Caliburn.Micro.Platform/ChildResolver.cs b/src/Caliburn.Micro.Platform/ChildResolver.cs index 9197c852..58185ce5 100644 --- a/src/Caliburn.Micro.Platform/ChildResolver.cs +++ b/src/Caliburn.Micro.Platform/ChildResolver.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Reflection; #if WINDOWS_UWP using Windows.UI.Xaml; #else diff --git a/src/Caliburn.Micro.Platform/ExtensionMethods.cs b/src/Caliburn.Micro.Platform/ExtensionMethods.cs deleted file mode 100644 index e36a213b..00000000 --- a/src/Caliburn.Micro.Platform/ExtensionMethods.cs +++ /dev/null @@ -1,73 +0,0 @@ -namespace Caliburn.Micro { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - - /// - /// Generic extension methods used by the framework. - /// - public static class ExtensionMethods { - /// - /// Get's the name of the assembly. - /// - /// The assembly. - /// The assembly's name. - public static string GetAssemblyName(this Assembly assembly) { - return assembly.FullName.Remove(assembly.FullName.IndexOf(',')); - } - - /// - /// Gets all the attributes of a particular type. - /// - /// The type of attributes to get. - /// The member to inspect for attributes. - /// Whether or not to search for inherited attributes. - /// The list of attributes found. - public static IEnumerable GetAttributes(this MemberInfo member, bool inherit) { -#if WINDOWS_UWP || CORE - return member.GetCustomAttributes(inherit).OfType(); -#else - return Attribute.GetCustomAttributes(member, inherit).OfType(); -#endif - } - -#if WINDOWS_UWP || CORE - /// - /// Gets a collection of the public types defined in this assembly that are visible outside the assembly. - /// - /// The assembly. - /// A collection of the public types defined in this assembly that are visible outside the assembly. - /// - public static IEnumerable GetExportedTypes(this Assembly assembly) { - if (assembly == null) - throw new ArgumentNullException("assembly"); - - return assembly.ExportedTypes; - } - - /// - /// Returns a value that indicates whether the specified type can be assigned to the current type. - /// - /// The target type - /// The type to check. - /// true if the specified type can be assigned to this type; otherwise, false. - public static bool IsAssignableFrom(this Type target, Type type) { - return target.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()); - } -#endif - - /// - /// Gets the value for a key. If the key does not exist, return default(TValue); - /// - /// The type of the keys in the dictionary. - /// The type of the values in the dictionary. - /// The dictionary to call this method on. - /// The key to look up. - /// The key value. default(TValue) if this key is not in the dictionary. - public static TValue GetValueOrDefault(this IDictionary dictionary, TKey key) { - TValue result; - return dictionary.TryGetValue(key, out result) ? result : default(TValue); - } - } -} diff --git a/src/Caliburn.Micro.Platform/MessageBinder.cs b/src/Caliburn.Micro.Platform/MessageBinder.cs index f5a357ad..dfa5b7d6 100644 --- a/src/Caliburn.Micro.Platform/MessageBinder.cs +++ b/src/Caliburn.Micro.Platform/MessageBinder.cs @@ -102,7 +102,7 @@ public static object CoerceValue(Type destinationType, object providedValue, obj } var providedType = providedValue.GetType(); - if (destinationType.IsAssignableFrom(providedType)) { + if (destinationType.GetTypeInfo().IsAssignableFrom(providedType.GetTypeInfo())) { return providedValue; } @@ -137,7 +137,7 @@ public static object CoerceValue(Type destinationType, object providedValue, obj return Enum.ToObject(destinationType, providedValue); } - if (typeof (Guid).IsAssignableFrom(destinationType)) { + if (typeof (Guid).GetTypeInfo().IsAssignableFrom(destinationType.GetTypeInfo())) { var stringValue = providedValue as string; if (stringValue != null) { return new Guid(stringValue); diff --git a/src/Caliburn.Micro.Platform/View.cs b/src/Caliburn.Micro.Platform/View.cs index 1a662f9f..9a2c2d8b 100644 --- a/src/Caliburn.Micro.Platform/View.cs +++ b/src/Caliburn.Micro.Platform/View.cs @@ -234,7 +234,8 @@ public static void ExecuteOnLayoutUpdated(FrameworkElement element, EventHandler .GetValue(dependencyObject, null); #else var type = dependencyObject.GetType(); - var contentProperty = type.GetAttributes(true) + var contentProperty = type.GetCustomAttributes(typeof(ContentPropertyAttribute), true) + .OfType() .FirstOrDefault() ?? DefaultContentProperty; return type.GetProperty(contentProperty.Name) @@ -390,7 +391,8 @@ private static string GetContentPropertyName(Type type) { static bool SetContentPropertyCore(object targetLocation, object view) { try { var type = targetLocation.GetType(); - var contentProperty = type.GetAttributes(true) + var contentProperty = type.GetCustomAttributes(typeof(ContentPropertyAttribute), true) + .OfType() .FirstOrDefault() ?? DefaultContentProperty; type.GetProperty(contentProperty?.Name ?? DefaultContentProperty.Name) diff --git a/src/Caliburn.Micro.Platform/ViewModelBinder.cs b/src/Caliburn.Micro.Platform/ViewModelBinder.cs index bc726da4..ff4b0f8a 100644 --- a/src/Caliburn.Micro.Platform/ViewModelBinder.cs +++ b/src/Caliburn.Micro.Platform/ViewModelBinder.cs @@ -179,7 +179,7 @@ public static bool ShouldApplyConventions(FrameworkElement view) { }; static bool IsAsyncMethod(MethodInfo method) { - return typeof(Task).IsAssignableFrom(method.ReturnType) && + return typeof(Task).GetTypeInfo().IsAssignableFrom(method.ReturnType.GetTypeInfo()) && method.Name.EndsWith(AsyncSuffix, StringComparison.OrdinalIgnoreCase); } diff --git a/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs b/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs index 8fa4b5fe..614d26f4 100644 --- a/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs +++ b/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs @@ -142,7 +142,7 @@ public static class ConventionManager public static Action ApplyStringFormat = (binding, convention, property) => { #if !WINDOWS_UWP - if (typeof(DateTime).IsAssignableFrom(property.PropertyType)) + if (typeof(DateTime).GetTypeInfo().IsAssignableFrom(property.PropertyType.GetTypeInfo())) binding.StringFormat = "{0:d}"; #endif }; @@ -312,7 +312,7 @@ public static void ApplyItemTemplate(ItemsView itemsControl, P { if (property.PropertyType.GetTypeInfo().IsGenericType) { var itemType = property.PropertyType.GenericTypeArguments.First(); - if (itemType.GetTypeInfo().IsValueType || typeof (string).IsAssignableFrom(itemType)) { + if (itemType.GetTypeInfo().IsValueType || typeof (string).GetTypeInfo().IsAssignableFrom(itemType.GetTypeInfo())) { return; } } @@ -392,7 +392,7 @@ public static void ApplyHeaderTemplate(VisualElement element, BindableProperty h ? element.GetValue(headerTemplateSelectorProperty) : null; - if (template != null || selector != null || !typeof(IHaveDisplayName).IsAssignableFrom(viewModelType)) + if (template != null || selector != null || !typeof(IHaveDisplayName).GetTypeInfo().IsAssignableFrom(viewModelType.GetTypeInfo())) { return; } diff --git a/src/Caliburn.Micro.Platform/xforms/FormsApplication.cs b/src/Caliburn.Micro.Platform/xforms/FormsApplication.cs index d2b872f7..33f0cd43 100644 --- a/src/Caliburn.Micro.Platform/xforms/FormsApplication.cs +++ b/src/Caliburn.Micro.Platform/xforms/FormsApplication.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Reflection; using Xamarin.Forms; namespace Caliburn.Micro.Xamarin.Forms @@ -27,8 +28,8 @@ protected void Initialize() { AssemblySourceCache.ExtractTypes = assembly => { var baseTypes = baseExtractTypes(assembly); - var elementTypes = assembly.GetExportedTypes() - .Where(t => typeof (Element).IsAssignableFrom(t)); + var elementTypes = assembly.ExportedTypes + .Where(t => typeof (Element).GetTypeInfo().IsAssignableFrom(t.GetTypeInfo())); return baseTypes.Union(elementTypes); }; diff --git a/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj b/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj index 8492c319..79b9f408 100644 --- a/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj +++ b/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj @@ -77,8 +77,8 @@ {026678e0-a3e4-4760-a277-87352392fb6e} Caliburn.Micro.Core - - {0ecbe3d9-aed4-419d-a6e3-c53d5ce2a02a} + + {04c6555d-50be-40be-9b3f-74fac0f73fa2} Caliburn.Micro.Platform.Core diff --git a/src/Caliburn.Micro.sln b/src/Caliburn.Micro.sln index fe7fd1fa..b452b8f9 100644 --- a/src/Caliburn.Micro.sln +++ b/src/Caliburn.Micro.sln @@ -17,10 +17,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.iOS EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Xamarin.Forms", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.Xamarin.Forms.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Core", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.Core.csproj", "{0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.UWP", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.UWP.csproj", "{94D9A9C6-44C1-4E5A-877B-5761C963B2F6}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Caliburn.Micro.Core", "Caliburn.Micro.Core\Caliburn.Micro.Core.csproj", "{026678E0-A3E4-4760-A277-87352392FB6E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Core", "Caliburn.Micro.Platform.Core\Caliburn.Micro.Platform.Core.csproj", "{04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -114,22 +115,6 @@ Global {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x64.Build.0 = Release|Any CPU {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x86.ActiveCfg = Release|Any CPU {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x86.Build.0 = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|ARM.Build.0 = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|x64.ActiveCfg = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|x64.Build.0 = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|x86.ActiveCfg = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Debug|x86.Build.0 = Debug|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|Any CPU.Build.0 = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|ARM.ActiveCfg = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|ARM.Build.0 = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|x64.ActiveCfg = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|x64.Build.0 = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|x86.ActiveCfg = Release|Any CPU - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A}.Release|x86.Build.0 = Release|Any CPU {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Debug|ARM.ActiveCfg = Debug|ARM @@ -146,6 +131,38 @@ Global {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x64.Build.0 = Release|x64 {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x86.ActiveCfg = Release|x86 {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x86.Build.0 = Release|x86 + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|ARM.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|ARM.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x64.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x64.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x86.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x86.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|Any CPU.Build.0 = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|ARM.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|ARM.Build.0 = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x64.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x64.Build.0 = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x86.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x86.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|ARM.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|ARM.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x64.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x64.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x86.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x86.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|Any CPU.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|ARM.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|ARM.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x64.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x64.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x86.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -156,7 +173,6 @@ Global {1647828F-AD5F-4CC3-8A27-11F06428B877} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {67F9D3A8-F71E-4428-913F-C37AE82CDB24} = {266A0FDB-CA59-4E27-B258-9552E368BE46} - {0ECBE3D9-AED4-419D-A6E3-C53D5CE2A02A} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {94D9A9C6-44C1-4E5A-877B-5761C963B2F6} = {266A0FDB-CA59-4E27-B258-9552E368BE46} EndGlobalSection EndGlobal From c8185a60a5952a81f323a1c8b32e15c9b1dcf8b2 Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Thu, 1 Jun 2017 23:27:48 +1200 Subject: [PATCH 013/142] #371 Shift existing projects to Legacy folder Temporary while building multitargeting project --- .../Action.cs | 0 .../ActionExecutionContext.cs | 0 .../ActionMessage.cs | 0 .../Bind.cs | 0 .../BindingScope.cs | 0 .../BooleanToVisibilityConverter.cs | 0 .../Bootstrapper.cs | 0 .../Caliburn.Micro.Platform.Android.csproj | 0 ....Micro.Platform.Android.csproj.DotSettings | 0 .../Caliburn.Micro.Platform.NET45.csproj | 0 ...rn.Micro.Platform.NET45.csproj.DotSettings | 0 .../Caliburn.Micro.Platform.UWP.csproj | 0 .../Caliburn.Micro.Platform.UWP.project.json | 0 ...liburn.Micro.Platform.Xamarin.Forms.csproj | 0 ....Platform.Xamarin.Forms.csproj.DotSettings | 0 ...o.Platform.XamarinForms.csproj.DotSettings | 0 .../Caliburn.Micro.Platform.iOS.csproj | 0 ...burn.Micro.Platform.iOS.csproj.DotSettings | 0 .../Caliburn.snk | Bin .../ChildResolver.cs | 0 .../ConventionManager.cs | 0 .../DependencyPropertyHelper.cs | 0 .../ElementConvention.cs | 0 .../IHaveParameters.cs | 0 .../Message.cs | 0 .../MessageBinder.cs | 0 .../Parser.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../Caliburn.Micro.Platform.UWP.rd.xml | 0 .../View.cs | 0 .../ViewLocator.cs | 0 .../ViewModelBinder.cs | 0 .../ViewModelLocator.cs | 0 .../XamlPlatformProvider.cs | 0 .../android/ActivityEventArgs.cs | 0 .../ActivityLifecycleCallbackHandler.cs | 0 .../android/ActivityLocator.cs | 0 .../android/AndroidPlatformProvider.cs | 0 .../android/CaliburnApplication.cs | 0 .../iOS/CaliburnApplicationDelegate.cs | 0 .../iOS/IUIViewController.cs | 0 .../iOS/iOSPlatformProvider.cs | 0 .../net40/AttachedCollection.cs | 0 .../net40/INavigationService.cs | 0 .../net40/NavigationExtensions.cs | 0 .../net40/NavigationHelper.cs | 0 .../net40/Parameter.cs | 0 .../net40/WindowManager.cs | 0 ...kages.Caliburn.Micro.Platform.NET45.config | 0 ...liburn.Micro.Platform.Xamarin.Forms.config | 0 .../win8/AppManifestHelper.cs | 0 .../win8/AttachedCollection.81.cs | 0 .../win8/CachingFrameAdapter.cs | 0 .../win8/CaliburnApplication.cs | 0 .../win8/IAttachedObject.cs | 0 .../win8/INavigationService.cs | 0 .../win8/ISharingService.cs | 0 .../win8/ISupportSharing.cs | 0 .../win8/NavigateHelper.cs | 0 .../win8/NavigationExtensions.cs | 0 .../win8/Parameter.cs | 0 .../win8/SharingService.cs | 0 .../win8/TriggerAction.cs | 0 .../win8/WinRTContainer.cs | 0 .../win8/XamlMetadataProvider.cs | 0 .../xforms/ActionMessage.cs | 0 .../xforms/AttachedCollection.cs | 0 .../xforms/ConventionManager.cs | 0 .../DependencyPropertyChangedEventArgs.cs | 0 .../xforms/FormsApplication.cs | 0 .../xforms/FormsPlatformProvider.cs | 0 .../xforms/HttpUtility.cs | 0 .../xforms/IAttachedObject.cs | 0 .../xforms/INavigationService.cs | 0 .../xforms/NavigationExtensions.cs | 0 .../xforms/NavigationHelper.cs | 0 .../xforms/NavigationPageAdapter.cs | 0 .../xforms/Parameter.cs | 0 .../xforms/PropertyChangedCallback.cs | 0 .../xforms/RoutedEventArgs.cs | 0 .../xforms/RoutedEventHandler.cs | 0 .../xforms/TriggerActionBase.cs | 0 .../Caliburn.Micro.Tests.NET45.csproj | 2 +- src/Caliburn.Micro.sln | 148 +++++++++--------- 84 files changed, 75 insertions(+), 75 deletions(-) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Action.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ActionExecutionContext.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ActionMessage.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Bind.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/BindingScope.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/BooleanToVisibilityConverter.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Bootstrapper.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.Android.csproj (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.Android.csproj.DotSettings (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.NET45.csproj (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.NET45.csproj.DotSettings (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.UWP.csproj (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.UWP.project.json (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.Xamarin.Forms.csproj (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.Xamarin.Forms.csproj.DotSettings (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.XamarinForms.csproj.DotSettings (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.iOS.csproj (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.Micro.Platform.iOS.csproj.DotSettings (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Caliburn.snk (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ChildResolver.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ConventionManager.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/DependencyPropertyHelper.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ElementConvention.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/IHaveParameters.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Message.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/MessageBinder.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Parser.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Properties/AssemblyInfo.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/Properties/Caliburn.Micro.Platform.UWP.rd.xml (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/View.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ViewLocator.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ViewModelBinder.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/ViewModelLocator.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/XamlPlatformProvider.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/android/ActivityEventArgs.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/android/ActivityLifecycleCallbackHandler.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/android/ActivityLocator.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/android/AndroidPlatformProvider.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/android/CaliburnApplication.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/iOS/CaliburnApplicationDelegate.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/iOS/IUIViewController.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/iOS/iOSPlatformProvider.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/net40/AttachedCollection.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/net40/INavigationService.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/net40/NavigationExtensions.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/net40/NavigationHelper.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/net40/Parameter.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/net40/WindowManager.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/packages.Caliburn.Micro.Platform.NET45.config (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/packages.Caliburn.Micro.Platform.Xamarin.Forms.config (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/AppManifestHelper.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/AttachedCollection.81.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/CachingFrameAdapter.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/CaliburnApplication.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/IAttachedObject.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/INavigationService.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/ISharingService.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/ISupportSharing.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/NavigateHelper.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/NavigationExtensions.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/Parameter.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/SharingService.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/TriggerAction.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/WinRTContainer.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/win8/XamlMetadataProvider.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/ActionMessage.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/AttachedCollection.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/ConventionManager.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/DependencyPropertyChangedEventArgs.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/FormsApplication.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/FormsPlatformProvider.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/HttpUtility.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/IAttachedObject.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/INavigationService.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/NavigationExtensions.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/NavigationHelper.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/NavigationPageAdapter.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/Parameter.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/PropertyChangedCallback.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/RoutedEventArgs.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/RoutedEventHandler.cs (100%) rename src/{Caliburn.Micro.Platform => Caliburn.Micro.Platform.Legacy}/xforms/TriggerActionBase.cs (100%) diff --git a/src/Caliburn.Micro.Platform/Action.cs b/src/Caliburn.Micro.Platform.Legacy/Action.cs similarity index 100% rename from src/Caliburn.Micro.Platform/Action.cs rename to src/Caliburn.Micro.Platform.Legacy/Action.cs diff --git a/src/Caliburn.Micro.Platform/ActionExecutionContext.cs b/src/Caliburn.Micro.Platform.Legacy/ActionExecutionContext.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ActionExecutionContext.cs rename to src/Caliburn.Micro.Platform.Legacy/ActionExecutionContext.cs diff --git a/src/Caliburn.Micro.Platform/ActionMessage.cs b/src/Caliburn.Micro.Platform.Legacy/ActionMessage.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ActionMessage.cs rename to src/Caliburn.Micro.Platform.Legacy/ActionMessage.cs diff --git a/src/Caliburn.Micro.Platform/Bind.cs b/src/Caliburn.Micro.Platform.Legacy/Bind.cs similarity index 100% rename from src/Caliburn.Micro.Platform/Bind.cs rename to src/Caliburn.Micro.Platform.Legacy/Bind.cs diff --git a/src/Caliburn.Micro.Platform/BindingScope.cs b/src/Caliburn.Micro.Platform.Legacy/BindingScope.cs similarity index 100% rename from src/Caliburn.Micro.Platform/BindingScope.cs rename to src/Caliburn.Micro.Platform.Legacy/BindingScope.cs diff --git a/src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs b/src/Caliburn.Micro.Platform.Legacy/BooleanToVisibilityConverter.cs similarity index 100% rename from src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs rename to src/Caliburn.Micro.Platform.Legacy/BooleanToVisibilityConverter.cs diff --git a/src/Caliburn.Micro.Platform/Bootstrapper.cs b/src/Caliburn.Micro.Platform.Legacy/Bootstrapper.cs similarity index 100% rename from src/Caliburn.Micro.Platform/Bootstrapper.cs rename to src/Caliburn.Micro.Platform.Legacy/Bootstrapper.cs diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Android.csproj similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Android.csproj diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj.DotSettings b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Android.csproj.DotSettings similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Android.csproj.DotSettings rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Android.csproj.DotSettings diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.NET45.csproj similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.NET45.csproj diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj.DotSettings b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.NET45.csproj.DotSettings similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.NET45.csproj.DotSettings rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.NET45.csproj.DotSettings diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.UWP.csproj similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.csproj rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.UWP.csproj diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.project.json b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.UWP.project.json similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.UWP.project.json rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.UWP.project.json diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Xamarin.Forms.csproj similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Xamarin.Forms.csproj diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj.DotSettings b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Xamarin.Forms.csproj.DotSettings similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.Xamarin.Forms.csproj.DotSettings rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.Xamarin.Forms.csproj.DotSettings diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.XamarinForms.csproj.DotSettings b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.XamarinForms.csproj.DotSettings similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.XamarinForms.csproj.DotSettings rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.XamarinForms.csproj.DotSettings diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.iOS.csproj similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.iOS.csproj diff --git a/src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj.DotSettings b/src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.iOS.csproj.DotSettings similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.iOS.csproj.DotSettings rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.Micro.Platform.iOS.csproj.DotSettings diff --git a/src/Caliburn.Micro.Platform/Caliburn.snk b/src/Caliburn.Micro.Platform.Legacy/Caliburn.snk similarity index 100% rename from src/Caliburn.Micro.Platform/Caliburn.snk rename to src/Caliburn.Micro.Platform.Legacy/Caliburn.snk diff --git a/src/Caliburn.Micro.Platform/ChildResolver.cs b/src/Caliburn.Micro.Platform.Legacy/ChildResolver.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ChildResolver.cs rename to src/Caliburn.Micro.Platform.Legacy/ChildResolver.cs diff --git a/src/Caliburn.Micro.Platform/ConventionManager.cs b/src/Caliburn.Micro.Platform.Legacy/ConventionManager.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ConventionManager.cs rename to src/Caliburn.Micro.Platform.Legacy/ConventionManager.cs diff --git a/src/Caliburn.Micro.Platform/DependencyPropertyHelper.cs b/src/Caliburn.Micro.Platform.Legacy/DependencyPropertyHelper.cs similarity index 100% rename from src/Caliburn.Micro.Platform/DependencyPropertyHelper.cs rename to src/Caliburn.Micro.Platform.Legacy/DependencyPropertyHelper.cs diff --git a/src/Caliburn.Micro.Platform/ElementConvention.cs b/src/Caliburn.Micro.Platform.Legacy/ElementConvention.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ElementConvention.cs rename to src/Caliburn.Micro.Platform.Legacy/ElementConvention.cs diff --git a/src/Caliburn.Micro.Platform/IHaveParameters.cs b/src/Caliburn.Micro.Platform.Legacy/IHaveParameters.cs similarity index 100% rename from src/Caliburn.Micro.Platform/IHaveParameters.cs rename to src/Caliburn.Micro.Platform.Legacy/IHaveParameters.cs diff --git a/src/Caliburn.Micro.Platform/Message.cs b/src/Caliburn.Micro.Platform.Legacy/Message.cs similarity index 100% rename from src/Caliburn.Micro.Platform/Message.cs rename to src/Caliburn.Micro.Platform.Legacy/Message.cs diff --git a/src/Caliburn.Micro.Platform/MessageBinder.cs b/src/Caliburn.Micro.Platform.Legacy/MessageBinder.cs similarity index 100% rename from src/Caliburn.Micro.Platform/MessageBinder.cs rename to src/Caliburn.Micro.Platform.Legacy/MessageBinder.cs diff --git a/src/Caliburn.Micro.Platform/Parser.cs b/src/Caliburn.Micro.Platform.Legacy/Parser.cs similarity index 100% rename from src/Caliburn.Micro.Platform/Parser.cs rename to src/Caliburn.Micro.Platform.Legacy/Parser.cs diff --git a/src/Caliburn.Micro.Platform/Properties/AssemblyInfo.cs b/src/Caliburn.Micro.Platform.Legacy/Properties/AssemblyInfo.cs similarity index 100% rename from src/Caliburn.Micro.Platform/Properties/AssemblyInfo.cs rename to src/Caliburn.Micro.Platform.Legacy/Properties/AssemblyInfo.cs diff --git a/src/Caliburn.Micro.Platform/Properties/Caliburn.Micro.Platform.UWP.rd.xml b/src/Caliburn.Micro.Platform.Legacy/Properties/Caliburn.Micro.Platform.UWP.rd.xml similarity index 100% rename from src/Caliburn.Micro.Platform/Properties/Caliburn.Micro.Platform.UWP.rd.xml rename to src/Caliburn.Micro.Platform.Legacy/Properties/Caliburn.Micro.Platform.UWP.rd.xml diff --git a/src/Caliburn.Micro.Platform/View.cs b/src/Caliburn.Micro.Platform.Legacy/View.cs similarity index 100% rename from src/Caliburn.Micro.Platform/View.cs rename to src/Caliburn.Micro.Platform.Legacy/View.cs diff --git a/src/Caliburn.Micro.Platform/ViewLocator.cs b/src/Caliburn.Micro.Platform.Legacy/ViewLocator.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ViewLocator.cs rename to src/Caliburn.Micro.Platform.Legacy/ViewLocator.cs diff --git a/src/Caliburn.Micro.Platform/ViewModelBinder.cs b/src/Caliburn.Micro.Platform.Legacy/ViewModelBinder.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ViewModelBinder.cs rename to src/Caliburn.Micro.Platform.Legacy/ViewModelBinder.cs diff --git a/src/Caliburn.Micro.Platform/ViewModelLocator.cs b/src/Caliburn.Micro.Platform.Legacy/ViewModelLocator.cs similarity index 100% rename from src/Caliburn.Micro.Platform/ViewModelLocator.cs rename to src/Caliburn.Micro.Platform.Legacy/ViewModelLocator.cs diff --git a/src/Caliburn.Micro.Platform/XamlPlatformProvider.cs b/src/Caliburn.Micro.Platform.Legacy/XamlPlatformProvider.cs similarity index 100% rename from src/Caliburn.Micro.Platform/XamlPlatformProvider.cs rename to src/Caliburn.Micro.Platform.Legacy/XamlPlatformProvider.cs diff --git a/src/Caliburn.Micro.Platform/android/ActivityEventArgs.cs b/src/Caliburn.Micro.Platform.Legacy/android/ActivityEventArgs.cs similarity index 100% rename from src/Caliburn.Micro.Platform/android/ActivityEventArgs.cs rename to src/Caliburn.Micro.Platform.Legacy/android/ActivityEventArgs.cs diff --git a/src/Caliburn.Micro.Platform/android/ActivityLifecycleCallbackHandler.cs b/src/Caliburn.Micro.Platform.Legacy/android/ActivityLifecycleCallbackHandler.cs similarity index 100% rename from src/Caliburn.Micro.Platform/android/ActivityLifecycleCallbackHandler.cs rename to src/Caliburn.Micro.Platform.Legacy/android/ActivityLifecycleCallbackHandler.cs diff --git a/src/Caliburn.Micro.Platform/android/ActivityLocator.cs b/src/Caliburn.Micro.Platform.Legacy/android/ActivityLocator.cs similarity index 100% rename from src/Caliburn.Micro.Platform/android/ActivityLocator.cs rename to src/Caliburn.Micro.Platform.Legacy/android/ActivityLocator.cs diff --git a/src/Caliburn.Micro.Platform/android/AndroidPlatformProvider.cs b/src/Caliburn.Micro.Platform.Legacy/android/AndroidPlatformProvider.cs similarity index 100% rename from src/Caliburn.Micro.Platform/android/AndroidPlatformProvider.cs rename to src/Caliburn.Micro.Platform.Legacy/android/AndroidPlatformProvider.cs diff --git a/src/Caliburn.Micro.Platform/android/CaliburnApplication.cs b/src/Caliburn.Micro.Platform.Legacy/android/CaliburnApplication.cs similarity index 100% rename from src/Caliburn.Micro.Platform/android/CaliburnApplication.cs rename to src/Caliburn.Micro.Platform.Legacy/android/CaliburnApplication.cs diff --git a/src/Caliburn.Micro.Platform/iOS/CaliburnApplicationDelegate.cs b/src/Caliburn.Micro.Platform.Legacy/iOS/CaliburnApplicationDelegate.cs similarity index 100% rename from src/Caliburn.Micro.Platform/iOS/CaliburnApplicationDelegate.cs rename to src/Caliburn.Micro.Platform.Legacy/iOS/CaliburnApplicationDelegate.cs diff --git a/src/Caliburn.Micro.Platform/iOS/IUIViewController.cs b/src/Caliburn.Micro.Platform.Legacy/iOS/IUIViewController.cs similarity index 100% rename from src/Caliburn.Micro.Platform/iOS/IUIViewController.cs rename to src/Caliburn.Micro.Platform.Legacy/iOS/IUIViewController.cs diff --git a/src/Caliburn.Micro.Platform/iOS/iOSPlatformProvider.cs b/src/Caliburn.Micro.Platform.Legacy/iOS/iOSPlatformProvider.cs similarity index 100% rename from src/Caliburn.Micro.Platform/iOS/iOSPlatformProvider.cs rename to src/Caliburn.Micro.Platform.Legacy/iOS/iOSPlatformProvider.cs diff --git a/src/Caliburn.Micro.Platform/net40/AttachedCollection.cs b/src/Caliburn.Micro.Platform.Legacy/net40/AttachedCollection.cs similarity index 100% rename from src/Caliburn.Micro.Platform/net40/AttachedCollection.cs rename to src/Caliburn.Micro.Platform.Legacy/net40/AttachedCollection.cs diff --git a/src/Caliburn.Micro.Platform/net40/INavigationService.cs b/src/Caliburn.Micro.Platform.Legacy/net40/INavigationService.cs similarity index 100% rename from src/Caliburn.Micro.Platform/net40/INavigationService.cs rename to src/Caliburn.Micro.Platform.Legacy/net40/INavigationService.cs diff --git a/src/Caliburn.Micro.Platform/net40/NavigationExtensions.cs b/src/Caliburn.Micro.Platform.Legacy/net40/NavigationExtensions.cs similarity index 100% rename from src/Caliburn.Micro.Platform/net40/NavigationExtensions.cs rename to src/Caliburn.Micro.Platform.Legacy/net40/NavigationExtensions.cs diff --git a/src/Caliburn.Micro.Platform/net40/NavigationHelper.cs b/src/Caliburn.Micro.Platform.Legacy/net40/NavigationHelper.cs similarity index 100% rename from src/Caliburn.Micro.Platform/net40/NavigationHelper.cs rename to src/Caliburn.Micro.Platform.Legacy/net40/NavigationHelper.cs diff --git a/src/Caliburn.Micro.Platform/net40/Parameter.cs b/src/Caliburn.Micro.Platform.Legacy/net40/Parameter.cs similarity index 100% rename from src/Caliburn.Micro.Platform/net40/Parameter.cs rename to src/Caliburn.Micro.Platform.Legacy/net40/Parameter.cs diff --git a/src/Caliburn.Micro.Platform/net40/WindowManager.cs b/src/Caliburn.Micro.Platform.Legacy/net40/WindowManager.cs similarity index 100% rename from src/Caliburn.Micro.Platform/net40/WindowManager.cs rename to src/Caliburn.Micro.Platform.Legacy/net40/WindowManager.cs diff --git a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.NET45.config b/src/Caliburn.Micro.Platform.Legacy/packages.Caliburn.Micro.Platform.NET45.config similarity index 100% rename from src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.NET45.config rename to src/Caliburn.Micro.Platform.Legacy/packages.Caliburn.Micro.Platform.NET45.config diff --git a/src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.Xamarin.Forms.config b/src/Caliburn.Micro.Platform.Legacy/packages.Caliburn.Micro.Platform.Xamarin.Forms.config similarity index 100% rename from src/Caliburn.Micro.Platform/packages.Caliburn.Micro.Platform.Xamarin.Forms.config rename to src/Caliburn.Micro.Platform.Legacy/packages.Caliburn.Micro.Platform.Xamarin.Forms.config diff --git a/src/Caliburn.Micro.Platform/win8/AppManifestHelper.cs b/src/Caliburn.Micro.Platform.Legacy/win8/AppManifestHelper.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/AppManifestHelper.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/AppManifestHelper.cs diff --git a/src/Caliburn.Micro.Platform/win8/AttachedCollection.81.cs b/src/Caliburn.Micro.Platform.Legacy/win8/AttachedCollection.81.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/AttachedCollection.81.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/AttachedCollection.81.cs diff --git a/src/Caliburn.Micro.Platform/win8/CachingFrameAdapter.cs b/src/Caliburn.Micro.Platform.Legacy/win8/CachingFrameAdapter.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/CachingFrameAdapter.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/CachingFrameAdapter.cs diff --git a/src/Caliburn.Micro.Platform/win8/CaliburnApplication.cs b/src/Caliburn.Micro.Platform.Legacy/win8/CaliburnApplication.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/CaliburnApplication.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/CaliburnApplication.cs diff --git a/src/Caliburn.Micro.Platform/win8/IAttachedObject.cs b/src/Caliburn.Micro.Platform.Legacy/win8/IAttachedObject.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/IAttachedObject.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/IAttachedObject.cs diff --git a/src/Caliburn.Micro.Platform/win8/INavigationService.cs b/src/Caliburn.Micro.Platform.Legacy/win8/INavigationService.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/INavigationService.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/INavigationService.cs diff --git a/src/Caliburn.Micro.Platform/win8/ISharingService.cs b/src/Caliburn.Micro.Platform.Legacy/win8/ISharingService.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/ISharingService.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/ISharingService.cs diff --git a/src/Caliburn.Micro.Platform/win8/ISupportSharing.cs b/src/Caliburn.Micro.Platform.Legacy/win8/ISupportSharing.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/ISupportSharing.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/ISupportSharing.cs diff --git a/src/Caliburn.Micro.Platform/win8/NavigateHelper.cs b/src/Caliburn.Micro.Platform.Legacy/win8/NavigateHelper.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/NavigateHelper.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/NavigateHelper.cs diff --git a/src/Caliburn.Micro.Platform/win8/NavigationExtensions.cs b/src/Caliburn.Micro.Platform.Legacy/win8/NavigationExtensions.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/NavigationExtensions.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/NavigationExtensions.cs diff --git a/src/Caliburn.Micro.Platform/win8/Parameter.cs b/src/Caliburn.Micro.Platform.Legacy/win8/Parameter.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/Parameter.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/Parameter.cs diff --git a/src/Caliburn.Micro.Platform/win8/SharingService.cs b/src/Caliburn.Micro.Platform.Legacy/win8/SharingService.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/SharingService.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/SharingService.cs diff --git a/src/Caliburn.Micro.Platform/win8/TriggerAction.cs b/src/Caliburn.Micro.Platform.Legacy/win8/TriggerAction.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/TriggerAction.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/TriggerAction.cs diff --git a/src/Caliburn.Micro.Platform/win8/WinRTContainer.cs b/src/Caliburn.Micro.Platform.Legacy/win8/WinRTContainer.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/WinRTContainer.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/WinRTContainer.cs diff --git a/src/Caliburn.Micro.Platform/win8/XamlMetadataProvider.cs b/src/Caliburn.Micro.Platform.Legacy/win8/XamlMetadataProvider.cs similarity index 100% rename from src/Caliburn.Micro.Platform/win8/XamlMetadataProvider.cs rename to src/Caliburn.Micro.Platform.Legacy/win8/XamlMetadataProvider.cs diff --git a/src/Caliburn.Micro.Platform/xforms/ActionMessage.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/ActionMessage.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/ActionMessage.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/ActionMessage.cs diff --git a/src/Caliburn.Micro.Platform/xforms/AttachedCollection.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/AttachedCollection.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/AttachedCollection.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/AttachedCollection.cs diff --git a/src/Caliburn.Micro.Platform/xforms/ConventionManager.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/ConventionManager.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/ConventionManager.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/ConventionManager.cs diff --git a/src/Caliburn.Micro.Platform/xforms/DependencyPropertyChangedEventArgs.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/DependencyPropertyChangedEventArgs.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/DependencyPropertyChangedEventArgs.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/DependencyPropertyChangedEventArgs.cs diff --git a/src/Caliburn.Micro.Platform/xforms/FormsApplication.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/FormsApplication.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/FormsApplication.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/FormsApplication.cs diff --git a/src/Caliburn.Micro.Platform/xforms/FormsPlatformProvider.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/FormsPlatformProvider.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/FormsPlatformProvider.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/FormsPlatformProvider.cs diff --git a/src/Caliburn.Micro.Platform/xforms/HttpUtility.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/HttpUtility.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/HttpUtility.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/HttpUtility.cs diff --git a/src/Caliburn.Micro.Platform/xforms/IAttachedObject.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/IAttachedObject.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/IAttachedObject.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/IAttachedObject.cs diff --git a/src/Caliburn.Micro.Platform/xforms/INavigationService.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/INavigationService.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/INavigationService.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/INavigationService.cs diff --git a/src/Caliburn.Micro.Platform/xforms/NavigationExtensions.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/NavigationExtensions.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/NavigationExtensions.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/NavigationExtensions.cs diff --git a/src/Caliburn.Micro.Platform/xforms/NavigationHelper.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/NavigationHelper.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/NavigationHelper.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/NavigationHelper.cs diff --git a/src/Caliburn.Micro.Platform/xforms/NavigationPageAdapter.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/NavigationPageAdapter.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/NavigationPageAdapter.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/NavigationPageAdapter.cs diff --git a/src/Caliburn.Micro.Platform/xforms/Parameter.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/Parameter.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/Parameter.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/Parameter.cs diff --git a/src/Caliburn.Micro.Platform/xforms/PropertyChangedCallback.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/PropertyChangedCallback.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/PropertyChangedCallback.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/PropertyChangedCallback.cs diff --git a/src/Caliburn.Micro.Platform/xforms/RoutedEventArgs.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/RoutedEventArgs.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/RoutedEventArgs.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/RoutedEventArgs.cs diff --git a/src/Caliburn.Micro.Platform/xforms/RoutedEventHandler.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/RoutedEventHandler.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/RoutedEventHandler.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/RoutedEventHandler.cs diff --git a/src/Caliburn.Micro.Platform/xforms/TriggerActionBase.cs b/src/Caliburn.Micro.Platform.Legacy/xforms/TriggerActionBase.cs similarity index 100% rename from src/Caliburn.Micro.Platform/xforms/TriggerActionBase.cs rename to src/Caliburn.Micro.Platform.Legacy/xforms/TriggerActionBase.cs diff --git a/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj b/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj index 79b9f408..3f54bb58 100644 --- a/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj +++ b/src/Caliburn.Micro.Tests.NET45/Caliburn.Micro.Tests.NET45.csproj @@ -81,7 +81,7 @@ {04c6555d-50be-40be-9b3f-74fac0f73fa2} Caliburn.Micro.Platform.Core - + {ef2c0c7d-3ffe-4884-9aac-7622fee66809} Caliburn.Micro.Platform.NET45 diff --git a/src/Caliburn.Micro.sln b/src/Caliburn.Micro.sln index b452b8f9..17a12355 100644 --- a/src/Caliburn.Micro.sln +++ b/src/Caliburn.Micro.sln @@ -7,21 +7,21 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caliburn.Micro.Platform", " EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caliburn.Micro.Tests", "Caliburn.Micro.Tests", "{75218E6C-3CF6-4A27-877B-5563A2BFB4A3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.NET45", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.NET45.csproj", "{EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Tests.NET45", "Caliburn.Micro.Tests.NET45\Caliburn.Micro.Tests.NET45.csproj", "{374C996D-59C3-426D-B6BD-D884348BE7C8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Android", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.Android.csproj", "{1647828F-AD5F-4CC3-8A27-11F06428B877}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Caliburn.Micro.Core", "Caliburn.Micro.Core\Caliburn.Micro.Core.csproj", "{026678E0-A3E4-4760-A277-87352392FB6E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.iOS", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.iOS.csproj", "{F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Core", "Caliburn.Micro.Platform.Core\Caliburn.Micro.Platform.Core.csproj", "{04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Xamarin.Forms", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.Xamarin.Forms.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Android", "Caliburn.Micro.Platform.Legacy\Caliburn.Micro.Platform.Android.csproj", "{1647828F-AD5F-4CC3-8A27-11F06428B877}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.UWP", "Caliburn.Micro.Platform\Caliburn.Micro.Platform.UWP.csproj", "{94D9A9C6-44C1-4E5A-877B-5761C963B2F6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.iOS", "Caliburn.Micro.Platform.Legacy\Caliburn.Micro.Platform.iOS.csproj", "{F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Caliburn.Micro.Core", "Caliburn.Micro.Core\Caliburn.Micro.Core.csproj", "{026678E0-A3E4-4760-A277-87352392FB6E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.NET45", "Caliburn.Micro.Platform.Legacy\Caliburn.Micro.Platform.NET45.csproj", "{EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Core", "Caliburn.Micro.Platform.Core\Caliburn.Micro.Platform.Core.csproj", "{04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.UWP", "Caliburn.Micro.Platform.Legacy\Caliburn.Micro.Platform.UWP.csproj", "{94D9A9C6-44C1-4E5A-877B-5761C963B2F6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.Platform.Xamarin.Forms", "Caliburn.Micro.Platform.Legacy\Caliburn.Micro.Platform.Xamarin.Forms.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -35,22 +35,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|ARM.ActiveCfg = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|ARM.Build.0 = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x64.ActiveCfg = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x64.Build.0 = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x86.ActiveCfg = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x86.Build.0 = Debug|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|Any CPU.Build.0 = Release|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|ARM.ActiveCfg = Release|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|ARM.Build.0 = Release|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x64.ActiveCfg = Release|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x64.Build.0 = Release|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x86.ActiveCfg = Release|Any CPU - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x86.Build.0 = Release|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -67,6 +51,38 @@ Global {374C996D-59C3-426D-B6BD-D884348BE7C8}.Release|x64.Build.0 = Release|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Release|x86.ActiveCfg = Release|Any CPU {374C996D-59C3-426D-B6BD-D884348BE7C8}.Release|x86.Build.0 = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|ARM.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|ARM.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x64.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x64.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x86.ActiveCfg = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x86.Build.0 = Debug|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|Any CPU.Build.0 = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|ARM.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|ARM.Build.0 = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x64.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x64.Build.0 = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x86.ActiveCfg = Release|Any CPU + {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x86.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|ARM.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|ARM.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x64.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x64.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x86.ActiveCfg = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x86.Build.0 = Debug|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|Any CPU.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|ARM.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|ARM.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x64.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x64.Build.0 = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x86.ActiveCfg = Release|Any CPU + {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x86.Build.0 = Release|Any CPU {1647828F-AD5F-4CC3-8A27-11F06428B877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1647828F-AD5F-4CC3-8A27-11F06428B877}.Debug|Any CPU.Build.0 = Debug|Any CPU {1647828F-AD5F-4CC3-8A27-11F06428B877}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -99,22 +115,22 @@ Global {F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1}.Release|x64.Build.0 = Release|Any CPU {F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1}.Release|x86.ActiveCfg = Release|Any CPU {F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1}.Release|x86.Build.0 = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|Any CPU.Build.0 = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|ARM.ActiveCfg = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|ARM.Build.0 = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x64.ActiveCfg = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x64.Build.0 = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x86.ActiveCfg = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x86.Build.0 = Debug|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|Any CPU.ActiveCfg = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|Any CPU.Build.0 = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|ARM.ActiveCfg = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|ARM.Build.0 = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x64.ActiveCfg = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x64.Build.0 = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x86.ActiveCfg = Release|Any CPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x86.Build.0 = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|ARM.ActiveCfg = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|ARM.Build.0 = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x64.ActiveCfg = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x64.Build.0 = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x86.ActiveCfg = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Debug|x86.Build.0 = Debug|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|Any CPU.Build.0 = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|ARM.ActiveCfg = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|ARM.Build.0 = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x64.ActiveCfg = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x64.Build.0 = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x86.ActiveCfg = Release|Any CPU + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809}.Release|x86.Build.0 = Release|Any CPU {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Debug|ARM.ActiveCfg = Debug|ARM @@ -131,48 +147,32 @@ Global {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x64.Build.0 = Release|x64 {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x86.ActiveCfg = Release|x86 {94D9A9C6-44C1-4E5A-877B-5761C963B2F6}.Release|x86.Build.0 = Release|x86 - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|ARM.ActiveCfg = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|ARM.Build.0 = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x64.ActiveCfg = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x64.Build.0 = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x86.ActiveCfg = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Debug|x86.Build.0 = Debug|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|Any CPU.Build.0 = Release|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|ARM.ActiveCfg = Release|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|ARM.Build.0 = Release|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x64.ActiveCfg = Release|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x64.Build.0 = Release|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x86.ActiveCfg = Release|Any CPU - {026678E0-A3E4-4760-A277-87352392FB6E}.Release|x86.Build.0 = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|ARM.ActiveCfg = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|ARM.Build.0 = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x64.ActiveCfg = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x64.Build.0 = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x86.ActiveCfg = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Debug|x86.Build.0 = Debug|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|Any CPU.Build.0 = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|ARM.ActiveCfg = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|ARM.Build.0 = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x64.ActiveCfg = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x64.Build.0 = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x86.ActiveCfg = Release|Any CPU - {04C6555D-50BE-40BE-9B3F-74FAC0F73FA2}.Release|x86.Build.0 = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|ARM.ActiveCfg = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|ARM.Build.0 = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x64.ActiveCfg = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x64.Build.0 = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x86.ActiveCfg = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Debug|x86.Build.0 = Debug|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|Any CPU.Build.0 = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|ARM.ActiveCfg = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|ARM.Build.0 = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x64.ActiveCfg = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x64.Build.0 = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x86.ActiveCfg = Release|Any CPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {374C996D-59C3-426D-B6BD-D884348BE7C8} = {75218E6C-3CF6-4A27-877B-5563A2BFB4A3} {1647828F-AD5F-4CC3-8A27-11F06428B877} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {F2A3A287-ADA2-4FB8-A7AD-15B5BA92F2D1} = {266A0FDB-CA59-4E27-B258-9552E368BE46} - {67F9D3A8-F71E-4428-913F-C37AE82CDB24} = {266A0FDB-CA59-4E27-B258-9552E368BE46} + {EF2C0C7D-3FFE-4884-9AAC-7622FEE66809} = {266A0FDB-CA59-4E27-B258-9552E368BE46} {94D9A9C6-44C1-4E5A-877B-5761C963B2F6} = {266A0FDB-CA59-4E27-B258-9552E368BE46} + {67F9D3A8-F71E-4428-913F-C37AE82CDB24} = {266A0FDB-CA59-4E27-B258-9552E368BE46} EndGlobalSection EndGlobal From 3cf65610fbb6f840ca94162cfd0b6313c895455d Mon Sep 17 00:00:00 2001 From: Nigel Sampson Date: Thu, 1 Jun 2017 23:58:08 +1200 Subject: [PATCH 014/142] #371 Create Caliburn.Micro.Platform Inital framework targeting .NET 4.5 --- src/Caliburn.Micro.Platform/Action.cs | 186 ++++++ .../ActionExecutionContext.cs | 114 ++++ src/Caliburn.Micro.Platform/ActionMessage.cs | 553 +++++++++++++++++ src/Caliburn.Micro.Platform/Bind.cs | 222 +++++++ src/Caliburn.Micro.Platform/BindingScope.cs | 388 ++++++++++++ .../BooleanToVisibilityConverter.cs | 44 ++ src/Caliburn.Micro.Platform/Bootstrapper.cs | 211 +++++++ .../Caliburn.Micro.Platform.csproj | 28 + src/Caliburn.Micro.Platform/ChildResolver.cs | 64 ++ .../ConventionManager.cs | 562 ++++++++++++++++++ .../DependencyPropertyHelper.cs | 60 ++ .../ElementConvention.cs | 54 ++ .../IHaveParameters.cs | 16 + src/Caliburn.Micro.Platform/Message.cs | 143 +++++ src/Caliburn.Micro.Platform/MessageBinder.cs | 173 ++++++ src/Caliburn.Micro.Platform/Parser.cs | 359 +++++++++++ .../Platforms/WPF/AttachedCollection.cs | 85 +++ .../Platforms/WPF/INavigationService.cs | 382 ++++++++++++ .../Platforms/WPF/NavigationExtensions.cs | 21 + .../Platforms/WPF/NavigationHelper.cs | 58 ++ .../Platforms/WPF/Parameter.cs | 88 +++ .../Platforms/WPF/WindowManager.cs | 374 ++++++++++++ src/Caliburn.Micro.Platform/View.cs | 436 ++++++++++++++ src/Caliburn.Micro.Platform/ViewLocator.cs | 461 ++++++++++++++ .../ViewModelBinder.cs | 262 ++++++++ .../ViewModelLocator.cs | 428 +++++++++++++ .../XamlPlatformProvider.cs | 247 ++++++++ src/Caliburn.Micro.sln | 30 +- 28 files changed, 6037 insertions(+), 12 deletions(-) create mode 100644 src/Caliburn.Micro.Platform/Action.cs create mode 100644 src/Caliburn.Micro.Platform/ActionExecutionContext.cs create mode 100644 src/Caliburn.Micro.Platform/ActionMessage.cs create mode 100644 src/Caliburn.Micro.Platform/Bind.cs create mode 100644 src/Caliburn.Micro.Platform/BindingScope.cs create mode 100644 src/Caliburn.Micro.Platform/BooleanToVisibilityConverter.cs create mode 100644 src/Caliburn.Micro.Platform/Bootstrapper.cs create mode 100644 src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.csproj create mode 100644 src/Caliburn.Micro.Platform/ChildResolver.cs create mode 100644 src/Caliburn.Micro.Platform/ConventionManager.cs create mode 100644 src/Caliburn.Micro.Platform/DependencyPropertyHelper.cs create mode 100644 src/Caliburn.Micro.Platform/ElementConvention.cs create mode 100644 src/Caliburn.Micro.Platform/IHaveParameters.cs create mode 100644 src/Caliburn.Micro.Platform/Message.cs create mode 100644 src/Caliburn.Micro.Platform/MessageBinder.cs create mode 100644 src/Caliburn.Micro.Platform/Parser.cs create mode 100644 src/Caliburn.Micro.Platform/Platforms/WPF/AttachedCollection.cs create mode 100644 src/Caliburn.Micro.Platform/Platforms/WPF/INavigationService.cs create mode 100644 src/Caliburn.Micro.Platform/Platforms/WPF/NavigationExtensions.cs create mode 100644 src/Caliburn.Micro.Platform/Platforms/WPF/NavigationHelper.cs create mode 100644 src/Caliburn.Micro.Platform/Platforms/WPF/Parameter.cs create mode 100644 src/Caliburn.Micro.Platform/Platforms/WPF/WindowManager.cs create mode 100644 src/Caliburn.Micro.Platform/View.cs create mode 100644 src/Caliburn.Micro.Platform/ViewLocator.cs create mode 100644 src/Caliburn.Micro.Platform/ViewModelBinder.cs create mode 100644 src/Caliburn.Micro.Platform/ViewModelLocator.cs create mode 100644 src/Caliburn.Micro.Platform/XamlPlatformProvider.cs diff --git a/src/Caliburn.Micro.Platform/Action.cs b/src/Caliburn.Micro.Platform/Action.cs new file mode 100644 index 00000000..a7ed7b5c --- /dev/null +++ b/src/Caliburn.Micro.Platform/Action.cs @@ -0,0 +1,186 @@ +#if XFORMS +namespace Caliburn.Micro.Xamarin.Forms +#else +namespace Caliburn.Micro +#endif +{ +#if WINDOWS_UWP + using System.Linq; + using Windows.UI.Xaml; + using System.Reflection; +#elif XFORMS + using UIElement = global::Xamarin.Forms.Element; + using FrameworkElement = global::Xamarin.Forms.VisualElement; + using DependencyProperty = global::Xamarin.Forms.BindableProperty; + using DependencyObject = global::Xamarin.Forms.BindableObject; +#else + using System.Windows; +#endif + + /// + /// A host for action related attached properties. + /// + public static class Action { + static readonly ILog Log = LogManager.GetLog(typeof(Action)); + + /// + /// A property definition representing the target of an . The DataContext of the element will be set to this instance. + /// + public static readonly DependencyProperty TargetProperty = + DependencyPropertyHelper.RegisterAttached( + "Target", + typeof(object), + typeof(Action), + null, + OnTargetChanged + ); + + /// + /// A property definition representing the target of an . The DataContext of the element is not set to this instance. + /// + public static readonly DependencyProperty TargetWithoutContextProperty = + DependencyPropertyHelper.RegisterAttached( + "TargetWithoutContext", + typeof(object), + typeof(Action), + null, + OnTargetWithoutContextChanged + ); + + /// + /// Sets the target of the . + /// + /// The element to attach the target to. + /// The target for instances of . + public static void SetTarget(DependencyObject d, object target) { + d.SetValue(TargetProperty, target); + } + + /// + /// Gets the target for instances of . + /// + /// The element to which the target is attached. + /// The target for instances of + public static object GetTarget(DependencyObject d) { + return d.GetValue(TargetProperty); + } + + /// + /// Sets the target of the . + /// + /// The element to attach the target to. + /// The target for instances of . + /// + /// The DataContext will not be set. + /// + public static void SetTargetWithoutContext(DependencyObject d, object target) { + d.SetValue(TargetWithoutContextProperty, target); + } + + /// + /// Gets the target for instances of . + /// + /// The element to which the target is attached. + /// The target for instances of + public static object GetTargetWithoutContext(DependencyObject d) { + return d.GetValue(TargetWithoutContextProperty); + } + + /// + /// Checks if the -Target was set. + /// + /// DependencyObject to check + /// True if Target or TargetWithoutContext was set on + public static bool HasTargetSet(DependencyObject element) { + if (GetTarget(element) != null || GetTargetWithoutContext(element) != null) + return true; +#if XFORMS + return false; +#else + var frameworkElement = element as FrameworkElement; + if (frameworkElement == null) + return false; + + return ConventionManager.HasBinding(frameworkElement, TargetProperty) + || ConventionManager.HasBinding(frameworkElement, TargetWithoutContextProperty); +#endif + } + +#if !XFORMS + /// + /// Uses the action pipeline to invoke the method. + /// + /// The object instance to invoke the method on. + /// The name of the method to invoke. + /// The view. + /// The source of the invocation. + /// The event args. + /// The method parameters. + public static void Invoke(object target, string methodName, DependencyObject view = null, FrameworkElement source = null, object eventArgs = null, object[] parameters = null) { + + var message = new ActionMessage {MethodName = methodName}; + + var context = new ActionExecutionContext { + Target = target, +#if WINDOWS_UWP + Method = target.GetType().GetRuntimeMethods().Single(m => m.Name == methodName), +#else + Method = target.GetType().GetMethod(methodName), +#endif + Message = message, + View = view, + Source = source, + EventArgs = eventArgs + }; + + if (parameters != null) { + parameters.Apply(x => context.Message.Parameters.Add(x as Parameter ?? new Parameter { Value = x })); + } + + ActionMessage.InvokeAction(context); + + // This is a bit of hack but keeps message being garbage collected + Log.Info("Invoking action {0} on {1}.", message.MethodName, target); + } +#endif + + static void OnTargetWithoutContextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + SetTargetCore(e, d, false); + } + + static void OnTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + SetTargetCore(e, d, true); + } + + static void SetTargetCore(DependencyPropertyChangedEventArgs e, DependencyObject d, bool setContext) { + if (e.NewValue == e.OldValue || (Execute.InDesignMode && e.NewValue is string)) { + return; + } + + var target = e.NewValue; + var containerKey = e.NewValue as string; + if (containerKey != null) { + target = IoC.GetInstance(null, containerKey); + } +#if XFORMS + Log.Info("Attaching message handler {0} to {1}.", target, d); + Message.SetHandler(d, target); + + if (setContext && d is FrameworkElement) { + Log.Info("Setting DC of {0} to {1}.", d, target); + ((FrameworkElement)d).BindingContext = target; + } +#else + if (setContext && d is FrameworkElement) { + Log.Info("Setting DC of {0} to {1}.", d, target); + ((FrameworkElement)d).DataContext = target; + } + + Log.Info("Attaching message handler {0} to {1}.", target, d); + Message.SetHandler(d, target); +#endif + + + } + } +} diff --git a/src/Caliburn.Micro.Platform/ActionExecutionContext.cs b/src/Caliburn.Micro.Platform/ActionExecutionContext.cs new file mode 100644 index 00000000..57df00c9 --- /dev/null +++ b/src/Caliburn.Micro.Platform/ActionExecutionContext.cs @@ -0,0 +1,114 @@ +#if XFORMS +namespace Caliburn.Micro.Xamarin.Forms +#else +namespace Caliburn.Micro +#endif +{ + using System; + using System.Collections.Generic; + using System.Reflection; +#if WINDOWS_UWP + using Windows.UI.Xaml; +#elif XFORMS + using global::Xamarin.Forms; + using DependencyObject = global::Xamarin.Forms.BindableObject; + using DependencyProperty = global::Xamarin.Forms.BindableProperty; + using FrameworkElement = global::Xamarin.Forms.VisualElement; +#else + using System.Windows; +#endif + + /// + /// The context used during the execution of an Action or its guard. + /// + public class ActionExecutionContext : IDisposable { + private WeakReference message; + private WeakReference source; + private WeakReference target; + private WeakReference view; + private Dictionary values; + + /// + /// Determines whether the action can execute. + /// + /// Returns true if the action can execute, false otherwise. + public Func CanExecute; + + /// + /// Any event arguments associated with the action's invocation. + /// + public object EventArgs; + + /// + /// The actual method info to be invoked. + /// + public MethodInfo Method; + + /// + /// The message being executed. + /// + public ActionMessage Message { + get { return message == null ? null : message.Target as ActionMessage; } + set { message = new WeakReference(value); } + } + + /// + /// The source from which the message originates. + /// + public FrameworkElement Source { + get { return source == null ? null : source.Target as FrameworkElement; } + set { source = new WeakReference(value); } + } + + /// + /// The instance on which the action is invoked. + /// + public object Target { + get { return target == null ? null : target.Target; } + set { target = new WeakReference(value); } + } + + /// + /// The view associated with the target. + /// + public DependencyObject View { + get { return view == null ? null : view.Target as DependencyObject; } + set { view = new WeakReference(value); } + } + + /// + /// Gets or sets additional data needed to invoke the action. + /// + /// The data key. + /// Custom data associated with the context. + public object this[string key] { + get { + if (values == null) + values = new Dictionary(); + + object result; + values.TryGetValue(key, out result); + + return result; + } + set { + if (values == null) + values = new Dictionary(); + + values[key] = value; + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() { + Disposing(this, System.EventArgs.Empty); + } + + /// + /// Called when the execution context is disposed + /// + public event EventHandler Disposing = delegate { }; + } +} diff --git a/src/Caliburn.Micro.Platform/ActionMessage.cs b/src/Caliburn.Micro.Platform/ActionMessage.cs new file mode 100644 index 00000000..c51e54de --- /dev/null +++ b/src/Caliburn.Micro.Platform/ActionMessage.cs @@ -0,0 +1,553 @@ +namespace Caliburn.Micro { + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.Linq; + using System.Reflection; +#if WINDOWS_UWP + using Windows.UI.Xaml; + using Windows.UI.Xaml.Data; + using Windows.UI.Xaml.Markup; + using Windows.UI.Xaml.Media; + using Windows.UI.Xaml.Controls; + using Microsoft.Xaml.Interactivity; + using TriggerBase = Microsoft.Xaml.Interactivity.IBehavior; + using EventTrigger = Microsoft.Xaml.Interactions.Core.EventTriggerBehavior; +#else + using System.Windows; + using System.Windows.Controls; + using System.Windows.Controls.Primitives; + using System.Windows.Data; + using System.Windows.Interactivity; + using System.Windows.Markup; + using System.Windows.Media; + using EventTrigger = System.Windows.Interactivity.EventTrigger; +#endif + + /// + /// Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked. + /// +#if WINDOWS_UWP + [ContentProperty(Name = "Parameters")] +#else + [ContentProperty("Parameters")] + [DefaultTrigger(typeof(FrameworkElement), typeof(EventTrigger), "MouseLeftButtonDown")] + [DefaultTrigger(typeof(ButtonBase), typeof(EventTrigger), "Click")] + [TypeConstraint(typeof(FrameworkElement))] +#endif + public class ActionMessage : TriggerAction, IHaveParameters { + static readonly ILog Log = LogManager.GetLog(typeof(ActionMessage)); + ActionExecutionContext context; + + internal static readonly DependencyProperty HandlerProperty = DependencyProperty.RegisterAttached( + "Handler", + typeof(object), + typeof(ActionMessage), + new PropertyMetadata(null, HandlerPropertyChanged) + ); + + /// + /// Causes the action invocation to "double check" if the action should be invoked by executing the guard immediately before hand. + /// + /// This is disabled by default. If multiple actions are attached to the same element, you may want to enable this so that each individaul action checks its guard regardless of how the UI state appears. + public static bool EnforceGuardsDuringInvocation = false; + + /// + /// Causes the action to throw if it cannot locate the target or the method at invocation time. + /// + /// True by default. + public static bool ThrowsExceptions = true; + + /// + /// Represents the method name of an action message. + /// + public static readonly DependencyProperty MethodNameProperty = + DependencyProperty.Register( + "MethodName", + typeof(string), + typeof(ActionMessage), + null + ); + + /// + /// Represents the parameters of an action message. + /// + public static readonly DependencyProperty ParametersProperty = + DependencyProperty.Register( + "Parameters", + typeof(AttachedCollection), + typeof(ActionMessage), + null + ); + + /// + /// Creates an instance of . + /// + public ActionMessage() { + SetValue(ParametersProperty, new AttachedCollection()); + } + + /// + /// Gets or sets the name of the method to be invoked on the presentation model class. + /// + /// The name of the method. +#if !WINDOWS_UWP + [Category("Common Properties")] +#endif + public string MethodName { + get { return (string)GetValue(MethodNameProperty); } + set { SetValue(MethodNameProperty, value); } + } + + /// + /// Gets the parameters to pass as part of the method invocation. + /// + /// The parameters. +#if !WINDOWS_UWP + [Category("Common Properties")] +#endif + public AttachedCollection Parameters { + get { return (AttachedCollection)GetValue(ParametersProperty); } + } + + /// + /// Occurs before the message detaches from the associated object. + /// + public event EventHandler Detaching = delegate { }; + + /// + /// Called after the action is attached to an AssociatedObject. + /// +#if WINDOWS_UWP + protected override void OnAttached() { + if (!View.InDesignMode) { + Parameters.Attach(AssociatedObject); + Parameters.OfType().Apply(x => x.MakeAwareOf(this)); + + + if (View.ExecuteOnLoad(AssociatedObject, ElementLoaded)) { + // Not yet sure if this will be needed + //var trigger = Interaction.GetTriggers(AssociatedObject) + // .FirstOrDefault(t => t.Actions.Contains(this)) as EventTrigger; + //if (trigger != null && trigger.EventName == "Loaded") + // Invoke(new RoutedEventArgs()); + } + + View.ExecuteOnUnload(AssociatedObject, ElementUnloaded); + } + + base.OnAttached(); + } + + void ElementUnloaded(object sender, RoutedEventArgs e) + { + OnDetaching(); + } +#else + protected override void OnAttached() { + if (!View.InDesignMode) { + Parameters.Attach(AssociatedObject); + Parameters.Apply(x => x.MakeAwareOf(this)); + + if (View.ExecuteOnLoad(AssociatedObject, ElementLoaded)) { + var trigger = Interaction.GetTriggers(AssociatedObject) + .FirstOrDefault(t => t.Actions.Contains(this)) as EventTrigger; + if (trigger != null && trigger.EventName == "Loaded") + Invoke(new RoutedEventArgs()); + } + } + + base.OnAttached(); + } +#endif + + static void HandlerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + ((ActionMessage)d).UpdateContext(); + } + + /// + /// Called when the action is being detached from its AssociatedObject, but before it has actually occurred. + /// + protected override void OnDetaching() { + if (!View.InDesignMode) { + Detaching(this, EventArgs.Empty); + AssociatedObject.Loaded -= ElementLoaded; + Parameters.Detach(); + } + + base.OnDetaching(); + } + + void ElementLoaded(object sender, RoutedEventArgs e) { + UpdateContext(); + + DependencyObject currentElement; + if (context.View == null) { + currentElement = AssociatedObject; + while (currentElement != null) { + if (Action.HasTargetSet(currentElement)) + break; + + currentElement = BindingScope.GetVisualParent(currentElement); + } + } + else currentElement = context.View; + +#if NET + var binding = new Binding { + Path = new PropertyPath(Message.HandlerProperty), + Source = currentElement + }; +#elif WINDOWS_UWP + var binding = new Binding { + Source = currentElement + }; +#else + const string bindingText = ""; + + var binding = (Binding)XamlReader.Load(bindingText); + binding.Source = currentElement; +#endif + BindingOperations.SetBinding(this, HandlerProperty, binding); + } + + void UpdateContext() { + if (context != null) + context.Dispose(); + + context = new ActionExecutionContext { + Message = this, + Source = AssociatedObject + }; + + PrepareContext(context); + UpdateAvailabilityCore(); + } + + /// + /// Invokes the action. + /// + /// The parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference. + protected override void Invoke(object eventArgs) { + Log.Info("Invoking {0}.", this); + + if (context == null) { + UpdateContext(); + } + + if (context.Target == null || context.View == null) { + PrepareContext(context); + if (context.Target == null) { + var ex = new Exception(string.Format("No target found for method {0}.", context.Message.MethodName)); + Log.Error(ex); + + if (!ThrowsExceptions) + return; + throw ex; + } + + if (!UpdateAvailabilityCore()) { + return; + } + } + + if (context.Method == null) { + var ex = new Exception(string.Format("Method {0} not found on target of type {1}.", context.Message.MethodName, context.Target.GetType())); + Log.Error(ex); + + if (!ThrowsExceptions) + return; + throw ex; + } + + context.EventArgs = eventArgs; + + if (EnforceGuardsDuringInvocation && context.CanExecute != null && !context.CanExecute()) { + return; + } + + InvokeAction(context); + context.EventArgs = null; + } + + /// + /// Forces an update of the UI's Enabled/Disabled state based on the the preconditions associated with the method. + /// + public virtual void UpdateAvailability() { + if (context == null) + return; + + if (context.Target == null || context.View == null) + PrepareContext(context); + + UpdateAvailabilityCore(); + } + + bool UpdateAvailabilityCore() { + Log.Info("{0} availability update.", this); + return ApplyAvailabilityEffect(context); + } + + /// + /// Returns a that represents the current . + /// + /// + /// A that represents the current . + /// + public override string ToString() { + return "Action: " + MethodName; + } + + /// + /// Invokes the action using the specified + /// + public static Action InvokeAction = context => { + var values = MessageBinder.DetermineParameters(context, context.Method.GetParameters()); + var returnValue = context.Method.Invoke(context.Target, values); + + var task = returnValue as System.Threading.Tasks.Task; + if (task != null) { + returnValue = task.AsResult(); + } + + var result = returnValue as IResult; + if (result != null) { + returnValue = new[] { result }; + } + + var enumerable = returnValue as IEnumerable; + if (enumerable != null) { + returnValue = enumerable.GetEnumerator(); + } + + var enumerator = returnValue as IEnumerator; + if (enumerator != null) { + Coroutine.BeginExecute(enumerator, + new CoroutineExecutionContext + { + Source = context.Source, + View = context.View, + Target = context.Target + }); + } + }; + + /// + /// Applies an availability effect, such as IsEnabled, to an element. + /// + /// Returns a value indicating whether or not the action is available. + public static Func ApplyAvailabilityEffect = context => { + +#if WINDOWS_UWP + var source = context.Source as Control; +#else + var source = context.Source; +#endif + if (source == null) { + return true; + } + +#if WINDOWS_UWP + var hasBinding = ConventionManager.HasBinding(source, Control.IsEnabledProperty); +#else + var hasBinding = ConventionManager.HasBinding(source, UIElement.IsEnabledProperty); +#endif + if (!hasBinding && context.CanExecute != null) { + source.IsEnabled = context.CanExecute(); + } + + return source.IsEnabled; + }; + + /// + /// Finds the method on the target matching the specified message. + /// + /// The target. + /// The message. + /// The matching method, if available. + public static Func GetTargetMethod = (message, target) => { +#if WINDOWS_UWP + return (from method in target.GetType().GetRuntimeMethods() + where method.Name == message.MethodName + let methodParameters = method.GetParameters() + where message.Parameters.Count == methodParameters.Length + select method).FirstOrDefault(); +#else + return (from method in target.GetType().GetMethods() + where method.Name == message.MethodName + let methodParameters = method.GetParameters() + where message.Parameters.Count == methodParameters.Length + select method).FirstOrDefault(); +#endif + }; + + /// + /// Sets the target, method and view on the context. Uses a bubbling strategy by default. + /// + public static Action SetMethodBinding = context => { + var source = context.Source; + + DependencyObject currentElement = source; + while (currentElement != null) { + if (Action.HasTargetSet(currentElement)) { + var target = Message.GetHandler(currentElement); + if (target != null) { + var method = GetTargetMethod(context.Message, target); + if (method != null) { + context.Method = method; + context.Target = target; + context.View = currentElement; + return; + } + } + else { + context.View = currentElement; + return; + } + } + + currentElement = BindingScope.GetVisualParent(currentElement); + } + + if (source != null && source.DataContext != null) { + var target = source.DataContext; + var method = GetTargetMethod(context.Message, target); + + if (method != null) { + context.Target = target; + context.Method = method; + context.View = source; + } + } + }; + + /// + /// Prepares the action execution context for use. + /// + public static Action PrepareContext = context => { + SetMethodBinding(context); + if (context.Target == null || context.Method == null) + { + return; + } + var possibleGuardNames = BuildPossibleGuardNames(context.Method).ToList(); + + var guard = TryFindGuardMethod(context, possibleGuardNames); + + if (guard == null) + { + var inpc = context.Target as INotifyPropertyChanged; + if (inpc == null) + return; + + var targetType = context.Target.GetType(); + string matchingGuardName = null; + foreach (string possibleGuardName in possibleGuardNames) + { + matchingGuardName = possibleGuardName; + guard = GetMethodInfo(targetType, "get_" + matchingGuardName); + if (guard != null) break; + } + + if (guard == null) + return; + + PropertyChangedEventHandler handler = null; + handler = (s, e) => { + if (string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == matchingGuardName) + { + Caliburn.Micro.Execute.OnUIThread(() => { + var message = context.Message; + if (message == null) + { + inpc.PropertyChanged -= handler; + return; + } + message.UpdateAvailability(); + }); + } + }; + + inpc.PropertyChanged += handler; + context.Disposing += delegate { inpc.PropertyChanged -= handler; }; + context.Message.Detaching += delegate { inpc.PropertyChanged -= handler; }; + } + + context.CanExecute = () => (bool)guard.Invoke( + context.Target, + MessageBinder.DetermineParameters(context, guard.GetParameters())); + }; + + /// + /// Try to find a candidate for guard function, having: + /// - a name matching any of + /// - no generic parameters + /// - a bool return type + /// - no parameters or a set of parameters corresponding to the action method + /// + /// The execution context + /// Method names to look for. + ///A MethodInfo, if found; null otherwise + static MethodInfo TryFindGuardMethod(ActionExecutionContext context, IEnumerable possibleGuardNames) { + var targetType = context.Target.GetType(); + MethodInfo guard = null; + foreach (string possibleGuardName in possibleGuardNames) + { + guard = GetMethodInfo(targetType, possibleGuardName); + if (guard != null) break; + } + + if (guard == null) return null; + if (guard.ContainsGenericParameters) return null; + if (!typeof(bool).Equals(guard.ReturnType)) return null; + + var guardPars = guard.GetParameters(); + var actionPars = context.Method.GetParameters(); + if (guardPars.Length == 0) return guard; + if (guardPars.Length != actionPars.Length) return null; + + var comparisons = guardPars.Zip( + context.Method.GetParameters(), + (x, y) => x.ParameterType == y.ParameterType + ); + + if (comparisons.Any(x => !x)) + { + return null; + } + + return guard; + } + + /// + /// Returns the list of possible names of guard methods / properties for the given method. + /// + public static Func> BuildPossibleGuardNames = method => { + + var guardNames = new List(); + + const string GuardPrefix = "Can"; + + var methodName = method.Name; + + guardNames.Add(GuardPrefix + methodName); + + const string AsyncMethodSuffix = "Async"; + + if (methodName.EndsWith(AsyncMethodSuffix, StringComparison.OrdinalIgnoreCase)) { + guardNames.Add(GuardPrefix + methodName.Substring(0, methodName.Length - AsyncMethodSuffix.Length)); + } + + return guardNames; + }; + + static MethodInfo GetMethodInfo(Type t, string methodName) + { +#if WINDOWS_UWP + return t.GetRuntimeMethods().SingleOrDefault(m => m.Name == methodName); +#else + return t.GetMethod(methodName); +#endif + } + } +} diff --git a/src/Caliburn.Micro.Platform/Bind.cs b/src/Caliburn.Micro.Platform/Bind.cs new file mode 100644 index 00000000..918da846 --- /dev/null +++ b/src/Caliburn.Micro.Platform/Bind.cs @@ -0,0 +1,222 @@ +#if XFORMS +namespace Caliburn.Micro.Xamarin.Forms +#else +namespace Caliburn.Micro +#endif +{ + using System; +#if WINDOWS_UWP + using Windows.UI.Xaml; + using Windows.UI.Xaml.Data; +#elif XFORMS + using global::Xamarin.Forms; + using UIElement = global::Xamarin.Forms.Element; + using FrameworkElement = global::Xamarin.Forms.VisualElement; + using DependencyProperty = global::Xamarin.Forms.BindableProperty; + using DependencyObject =global::Xamarin.Forms.BindableObject; +#else + using System.Windows; + using System.Windows.Data; +#endif + + /// + /// Hosts dependency properties for binding. + /// + public static class Bind { + /// + /// Allows binding on an existing view. Use this on root UserControls, Pages and Windows; not in a DataTemplate. + /// + public static DependencyProperty ModelProperty = + DependencyPropertyHelper.RegisterAttached( + "Model", + typeof(object), + typeof(Bind), + null, + ModelChanged); + + /// + /// Allows binding on an existing view without setting the data context. Use this from within a DataTemplate. + /// + public static DependencyProperty ModelWithoutContextProperty = + DependencyPropertyHelper.RegisterAttached( + "ModelWithoutContext", + typeof(object), + typeof(Bind), + null, + ModelWithoutContextChanged); + + internal static DependencyProperty NoContextProperty = + DependencyPropertyHelper.RegisterAttached( + "NoContext", + typeof(bool), + typeof(Bind), + false); + + /// + /// Gets the model to bind to. + /// + /// The dependency object to bind to. + /// The model. + public static object GetModelWithoutContext(DependencyObject dependencyObject) { + return dependencyObject.GetValue(ModelWithoutContextProperty); + } + + /// + /// Sets the model to bind to. + /// + /// The dependency object to bind to. + /// The model. + public static void SetModelWithoutContext(DependencyObject dependencyObject, object value) { + dependencyObject.SetValue(ModelWithoutContextProperty, value); + } + + /// + /// Gets the model to bind to. + /// + /// The dependency object to bind to. + /// The model. + public static object GetModel(DependencyObject dependencyObject) { + return dependencyObject.GetValue(ModelProperty); + } + + /// + /// Sets the model to bind to. + /// + /// The dependency object to bind to. + /// The model. + public static void SetModel(DependencyObject dependencyObject, object value) { + dependencyObject.SetValue(ModelProperty, value); + } + + static void ModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + if (View.InDesignMode || e.NewValue == null || e.NewValue == e.OldValue) { + return; + } + + var fe = d as FrameworkElement; + if (fe == null) { + return; + } + + View.ExecuteOnLoad(fe, delegate { + var target = e.NewValue; + + d.SetValue(View.IsScopeRootProperty, true); + +#if XFORMS + var context = fe.Id.ToString("N"); +#else + var context = string.IsNullOrEmpty(fe.Name) + ? fe.GetHashCode().ToString() + : fe.Name; +#endif + + ViewModelBinder.Bind(target, d, context); + }); + } + + static void ModelWithoutContextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + if (View.InDesignMode || e.NewValue == null || e.NewValue == e.OldValue) { + return; + } + + var fe = d as FrameworkElement; + if (fe == null) { + return; + } + + View.ExecuteOnLoad(fe, delegate { + var target = e.NewValue; + var containerKey = e.NewValue as string; + if (containerKey != null) { + LogManager.GetLog(typeof(Bind)).Info("Using IoC is deprecated and will be removed in v3.0"); + target = IoC.GetInstance(null, containerKey); + } + + d.SetValue(View.IsScopeRootProperty, true); + +#if XFORMS + var context = fe.Id.ToString("N"); +#else + var context = string.IsNullOrEmpty(fe.Name) + ? fe.GetHashCode().ToString() + : fe.Name; +#endif + + d.SetValue(NoContextProperty, true); + ViewModelBinder.Bind(target, d, context); + }); + } + + /// + /// Allows application of conventions at design-time. + /// + public static DependencyProperty AtDesignTimeProperty = + DependencyPropertyHelper.RegisterAttached( + "AtDesignTime", + typeof(bool), + typeof(Bind), + false, + AtDesignTimeChanged); + + /// + /// Gets whether or not conventions are being applied at design-time. + /// + /// The ui to apply conventions to. + /// Whether or not conventions are applied. +#if NET + [AttachedPropertyBrowsableForTypeAttribute(typeof(DependencyObject))] +#endif + public static bool GetAtDesignTime(DependencyObject dependencyObject) { + return (bool)dependencyObject.GetValue(AtDesignTimeProperty); + } + + /// + /// Sets whether or not do bind conventions at design-time. + /// + /// The ui to apply conventions to. + /// Whether or not to apply conventions. + public static void SetAtDesignTime(DependencyObject dependencyObject, bool value) { + dependencyObject.SetValue(AtDesignTimeProperty, value); + } + + static void AtDesignTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + if (!View.InDesignMode) + return; + + var atDesignTime = (bool) e.NewValue; + if (!atDesignTime) + return; +#if XFORMS + d.SetBinding(DataContextProperty, String.Empty); +#else + BindingOperations.SetBinding(d, DataContextProperty, new Binding()); +#endif + } + + static readonly DependencyProperty DataContextProperty = + DependencyPropertyHelper.RegisterAttached( + "DataContext", + typeof(object), + typeof(Bind), + null, DataContextChanged); + + static void DataContextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + if (!View.InDesignMode) + return; + + var enable = d.GetValue(AtDesignTimeProperty); + if (enable == null || ((bool)enable) == false || e.NewValue == null) + return; + + var fe = d as FrameworkElement; + if (fe == null) + return; +#if XFORMS + ViewModelBinder.Bind(e.NewValue, d, fe.Id.ToString("N")); +#else + ViewModelBinder.Bind(e.NewValue, d, string.IsNullOrEmpty(fe.Name) ? fe.GetHashCode().ToString() : fe.Name); +#endif + } + } +} diff --git a/src/Caliburn.Micro.Platform/BindingScope.cs b/src/Caliburn.Micro.Platform/BindingScope.cs new file mode 100644 index 00000000..1f06e2cf --- /dev/null +++ b/src/Caliburn.Micro.Platform/BindingScope.cs @@ -0,0 +1,388 @@ +namespace Caliburn.Micro { + using System; + using System.Collections.Generic; + using System.Linq; +#if WINDOWS_UWP + using System.ServiceModel; + using Windows.UI.Xaml; + using Windows.UI.Xaml.Controls; + using Windows.UI.Xaml.Controls.Primitives; + using Windows.UI.Xaml.Media; +#else + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media; + using System.Windows.Media.Media3D; +#endif + + /// + /// Provides methods for searching a given scope for named elements. + /// + public static class BindingScope { + static readonly List ChildResolvers = new List(); + static readonly Dictionary NonResolvableChildTypes = new Dictionary(); + + static BindingScope() + { + AddChildResolver(e => new[] { e.Content as DependencyObject }); + AddChildResolver(e => e.Items.OfType().ToArray() ); +#if !WINDOWS_UWP + AddChildResolver(e => new[] { e.Header as DependencyObject }); + AddChildResolver(e => new[] { e.Header as DependencyObject }); +#endif +#if WINDOWS_UWP + AddChildResolver(e => new[] { e.ZoomedInView as DependencyObject, e.ZoomedOutView as DependencyObject }); + AddChildResolver(e => new[] { e.Header as DependencyObject }); +#endif +#if WINDOWS_UWP + AddChildResolver(e => new[] { e.Footer as DependencyObject }); + AddChildResolver(ResolveHub); + AddChildResolver(e => new[] { e.Header as DependencyObject }); + AddChildResolver(ResolveCommandBar); + AddChildResolver