# HG changeset patch
# User stevenh7776 stevenhollidge@hotmail.com
# Date 1329819944 -25200
# Node ID 443821e55f062639e453ed4fac96c5c633c67207
# Parent 904a9faadf8b62e0668537209dec6a81be0e5af3
Initial cleaned up add from Codeplex files
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/Chronos.sln
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/Chronos.sln Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,364 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos", "source\Chronos.csproj", "{24DB19C6-1212-4F41-9201-A50626212C03}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Presentation.DragAndDrop", "source\DragAndDrop\Chronos.Presentation.DragAndDrop.csproj", "{F3061A2B-7688-4B26-8D5B-E556EAFE1D49}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Interop", "source\Interop\Chronos.Interop.csproj", "{3A90897C-B83C-422E-9E81-DD90245079F0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Presentation.Controls", "source\Presentation\Controls\Chronos.Presentation.Controls.csproj", "{66D734BC-132C-4252-9CBD-78DF2585D52D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Presentation.Windows", "source\Presentation\Windows\Chronos.Presentation.Windows.csproj", "{1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Presentation.Widgets", "source\Presentation\Widgets\Chronos.Presentation.Widgets.csproj", "{2CF0AED5-C924-4536-95D4-AA338BFCDA23}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Presentation.Core", "source\Presentation\Core\Chronos.Presentation.Core.csproj", "{4C9AD768-6AB8-43B1-833A-C8CC520471B1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Presentation.ViewModel", "source\Presentation\ViewModel\Chronos.Presentation.ViewModel.csproj", "{AAB3929F-049B-469A-AAEB-BBABEE03FE0A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Extensions", "source\Extensions\Chronos.Extensions.csproj", "{AA911078-3A2A-41B1-B779-3C8B55E1B8E3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Extensions.Windows", "source\Extensions\Windows\Chronos.Extensions.Windows.csproj", "{F5F26463-32DA-4685-B361-B984EDF5A5F2}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{21C18130-C85A-418B-9568-4534A7E5C83D}"
+ ProjectSection(SolutionItems) = preProject
+ SolutionInfo.cs = SolutionInfo.cs
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Modules.Navigation", "source\Modules\Navigation\Chronos.Modules.Navigation.csproj", "{276B4110-E91B-45EB-BFD3-1983CB871B2F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Modules.Sample", "source\Modules\Sample\Chronos.Modules.Sample.csproj", "{97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chronos.Configuration", "source\Configuration\Chronos.Configuration.csproj", "{33197834-06F8-4056-8E56-CCA7614EA831}"
+EndProject
+Global
+ GlobalSection(TeamFoundationVersionControl) = preSolution
+ SccNumberOfProjects = 14
+ SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+ SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs04
+ SccLocalPath0 = .
+ SccProjectUniqueName1 = source\\Chronos.csproj
+ SccProjectName1 = source
+ SccLocalPath1 = source
+ SccProjectUniqueName2 = source\\DragAndDrop\\Chronos.Presentation.DragAndDrop.csproj
+ SccProjectName2 = source/DragAndDrop
+ SccLocalPath2 = source\\DragAndDrop
+ SccProjectUniqueName3 = source\\Extensions\\Chronos.Extensions.csproj
+ SccProjectName3 = source/Extensions
+ SccLocalPath3 = source\\Extensions
+ SccProjectUniqueName4 = source\\Extensions\\Windows\\Chronos.Extensions.Windows.csproj
+ SccProjectName4 = source/Extensions/Windows
+ SccLocalPath4 = source\\Extensions\\Windows
+ SccProjectUniqueName5 = source\\Interop\\Chronos.Interop.csproj
+ SccProjectName5 = source/Interop
+ SccLocalPath5 = source\\Interop
+ SccProjectUniqueName6 = source\\Modules\\Navigation\\Chronos.Modules.Navigation.csproj
+ SccProjectName6 = source/Modules/Navigation
+ SccLocalPath6 = source\\Modules\\Navigation
+ SccProjectUniqueName7 = source\\Modules\\Sample\\Chronos.Modules.Sample.csproj
+ SccProjectName7 = source/Modules/Sample
+ SccLocalPath7 = source\\Modules\\Sample
+ SccProjectUniqueName8 = source\\Presentation\\Controls\\Chronos.Presentation.Controls.csproj
+ SccProjectName8 = source/Presentation/Controls
+ SccLocalPath8 = source\\Presentation\\Controls
+ SccProjectUniqueName9 = source\\Presentation\\Core\\Chronos.Presentation.Core.csproj
+ SccProjectName9 = source/Presentation/Core
+ SccLocalPath9 = source\\Presentation\\Core
+ SccProjectUniqueName10 = source\\Presentation\\ViewModel\\Chronos.Presentation.ViewModel.csproj
+ SccProjectName10 = source/Presentation/ViewModel
+ SccLocalPath10 = source\\Presentation\\ViewModel
+ SccProjectUniqueName11 = source\\Presentation\\Widgets\\Chronos.Presentation.Widgets.csproj
+ SccProjectName11 = source/Presentation/Widgets
+ SccLocalPath11 = source\\Presentation\\Widgets
+ SccProjectUniqueName12 = source\\Presentation\\Windows\\Chronos.Presentation.Windows.csproj
+ SccProjectName12 = source/Presentation/Windows
+ SccLocalPath12 = source\\Presentation\\Windows
+ SccProjectUniqueName13 = source\\Configuration\\Chronos.Configuration.csproj
+ SccProjectName13 = source/Configuration
+ SccLocalPath13 = source\\Configuration
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ AutomatedDebug|Any CPU = AutomatedDebug|Any CPU
+ AutomatedDebug|Mixed Platforms = AutomatedDebug|Mixed Platforms
+ AutomatedDebug|x86 = AutomatedDebug|x86
+ CodeAnalysisDebug|Any CPU = CodeAnalysisDebug|Any CPU
+ CodeAnalysisDebug|Mixed Platforms = CodeAnalysisDebug|Mixed Platforms
+ CodeAnalysisDebug|x86 = CodeAnalysisDebug|x86
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {24DB19C6-1212-4F41-9201-A50626212C03}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Release|Any CPU.Build.0 = Release|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {24DB19C6-1212-4F41-9201-A50626212C03}.Release|x86.ActiveCfg = Release|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}.Release|x86.ActiveCfg = Release|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {3A90897C-B83C-422E-9E81-DD90245079F0}.Release|x86.ActiveCfg = Release|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}.Release|x86.ActiveCfg = Release|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}.Release|x86.ActiveCfg = Release|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}.Release|x86.ActiveCfg = Release|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}.Release|x86.ActiveCfg = Release|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}.Release|x86.ActiveCfg = Release|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}.Release|x86.ActiveCfg = Release|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}.Release|x86.ActiveCfg = Release|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}.Release|x86.ActiveCfg = Release|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}.Release|x86.ActiveCfg = Release|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.AutomatedDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.AutomatedDebug|Any CPU.Build.0 = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.AutomatedDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.AutomatedDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.AutomatedDebug|x86.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.CodeAnalysisDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.CodeAnalysisDebug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.CodeAnalysisDebug|x86.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Release|Any CPU.Build.0 = Release|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {33197834-06F8-4056-8E56-CCA7614EA831}.Release|x86.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(SubversionScc) = preSolution
+ Svn-Managed = True
+ Manager = AnkhSVN - Subversion Support for Visual Studio
+ EndGlobalSection
+EndGlobal
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/Doc/Introduction to Chronos v2.xps
Binary file Chronosv2/Doc/Introduction to Chronos v2.xps has changed
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/Lib/NLog/NLog.Extended.dll
Binary file Chronosv2/Lib/NLog/NLog.Extended.dll has changed
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/Lib/NLog/NLog.dll
Binary file Chronosv2/Lib/NLog/NLog.dll has changed
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/Lib/nRoute/nRoute.Framework.dll
Binary file Chronosv2/Lib/nRoute/nRoute.Framework.dll has changed
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/SolutionInfo.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/SolutionInfo.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,15 @@
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyCompany("Carlos Guzmán Álvarez")]
+[assembly: AssemblyProduct("chronos")]
+[assembly: AssemblyCopyright("Copyright © 2010, Carlos Guzmán Álvarez")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: AssemblyVersionAttribute("2.0.*")]
+[assembly: AssemblyFileVersion("2.0.0.0")]
+
+[assembly: ComVisible(false)]
+[assembly: CLSCompliant(true)]
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/App.xaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/App.xaml Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/App.xaml.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/App.xaml.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Threading;
+using Chronos.Authentication;
+using Chronos.Extensions.Windows;
+using Chronos.Presentation.Core.Navigation;
+using NLog;
+using nRoute.Components.Messaging;
+using nRoute.Services;
+using System.Windows.Media;
+
+namespace Chronos
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App
+ : nRoute.ApplicationServices.Application
+ {
+ #region · Logger ·
+
+ private static Logger Logger = LogManager.GetCurrentClassLogger();
+
+ #endregion
+
+ #region · Static Members ·
+
+ ///
+ /// Determines if the application is running on Windows 7
+ ///
+ public static bool RunningOnWin7
+ {
+ get
+ {
+ return (Environment.OSVersion.Version.Major > 6) ||
+ (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 1);
+ }
+ }
+
+ #endregion
+
+ #region · Fields ·
+
+ private ChannelObserver authenticationObserver;
+ private List pendingNavigations;
+ private string[] args;
+ private bool isLoggedIn;
+
+ #endregion
+
+ #region · Methods ·
+
+ public void Run(string[] arguments)
+ {
+ this.args = arguments;
+
+ this.Run();
+ }
+
+ #endregion
+
+ #region · Overriden Methods ·
+
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ //RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
+
+ this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(OnDispatcherUnhandledException);
+ SingleInstance.SingleInstanceActivated += new EventHandler(OnSingleInstanceActivated);
+
+ // Pending Navigations
+ this.pendingNavigations = new List();
+
+ // Authentication Observer
+ this.authenticationObserver = new ChannelObserver((l) => OnAuthenticationAction(l));
+
+ // Subscribe on background thread
+ this.authenticationObserver.Subscribe(ThreadOption.BackgroundThread);
+
+ base.OnStartup(e);
+
+ if (this.args != null && this.args.Length > 0)
+ {
+ if (this.isLoggedIn)
+ {
+ ServiceLocator.GetService().Navigate(e.Args[0]);
+ }
+ else
+ {
+ this.pendingNavigations.Add(e.Args[0]);
+ }
+ }
+
+ RenderTier renderTier = this.GetRenderTier();
+ }
+
+ #endregion
+
+ #region · Observer Actions ·
+
+ private void OnAuthenticationAction(AuthenticationInfo info)
+ {
+ switch (info.Action)
+ {
+ case AuthenticationAction.LogOn:
+ this.isLoggedIn = false;
+ break;
+
+ case AuthenticationAction.LoggedIn:
+ this.isLoggedIn = true;
+
+ if (this.pendingNavigations != null &&
+ this.pendingNavigations.Count > 0)
+ {
+ this.ProcessPendingNavigations();
+ }
+ break;
+
+ case AuthenticationAction.LogOut:
+ this.isLoggedIn = false;
+ break;
+ }
+ }
+
+ #endregion
+
+ #region · Private Methods ·
+
+ private void ProcessPendingNavigations()
+ {
+ foreach (string url in this.pendingNavigations)
+ {
+ ServiceLocator.GetService().Navigate(url);
+ }
+ }
+
+ #endregion
+
+ #region · Event Handlers ·
+
+ private void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
+ {
+ Logger.ErrorException("Excepción no manejada", e.Exception);
+
+ e.Handled = true;
+ }
+
+ private void OnSingleInstanceActivated(object sender, SingleInstanceEventArgs e)
+ {
+ if (e != null && e.Args != null && e.Args.Count > 1)
+ {
+ ServiceLocator.GetService().Navigate(e.Args[1]);
+ }
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/ApplicationStateObserver.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/ApplicationStateObserver.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,124 @@
+/*
+The MIT License
+
+Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+using System;
+using System.Windows;
+using System.Windows.Shell;
+using Chronos.Authentication;
+using nRoute.ApplicationServices;
+using nRoute.Components.Composition;
+using nRoute.Components.Messaging;
+
+namespace Chronos
+{
+ ///
+ /// Dedicated observer for application state notifications
+ ///
+ [MapChannelObserver(typeof(ApplicationStateInfo),
+ InitializationMode=InitializationMode.WhenAvailable,
+ Lifetime=InstanceLifetime.Singleton,
+ ThreadOption=ThreadOption.UIThread)]
+ public sealed class ApplicationStateObserver : IObserver
+ {
+ #region · Fields ·
+
+ private SplashScreen splashScreen;
+
+ #endregion
+
+ #region · IObserver Members ·
+
+ ///
+ /// Notifies the observer that the provider has finished sending push-based notifications.
+ ///
+ public void OnCompleted()
+ {
+ }
+
+ ///
+ /// Notifies the observer that the provider has experienced an error condition.
+ ///
+ /// An object that provides additional information about the error.
+ public void OnError(Exception error)
+ {
+ }
+
+ ///
+ /// Provides the observer with new data.
+ ///
+ /// The current notification information.
+ public void OnNext(ApplicationStateInfo value)
+ {
+ if (value.CurrentState == ApplicationState.Starting)
+ {
+ this.splashScreen = new SplashScreen("SplashScreen.png");
+ this.splashScreen.Show(false);
+ }
+ else if (value.CurrentState == ApplicationState.Started)
+ {
+ // Close the splash screen
+ if (this.splashScreen != null)
+ {
+ this.splashScreen.Close(new TimeSpan(0, 0, 1));
+ this.splashScreen = null;
+ }
+
+ // Initialize the JumpList
+ this.InitializeJumpList();
+
+ // Publish LogOn Request
+ Channel.Public.OnNext
+ (
+ new AuthenticationInfo
+ {
+ Action = AuthenticationAction.LogOn
+ },
+ true
+ );
+ }
+ }
+
+ #endregion
+
+ #region · Private Methods ·
+
+ private void InitializeJumpList()
+ {
+ if (App.RunningOnWin7)
+ {
+ JumpList jl = JumpList.GetJumpList(nRoute.ApplicationServices.Application.Current);
+
+ if (jl == null)
+ {
+ jl = new JumpList();
+ JumpList.SetJumpList(nRoute.ApplicationServices.Application.Current, jl);
+ }
+
+ jl.Apply();
+ }
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Authentication/AuthenticationAction.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Authentication/AuthenticationAction.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,46 @@
+/*
+The MIT License
+
+Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+
+namespace Chronos.Authentication
+{
+ ///
+ /// Authentication actions
+ ///
+ public enum AuthenticationAction
+ {
+ ///
+ /// Log on
+ ///
+ LogOn,
+ ///
+ /// Log out
+ ///
+ LogOut,
+ ///
+ /// Logged in
+ ///
+ LoggedIn
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Authentication/AuthenticationInfo.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Authentication/AuthenticationInfo.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,65 @@
+/*
+The MIT License
+
+Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+namespace Chronos.Authentication
+{
+ ///
+ /// Provides information about an information action
+ ///
+ public sealed class AuthenticationInfo
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets or sets the user id
+ ///
+ public string UserId
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Gets or sets the
+ ///
+ public AuthenticationAction Action
+ {
+ get;
+ set;
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ public AuthenticationInfo()
+ {
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Authentication/AuthenticationObserver.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Authentication/AuthenticationObserver.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,115 @@
+/*
+The MIT License
+
+Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+using System;
+using System.Threading.Tasks;
+using Chronos.Authentication;
+using Chronos.Modules.Navigation;
+using Chronos.Presentation.Core.Navigation;
+using Chronos.Presentation.Core.VirtualDesktops;
+using NLog;
+using nRoute.Components.Composition;
+using nRoute.Components.Messaging;
+using nRoute.Navigation;
+using nRoute.Services;
+
+namespace Chronos
+{
+ ///
+ /// Dedicated observer for authentication
+ ///
+ [MapChannelObserver(typeof(AuthenticationInfo),
+ InitializationMode = InitializationMode.WhenAvailable,
+ Lifetime = InstanceLifetime.Singleton)]
+ public sealed class AuthenticationObserver : IObserver
+ {
+ #region · Logger ·
+
+ private static Logger Logger = LogManager.GetCurrentClassLogger();
+
+ #endregion
+
+ #region · IObserver Members ·
+
+ ///
+ /// Notifies the observer that the provider has finished sending push-based notifications.
+ ///
+ public void OnCompleted()
+ {
+ }
+
+ ///
+ /// Notifies the observer that the provider has experienced an error condition.
+ ///
+ /// An object that provides additional information about the error.
+ public void OnError(Exception error)
+ {
+ }
+
+ ///
+ /// Provides the observer with new data.
+ ///
+ /// The current notification information.
+ public void OnNext(AuthenticationInfo value)
+ {
+ switch (value.Action)
+ {
+ case AuthenticationAction.LogOn:
+ Logger.Debug("Autenticación del usuario");
+ ServiceLocator.GetService()
+ .Navigate(NavigateMode.Modal, NavigationRoutes.Login);
+ break;
+
+ case AuthenticationAction.LoggedIn:
+ Logger.Debug("Usuario autenticado correctamente");
+ ServiceLocator.GetService()
+ .ActivateDefaultDesktop();
+ break;
+
+ case AuthenticationAction.LogOut:
+ Logger.Debug("Cerrando sesión");
+ Task t = Task.Factory.StartNew
+ (
+ () =>
+ {
+ ServiceLocator.GetService()
+ .CloseAll();
+
+ Channel.Publish
+ (
+ new AuthenticationInfo
+ {
+ Action = AuthenticationAction.LogOn
+ },
+ true
+ );
+ }
+ );
+ break;
+ }
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Chronos.csproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Chronos.csproj Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,320 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {24DB19C6-1212-4F41-9201-A50626212C03}
+ WinExe
+ Properties
+ Chronos
+ Chronos
+ v4.0
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ 4.0.20525.0
+
+
+
+
+ 3.5
+ false
+
+
+ Chronos.ico
+ true
+ SAK
+ SAK
+ SAK
+ SAK
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ true
+
+
+ true
+ full
+ false
+ bin\debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+
+
+ false
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ AllRules.ruleset
+
+
+ Chronos.ChronosMain
+
+
+
+ ..\Lib\NLog\NLog.dll
+
+
+ ..\Lib\nRoute\nRoute.Framework.dll
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+ 3.5
+
+
+
+
+ 3.0
+
+
+ 3.0
+
+
+ 3.0
+
+
+ 3.0
+
+
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ Properties\SolutionInfo.cs
+
+
+
+
+
+ About.xaml
+
+
+
+ WidgetLibraryView.xaml
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+
+
+
+
+
+
+
+
+ Login.xaml
+
+
+ True
+ True
+ Resources.resx
+
+
+ Shell.xaml
+ Code
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+ Code
+
+
+ True
+ Settings.settings
+ True
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ Always
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+ Always
+ Designer
+
+
+
+
+ {33197834-06F8-4056-8E56-CCA7614EA831}
+ Chronos.Configuration
+
+
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}
+ Chronos.Extensions.Windows
+
+
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}
+ Chronos.Presentation.DragAndDrop
+
+
+ {3A90897C-B83C-422E-9E81-DD90245079F0}
+ Chronos.Interop
+
+
+ {276B4110-E91B-45EB-BFD3-1983CB871B2F}
+ Chronos.Modules.Navigation
+
+
+ {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9}
+ Chronos.Modules.Sample
+
+
+ {66D734BC-132C-4252-9CBD-78DF2585D52D}
+ Chronos.Presentation.Controls
+
+
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}
+ Chronos.Presentation.Core
+
+
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}
+ Chronos.Presentation.ViewModel
+
+
+ {2CF0AED5-C924-4536-95D4-AA338BFCDA23}
+ Chronos.Presentation.Widgets
+
+
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}
+ Chronos.Presentation.Windows
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Chronos.ico
Binary file Chronosv2/source/Chronos.ico has changed
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Configuration/Chronos.Configuration.csproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Configuration/Chronos.Configuration.csproj Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,63 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {33197834-06F8-4056-8E56-CCA7614EA831}
+ Library
+ Properties
+ Chronos.Configuration
+ Chronos.Configuration
+ v4.0
+ 512
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ Properties\SolutionInfo.cs
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Configuration/GenericElementCollection.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Configuration/GenericElementCollection.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,134 @@
+using System.Configuration;
+
+namespace Chronos.Configuration
+{
+ ///
+ /// http://utahdnug.org/blogs/josh/archive/2007/08/21/generic-configurationelementcollection.aspx
+ ///
+ ///
+ ///
+ public abstract class GenericElementCollection
+ : ConfigurationElementCollection where V : ConfigurationElement, new()
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets the type of the .
+ ///
+ ///
+ ///
+ /// The of this collection.
+ ///
+ public abstract override ConfigurationElementCollectionType CollectionType
+ {
+ get;
+ }
+
+ ///
+ /// Gets the name used to identify this collection of elements in the configuration file when overridden in a derived class.
+ ///
+ ///
+ ///
+ /// The name of the collection; otherwise, an empty string. The default is an empty string.
+ ///
+ protected abstract override string ElementName
+ {
+ get;
+ }
+
+ #endregion
+
+ #region · Indexers ·
+
+ ///
+ /// Gets the with the specified key.
+ ///
+ ///
+ public V this[K key]
+ {
+ get { return (V)BaseGet(key); }
+ }
+
+ ///
+ /// Gets the at the specified index.
+ ///
+ ///
+ public V this[int index]
+ {
+ get { return (V)BaseGet(index); }
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public GenericElementCollection()
+ {
+ }
+
+ #endregion
+
+ #region · Methods ·
+
+ ///
+ /// Adds the specified path.
+ ///
+ /// The path.
+ public void Add(V path)
+ {
+ BaseAdd(path);
+ }
+
+ ///
+ /// Removes the specified key.
+ ///
+ /// The key.
+ public void Remove(K key)
+ {
+ BaseRemove(key);
+ }
+
+ #endregion
+
+ #region · Overriden Methods ·
+
+ ///
+ /// When overridden in a derived class, creates a new .
+ ///
+ ///
+ /// A new .
+ ///
+ protected override ConfigurationElement CreateNewElement()
+ {
+ return new V();
+ }
+
+ ///
+ /// Gets the element key for a specified configuration element when overridden in a derived class.
+ ///
+ /// The to return the key for.
+ ///
+ /// An that acts as the key for the specified .
+ ///
+ protected override object GetElementKey(ConfigurationElement element)
+ {
+ return GetElementKey((V)element);
+ }
+
+ #endregion
+
+ #region · Protected Abstract Methods ·
+
+ ///
+ /// Gets the element key.
+ ///
+ /// The element.
+ ///
+ protected abstract K GetElementKey(V element);
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Configuration/Properties/AssemblyInfo.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Configuration/Properties/AssemblyInfo.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,9 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Chronos Configuration")]
+[assembly: AssemblyDescription("Chronos Configuration")]
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Configuration/WidgetConfigurationElement.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Configuration/WidgetConfigurationElement.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,48 @@
+using System.Configuration;
+
+namespace Chronos.Configuration
+{
+ ///
+ /// Widget configuration element
+ ///
+ public sealed class WidgetConfigurationElement
+ : ConfigurationElement
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets or sets the widget id.
+ ///
+ /// The widget id.
+ [ConfigurationProperty("id", IsRequired = true, IsKey=true)]
+ public string Id
+ {
+ get { return (string)this["id"]; }
+ set { this["id"] = value; }
+ }
+
+ ///
+ /// Gets or sets the widget handler type.
+ ///
+ /// The widget handler type.
+ [ConfigurationProperty("type", IsRequired = true)]
+ public string Type
+ {
+ get { return (string)this["type"]; }
+ set { this["type"] = value; }
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public WidgetConfigurationElement()
+ {
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Configuration/WidgetConfigurationElementCollection.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Configuration/WidgetConfigurationElementCollection.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,62 @@
+using System.Configuration;
+
+namespace Chronos.Configuration
+{
+ ///
+ /// Represents a collection
+ ///
+ public sealed class WidgetConfigurationElementCollection
+ : GenericElementCollection
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets the type of the collection.
+ ///
+ /// The type of the collection.
+ public override ConfigurationElementCollectionType CollectionType
+ {
+ get
+ {
+ return ConfigurationElementCollectionType.BasicMap;
+ }
+ }
+
+ ///
+ /// Gets the name of the element.
+ ///
+ /// The name of the element.
+ protected override string ElementName
+ {
+ get { return "widget"; }
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public WidgetConfigurationElementCollection()
+ : base()
+ {
+ }
+
+ #endregion
+
+ #region · Methods ·
+
+ ///
+ /// Gets the element key.
+ ///
+ /// The element.
+ ///
+ protected override string GetElementKey(WidgetConfigurationElement element)
+ {
+ return element.Id;
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Configuration/WidgetsSectionHandler.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Configuration/WidgetsSectionHandler.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,39 @@
+using System.Configuration;
+
+namespace Chronos.Configuration
+{
+ ///
+ /// Widget configuration section handler
+ ///
+ public sealed class WidgetsSectionHandler
+ : ConfigurationSection
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets the list of configured widgets.
+ ///
+ /// The desktops.
+ [ConfigurationProperty("widgets", IsDefaultCollection = true)]
+ public WidgetConfigurationElementCollection Widgets
+ {
+ get
+ {
+ return (WidgetConfigurationElementCollection)base["widgets"];
+ }
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public WidgetsSectionHandler()
+ {
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/Chronos.Presentation.DragAndDrop.csproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/Chronos.Presentation.DragAndDrop.csproj Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,101 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {F3061A2B-7688-4B26-8D5B-E556EAFE1D49}
+ Library
+ Properties
+ Chronos.Presentation.DragAndDrop
+ Chronos.Presentation.DragAndDrop
+ v4.0
+ 512
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\Lib\nRoute\nRoute.Framework.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties\SolutionInfo.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {F5F26463-32DA-4685-B361-B984EDF5A5F2}
+ Chronos.Extensions.Windows
+
+
+ {3A90897C-B83C-422E-9E81-DD90245079F0}
+ Chronos.Interop
+
+
+ {4C9AD768-6AB8-43B1-833A-C8CC520471B1}
+ Chronos.Presentation.Core
+
+
+ {AAB3929F-049B-469A-AAEB-BBABEE03FE0A}
+ Chronos.Presentation.ViewModel
+
+
+ {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7}
+ Chronos.Presentation.Windows
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/DragAdorner.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/DragAdorner.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,143 @@
+using System.Windows;
+using System.Windows.Documents;
+using System.Windows.Media;
+using System.Windows.Shapes;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public sealed class DragAdorner : Adorner
+ {
+ #region Fields
+
+ private UIElement child;
+ private UIElement owner;
+ private double XCenter;
+ private double YCenter;
+ private double topOffset;
+ private double leftOffset;
+
+ #endregion
+
+ #region Properties
+
+ public double LeftOffset
+ {
+ get { return this.leftOffset; }
+ set
+ {
+ this.leftOffset = (value - this.XCenter);
+ this.UpdatePosition();
+ }
+ }
+
+ public double TopOffset
+ {
+ get { return this.topOffset; }
+ set
+ {
+ this.topOffset = (value - this.YCenter);
+ this.UpdatePosition();
+ }
+ }
+
+ #endregion
+
+ #region Protected Properties
+
+ protected override int VisualChildrenCount
+ {
+ get { return 1; }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ public DragAdorner(UIElement owner)
+ : base(owner)
+ {
+ }
+
+ public DragAdorner(UIElement owner, UIElement adornElement, bool useVisualBrush, double opacity)
+ : base(owner)
+ {
+ this.owner = owner;
+
+ if (useVisualBrush)
+ {
+ VisualBrush brush = new VisualBrush(adornElement);
+ Rectangle rect = new Rectangle();
+
+ brush.Opacity = opacity;
+ rect.RadiusX = 3;
+ rect.RadiusY = 3;
+ rect.Width = adornElement.DesiredSize.Width;
+ rect.Height = adornElement.DesiredSize.Height;
+
+ this.XCenter = adornElement.DesiredSize.Width / 2;
+ this.YCenter = adornElement.DesiredSize.Height / 2;
+
+ rect.Fill = brush;
+
+ this.child = rect;
+ }
+ else
+ {
+ this.child = adornElement;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override GeneralTransform GetDesiredTransform(GeneralTransform transform)
+ {
+ GeneralTransformGroup result = new GeneralTransformGroup();
+
+ result.Children.Add(base.GetDesiredTransform(transform));
+ result.Children.Add(new TranslateTransform(this.leftOffset, this.topOffset));
+
+ return result;
+ }
+
+ #endregion
+
+ #region Protected Methods
+
+ protected override Visual GetVisualChild(int index)
+ {
+ return this.child;
+ }
+
+ protected override Size MeasureOverride(Size finalSize)
+ {
+ this.child.Measure(finalSize);
+
+ return this.child.DesiredSize;
+ }
+
+ protected override Size ArrangeOverride(Size finalSize)
+ {
+ this.child.Arrange(new Rect(this.child.DesiredSize));
+
+ return finalSize;
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void UpdatePosition()
+ {
+ AdornerLayer adorner = (AdornerLayer)this.Parent;
+
+ if (adorner != null)
+ {
+ adorner.Update(this.AdornedElement);
+ }
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/DragDataWrapper.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/DragDataWrapper.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,52 @@
+using System.Windows;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public sealed class DragDataWrapper
+ {
+ #region · Fields ·
+
+ private DependencyObject source;
+ private object data;
+ private bool allowChildrenRemove;
+ private IDataDropObjectProvider shim;
+
+ #endregion
+
+ #region · Properties ·
+
+ public DependencyObject Source
+ {
+ get { return this.source; }
+ set { this.source = value; }
+ }
+
+ public object Data
+ {
+ get { return this.data; }
+ set { this.data = value; }
+ }
+
+ public bool AllowChildrenRemove
+ {
+ get { return this.allowChildrenRemove; }
+ set { this.allowChildrenRemove = value; }
+ }
+
+ public IDataDropObjectProvider Shim
+ {
+ get { return this.shim; }
+ set { this.shim = value; }
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ public DragDataWrapper()
+ {
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/DragDropManager.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/DragDropManager.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,192 @@
+/*
+The MIT License
+
+Copyright (c) 2009-2010 Carlos Guzmán Álvarez
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public sealed class DragDropManager
+ {
+ #region · Singleton Instance ·
+
+ public static readonly DragDropManager Instance = new DragDropManager();
+
+ #endregion
+
+ #region · Attached Properties ·
+
+ ///
+ /// Identifies the IsDesktopCanvas dependency property.
+ ///
+ public static readonly DependencyProperty IsDropTargetProperty =
+ DependencyProperty.RegisterAttached("IsDropTarget", typeof(bool), typeof(DragDropManager),
+ new FrameworkPropertyMetadata(false,
+ new PropertyChangedCallback(OnIsDropTarget)));
+
+ ///
+ /// Identifies the IsDragSource dependency property.
+ ///
+ public static readonly DependencyProperty IsDragSourceProperty =
+ DependencyProperty.RegisterAttached("IsDragSource", typeof(bool), typeof(DragDropManager),
+ new FrameworkPropertyMetadata(false,
+ new PropertyChangedCallback(OnIsDragSource)));
+
+ #endregion
+
+ #region · Dependency Property Get/Set Methods ·
+
+ ///
+ /// Gets the value of the IsDropTarget attached property
+ ///
+ ///
+ ///
+ public static bool GetIsDropTarget(DependencyObject d)
+ {
+ return (bool)d.GetValue(IsDropTargetProperty);
+ }
+
+ ///
+ /// Sets the value of the IsDropTarget attached property
+ ///
+ ///
+ ///
+ public static void SetIsDropTarget(DependencyObject d, bool value)
+ {
+ d.SetValue(IsDropTargetProperty, value);
+ }
+
+ ///
+ /// Gets the value of the IsDragSource attached property
+ ///
+ ///
+ ///
+ public static bool GetIsDragSource(DependencyObject d)
+ {
+ return (bool)d.GetValue(IsDragSourceProperty);
+ }
+
+ ///
+ /// Sets the value of the IsDragSource attached property
+ ///
+ ///
+ ///
+ public static void SetIsDragSource(DependencyObject d, bool value)
+ {
+ d.SetValue(IsDragSourceProperty, value);
+ }
+
+ #endregion
+
+ #region · Dependency Property Callbacks ·
+
+ private static void OnIsDropTarget(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ FrameworkElement element = d as FrameworkElement;
+
+ if (element != null)
+ {
+ DragDropManager.Instance.AttachDropTarget(element);
+ }
+ }
+
+ private static void OnIsDragSource(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ FrameworkElement element = d as FrameworkElement;
+
+ if (element != null)
+ {
+ DragDropManager.Instance.AttachDragSource(element);
+ }
+ }
+
+ #endregion
+
+ #region · Fields ·
+
+ private Dictionary dropTargets;
+ private Dictionary dragSources;
+
+ #endregion
+
+ #region · Constructors ·
+
+ private DragDropManager()
+ {
+ this.dropTargets = new Dictionary();
+ this.dragSources = new Dictionary();
+ }
+
+ #endregion
+
+ #region · Private Methods ·
+
+ private void AttachDropTarget(FrameworkElement element)
+ {
+ if (!this.dropTargets.ContainsKey(element))
+ {
+ element.Unloaded += new RoutedEventHandler(DragDropManager_Unloaded);
+ this.dropTargets.Add(element, new DropHelper(element));
+ }
+ }
+
+ private void AttachDragSource(FrameworkElement element)
+ {
+ if (!this.dragSources.ContainsKey(element))
+ {
+ element.Unloaded += new RoutedEventHandler(DragDropManager_Unloaded);
+
+ if (element is ListBox)
+ {
+ this.dragSources.Add(element, new DragHelper(element, new ListBoxDragDropDataProvider(element as ListBox), null));
+ }
+ else if (element is TreeView)
+ {
+ this.dragSources.Add(element, new DragHelper(element, new TreeViewDragDropDataProvider(element as TreeView), null));
+ }
+ }
+ }
+
+ #endregion
+
+ #region · Event Handlers ·
+
+ private void DragDropManager_Unloaded(object sender, RoutedEventArgs e)
+ {
+ (sender as FrameworkElement).Unloaded -= new RoutedEventHandler(DragDropManager_Unloaded);
+
+ if (this.dragSources.ContainsKey(sender as FrameworkElement))
+ {
+ this.dragSources.Remove(sender as FrameworkElement);
+ }
+ else if (this.dropTargets.ContainsKey(sender as FrameworkElement))
+ {
+ this.dropTargets.Remove(sender as FrameworkElement);
+ }
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/DragDropProviderActions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/DragDropProviderActions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,19 @@
+using System;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ [Serializable]
+ public enum DragDropProviderActions
+ {
+ None = 0,
+ Data = 1,
+ Visual = 2,
+ Feedback = 4,
+ ContinueDrag = 8,
+ Clone = 16,
+ MultiFormatData = 32,
+ // 64, 128 left for decent operations
+ // unparent feels hacky
+ Unparent = 256,
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/DragHelper.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/DragHelper.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,465 @@
+using System;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Interop;
+using System.Windows.Media;
+using System.Windows.Shapes;
+using Chronos.Interop;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public sealed class DragHelper
+ {
+ #region Static Methods
+
+ private static UIElement GetDragElementOnHitTest(UIElement src, MouseEventArgs args)
+ {
+ HitTestResult hr = VisualTreeHelper.HitTest(src, args.GetPosition((IInputElement)src));
+ return hr.VisualHit as UIElement;
+ }
+
+ #endregion
+
+ #region Fields
+
+ private UIElement dragSource;
+ private UIElement dragScope;
+ private IDataDropObjectProvider callback;
+ private Point startPoint;
+ private DragAdorner adorner;
+ private AdornerLayer layer;
+ private Window dragdropWindow;
+ private DragDropEffects allowedEffects;
+ private bool mouseLeftScope;
+ private bool isDragging;
+ private double opacity;
+
+ #endregion
+
+ #region Properties
+
+ public double Opacity
+ {
+ get { return this.opacity; }
+ }
+
+ public DragDropEffects AllowedEffects
+ {
+ get { return this.allowedEffects; }
+ set { this.allowedEffects = value; }
+ }
+
+ #endregion
+
+ #region Private Properties
+
+ private UIElement DragSource
+ {
+ get { return this.dragSource; }
+ set
+ {
+ this.dragSource = value;
+ this.WireEvents(value);
+ }
+ }
+
+ private UIElement DragScope
+ {
+ get { return this.dragScope; }
+ set { this.dragScope = value; }
+ }
+
+ private IDataDropObjectProvider Callback
+ {
+ get { return this.callback; }
+ set { this.callback = value; }
+ }
+
+ private bool IsDragging
+ {
+ get { return this.isDragging; }
+ set { this.isDragging = value; }
+ }
+
+ private bool AllowsLink
+ {
+ get { return ((this.AllowedEffects & DragDropEffects.Link) != 0); }
+ }
+
+ private bool AllowsMove
+ {
+ get { return ((this.AllowedEffects & DragDropEffects.Move) != 0); }
+ }
+
+ private bool AllowsCopy
+ {
+ get { return ((this.AllowedEffects & DragDropEffects.Copy) != 0); }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ public DragHelper(UIElement dragSource, IDataDropObjectProvider callback, UIElement dragScope)
+ {
+ this.allowedEffects = DragDropEffects.Copy | DragDropEffects.Move;
+ this.opacity = 0.7;
+ this.DragSource = dragSource;
+ this.Callback = callback;
+ this.DragScope = dragScope;
+ }
+
+ #endregion
+
+ #region DragSource Event Handlers
+
+ private void DragSource_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ this.startPoint = e.GetPosition(DragScope);
+ }
+
+#if DEBUG
+ void DragSource_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+ System.Diagnostics.Debug.Assert(IsDragging == false);
+ }
+#endif
+
+ private void DragSource_PreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
+ {
+ if (e.LeftButton == MouseButtonState.Pressed && !this.IsDragging)
+ {
+ Point position = e.GetPosition((IInputElement)DragScope);
+
+ if (Math.Abs(position.X - startPoint.X) > SystemParameters.MinimumHorizontalDragDistance ||
+ Math.Abs(position.Y - startPoint.Y) > SystemParameters.MinimumVerticalDragDistance)
+ {
+ this.StartDrag(e);
+ }
+ }
+ }
+
+ #endregion
+
+ #region DragScope Event Handlers
+
+ private void DragScope_DragLeave(object sender, DragEventArgs args)
+ {
+ if (args.OriginalSource == this.DragScope)
+ {
+ this.mouseLeftScope = true;
+ }
+ }
+
+ private void DragScope_DragOver(object sender, DragEventArgs args)
+ {
+ if (this.adorner != null)
+ {
+ this.adorner.LeftOffset = args.GetPosition(this.DragScope).X; /* - _startPoint.X */
+ this.adorner.TopOffset = args.GetPosition(this.DragScope).Y; /* - _startPoint.Y */
+ }
+ }
+
+ #endregion
+
+ #region Event Wiring
+
+ private void WireEvents(UIElement uie)
+ {
+ Debug.Assert(uie != null);
+
+ if (uie != null)
+ {
+ uie.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(DragSource_PreviewMouseLeftButtonDown);
+ uie.PreviewMouseMove += new MouseEventHandler(DragSource_PreviewMouseMove);
+
+#if DEBUG
+ uie.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(DragSource_PreviewMouseLeftButtonUp);
+#endif
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private void StartDrag(MouseEventArgs args)
+ {
+ IDataObject data = null;
+ UIElement dragelement = null;
+
+ // ADD THE DATA
+ if (this.Callback != null)
+ {
+ DragDataWrapper dw = new DragDataWrapper();
+
+ data = new DataObject(typeof(DragDataWrapper).ToString(), dw);
+
+ if ((this.Callback.SupportedActions & DragDropProviderActions.MultiFormatData) != 0)
+ {
+ this.Callback.AppendData(ref data, args);
+ }
+
+ if ((this.Callback.SupportedActions & DragDropProviderActions.Data) != 0)
+ {
+ dw.Data = this.Callback.GetData();
+ }
+
+ if ((this.Callback.SupportedActions & DragDropProviderActions.Visual) != 0)
+ {
+ dragelement = this.Callback.GetVisual(args);
+ }
+ else
+ {
+ dragelement = args.OriginalSource as UIElement;
+ }
+
+ dw.Source = this.DragSource;
+ dw.Shim = this.Callback;
+
+ Debug.Assert(this.DragScope == null, "The DragDataWrapper is meant for in-proc... Sorry for asserting, just wanted to confirm.. comment out assertion if needed");
+ }
+ else
+ {
+ dragelement = args.OriginalSource as UIElement;
+ data = new DataObject(typeof(UIElement).ToString(), dragelement);
+ }
+
+ if (dragelement == null || data == null || dragelement == this.DragSource)
+ {
+ return;
+ }
+
+ DragEventHandler dragOver = null;
+ DragEventHandler dragLeave = null;
+ QueryContinueDragEventHandler queryContinue = null;
+ GiveFeedbackEventHandler giveFeedback = null;
+ DragDropEffects effects = this.GetDragDropEffects();
+ DragDropEffects resultEffects;
+
+ // Inprocess Drag ...
+ if (this.DragScope != null)
+ {
+ bool previousAllowDrop = this.DragScope.AllowDrop;
+
+ this.adorner = new DragAdorner(this.DragScope, (UIElement)dragelement, true, this.Opacity);
+ this.layer = AdornerLayer.GetAdornerLayer(this.DragScope as Visual);
+
+ this.layer.Add(this.adorner);
+
+ if (this.DragScope != this.DragSource)
+ {
+ this.DragScope.AllowDrop = true;
+
+ DragDrop.AddPreviewDragOverHandler((DependencyObject)this.DragScope, dragOver = new DragEventHandler(DragScope_DragOver));
+ DragDrop.AddPreviewDragLeaveHandler(this.DragScope, dragLeave = new DragEventHandler(DragScope_DragLeave));
+ DragDrop.AddPreviewQueryContinueDragHandler(this.DragSource, queryContinue = new QueryContinueDragEventHandler(OnQueryContinueDrag));
+ }
+
+ try
+ {
+ this.IsDragging = true;
+ this.mouseLeftScope = false;
+ resultEffects = DragDrop.DoDragDrop(this.DragSource, data, effects);
+
+ this.DragFinished(resultEffects);
+ }
+ catch
+ {
+ Debug.Assert(false);
+ }
+
+ if (this.DragScope != this.DragSource)
+ {
+ this.DragScope.AllowDrop = previousAllowDrop;
+
+ DragDrop.RemovePreviewDragOverHandler(this.DragScope, dragOver);
+ DragDrop.RemovePreviewDragLeaveHandler(this.DragScope, dragLeave);
+ DragDrop.RemovePreviewQueryContinueDragHandler(this.DragSource, queryContinue);
+ }
+ }
+ else
+ {
+ DragDrop.AddPreviewQueryContinueDragHandler(this.DragSource, queryContinue = new QueryContinueDragEventHandler(OnQueryContinueDrag));
+ DragDrop.AddGiveFeedbackHandler(this.DragSource, giveFeedback = new GiveFeedbackEventHandler(OnGiveFeedback));
+
+ this.IsDragging = true;
+
+ if ((this.Callback.SupportedActions & DragDropProviderActions.Visual) != 0)
+ {
+ this.CreateDragDropWindow(dragelement);
+ this.dragdropWindow.Show();
+ }
+
+ try
+ {
+ resultEffects = DragDrop.DoDragDrop(this.DragSource, data, effects);
+ }
+ finally
+ {
+ }
+
+ if ((this.Callback.SupportedActions & DragDropProviderActions.Visual) != 0)
+ {
+ this.DestroyDragDropWindow();
+ }
+
+ DragDrop.RemovePreviewQueryContinueDragHandler(this.DragSource, OnQueryContinueDrag);
+ DragDrop.AddGiveFeedbackHandler(this.DragSource, OnGiveFeedback);
+
+ this.IsDragging = false;
+ this.DragFinished(resultEffects);
+ }
+ }
+
+ private DragDropEffects GetDragDropEffects()
+ {
+ DragDropEffects effects = DragDropEffects.None;
+
+ bool ctrl = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl);
+ bool shift = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift);
+
+ if (ctrl && shift && this.AllowsLink)
+ {
+ effects |= DragDropEffects.Link;
+ }
+ else if (ctrl && this.AllowsCopy)
+ {
+ effects |= DragDropEffects.Copy;
+ }
+ else if (this.AllowsMove)
+ {
+ effects |= DragDropEffects.Move;
+ }
+
+ return effects;
+ }
+
+ private void OnGiveFeedback(object sender, GiveFeedbackEventArgs args)
+ {
+ args.UseDefaultCursors = ((this.Callback.SupportedActions & DragDropProviderActions.Visual) == 0);
+ args.Handled = true;
+ }
+
+ private void OnQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
+ {
+#if DEBUG
+ if (this.DragScope != null)
+ {
+ Point pd = Mouse.GetPosition(this.DragScope);
+ }
+#endif
+ if (this.DragScope == null)
+ {
+ this.UpdateWindowLocation();
+ }
+ else
+ {
+ Point p = Mouse.GetPosition(this.DragScope);
+
+ if (this.adorner != null)
+ {
+ this.adorner.LeftOffset = p.X /* - _startPoint.X */ ;
+ this.adorner.TopOffset = p.Y /* - _startPoint.Y */ ;
+ }
+
+ if (this.mouseLeftScope)
+ {
+ e.Action = DragAction.Cancel;
+ e.Handled = true;
+ }
+ }
+ }
+
+ private void DestroyDragDropWindow()
+ {
+ if (this.dragdropWindow != null)
+ {
+ this.dragdropWindow.Close();
+ this.dragdropWindow = null;
+ }
+ }
+
+ private void CreateDragDropWindow(Visual dragElement)
+ {
+ Debug.Assert(this.dragdropWindow == null);
+
+ this.dragdropWindow = new Window();
+
+ this.dragdropWindow.WindowStyle = WindowStyle.None;
+ this.dragdropWindow.AllowsTransparency = true;
+ this.dragdropWindow.AllowDrop = false;
+ this.dragdropWindow.Background = null;
+ this.dragdropWindow.IsHitTestVisible = false;
+ this.dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight;
+ this.dragdropWindow.Topmost = true;
+ this.dragdropWindow.ShowInTaskbar = false;
+
+ this.dragdropWindow.SourceInitialized += new EventHandler(
+ delegate(object sender, EventArgs args)
+ {
+ //TODO assert that we can do this..
+ PresentationSource windowSource = PresentationSource.FromVisual(this.dragdropWindow);
+ IntPtr handle = ((HwndSource)windowSource).Handle;
+
+ Int32 styles = Win32Interop.GetWindowLong(handle, Win32Interop.GWL_EXSTYLE);
+
+ Win32Interop.SetWindowLong(handle, Win32Interop.GWL_EXSTYLE, styles | Win32Interop.WS_EX_LAYERED | Win32Interop.WS_EX_TRANSPARENT);
+ });
+
+ Rectangle r = new Rectangle();
+
+ r.Width = ((FrameworkElement)dragElement).ActualWidth;
+ r.Height = ((FrameworkElement)dragElement).ActualHeight;
+ r.Fill = new VisualBrush(dragElement);
+
+ this.dragdropWindow.Content = r;
+
+ // we want QueryContinueDrag notification so we can update the window position
+ //DragDrop.AddPreviewQueryContinueDragHandler(source, QueryContinueDrag);
+
+ // put the window in the right place to start
+ this.UpdateWindowLocation();
+ }
+
+ private void UpdateWindowLocation()
+ {
+ if (this.dragdropWindow != null)
+ {
+ Win32Interop.POINT p;
+
+ if (!Win32Interop.GetCursorPos(out p))
+ {
+ return;
+ }
+
+ this.dragdropWindow.Left = (double)p.X;
+ this.dragdropWindow.Top = (double)p.Y;
+ }
+ }
+
+ private void DragFinished(DragDropEffects ret)
+ {
+ Mouse.Capture(null);
+
+ if (this.IsDragging)
+ {
+ if (this.DragScope != null)
+ {
+ //AdornerLayer.GetAdornerLayer(this.DragScope).Remove(this.adorner);
+ //this.adorner = null;
+ }
+ else
+ {
+ this.DestroyDragDropWindow();
+ }
+ }
+
+ this.IsDragging = false;
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/DropHelper.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/DropHelper.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,333 @@
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using Chronos.Presentation.Core.VirtualDesktops;
+using Chronos.Presentation.Core.Widgets;
+using Chronos.Presentation.ViewModel;
+using Chronos.Presentation.Windows.Controls;
+using nRoute.Services;
+using nRoute.SiteMaps;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public sealed class DropHelper
+ {
+ #region Consts
+
+ const string UrlDataFormat = "text/x-moz-url";
+
+ #endregion
+
+ #region Fields
+
+ private UIElement dropTarget = null;
+ private string[] datatypes = { typeof(UIElement).ToString(), "Text" };
+ private DragDropEffects allowedEffects;
+
+ #endregion
+
+ #region Properties
+
+ public string[] AllowedDataTypes
+ {
+ get { return this.datatypes; }
+ set
+ {
+ this.datatypes = value;
+
+ for (int x = 0; x < this.datatypes.Length; x++)
+ {
+ this.datatypes[x] = this.datatypes[x].ToLower();
+ }
+ }
+ }
+
+ public DragDropEffects AllowedEffects
+ {
+ get { return this.allowedEffects; }
+ set { this.allowedEffects = value; }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ public DropHelper(UIElement wrapper)
+ {
+ this.dropTarget = wrapper;
+
+ this.dropTarget.AllowDrop = true;
+ this.dropTarget.DragOver += new DragEventHandler(DropTarget_DragOver);
+ this.dropTarget.Drop += new DragEventHandler(DropTarget_Drop);
+ }
+
+ #endregion
+
+ #region DropTarget Event Handlers
+
+ private void DropTarget_Drop(object sender, DragEventArgs e)
+ {
+ IDataObject data = e.Data;
+ DragDataWrapper dw = null;
+ bool isDataOperation = false;
+
+ Debug.Assert(data != null);
+
+ if (data.GetDataPresent(typeof(DragDataWrapper).ToString()))
+ {
+ dw = data.GetData(typeof(DragDataWrapper).ToString()) as DragDataWrapper;
+
+ Debug.Assert(dw.Shim != null);
+
+ if ((dw.Shim.SupportedActions & DragDropProviderActions.Data) != 0)
+ {
+ isDataOperation = true;
+ }
+ }
+
+ // Try a BRUTE FORCE APPROACH on UIElement just to show how it could be done
+ // BUT NOT ENDORSING IT!!!
+ if (!isDataOperation)
+ {
+ if (this.dropTarget is Canvas)
+ {
+ if (e.Data.GetDataPresent(DataFormats.FileDrop))
+ {
+ this.DropFileLink(e);
+ }
+ else if (e.Data.GetDataPresent(UrlDataFormat))
+ {
+ this.DropUrl(e);
+ }
+ }
+ }
+ else
+ {
+ Debug.Assert(dw != null);
+ Debug.Assert(dw.Shim != null);
+
+ object rawdata = dw.Data;
+
+ if (this.dropTarget is ItemsControl)
+ {
+ this.DropItemsControlHandler(e, rawdata);
+ }
+ else if (dropTarget is Canvas)
+ {
+ if (rawdata is IWidget)
+ {
+ this.DropCanvasWidget(e, rawdata as IWidget);
+ }
+ else if (rawdata is SiteMapNode)
+ {
+ this.DropCanvasInternalLink(e, rawdata as NavigationNode);
+ }
+ }
+ }
+
+ e.Handled = true;
+ }
+
+ private void DropTarget_DragOver(object sender, DragEventArgs e)
+ {
+ string[] types = e.Data.GetFormats();
+ bool match = false;
+
+ if (datatypes == null || types == null)
+ {
+ //TODO: ??? Should we set for DragDropEffects.None?
+ return;
+ }
+
+ foreach (string s in types)
+ {
+ foreach (string type in datatypes)
+ {
+ match = (s.ToLower() == type);
+
+ if (match)
+ {
+ break;
+ }
+ }
+
+ if (match)
+ {
+ break;
+ }
+ }
+
+ if (match)
+ {
+ e.Effects = AllowedEffects;
+ e.Handled = true;
+ }
+ }
+
+ #endregion
+
+ #region Drop Handlers Methods
+
+ private void DropCanvasWidget(DragEventArgs e, IWidget dropObject)
+ {
+ ServiceLocator.GetService()
+ .Show
+ (
+ dropObject.CreateView() as WidgetElement,
+ e.GetPosition(this.dropTarget)
+ );
+ }
+
+ private void DropItemsControlHandler(DragEventArgs e, object rawdata)
+ {
+ ItemsControl ic = this.dropTarget as ItemsControl;
+ IList list = ic.ItemsSource as IList;
+
+ if (list == null)
+ {
+ list = ic.Items as System.Collections.IList;
+ }
+
+ if (list != null)
+ {
+ if (!list.Contains(rawdata))
+ {
+ // Here we do not check for Move | Copy ... because this is a DATA operation .. No parent relationshop at all ...
+ list.Add(rawdata);
+ }
+ else
+ {
+ // nothing was done ...
+ e.Effects = DragDropEffects.None;
+ }
+ }
+ else
+ {
+ e.Effects = DragDropEffects.None;
+ }
+ }
+
+ private void DropFileLink(DragEventArgs e)
+ {
+ // External link drop
+ Point position = e.GetPosition(this.dropTarget);
+ string[] filenames = e.Data.GetData(DataFormats.FileDrop, true) as string[];
+
+ e.Effects = DragDropEffects.Link;
+
+ foreach (string filename in filenames)
+ {
+ ServiceLocator.GetService()
+ .CreateShortcut
+ (
+ Path.GetFileNameWithoutExtension(filename), filename, position
+ );
+ }
+ }
+
+ private void DropUrl(DragEventArgs e)
+ {
+ // External link drop
+ Point position = e.GetPosition(this.dropTarget);
+ String data = null;
+
+ using (MemoryStream stream = e.Data.GetData(UrlDataFormat, true) as MemoryStream)
+ {
+ using (StreamReader reader = new StreamReader(stream, Encoding.Unicode))
+ {
+ data = reader.ReadToEnd().Replace("\0", "");
+ }
+ }
+
+ if (!String.IsNullOrEmpty(data))
+ {
+ string[] elements = data.Split('\n');
+
+ e.Effects = DragDropEffects.Link;
+
+ if (!String.IsNullOrWhiteSpace(elements[0]) &&
+ !String.IsNullOrWhiteSpace(elements[1]))
+ {
+ ServiceLocator.GetService()
+ .CreateShortcut
+ (
+ elements[1],
+ elements[0],
+ position
+ );
+ }
+ }
+ }
+
+ private void DropCanvasInternalLink(DragEventArgs e, NavigationNode siteMapNode)
+ {
+ Point position = e.GetPosition(this.dropTarget);
+
+ ServiceLocator.GetService()
+ .CreateShortcut
+ (
+ siteMapNode.Title,
+ siteMapNode.Url,
+ position
+ );
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private bool Unparent(DragDataWrapper dw, UIElement uie)
+ {
+ bool success = false;
+
+ if (dw != null)
+ {
+ if (dw.AllowChildrenRemove)
+ {
+ dw.Shim.UnParent();
+ }
+ }
+
+ if (!success) // BRUTE FORCE
+ {
+ if (uie is FrameworkElement)
+ {
+ FrameworkElement fe = uie as FrameworkElement;
+
+ if (fe.Parent != null)
+ {
+ if (fe.Parent is Panel)
+ {
+ try
+ {
+ ((Panel)(fe.Parent)).Children.Remove(uie);
+ success = true;
+ }
+ catch (Exception)
+ {
+#if DEBUG
+ System.Diagnostics.Debug.Assert(false);
+#endif
+ }
+ }
+ }
+ else if (fe.Parent is ContentControl)
+ {
+ ContentControl cc = fe.Parent as ContentControl;
+
+ cc.Content = null;
+ success = true;
+ }
+ }
+ }
+
+ return success;
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/IDataDropObject.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/IDataDropObject.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public interface IDataDropObject
+ {
+ #region · Methods ·
+
+ object GetData();
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/IDataDropObjectProvider.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/IDataDropObjectProvider.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,41 @@
+using System.Windows;
+using System.Windows.Input;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ // This is an interface that can be implemented to help the DragHelper ( aka the source )
+ public interface IDataDropObjectProvider
+ {
+ #region · Properties ·
+
+ //Flag of actions sypported by implementation of IDataDropObjectProvider
+ DragDropProviderActions SupportedActions
+ {
+ get;
+ }
+
+ #endregion
+
+ #region · Methods ·
+
+ // Called before StartDrag () to get the Data () to be used in the DataObject
+ object GetData();
+
+ // Called before StartDrag () to add other formats , this way you can drag drop externally..
+ void AppendData(ref IDataObject data, MouseEventArgs e);
+
+ // Called to get the visual ( UIElement visual brush of the object being dragged..
+ UIElement GetVisual(MouseEventArgs e);
+
+ // Gives feedback during Drag
+ void GiveFeedback(GiveFeedbackEventArgs args);
+
+ // implements ContinueDrag -- to canceld the D&D..
+ void ContinueDrag(QueryContinueDragEventArgs args);
+
+ // called by the TARGET object .. this will attempt to "unparent" the current child so we can add it a child some where else..
+ bool UnParent();
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/ListBoxDragDropDataProvider.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/ListBoxDragDropDataProvider.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,103 @@
+using System;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Xml;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public sealed class ListBoxDragDropDataProvider : IDataDropObjectProvider
+ {
+ #region Fields
+
+ private ListBox list;
+
+ #endregion
+
+ #region Properties
+
+ public DragDropProviderActions SupportedActions
+ {
+ get
+ {
+ return DragDropProviderActions.Data |
+ DragDropProviderActions.Visual |
+ DragDropProviderActions.Unparent |
+ DragDropProviderActions.MultiFormatData;
+ }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ public ListBoxDragDropDataProvider(ListBox list)
+ {
+ this.list = list;
+ }
+
+ #endregion
+
+ #region IDataDropObjectProvider Members
+
+ public void AppendData (ref IDataObject data, MouseEventArgs e)
+ {
+ if (!(this.list.InputHitTest(e.GetPosition(e.OriginalSource as UIElement)) is ListBox)
+ && !(this.list.InputHitTest(e.GetPosition(e.OriginalSource as UIElement)) is ScrollViewer)
+ && !(e.OriginalSource is Thumb))
+ {
+ object o = this.list.SelectedItem;
+
+ // This is cheating .. just for an example's sake..
+ Debug.Assert(!data.GetDataPresent(DataFormats.Text));
+
+ if (o.GetType() == typeof(XmlElement))
+ {
+ data.SetData(DataFormats.Text, ((XmlElement)o).OuterXml);
+ }
+ else
+ {
+ data.SetData(DataFormats.Text, o.ToString());
+ }
+
+ Debug.Assert(!data.GetDataPresent(o.GetType().ToString()));
+
+ data.SetData(o.GetType().ToString(), o);
+ }
+ else
+ {
+ data = null;
+ }
+ }
+
+ public object GetData()
+ {
+ return this.list.SelectedItem;
+ }
+
+ public UIElement GetVisual(MouseEventArgs e)
+ {
+ return this.list.ItemContainerGenerator.ContainerFromItem(this.list.SelectedItem) as UIElement;
+ }
+
+ public void GiveFeedback(System.Windows.GiveFeedbackEventArgs args)
+ {
+ throw new NotImplementedException("Forgot to check the Supported actions??");
+ }
+
+ public void ContinueDrag(System.Windows.QueryContinueDragEventArgs args)
+ {
+ throw new NotImplementedException("Forgot to check the Supported actions??");
+ }
+
+ public bool UnParent()
+ {
+ // We are passing data, nothing to unparent
+ throw new NotImplementedException("We are passing data, nothing to unparent... what up ");
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/Properties/AssemblyInfo.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/Properties/AssemblyInfo.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,11 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows.Markup;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("chronos")]
+[assembly: AssemblyDescription("Soporte para Drag & Drop")]
+
+[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.DragAndDrop")]
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/DragAndDrop/TreeviewDragDropDataProvider.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/DragAndDrop/TreeviewDragDropDataProvider.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,113 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Xml;
+using Chronos.Extensions.Windows;
+
+namespace Chronos.Presentation.DragAndDrop
+{
+ public sealed class TreeViewDragDropDataProvider : IDataDropObjectProvider
+ {
+ #region · Fields ·
+
+ private TreeView treeview;
+
+ #endregion
+
+ #region · Properties ·
+
+ public DragDropProviderActions SupportedActions
+ {
+ get
+ {
+ return DragDropProviderActions.Data |
+ DragDropProviderActions.MultiFormatData;
+ }
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ public TreeViewDragDropDataProvider(TreeView treeview)
+ {
+ this.treeview = treeview;
+ }
+
+ #endregion
+
+ #region · IDataDropObjectProvider Members ·
+
+ public void AppendData(ref IDataObject data, MouseEventArgs e)
+ {
+ if (!(this.treeview.InputHitTest(e.GetPosition(e.OriginalSource as UIElement)) is TreeView)
+ && !(this.treeview.InputHitTest(e.GetPosition(e.OriginalSource as UIElement)) is ScrollViewer)
+ && !(e.OriginalSource is Thumb))
+ {
+ TreeViewItem selectedUIelement = this.GetVisual(e).GetParent();
+
+ if (selectedUIelement != null && selectedUIelement.Items.Count == 0)
+ {
+ object selectedItem = this.treeview.SelectedItem;
+
+ if (selectedItem != null)
+ {
+ if (selectedItem.GetType() == typeof(XmlElement))
+ {
+ data.SetData(DataFormats.Text, ((XmlElement)selectedItem).OuterXml);
+ }
+ else
+ {
+ data.SetData(DataFormats.Text, selectedItem.ToString());
+ }
+
+ data.SetData(selectedItem.GetType().ToString(), selectedItem);
+ }
+ else
+ {
+ data = null;
+ }
+ }
+ else
+ {
+ data = null;
+ }
+ }
+ else
+ {
+ data = null;
+ }
+ }
+
+ public object GetData()
+ {
+ return this.treeview.SelectedItem;
+ }
+
+ public UIElement GetVisual(MouseEventArgs e)
+ {
+ // return this.treeview.ItemContainerGenerator.ContainerFromItem(this.treeview.SelectedItem) as UIElement;
+ return e.OriginalSource as UIElement;
+ }
+
+ public void GiveFeedback(System.Windows.GiveFeedbackEventArgs args)
+ {
+ throw new NotImplementedException("Forgot to check the Supported actions??");
+ }
+
+ public void ContinueDrag(System.Windows.QueryContinueDragEventArgs args)
+ {
+ throw new NotImplementedException("Forgot to check the Supported actions??");
+ }
+
+ public bool UnParent()
+ {
+ // We are passing data, nothing to unparent
+ throw new NotImplementedException("We are passing data, nothing to unparent... what up ");
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/ArrayExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/ArrayExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,146 @@
+/*
+ Copyright (c) 2008 - 2009, Carlos Guzmán Álvarez
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+ * Neither the name of the author nor the names of its contributors may be used to endorse or
+ promote products derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods
+ ///
+ public static class ArrayExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Converts a given byte array to a base-64 string
+ ///
+ ///
+ ///
+ public static string ToBase64String(this byte[] buffer)
+ {
+ return Convert.ToBase64String(buffer);
+ }
+
+ ///
+ /// Computes the MD5 hash of a given byte array
+ ///
+ ///
+ ///
+ public static byte[] ComputeMD5Hash(this byte[] buffer)
+ {
+ MD5 md5 = MD5.Create();
+ md5.TransformFinalBlock(buffer, 0, buffer.Length);
+
+ return md5.Hash;
+ }
+
+ ///
+ /// Computes the SHA1 hash of a given byte array
+ ///
+ ///
+ ///
+ public static byte[] ComputeSHA1Hash(this byte[] buffer)
+ {
+ SHA1 hashAlgorithm = SHA1.Create();
+ hashAlgorithm.TransformFinalBlock(buffer, 0, buffer.Length);
+
+ return hashAlgorithm.Hash;
+ }
+
+ ///
+ /// Computes the MD5 hash of a given array of strings
+ ///
+ ///
+ ///
+ public static byte[] ComputeMD5Hash(this string[] values)
+ {
+ MD5 hashAlgorithm = MD5.Create();
+
+ foreach (string value in values)
+ {
+ if (value != null)
+ {
+ byte[] buffer = Encoding.UTF8.GetBytes(value);
+ byte[] output = new byte[buffer.Length];
+ int count = hashAlgorithm.TransformBlock(buffer, 0, buffer.Length, output, 0);
+ }
+ }
+
+ hashAlgorithm.TransformFinalBlock(new byte[0], 0, 0);
+
+ return hashAlgorithm.Hash;
+ }
+
+ ///
+ /// Computes the SHA1 hash of a given array of strings
+ ///
+ ///
+ ///
+ private static byte[] ComputeSHA1Hash(this string[] values)
+ {
+ SHA1 hashAlgorithm = SHA1.Create();
+
+ foreach (string value in values)
+ {
+ if (value != null)
+ {
+ byte[] buffer = Encoding.UTF8.GetBytes(value);
+ byte[] output = new byte[buffer.Length];
+ int count = hashAlgorithm.TransformBlock(buffer, 0, buffer.Length, output, 0);
+ }
+ }
+
+ hashAlgorithm.TransformFinalBlock(new byte[0], 0, 0);
+
+ return hashAlgorithm.Hash;
+ }
+
+ ///
+ /// Convert a byte array to an hex string
+ ///
+ ///
+ ///
+ public static string ToHexString(this byte[] buffer)
+ {
+ StringBuilder hex = new StringBuilder();
+
+ for (int i = 0; i < buffer.Length; i++)
+ {
+ hex.Append(buffer[i].ToString("x2"));
+ }
+
+ return hex.ToString();
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/BitmapExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/BitmapExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,191 @@
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for the System.Drawing.Bitmap class
+ ///
+ public static class BitmapExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Scales the bitmap to the passed target size without respecting the aspect.
+ ///
+ /// The source bitmap.
+ /// The target size.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleToSize(100, 100);
+ ///
+ public static Bitmap ScaleToSize(this Bitmap bitmap, Size size)
+ {
+ return bitmap.ScaleToSize(size.Width, size.Height);
+ }
+
+ ///
+ /// Scales the bitmap to the passed target size without respecting the aspect.
+ ///
+ /// The source bitmap.
+ /// The target width.
+ /// The target height.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleToSize(100, 100);
+ ///
+ public static Bitmap ScaleToSize(this Bitmap bitmap, int width, int height)
+ {
+ var scaledBitmap = new Bitmap(width, height);
+
+ using (var g = Graphics.FromImage(scaledBitmap))
+ {
+ g.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ g.DrawImage(bitmap, 0, 0, width, height);
+ }
+
+ return scaledBitmap;
+ }
+
+ ///
+ /// Scales the bitmap to the passed target size by respecting the aspect.
+ ///
+ /// The source bitmap.
+ /// The target size.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleProportional(100, 100);
+ ///
+ /// Please keep in mind that the returned bitmaps size might not match the desired size due to original bitmaps aspect.
+ public static Bitmap ScaleProportional(this Bitmap bitmap, Size size)
+ {
+ return bitmap.ScaleProportional(size.Width, size.Height);
+ }
+
+ ///
+ /// Scales the bitmap to the passed target size by respecting the aspect.
+ ///
+ /// The source bitmap.
+ /// The target width.
+ /// The target height.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleProportional(100, 100);
+ ///
+ /// Please keep in mind that the returned bitmaps size might not match the desired size due to original bitmaps aspect.
+ public static Bitmap ScaleProportional(this Bitmap bitmap, int width, int height)
+ {
+ float proportionalWidth, proportionalHeight;
+
+ if (width.Equals(0))
+ {
+ proportionalWidth = ((float)height) / bitmap.Size.Height * bitmap.Width;
+ proportionalHeight = height;
+ }
+ else if (height.Equals(0))
+ {
+ proportionalWidth = width;
+ proportionalHeight = ((float)width) / bitmap.Size.Width * bitmap.Height;
+ }
+ else if (((float)width) / bitmap.Size.Width * bitmap.Size.Height <= height)
+ {
+ proportionalWidth = width;
+ proportionalHeight = ((float)width) / bitmap.Size.Width * bitmap.Height;
+ }
+ else
+ {
+ proportionalWidth = ((float)height) / bitmap.Size.Height * bitmap.Width;
+ proportionalHeight = height;
+ }
+
+ return bitmap.ScaleToSize((int)proportionalWidth, (int)proportionalHeight);
+ }
+
+ ///
+ /// Scales the bitmap to the passed target size by respecting the aspect. The overlapping background is filled with the given background color.
+ ///
+ /// The source bitmap.
+ /// The target size.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleToSizeProportional(100, 100);
+ ///
+ public static Bitmap ScaleToSizeProportional(this Bitmap bitmap, Size size)
+ {
+ return bitmap.ScaleToSizeProportional(Color.White, size);
+ }
+
+ ///
+ /// Scales the bitmap to the passed target size by respecting the aspect. The overlapping background is filled with the given background color.
+ ///
+ /// The source bitmap.
+ /// The color of the background.
+ /// The target size.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleToSizeProportional(100, 100);
+ ///
+ public static Bitmap ScaleToSizeProportional(this Bitmap bitmap, Color backgroundColor, Size size)
+ {
+ return bitmap.ScaleToSizeProportional(backgroundColor, size.Width, size.Height);
+ }
+
+ ///
+ /// Scales the bitmap to the passed target size by respecting the aspect. The overlapping background is filled with the given background color.
+ ///
+ /// The source bitmap.
+ /// The target width.
+ /// The target height.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleToSizeProportional(100, 100);
+ ///
+ public static Bitmap ScaleToSizeProportional(this Bitmap bitmap, int width, int height)
+ {
+ return bitmap.ScaleToSizeProportional(Color.White, width, height);
+ }
+
+ ///
+ /// Scales the bitmap to the passed target size by respecting the aspect. The overlapping background is filled with the given background color.
+ ///
+ /// The source bitmap.
+ /// The color of the background.
+ /// The target width.
+ /// The target height.
+ /// The scaled bitmap
+ ///
+ /// var bitmap = new Bitmap("image.png");
+ /// var thumbnail = bitmap.ScaleToSizeProportional(100, 100);
+ ///
+ public static Bitmap ScaleToSizeProportional(this Bitmap bitmap, Color backgroundColor, int width, int height)
+ {
+ var scaledBitmap = new Bitmap(width, height);
+ using (var g = Graphics.FromImage(scaledBitmap))
+ {
+ g.Clear(backgroundColor);
+
+ var proportionalBitmap = bitmap.ScaleProportional(width, height);
+
+ var imagePosition = new Point
+ (
+ (int)((width - proportionalBitmap.Width) / 2m),
+ (int)((height - proportionalBitmap.Height) / 2m)
+ );
+
+ g.DrawImage(proportionalBitmap, imagePosition);
+ }
+
+ return scaledBitmap;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/Chronos.Extensions.csproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/Chronos.Extensions.csproj Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,83 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {AA911078-3A2A-41B1-B779-3C8B55E1B8E3}
+ Library
+ Properties
+ Chronos.Extensions
+ Chronos.Extensions
+ v4.0
+ 512
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ Properties\SolutionInfo.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/CollectionExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/CollectionExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for all kind of Collections implementing the ICollection<T> interface
+ ///
+ public static class CollectionExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Adds a value uniquely to to a collection and returns a value whether the value was added or not.
+ ///
+ /// The generic collection value type
+ /// The collection.
+ /// The value to be added.
+ /// Indicates whether the value was added or not
+ ///
+ /// list.AddUnique(1); // returns true;
+ /// list.AddUnique(1); // returns false the second time;
+ ///
+ public static bool AddUnique(this ICollection collection, T value)
+ {
+ if (!collection.Contains(value))
+ {
+ collection.Add(value);
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
+ /// Adds a range of value uniquely to a collection and returns the amount of values added.
+ ///
+ /// The generic collection value type.
+ /// The collection.
+ /// The values to be added.
+ /// The amount if values that were added.
+ public static int AddRangeUnique(this ICollection collection, IEnumerable values)
+ {
+ var count = 0;
+
+ foreach (var value in values)
+ {
+ if (collection.AddUnique(value))
+ {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ public static void AddRange(this ICollection collection, IEnumerable values)
+ {
+ foreach (T value in values)
+ {
+ collection.Add(value);
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/CombinedException.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/CombinedException.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,39 @@
+using System;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Generic exception for combining several other exceptions
+ ///
+ public class CombinedException : Exception
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets the inner exceptions.
+ ///
+ /// The inner exceptions.
+ public Exception[] InnerExceptions
+ {
+ get;
+ protected set;
+ }
+
+ #endregion
+
+ #region · Constructors ·
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message.
+ /// The inner exceptions.
+ public CombinedException(string message, Exception[] innerExceptions)
+ : base(message)
+ {
+ this.InnerExceptions = innerExceptions;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/ComparableExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/ComparableExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for all comparable objects eg. string, DateTime, numeric values ...
+ ///
+ public static class ComparableExtensions
+ {
+
+ ///
+ /// Determines whether the specified value is between the the defined minimum and maximum range (including those values).
+ ///
+ ///
+ /// The value.
+ /// The minimum value.
+ /// The maximum value.
+ ///
+ /// true if the specified value is between min and max; otherwise, false.
+ ///
+ ///
+ /// var value = 5;
+ /// if(value.IsBetween(1, 10)) {
+ /// // ...
+ /// }
+ ///
+ public static bool IsBetween(this T value, T minValue, T maxValue) where T : IComparable
+ {
+ return IsBetween(value, minValue, maxValue, null);
+ }
+
+ ///
+ /// Determines whether the specified value is between the the defined minimum and maximum range (including those values).
+ ///
+ ///
+ /// The value.
+ /// The minimum value.
+ /// The maximum value.
+ /// An optional comparer to be used instead of the types default comparer.
+ ///
+ /// true if the specified value is between min and max; otherwise, false.
+ ///
+ ///
+ /// var value = 5;
+ /// if(value.IsBetween(1, 10)) {
+ /// // ...
+ /// }
+ ///
+ public static bool IsBetween(this T value, T minValue, T maxValue, IComparer comparer) where T : IComparable
+ {
+ comparer = comparer ?? Comparer.Default;
+
+ var minMaxCompare = comparer.Compare(minValue, maxValue);
+ if (minMaxCompare < 0)
+ {
+ return ((comparer.Compare(value, minValue) >= 0) && (comparer.Compare(value, maxValue) <= 0));
+ }
+ else if (minMaxCompare == 0)
+ {
+ return (comparer.Compare(value, minValue) == 0);
+ }
+ else
+ {
+ return ((comparer.Compare(value, maxValue) >= 0) && (comparer.Compare(value, minValue) <= 0));
+ }
+ }
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/Converter.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/Converter.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,39 @@
+using System;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// An internal implementation of the IConverter<T> interface
+ ///
+ ///
+ internal class Converter
+ : IConverter
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets the internal value to be converted.
+ ///
+ /// The value.
+ public T Value
+ {
+ get;
+ protected set;
+ }
+
+ #endregion
+
+ #region · Methods ·
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The value.
+ public Converter(T value)
+ {
+ this.Value = value;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/DateTimeExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/DateTimeExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,299 @@
+using System;
+using System.Globalization;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for the DateTimeOffset data type.
+ ///
+ public static class DateTimeExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Calculates the age based on today.
+ ///
+ /// The date of birth.
+ /// The calculated age.
+ public static int CalculateAge(this DateTime dateOfBirth)
+ {
+ return CalculateAge(dateOfBirth, DateTime.Today);
+ }
+
+ ///
+ /// Calculates the age based on a passed reference date.
+ ///
+ /// The date of birth.
+ /// The reference date to calculate on.
+ /// The calculated age.
+ public static int CalculateAge(this DateTime dateOfBirth, DateTime referenceDate)
+ {
+ int years = referenceDate.Year - dateOfBirth.Year;
+
+ if (referenceDate.Month < dateOfBirth.Month
+ || (referenceDate.Month == dateOfBirth.Month
+ && referenceDate.Day < dateOfBirth.Day))
+ {
+ --years;
+ }
+
+ return years;
+ }
+
+ ///
+ /// Returns the number of days in the month of the provided date.
+ ///
+ /// The date.
+ /// The number of days.
+ public static int GetCountDaysOfMonth(this DateTime date)
+ {
+ var nextMonth = date.AddMonths(1);
+
+ return new DateTime(nextMonth.Year, nextMonth.Month, 1).AddDays(-1).Day;
+ }
+
+ ///
+ /// Returns the first day of the month of the provided date.
+ ///
+ /// The date.
+ /// The first day of the month
+ public static DateTime GetFirstDayOfMonth(this DateTime date)
+ {
+ return new DateTime(date.Year, date.Month, 1);
+ }
+
+ ///
+ /// Returns the first day of the month of the provided date.
+ ///
+ /// The date.
+ /// The desired day of week.
+ /// The first day of the month
+ public static DateTime GetFirstDayOfMonth(this DateTime date, DayOfWeek dayOfWeek)
+ {
+ var dt = date.GetFirstDayOfMonth();
+
+ while (dt.DayOfWeek != dayOfWeek)
+ {
+ dt = dt.AddDays(1);
+ }
+
+ return dt;
+ }
+
+ ///
+ /// Returns the last day of the month of the provided date.
+ ///
+ /// The date.
+ /// The last day of the month.
+ public static DateTime GetLastDayOfMonth(this DateTime date)
+ {
+ return new DateTime(date.Year, date.Month, GetCountDaysOfMonth(date));
+ }
+
+ ///
+ /// Returns the last day of the month of the provided date.
+ ///
+ /// The date.
+ /// The desired day of week.
+ /// The date time
+ public static DateTime GetLastDayOfMonth(this DateTime date, DayOfWeek dayOfWeek)
+ {
+ var dt = date.GetLastDayOfMonth();
+
+ while (dt.DayOfWeek != dayOfWeek)
+ {
+ dt = dt.AddDays(-1);
+ }
+
+ return dt;
+ }
+
+ ///
+ /// Indicates whether the date is today.
+ ///
+ /// The date.
+ ///
+ /// true if the specified date is today; otherwise, false.
+ ///
+ public static bool IsToday(this DateTime dt)
+ {
+ return (dt.Date == DateTime.Today);
+ }
+
+ ///
+ /// Sets the time on the specified DateTime value.
+ ///
+ /// The base date.
+ /// The hours to be set.
+ /// The minutes to be set.
+ /// The seconds to be set.
+ /// The DateTime including the new time value
+ public static DateTime SetTime(this DateTime date, int hours, int minutes, int seconds)
+ {
+ return date.SetTime(new TimeSpan(hours, minutes, seconds));
+ }
+
+ ///
+ /// Sets the time on the specified DateTime value.
+ ///
+ /// The base date.
+ /// The TimeSpan to be applied.
+ ///
+ /// The DateTime including the new time value
+ ///
+ public static DateTime SetTime(this DateTime date, TimeSpan time)
+ {
+ return date.Date.Add(time);
+ }
+
+ ///
+ /// Converts a DateTime into a DateTimeOffset using the local system time zone.
+ ///
+ /// The local DateTime.
+ /// The converted DateTimeOffset
+ public static DateTimeOffset ToDateTimeOffset(this DateTime localDateTime)
+ {
+ return localDateTime.ToDateTimeOffset(null);
+ }
+
+ ///
+ /// Converts a DateTime into a DateTimeOffset using the specified time zone.
+ ///
+ /// The local DateTime.
+ /// The local time zone.
+ /// The converted DateTimeOffset
+ public static DateTimeOffset ToDateTimeOffset(this DateTime localDateTime, TimeZoneInfo localTimeZone)
+ {
+ localTimeZone = (localTimeZone ?? TimeZoneInfo.Local);
+
+ if (localDateTime.Kind != DateTimeKind.Unspecified)
+ {
+ localDateTime = new DateTime(localDateTime.Ticks, DateTimeKind.Unspecified);
+ }
+
+ return TimeZoneInfo.ConvertTimeToUtc(localDateTime, localTimeZone);
+ }
+
+ ///
+ /// Gets the first day of the week using the current culture.
+ ///
+ /// The date.
+ /// The first day of the week
+ public static DateTime GetFirstDayOfWeek(this DateTime date)
+ {
+ return date.GetFirstDayOfWeek(null);
+ }
+
+ ///
+ /// Gets the first day of the week using the specified culture.
+ ///
+ /// The date.
+ /// The culture to determine the first weekday of a week.
+ /// The first day of the week
+ public static DateTime GetFirstDayOfWeek(this DateTime date, CultureInfo cultureInfo)
+ {
+ cultureInfo = (cultureInfo ?? CultureInfo.CurrentCulture);
+
+ var firstDayOfWeek = cultureInfo.DateTimeFormat.FirstDayOfWeek;
+
+ while (date.DayOfWeek != firstDayOfWeek)
+ {
+ date = date.AddDays(-1);
+ }
+
+ return date;
+ }
+
+ ///
+ /// Gets the last day of the week using the current culture.
+ ///
+ /// The date.
+ /// The first day of the week
+ public static DateTime GetLastDayOfWeek(this DateTime date)
+ {
+ return date.GetLastDayOfWeek(null);
+ }
+
+ ///
+ /// Gets the last day of the week using the specified culture.
+ ///
+ /// The date.
+ /// The culture to determine the first weekday of a week.
+ /// The first day of the week
+ public static DateTime GetLastDayOfWeek(this DateTime date, CultureInfo cultureInfo)
+ {
+ return date.GetFirstDayOfWeek(cultureInfo).AddDays(6);
+ }
+
+ ///
+ /// Gets the next occurence of the specified weekday within the current week using the current culture.
+ ///
+ /// The base date.
+ /// The desired weekday.
+ /// The calculated date.
+ ///
+ /// var thisWeeksMonday = DateTime.Now.GetWeekday(DayOfWeek.Monday);
+ ///
+ public static DateTime GetWeeksWeekday(this DateTime date, DayOfWeek weekday)
+ {
+ return date.GetWeeksWeekday(weekday, null);
+ }
+
+ ///
+ /// Gets the next occurence of the specified weekday within the current week using the specified culture.
+ ///
+ /// The base date.
+ /// The desired weekday.
+ /// The culture to determine the first weekday of a week.
+ /// The calculated date.
+ ///
+ /// var thisWeeksMonday = DateTime.Now.GetWeekday(DayOfWeek.Monday);
+ ///
+ public static DateTime GetWeeksWeekday(this DateTime date, DayOfWeek weekday, CultureInfo cultureInfo)
+ {
+ var firstDayOfWeek = date.GetFirstDayOfWeek(cultureInfo);
+
+ return firstDayOfWeek.GetNextWeekday(weekday);
+ }
+
+ ///
+ /// Gets the next occurence of the specified weekday.
+ ///
+ /// The base date.
+ /// The desired weekday.
+ /// The calculated date.
+ ///
+ /// var lastMonday = DateTime.Now.GetNextWeekday(DayOfWeek.Monday);
+ ///
+ public static DateTime GetNextWeekday(this DateTime date, DayOfWeek weekday)
+ {
+ while (date.DayOfWeek != weekday)
+ {
+ date = date.AddDays(1);
+ }
+
+ return date;
+ }
+
+ ///
+ /// Gets the previous occurence of the specified weekday.
+ ///
+ /// The base date.
+ /// The desired weekday.
+ /// The calculated date.
+ ///
+ /// var lastMonday = DateTime.Now.GetPreviousWeekday(DayOfWeek.Monday);
+ ///
+ public static DateTime GetPreviousWeekday(this DateTime date, DayOfWeek weekday)
+ {
+ while (date.DayOfWeek != weekday)
+ {
+ date = date.AddDays(-1);
+ }
+
+ return date;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/DateTimeOffsetExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/DateTimeOffsetExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,91 @@
+using System;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for the DateTimeOffset data type.
+ ///
+ public static class DateTimeOffsetExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Indicates whether the date is today.
+ ///
+ /// The date.
+ ///
+ /// true if the specified date is today; otherwise, false.
+ ///
+ public static bool IsToday(this DateTimeOffset dto)
+ {
+ return (dto.Date.IsToday());
+ }
+
+ ///
+ /// Sets the time on the specified DateTimeOffset value using the local system time zone.
+ ///
+ /// The base date.
+ /// The hours to be set.
+ /// The minutes to be set.
+ /// The seconds to be set.
+ /// The DateTimeOffset including the new time value
+ public static DateTimeOffset SetTime(this DateTimeOffset date, int hours, int minutes, int seconds)
+ {
+ return date.SetTime(new TimeSpan(hours, minutes, seconds));
+ }
+
+ ///
+ /// Sets the time on the specified DateTime value using the local system time zone.
+ ///
+ /// The base date.
+ /// The TimeSpan to be applied.
+ ///
+ /// The DateTimeOffset including the new time value
+ ///
+ public static DateTimeOffset SetTime(this DateTimeOffset date, TimeSpan time)
+ {
+ return date.SetTime(time, null);
+ }
+
+ ///
+ /// Sets the time on the specified DateTime value using the specified time zone.
+ ///
+ /// The base date.
+ /// The TimeSpan to be applied.
+ /// The local time zone.
+ /// /// The DateTimeOffset including the new time value///
+ public static DateTimeOffset SetTime(this DateTimeOffset date, TimeSpan time, TimeZoneInfo localTimeZone)
+ {
+ var localDate = date.ToLocalDateTime(localTimeZone);
+
+ localDate.SetTime(time);
+
+ return localDate.ToDateTimeOffset(localTimeZone);
+ }
+
+ ///
+ /// Converts a DateTimeOffset into a DateTime using the local system time zone.
+ ///
+ /// The base DateTimeOffset.
+ /// The converted DateTime
+ public static DateTime ToLocalDateTime(this DateTimeOffset dateTimeUtc)
+ {
+ return dateTimeUtc.ToLocalDateTime(null);
+ }
+
+ ///
+ /// Converts a DateTimeOffset into a DateTime using the specified time zone.
+ ///
+ /// The base DateTimeOffset.
+ /// The time zone to be used for conversion.
+ /// The converted DateTime
+ public static DateTime ToLocalDateTime(this DateTimeOffset dateTimeUtc, TimeZoneInfo localTimeZone)
+ {
+ localTimeZone = (localTimeZone ?? TimeZoneInfo.Local);
+
+ return TimeZoneInfo.ConvertTime(dateTimeUtc, localTimeZone).DateTime;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/DirectoryInfoExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/DirectoryInfoExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,163 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for the DirectoryInfo class
+ ///
+ public static class DirectoryInfoExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Gets all files in the directory matching one of the several (!) supplied patterns (instead of just one in the regular implementation).
+ ///
+ /// The directory.
+ /// The patterns.
+ /// The matching files
+ /// This methods is quite perfect to be used in conjunction with the newly created FileInfo-Array extension methods.
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ ///
+ public static FileInfo[] GetFiles(this DirectoryInfo directory, params string[] patterns)
+ {
+ var files = new List();
+
+ foreach (var pattern in patterns)
+ {
+ files.AddRange(directory.GetFiles(pattern));
+ }
+
+ return files.ToArray();
+ }
+
+ ///
+ /// Searches the provided directory recursively and returns the first file matching the provided pattern.
+ ///
+ /// The directory.
+ /// The pattern.
+ /// The found file
+ ///
+ ///
+ /// var directory = new DirectoryInfo(@"c:\");
+ /// var file = directory.FindFileRecursive("win.ini");
+ ///
+ public static FileInfo FindFileRecursive(this DirectoryInfo directory, string pattern)
+ {
+ var files = directory.GetFiles(pattern);
+
+ if (files.Length > 0)
+ {
+ return files[0];
+ }
+
+ foreach (var subDirectory in directory.GetDirectories())
+ {
+ var foundFile = subDirectory.FindFileRecursive(pattern);
+
+ if (foundFile != null)
+ {
+ return foundFile;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Searches the provided directory recursively and returns the first file matching to the provided predicate.
+ ///
+ /// The directory.
+ /// The predicate.
+ /// The found file
+ ///
+ ///
+ /// var directory = new DirectoryInfo(@"c:\");
+ /// var file = directory.FindFileRecursive(f => f.Extension == ".ini");
+ ///
+ public static FileInfo FindFileRecursive(this DirectoryInfo directory, Func predicate)
+ {
+ foreach (var file in directory.GetFiles())
+ {
+ if (predicate(file))
+ {
+ return file;
+ }
+ }
+
+ foreach (var subDirectory in directory.GetDirectories())
+ {
+ var foundFile = subDirectory.FindFileRecursive(predicate);
+
+ if (foundFile != null)
+ {
+ return foundFile;
+ }
+ }
+
+ return null;
+ }
+
+ ///
+ /// Searches the provided directory recursively and returns the all files matching the provided pattern.
+ ///
+ /// The directory.
+ /// The pattern.
+ /// This methods is quite perfect to be used in conjunction with the newly created FileInfo-Array extension methods.
+ /// The found files
+ ///
+ ///
+ /// var directory = new DirectoryInfo(@"c:\");
+ /// var files = directory.FindFilesRecursive("*.ini");
+ ///
+ public static FileInfo[] FindFilesRecursive(this DirectoryInfo directory, string pattern)
+ {
+ var foundFiles = new List();
+
+ FindFilesRecursive(directory, pattern, foundFiles);
+
+ return foundFiles.ToArray();
+ }
+
+ private static void FindFilesRecursive(DirectoryInfo directory, string pattern, List foundFiles)
+ {
+ foundFiles.AddRange(directory.GetFiles(pattern));
+
+ directory.GetDirectories().ForEach(d => FindFilesRecursive(d, pattern, foundFiles));
+ }
+
+ ///
+ /// Searches the provided directory recursively and returns the all files matching to the provided predicate.
+ ///
+ /// The directory.
+ /// The predicate.
+ /// The found files
+ /// This methods is quite perfect to be used in conjunction with the newly created FileInfo-Array extension methods.
+ ///
+ ///
+ /// var directory = new DirectoryInfo(@"c:\");
+ /// var files = directory.FindFilesRecursive(f => f.Extension == ".ini");
+ ///
+ public static FileInfo[] FindFilesRecursive(this DirectoryInfo directory, Func predicate)
+ {
+ var foundFiles = new List();
+
+ FindFilesRecursive(directory, predicate, foundFiles);
+
+ return foundFiles.ToArray();
+ }
+
+ private static void FindFilesRecursive(DirectoryInfo directory, Func predicate, List foundFiles)
+ {
+ foundFiles.AddRange(directory.GetFiles().Where(predicate));
+
+ directory.GetDirectories().ForEach(d => FindFilesRecursive(d, predicate, foundFiles));
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/EnumerableExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/EnumerableExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for all kinds of (typed) enumerable data (Array, List, ...)
+ ///
+ public static class EnumerableExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Converts all items of a list and returns them as enumerable.
+ ///
+ /// The source data type
+ /// The target data type
+ /// The source data.
+ /// The converted data
+ ///
+ ///
+ /// var values = new[] { "1", "2", "3" };
+ /// values.ConvertList<string, int>().ForEach(Console.WriteLine);
+ ///
+ ///
+ public static IEnumerable ConvertList(this IEnumerable source)
+ {
+ foreach (var value in source)
+ {
+ yield return value.ConvertTo();
+ }
+ }
+
+ ///
+ /// Performs an action for each item in the enumerable
+ ///
+ /// The enumerable data type
+ /// The data values.
+ /// The action to be performed.
+ ///
+ ///
+ /// var values = new[] { "1", "2", "3" };
+ /// values.ConvertList<string, int>().ForEach(Console.WriteLine);
+ ///
+ ///
+ /// This method was intended to return the passed values to provide method chaining. Howver due to defered execution the compiler would actually never run the entire code at all.
+ public static void ForEach(this IEnumerable values, Action action)
+ {
+ foreach (var value in values)
+ {
+ action(value);
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/FileInfoExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/FileInfoExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,341 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for the FileInfo and FileInfo-Array classes
+ ///
+ public static class FileInfoExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Renames a file.
+ ///
+ /// The file.
+ /// The new name.
+ /// The renamed file
+ ///
+ ///
+ /// var file = new FileInfo(@"c:\test.txt");
+ /// file.Rename("test2.txt");
+ ///
+ public static FileInfo Rename(this FileInfo file, string newName)
+ {
+ var filePath = Path.Combine(Path.GetDirectoryName(file.FullName), newName);
+
+ file.MoveTo(filePath);
+
+ return file;
+ }
+
+ ///
+ /// Renames a without changing its extension.
+ ///
+ /// The file.
+ /// The new name.
+ /// The renamed file
+ ///
+ ///
+ /// var file = new FileInfo(@"c:\test.txt");
+ /// file.RenameFileWithoutExtension("test3");
+ ///
+ public static FileInfo RenameFileWithoutExtension(this FileInfo file, string newName)
+ {
+ var fileName = string.Concat(newName, file.Extension);
+
+ file.Rename(fileName);
+
+ return file;
+ }
+
+ ///
+ /// Changes the files extension.
+ ///
+ /// The file.
+ /// The new extension.
+ /// The renamed file
+ ///
+ ///
+ /// var file = new FileInfo(@"c:\test.txt");
+ /// file.ChangeExtension("xml");
+ ///
+ public static FileInfo ChangeExtension(this FileInfo file, string newExtension)
+ {
+ newExtension = newExtension.EnsureStartsWith(".");
+
+ var fileName = string.Concat(Path.GetFileNameWithoutExtension(file.FullName), newExtension);
+
+ file.Rename(fileName);
+
+ return file;
+ }
+
+ ///
+ /// Changes the extensions of several files at once.
+ ///
+ /// The files.
+ /// The new extension.
+ /// The renamed files
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// files.ChangeExtensions("tmp");
+ ///
+ public static FileInfo[] ChangeExtensions(this FileInfo[] files, string newExtension)
+ {
+ files.ForEach(f => f.ChangeExtension(newExtension));
+
+ return files;
+ }
+
+ ///
+ /// Deletes several files at once and consolidates any exceptions.
+ ///
+ /// The files.
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// files.Delete()
+ ///
+ public static void Delete(this FileInfo[] files)
+ {
+ files.Delete(true);
+ }
+
+ ///
+ /// Deletes several files at once and optionally consolidates any exceptions.
+ ///
+ /// The files.
+ /// if set to true exceptions are consolidated and the processing is not interrupted.
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// files.Delete()
+ ///
+ public static void Delete(this FileInfo[] files, bool consolidateExceptions)
+ {
+ List exceptions = null;
+
+ foreach (var file in files)
+ {
+ try
+ {
+ file.Delete();
+ }
+ catch (Exception e)
+ {
+ if (consolidateExceptions)
+ {
+ if (exceptions == null)
+ {
+ exceptions = new List();
+ }
+
+ exceptions.Add(e);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ }
+
+ if ((exceptions != null) && (exceptions.Count > 0))
+ {
+ throw new CombinedException
+ (
+ "Error while deleting one or several files, see InnerExceptions array for details.",
+ exceptions.ToArray()
+ );
+ }
+ }
+
+ ///
+ /// Copies several files to a new folder at once and consolidates any exceptions.
+ ///
+ /// The files.
+ /// The target path.
+ /// The newly created file copies
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// var copiedFiles = files.CopyTo(@"c:\temp\");
+ ///
+ public static FileInfo[] CopyTo(this FileInfo[] files, string targetPath)
+ {
+ return files.CopyTo(targetPath, true);
+ }
+
+ ///
+ /// Copies several files to a new folder at once and optionally consolidates any exceptions.
+ ///
+ /// The files.
+ /// The target path.
+ /// if set to true exceptions are consolidated and the processing is not interrupted.
+ /// The newly created file copies
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// var copiedFiles = files.CopyTo(@"c:\temp\");
+ ///
+ public static FileInfo[] CopyTo(this FileInfo[] files, string targetPath, bool consolidateExceptions)
+ {
+ var copiedfiles = new List();
+ List exceptions = null;
+
+ foreach (var file in files)
+ {
+ try
+ {
+ var fileName = Path.Combine(targetPath, file.Name);
+
+ copiedfiles.Add(file.CopyTo(fileName));
+ }
+ catch (Exception e)
+ {
+ if (consolidateExceptions)
+ {
+ if (exceptions == null)
+ {
+ exceptions = new List();
+ }
+
+ exceptions.Add(e);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ }
+
+ if ((exceptions != null) && (exceptions.Count > 0))
+ {
+ throw new CombinedException
+ (
+ "Error while copying one or several files, see InnerExceptions array for details.",
+ exceptions.ToArray()
+ );
+ }
+
+ return copiedfiles.ToArray();
+ }
+
+ ///
+ /// Moves several files to a new folder at once and optionally consolidates any exceptions.
+ ///
+ /// The files.
+ /// The target path.
+ /// The moved files
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// files.MoveTo(@"c:\temp\");
+ ///
+ public static FileInfo[] MoveTo(this FileInfo[] files, string targetPath)
+ {
+ return files.MoveTo(targetPath, true);
+ }
+
+ ///
+ /// Movies several files to a new folder at once and optionally consolidates any exceptions.
+ ///
+ /// The files.
+ /// The target path.
+ /// if set to true exceptions are consolidated and the processing is not interrupted.
+ /// The moved files
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// files.MoveTo(@"c:\temp\");
+ ///
+ public static FileInfo[] MoveTo(this FileInfo[] files, string targetPath, bool consolidateExceptions)
+ {
+ List exceptions = null;
+
+ foreach (var file in files)
+ {
+ try
+ {
+ var fileName = Path.Combine(targetPath, file.Name);
+
+ file.MoveTo(fileName);
+ }
+ catch (Exception e)
+ {
+ if (consolidateExceptions)
+ {
+ if (exceptions == null)
+ {
+ exceptions = new List();
+ }
+
+ exceptions.Add(e);
+ }
+ else
+ {
+ throw;
+ }
+ }
+ }
+
+ if ((exceptions != null) && (exceptions.Count > 0))
+ {
+ throw new CombinedException
+ (
+ "Error while moving one or several files, see InnerExceptions array for details.",
+ exceptions.ToArray()
+ );
+ }
+
+ return files;
+ }
+
+ ///
+ /// Sets file attributes for several files at once
+ ///
+ /// The files.
+ /// The attributes to be set.
+ /// The changed files
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// files.SetAttributes(FileAttributes.Archive);
+ ///
+ public static FileInfo[] SetAttributes(this FileInfo[] files, FileAttributes attributes)
+ {
+ foreach (var file in files)
+ {
+ file.Attributes = attributes;
+ }
+
+ return files;
+ }
+
+ ///
+ /// Appends file attributes for several files at once (additive to any existing attributes)
+ ///
+ /// The files.
+ /// The attributes to be set.
+ /// The changed files
+ ///
+ ///
+ /// var files = directory.GetFiles("*.txt", "*.xml");
+ /// files.SetAttributesAdditive(FileAttributes.Archive);
+ ///
+ public static FileInfo[] SetAttributesAdditive(this FileInfo[] files, FileAttributes attributes)
+ {
+ foreach (var file in files)
+ {
+ file.Attributes = (file.Attributes | attributes);
+ }
+
+ return files;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/IConverter.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/IConverter.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,24 @@
+using System;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Generic converter interface used to allow extension methods to be applied.
+ ///
+ ///
+ public interface IConverter
+ {
+ #region · Properties ·
+
+ ///
+ /// Gets the internal value to be converted.
+ ///
+ /// The value.
+ T Value
+ {
+ get;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/ImageExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/ImageExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,47 @@
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace Chronos.Extensions
+{
+ public static class ImageExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Resizes the specified image.
+ ///
+ /// The image.
+ /// The size.
+ ///
+ public static Image Resize(this Image image, Size size)
+ {
+ Size newSize = new Size(size.Width, size.Height);
+
+ if (image.Size.Width > image.Size.Height)
+ {
+ newSize.Height = (image.Size.Height * size.Width) / image.Size.Width;
+ }
+ else
+ {
+ newSize.Width = (image.Size.Width * size.Height) / image.Size.Height;
+ }
+
+ Rectangle rectangle = new Rectangle(0, 0, newSize.Width, newSize.Height);
+ Image resized = new Bitmap(newSize.Width, newSize.Height, image.PixelFormat);
+
+ using (Graphics graphic = Graphics.FromImage(resized))
+ {
+ graphic.CompositingQuality = CompositingQuality.HighQuality;
+ graphic.SmoothingMode = SmoothingMode.HighQuality;
+ graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
+
+ graphic.DrawImage((System.Drawing.Image)image.Clone(), rectangle);
+ }
+
+ return resized;
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/IntExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/IntExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,40 @@
+using System;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for the string data type
+ ///
+ public static class IntExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Performs the specified action n times based on the underlying int value.
+ ///
+ /// The value.
+ /// The action.
+ public static void Times(this int value, Action action)
+ {
+ for (var i = 0; i < value; i++)
+ {
+ action();
+ }
+ }
+
+ ///
+ /// Performs the specified action n times based on the underlying int value.
+ ///
+ /// The value.
+ /// The action.
+ public static void Times(this int value, Action action)
+ {
+ for (var i = 0; i < value; i++)
+ {
+ action(i);
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/LinqExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/LinqExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,62 @@
+/*
+The MIT License
+
+Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+
+namespace Chronos.Extensions
+{
+ public static class LinqExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Traverses the specified source.
+ ///
+ ///
+ /// The source.
+ /// The fn recurse.
+ ///
+ public static IEnumerable Traverse(this IEnumerable source, Func> fnRecurse)
+ {
+ foreach (T item in source)
+ {
+ yield return item;
+
+ IEnumerable seqRecurse = fnRecurse(item);
+
+ if (seqRecurse != null)
+ {
+ foreach (T itemRecurse in Traverse(seqRecurse, fnRecurse))
+ {
+ yield return itemRecurse;
+ }
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/ListExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/ListExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for all kind of Lists implementing the IList<T> interface
+ ///
+ public static class ListExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Inserts an item uniquely to to a list and returns a value whether the item was inserted or not.
+ ///
+ /// The generic list item type.
+ /// The list to be inserted into.
+ /// The index to insert the item at.
+ /// The item to be added.
+ /// Indicates whether the item was inserted or not
+ public static bool InsertUnqiue(this IList list, int index, T item)
+ {
+ if (list.Contains(item) == false)
+ {
+ list.Insert(index, item);
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
+ /// Inserts a range of items uniquely to a list starting at a given index and returns the amount of items inserted.
+ ///
+ /// The generic list item type.
+ /// The list to be inserted into.
+ /// The start index.
+ /// The items to be inserted.
+ /// The amount if items that were inserted.
+ public static int InsertRangeUnique(this IList list, int startIndex, IEnumerable items)
+ {
+ var index = startIndex;
+
+ foreach (var item in items)
+ {
+ if (list.InsertUnqiue(startIndex, item))
+ {
+ index++;
+ }
+ }
+
+ return (index - startIndex);
+ }
+
+ ///
+ /// Return the index of the first matching item or -1.
+ ///
+ ///
+ /// The list.
+ /// The comparison.
+ /// The item index
+ public static int IndexOf(this IList list, Func comparison)
+ {
+ for (var i = 0; i < list.Count; i++)
+ {
+ if (comparison(list[i]))
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff -r 904a9faadf8b -r 443821e55f06 Chronosv2/source/Extensions/ObjectExtensions.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Chronosv2/source/Extensions/ObjectExtensions.cs Tue Feb 21 17:25:44 2012 +0700
@@ -0,0 +1,382 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Chronos.Extensions
+{
+ ///
+ /// Extension methods for the root data type object
+ ///
+ public static class ObjectExtensions
+ {
+ #region · Extensions ·
+
+ ///
+ /// Determines whether the object is equal to any of the provided values.
+ ///
+ ///
+ /// The object to be compared.
+ /// The values to compare with the object.
+ ///
+ public static bool EqualsAny(this T obj, params T[] values)
+ {
+ return (Array.IndexOf(values, obj) != -1);
+ }
+
+ ///
+ /// Determines whether the object is equal to none of the provided values.
+ ///
+ ///
+ /// The object to be compared.
+ /// The values to compare with the object.
+ ///
+ public static bool EqualsNone(this T obj, params T[] values)
+ {
+ return (obj.EqualsAny(values) == false);
+ }
+
+ ///
+ /// Converts an object to the specified target type or returns the default value.
+ ///
+ ///
+ /// The value.
+ /// The target type
+ public static T ConvertTo(this object value)
+ {
+ return value.ConvertTo(default(T));
+ }
+
+ ///
+ /// Converts an object to the specified target type or returns the default value.
+ ///
+ ///
+ /// The value.
+ /// The default value.
+ /// The target type
+ public static T ConvertTo(this object value, T defaultValue)
+ {
+ if (value != null)
+ {
+ var targetType = typeof(T);
+
+ var converter = TypeDescriptor.GetConverter(value);
+
+ if (converter != null)
+ {
+ if (converter.CanConvertTo(targetType))
+ {
+ return (T)converter.ConvertTo(value, targetType);
+ }
+ }
+
+ converter = TypeDescriptor.GetConverter(targetType);
+
+ if (converter != null)
+ {
+ if (converter.CanConvertFrom(value.GetType()))
+ {
+ return (T)converter.ConvertFrom(value);
+ }
+ }
+ }
+
+ return defaultValue;
+ }
+
+ ///
+ /// Converts an object to the specified target type or returns the default value. Any exceptions are optionally ignored.
+ ///
+ ///
+ /// The value.
+ /// The default value.
+ /// if set to true ignore any exception.
+ /// The target type
+ public static T ConvertTo(this object value, T defaultValue, bool ignoreException)
+ {
+ if (ignoreException)
+ {
+ try
+ {
+ return value.ConvertTo();
+ }
+ catch
+ {
+ return defaultValue;
+ }
+ }
+
+ return value.ConvertTo();
+ }
+
+ ///
+ /// Determines whether the value can (in theory) be converted to the specified target type.
+ ///
+ ///
+ /// The value.
+ ///
+ /// true if this instance can be convert to the specified target type; otherwise, false.
+ ///
+ public static bool CanConvertTo(this object value)
+ {
+ if (value != null)
+ {
+ var targetType = typeof(T);
+
+ var converter = TypeDescriptor.GetConverter(value);
+
+ if (converter != null)
+ {
+ if (converter.CanConvertTo(targetType))
+ {
+ return true;
+ }
+ }
+
+ converter = TypeDescriptor.GetConverter(targetType);
+
+ if (converter != null)
+ {
+ if (converter.CanConvertFrom(value.GetType()))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Converts the specified value to a different type.
+ ///
+ ///
+ /// The value.
+ /// An universal converter suppliying additional target conversion methods
+ ///
+ /// var value = "123";
+ /// var numeric = value.Convert().ToInt32();
+ ///
+ public static IConverter Convert(this T value)
+ {
+ return new Converter(value);
+ }
+
+ ///
+ /// Dynamically invokes a method using reflection
+ ///
+ /// The object to perform on.
+ /// The name of the method.
+ /// The parameters passed to the method.
+ /// The return value
+ ///
+ ///
+ /// var type = Type.GetType("System.IO.FileInfo, mscorlib");
+ /// var file = type.CreateInstance(@"c:\autoexec.bat");
+ /// if(file.GetPropertyValue<bool>("Exists")) {
+ /// var reader = file.InvokeMethod<StreamReader>("OpenText");
+ /// Console.WriteLine(reader.ReadToEnd());
+ /// reader.Close();
+ /// }
+ ///
+ ///
+ public static object InvokeMethod(this object obj, string methodName, params object[] parameters)
+ {
+ return InvokeMethod