# HG changeset patch # User adminsh@apollo # Date 1332403815 0 # Node ID 2df455021a91b5c650e5f6d5221280af7558cc29 # Parent 7d9de5746f180929c0591228906d8df4ba87a8c7 Removed chronos diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/Chronos.sln --- a/Chronosv2/Chronos.sln Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ - -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(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 7d9de5746f18 -r 2df455021a91 Chronosv2/Doc/Introduction to Chronos v2.xps Binary file Chronosv2/Doc/Introduction to Chronos v2.xps has changed diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/Lib/NLog/NLog.Extended.dll Binary file Chronosv2/Lib/NLog/NLog.Extended.dll has changed diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/Lib/NLog/NLog.dll Binary file Chronosv2/Lib/NLog/NLog.dll has changed diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/Lib/nRoute/nRoute.Framework.dll Binary file Chronosv2/Lib/nRoute/nRoute.Framework.dll has changed diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/SolutionInfo.cs --- a/Chronosv2/SolutionInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/VSExtension/Chronos.VisualStudio.Extensions.vsix Binary file Chronosv2/VSExtension/Chronos.VisualStudio.Extensions.vsix has changed diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/App.xaml --- a/Chronosv2/source/App.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/App.xaml.cs --- a/Chronosv2/source/App.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -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("Unhandled Exception", 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/ApplicationStateObserver.cs --- a/Chronosv2/source/ApplicationStateObserver.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ - -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Authentication/AuthenticationAction.cs --- a/Chronosv2/source/Authentication/AuthenticationAction.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -namespace Chronos.Authentication -{ - /// - /// Authentication actions - /// - public enum AuthenticationAction - { - /// - /// Log on - /// - LogOn, - /// - /// Log out - /// - LogOut, - /// - /// Logged in - /// - LoggedIn - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Authentication/AuthenticationInfo.cs --- a/Chronosv2/source/Authentication/AuthenticationInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Authentication/AuthenticationObserver.cs --- a/Chronosv2/source/Authentication/AuthenticationObserver.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -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("User Authentication"); - ServiceLocator.GetService() - .Navigate(NavigateMode.Modal, NavigationRoutes.Login); - break; - - case AuthenticationAction.LoggedIn: - Logger.Debug("Properly authenticated user"); - ServiceLocator.GetService() - .ActivateDefaultDesktop(); - break; - - case AuthenticationAction.LogOut: - Logger.Debug("Logging out"); - Task t = Task.Factory.StartNew - ( - () => - { - ServiceLocator.GetService() - .CloseAll(); - - Channel.Publish - ( - new AuthenticationInfo - { - Action = AuthenticationAction.LogOn - }, - true - ); - } - ); - break; - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Chronos.csproj --- a/Chronosv2/source/Chronos.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +0,0 @@ - - - - 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 - - - - - - - - - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Chronos.ico Binary file Chronosv2/source/Chronos.ico has changed diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Configuration/Chronos.Configuration.csproj --- a/Chronosv2/source/Configuration/Chronos.Configuration.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {33197834-06F8-4056-8E56-CCA7614EA831} - Library - Properties - Chronos.Configuration - Chronos.Configuration - v4.0 - 512 - - - - - - - - - - - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Configuration/GenericElementCollection.cs --- a/Chronosv2/source/Configuration/GenericElementCollection.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -using System.Configuration; - -namespace Chronos.Configuration -{ - /// - /// Generic Configuration Element Collection - /// - /// - /// - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Configuration/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Configuration/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Configuration/WidgetConfigurationElement.cs --- a/Chronosv2/source/Configuration/WidgetConfigurationElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Configuration/WidgetConfigurationElementCollection.cs --- a/Chronosv2/source/Configuration/WidgetConfigurationElementCollection.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Configuration/WidgetsSectionHandler.cs --- a/Chronosv2/source/Configuration/WidgetsSectionHandler.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/Chronos.Presentation.DragAndDrop.csproj --- a/Chronosv2/source/DragAndDrop/Chronos.Presentation.DragAndDrop.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {F3061A2B-7688-4B26-8D5B-E556EAFE1D49} - Library - Properties - Chronos.Presentation.DragAndDrop - Chronos.Presentation.DragAndDrop - v4.0 - 512 - - - - - - - - - - - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/DragAdorner.cs --- a/Chronosv2/source/DragAndDrop/DragAdorner.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/DragDataWrapper.cs --- a/Chronosv2/source/DragAndDrop/DragDataWrapper.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/DragDropManager.cs --- a/Chronosv2/source/DragAndDrop/DragDropManager.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/DragDropProviderActions.cs --- a/Chronosv2/source/DragAndDrop/DragDropProviderActions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/DragHelper.cs --- a/Chronosv2/source/DragAndDrop/DragHelper.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,465 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/DropHelper.cs --- a/Chronosv2/source/DragAndDrop/DropHelper.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,333 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/IDataDropObject.cs --- a/Chronosv2/source/DragAndDrop/IDataDropObject.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/IDataDropObjectProvider.cs --- a/Chronosv2/source/DragAndDrop/IDataDropObjectProvider.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/ListBoxDragDropDataProvider.cs --- a/Chronosv2/source/DragAndDrop/ListBoxDragDropDataProvider.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/Properties/AssemblyInfo.cs --- a/Chronosv2/source/DragAndDrop/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/DragAndDrop/TreeviewDragDropDataProvider.cs --- a/Chronosv2/source/DragAndDrop/TreeviewDragDropDataProvider.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/ArrayExtensions.cs --- a/Chronosv2/source/Extensions/ArrayExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/BitmapExtensions.cs --- a/Chronosv2/source/Extensions/BitmapExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Chronos.Extensions.csproj --- a/Chronosv2/source/Extensions/Chronos.Extensions.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {AA911078-3A2A-41B1-B779-3C8B55E1B8E3} - Library - Properties - Chronos.Extensions - Chronos.Extensions - v4.0 - 512 - - - - - - - - - - - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/CollectionExtensions.cs --- a/Chronosv2/source/Extensions/CollectionExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/CombinedException.cs --- a/Chronosv2/source/Extensions/CombinedException.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/ComparableExtensions.cs --- a/Chronosv2/source/Extensions/ComparableExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Converter.cs --- a/Chronosv2/source/Extensions/Converter.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/DateTimeExtensions.cs --- a/Chronosv2/source/Extensions/DateTimeExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,299 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/DateTimeOffsetExtensions.cs --- a/Chronosv2/source/Extensions/DateTimeOffsetExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/DirectoryInfoExtensions.cs --- a/Chronosv2/source/Extensions/DirectoryInfoExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/EnumerableExtensions.cs --- a/Chronosv2/source/Extensions/EnumerableExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/FileInfoExtensions.cs --- a/Chronosv2/source/Extensions/FileInfoExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,341 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/IConverter.cs --- a/Chronosv2/source/Extensions/IConverter.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/ImageExtensions.cs --- a/Chronosv2/source/Extensions/ImageExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/IntExtensions.cs --- a/Chronosv2/source/Extensions/IntExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/LinqExtensions.cs --- a/Chronosv2/source/Extensions/LinqExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/ListExtensions.cs --- a/Chronosv2/source/Extensions/ListExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/ObjectExtensions.cs --- a/Chronosv2/source/Extensions/ObjectExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,382 +0,0 @@ -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(obj, methodName, parameters); - } - - /// - /// Dynamically invokes a method using reflection and returns its value in a typed manner - /// - /// The expected return data types - /// 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 T InvokeMethod(this object obj, string methodName, params object[] parameters) - { - var type = obj.GetType(); - var method = type.GetMethod(methodName); - - if (method == null) - { - throw new ArgumentException(string.Format("Method '{0}' not found.", methodName), methodName); - } - - var value = method.Invoke(obj, parameters); - - return (value is T ? (T)value : default(T)); - } - - /// - /// Dynamically retrieves a property value. - /// - /// The object to perform on. - /// The Name of the property. - /// The property 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 GetPropertyValue(this object obj, string propertyName) - { - return GetPropertyValue(obj, propertyName, null); - } - - /// - /// Dynamically retrieves a property value. - /// - /// The expected return data type - /// The object to perform on. - /// The Name of the property. - /// The property 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 T GetPropertyValue(this object obj, string propertyName) - { - return GetPropertyValue(obj, propertyName, default(T)); - } - - /// - /// Dynamically retrieves a property value. - /// - /// The expected return data type - /// The object to perform on. - /// The Name of the property. - /// The default value to return. - /// The property 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 T GetPropertyValue(this object obj, string propertyName, T defaultValue) - { - var type = obj.GetType(); - var property = type.GetProperty(propertyName); - - if (property == null) - { - throw new ArgumentException(string.Format("Property '{0}' not found.", propertyName), propertyName); - } - - var value = property.GetValue(obj, null); - - return (value is T ? (T)value : defaultValue); - } - - /// - /// Dynamically sets a property value. - /// - /// The object to perform on. - /// The Name of the property. - /// The value to be set. - public static void SetPropertyValue(this object obj, string propertyName, object value) - { - var type = obj.GetType(); - var property = type.GetProperty(propertyName); - - if (property == null) - { - throw new ArgumentException(string.Format("Property '{0}' not found.", propertyName), propertyName); - } - - property.SetValue(obj, value, null); - } - - /// - /// Gets the first matching attribute defined on the data type. - /// - /// The attribute type tp look for. - /// The object to look on. - /// The found attribute - public static T GetAttribute(this object obj) where T : Attribute - { - return GetAttribute(obj, true); - } - - /// - /// Gets the first matching attribute defined on the data type. - /// - /// The attribute type tp look for. - /// The object to look on. - /// if set to true includes inherited attributes. - /// The found attribute - public static T GetAttribute(this object obj, bool includeInherited) where T : Attribute - { - var type = (obj as Type ?? obj.GetType()); - var attributes = type.GetCustomAttributes(typeof(T), includeInherited); - - if ((attributes != null) && (attributes.Length > 0)) - { - return (attributes[0] as T); - } - - return null; - } - - /// - /// Gets all matching attribute defined on the data type. - /// - /// The attribute type tp look for. - /// The object to look on. - /// The found attributes - public static IEnumerable GetAttributes(this object obj) where T : Attribute - { - return GetAttributes(obj); - } - - /// - /// Gets all matching attribute defined on the data type. - /// - /// The attribute type tp look for. - /// The object to look on. - /// if set to true includes inherited attributes. - /// The found attributes - public static IEnumerable GetAttributes(this object obj, bool includeInherited) where T : Attribute - { - var type = (obj as Type ?? obj.GetType()); - - foreach (var attribute in type.GetCustomAttributes(typeof(T), includeInherited)) - { - if (attribute is T) - { - yield return (T)attribute; - } - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Extensions/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -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")] -[assembly: AssemblyDescription("Extension Methods")] \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/PropertyExtensions.cs --- a/Chronosv2/source/Extensions/PropertyExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -using System; -using System.ComponentModel; -using System.Linq.Expressions; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Property Extension Methods - /// - /// - /// http://reyntjes.blogspot.com/2009/04/master-detail-viewmodel_24.html - /// http://blogs.ugidotnet.org/bmatte/archive/2008/11/28/pattern-model-view-viewmodel-inotifypropertychanged-static-reflection-e-extension-methods.aspx - /// - public static class PropertyExtensions - { - #region · Extension Methods · - - /// - /// Creates a instance for a given property. - /// - /// - /// The property. - /// - public static PropertyChangedEventArgs CreateChangeEventArgs(this Expression> property) - { - var expression = property.Body as MemberExpression; - var member = expression.Member; - - return new PropertyChangedEventArgs(member.Name); - } - - /// - /// Returns property name from expression - /// - /// - /// - /// - public static string GetPropertyName(this Expression> property) - { - var expression = property.Body as MemberExpression; - - return expression.Member.Name; - } - - /// - /// Return property name from expression. - /// - /// - /// > expression = i => i.Name; - /// var propertyName = expression.GetPropertyName(); // propertyName = "Name" - /// ]]> - /// - /// - /// - /// - /// - public static string GetPropertyName(this Expression> expression) - { - var lambda = expression as LambdaExpression; - - MemberExpression memberExpression; - - if (lambda.Body is UnaryExpression) - { - var unaryExpression = lambda.Body as UnaryExpression; - memberExpression = unaryExpression.Operand as MemberExpression; - } - else - { - memberExpression = lambda.Body as MemberExpression; - } - - if (memberExpression != null) - { - return memberExpression.Member.Name; - } - - return null; - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/StreamExtensions.cs --- a/Chronosv2/source/Extensions/StreamExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -using System; -using System.IO; -using System.Text; - -namespace Chronos.Extensions -{ - /// - /// Extension methods any kind of streams - /// - public static class StreamExtensions - { - #region · Extensions · - - /// - /// Opens a StreamReader using the default encoding. - /// - /// The stream. - /// The stream reader - public static StreamReader GetReader(this Stream stream) - { - return stream.GetReader(null); - } - - /// - /// Opens a StreamReader using the specified encoding. - /// - /// The stream. - /// The encoding. - /// The stream reader - public static StreamReader GetReader(this Stream stream, Encoding encoding) - { - if (stream.CanRead == false) - { - throw new InvalidOperationException("Stream does not support reading."); - } - - encoding = (encoding ?? Encoding.Default); - - return new StreamReader(stream, encoding); - } - - /// - /// Opens a StreamWriter using the default encoding. - /// - /// The stream. - /// The stream writer - public static StreamWriter GetWriter(this Stream stream) - { - return stream.GetWriter(null); - } - - /// - /// Opens a StreamWriter using the specified encoding. - /// - /// The stream. - /// The encoding. - /// The stream writer - public static StreamWriter GetWriter(this Stream stream, Encoding encoding) - { - if (stream.CanWrite == false) - { - throw new InvalidOperationException("Stream does not support writing."); - } - - encoding = (encoding ?? Encoding.Default); - - return new StreamWriter(stream, encoding); - } - - /// - /// Reads all text from the stream using the default encoding. - /// - /// The stream. - /// The result string. - public static string ReadToEnd(this Stream stream) - { - return stream.ReadToEnd(null); - } - - /// - /// Reads all text from the stream using a specified encoding. - /// - /// The stream. - /// The encoding. - /// The result string. - public static string ReadToEnd(this Stream stream, Encoding encoding) - { - using (var reader = stream.GetReader(encoding)) - { - return reader.ReadToEnd(); - } - } - - /// - /// Sets the stream cursor to the beginning of the stream. - /// - /// The stream. - /// The stream - public static Stream SeekToBegin(this Stream stream) - { - if (stream.CanSeek == false) - { - throw new InvalidOperationException("Stream does not support seeking."); - } - - stream.Seek(0, SeekOrigin.Begin); - - return stream; - } - - /// - /// Sets the stream cursor to the end of the stream. - /// - /// The stream. - /// The stream - public static Stream SeekToEnd(this Stream stream) - { - if (stream.CanSeek == false) - { - throw new InvalidOperationException("Stream does not support seeking."); - } - - stream.Seek(0, SeekOrigin.End); - - return stream; - } - - /// - /// Copies any stream into a local MemoryStream - /// - /// The source stream. - /// The copied memory stream. - public static MemoryStream CopyToMemory(this Stream stream) - { - var memoryStream = new MemoryStream((int)stream.Length); - - stream.CopyTo(memoryStream); - - return memoryStream; - } - - /// - /// Reads the entire stream and returns a byte array. - /// - /// The stream. - /// The byte array - /// Thanks to EsbenCarlsen for providing an update to this method. - public static byte[] ReadAllBytes(this Stream stream) - { - using (var memoryStream = stream.CopyToMemory()) - { - return memoryStream.ToArray(); - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/StringConverter.cs --- a/Chronosv2/source/Extensions/StringConverter.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -using System; - -namespace Chronos.Extensions -{ - /// - /// Universal conversion and parsing methods for strings. - /// These methods are avaiblable throught the generic object.Convert method: - /// Feel free to provide additional converns for string or any other object type. - /// - /// - /// var value = "123"; - /// var numeric = value.Convert().ToInt32(); - /// - public static class StringConverter - { - #region · Extensions · - - /// - /// Converts a string to an Int32 value - /// - /// The value. - /// - /// - /// var value = "123"; - /// var numeric = value.Convert().ToInt32(); - /// - public static int ToInt32(this IConverter value) - { - return ToInt32(value, 0, false); - } - - /// - /// Converts a string to an Int32 value - /// - /// The value. - /// The default value. - /// if set to true any parsing exception will be ignored. - /// - /// - /// var value = "123"; - /// var numeric = value.Convert().ToInt32(); - /// - public static int ToInt32(this IConverter value, int defaultValue, bool ignoreException) - { - if (ignoreException) - { - try - { - return ToInt32(value, defaultValue, false); - } - catch - { - } - - return defaultValue; - } - - return int.Parse(value.Value); - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/StringExtensions.cs --- a/Chronosv2/source/Extensions/StringExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,524 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Linq; -using System.Xml.XPath; - -namespace Chronos.Extensions -{ - /// - /// Extension methods for the string data type - /// - public static class StringExtensions - { - #region · Extensions · - - #region · Common string extensions · - - /// - /// Determines whether the specified string is null or empty. - /// - /// The string value to check. - public static bool IsEmpty(this string value) - { - return ((value == null) || (value.Length == 0)); - } - - /// - /// Determines whether the specified string is not null or empty. - /// - /// The string value to check. - public static bool IsNotEmpty(this string value) - { - return (value.IsEmpty() == false); - } - - /// - /// Checks whether the string is empty and returns a default value in case. - /// - /// The string to check. - /// The default value. - /// Either the string or the default value. - public static string IfEmpty(this string value, string defaultValue) - { - return (value.IsNotEmpty() ? value : defaultValue); - } - - /// - /// Formats the value with the parameters using string.Format. - /// - /// The input string. - /// The parameters. - /// - public static string FormatWith(this string value, params object[] parameters) - { - return string.Format(value, parameters); - } - - /// - /// Trims the text to a provided maximum length. - /// - /// The input string. - /// Maximum length. - /// - /// Proposed by Rene Schulte - public static string TrimToMaxLength(this string value, int maxLength) - { - return (value == null || value.Length <= maxLength ? value : value.Substring(0, maxLength)); - } - - /// - /// Trims the text to a provided maximum length and adds a suffix if required. - /// - /// The input string. - /// Maximum length. - /// The suffix. - /// - /// Proposed by Rene Schulte - public static string TrimToMaxLength(this string value, int maxLength, string suffix) - { - return (value == null || value.Length <= maxLength ? value : string.Concat(value.Substring(0, maxLength), suffix)); - } - - /// - /// Determines whether the comparison value strig is contained within the input value string - /// - /// The input value. - /// The comparison value. - /// Type of the comparison to allow case sensitive or insensitive comparison. - /// - /// true if input value contains the specified value, otherwise, false. - /// - public static bool Contains(this string inputValue, string comparisonValue, StringComparison comparisonType) - { - return (inputValue.IndexOf(comparisonValue, comparisonType) != -1); - } - - /// - /// Loads the string into a LINQ to XML XDocument - /// - /// The XML string. - /// The XML document object model (XDocument) - public static XDocument ToXDocument(this string xml) - { - return XDocument.Parse(xml); - } - - /// - /// Loads the string into a XML DOM object (XmlDocument) - /// - /// The XML string. - /// The XML document object model (XmlDocument) - public static XmlDocument ToXmlDOM(this string xml) - { - var document = new XmlDocument(); - - document.LoadXml(xml); - - return document; - } - - /// - /// Loads the string into a XML XPath DOM (XPathDocument) - /// - /// The XML string. - /// The XML XPath document object model (XPathNavigator) - public static XPathNavigator ToXPath(this string xml) - { - var document = new XPathDocument(new StringReader(xml)); - - return document.CreateNavigator(); - } - - /// - /// Reverses / mirrors a string. - /// - /// The string to be reversed. - /// The reversed string - public static string Reverse(this string value) - { - if (value.IsEmpty() || (value.Length == 1)) - { - return value; - } - - var chars = value.ToCharArray(); - - Array.Reverse(chars); - - return new string(chars); - } - - /// - /// Ensures that a string starts with a given prefix. - /// - /// The string value to check. - /// The prefix value to check for. - /// The string value including the prefix - /// - /// - /// var extension = "txt"; - /// var fileName = string.Concat(file.Name, extension.EnsureStartsWith(".")); - /// - /// - public static string EnsureStartsWith(this string value, string prefix) - { - if (value.StartsWith(prefix)) - { - return value; - } - - return string.Concat(prefix, value); - } - - /// - /// Ensures that a string ends with a given suffix. - /// - /// The string value to check. - /// The suffix value to check for. - /// The string value including the suffix - /// - /// - /// var url = "http://www.pgk.de"; - /// url = url.EnsureEndsWith("/")); - /// - /// - public static string EnsureEndsWith(this string value, string suffix) - { - if (value.EndsWith(suffix)) - { - return value; - } - - return string.Concat(value, suffix); - } - - #endregion - - #region · Regex based extension methods · - - /// - /// Uses regular expressions to determine if the string matches to a given regex pattern. - /// - /// The input string. - /// The regular expression pattern. - /// - /// true if the value is matching to the specified pattern; otherwise, false. - /// - /// - /// - /// var s = "12345"; - /// var isMatching = s.IsMatchingTo(@"^\d+$"); - /// - /// - public static bool IsMatchingTo(this string value, string regexPattern) - { - return IsMatchingTo(value, regexPattern, RegexOptions.None); - } - - /// - /// Uses regular expressions to determine if the string matches to a given regex pattern. - /// - /// The input string. - /// The regular expression pattern. - /// The regular expression options. - /// - /// true if the value is matching to the specified pattern; otherwise, false. - /// - /// - /// - /// var s = "12345"; - /// var isMatching = s.IsMatchingTo(@"^\d+$"); - /// - /// - public static bool IsMatchingTo(this string value, string regexPattern, RegexOptions options) - { - return Regex.IsMatch(value, regexPattern, options); - } - - /// - /// Uses regular expressions to replace parts of a string. - /// - /// The input string. - /// The regular expression pattern. - /// The replacement value. - /// The newly created string - /// - /// - /// var s = "12345"; - /// var replaced = s.ReplaceWith(@"\d", m => string.Concat(" -", m.Value, "- ")); - /// - /// - public static string ReplaceWith(this string value, string regexPattern, string replaceValue) - { - return ReplaceWith(value, regexPattern, replaceValue, RegexOptions.None); - } - - /// - /// Uses regular expressions to replace parts of a string. - /// - /// The input string. - /// The regular expression pattern. - /// The replacement value. - /// The regular expression options. - /// The newly created string - /// - /// - /// var s = "12345"; - /// var replaced = s.ReplaceWith(@"\d", m => string.Concat(" -", m.Value, "- ")); - /// - /// - public static string ReplaceWith(this string value, string regexPattern, string replaceValue, RegexOptions options) - { - return Regex.Replace(value, regexPattern, replaceValue, options); - } - - /// - /// Uses regular expressions to replace parts of a string. - /// - /// The input string. - /// The regular expression pattern. - /// The replacement method / lambda expression. - /// The newly created string - /// - /// - /// var s = "12345"; - /// var replaced = s.ReplaceWith(@"\d", m => string.Concat(" -", m.Value, "- ")); - /// - /// - public static string ReplaceWith(this string value, string regexPattern, MatchEvaluator evaluator) - { - return ReplaceWith(value, regexPattern, RegexOptions.None, evaluator); - } - - /// - /// Uses regular expressions to replace parts of a string. - /// - /// The input string. - /// The regular expression pattern. - /// The regular expression options. - /// The replacement method / lambda expression. - /// The newly created string - /// - /// - /// var s = "12345"; - /// var replaced = s.ReplaceWith(@"\d", m => string.Concat(" -", m.Value, "- ")); - /// - /// - public static string ReplaceWith(this string value, string regexPattern, RegexOptions options, MatchEvaluator evaluator) - { - return Regex.Replace(value, regexPattern, evaluator, options); - } - - /// - /// Uses regular expressions to determine all matches of a given regex pattern. - /// - /// The input string. - /// The regular expression pattern. - /// A collection of all matches - public static MatchCollection GetMatches(this string value, string regexPattern) - { - return GetMatches(value, regexPattern, RegexOptions.None); - } - - /// - /// Uses regular expressions to determine all matches of a given regex pattern. - /// - /// The input string. - /// The regular expression pattern. - /// The regular expression options. - /// A collection of all matches - public static MatchCollection GetMatches(this string value, string regexPattern, RegexOptions options) - { - return Regex.Matches(value, regexPattern, options); - } - - /// - /// Uses regular expressions to determine all matches of a given regex pattern and returns them as string enumeration. - /// - /// The input string. - /// The regular expression pattern. - /// An enumeration of matching strings - /// - /// - /// var s = "12345"; - /// foreach(var number in s.GetMatchingValues(@"\d")) { - /// Console.WriteLine(number); - /// } - /// - /// - public static IEnumerable GetMatchingValues(this string value, string regexPattern) - { - return GetMatchingValues(value, regexPattern, RegexOptions.None); - } - - /// - /// Uses regular expressions to determine all matches of a given regex pattern and returns them as string enumeration. - /// - /// The input string. - /// The regular expression pattern. - /// The regular expression options. - /// An enumeration of matching strings - /// - /// - /// var s = "12345"; - /// foreach(var number in s.GetMatchingValues(@"\d")) { - /// Console.WriteLine(number); - /// } - /// - /// - public static IEnumerable GetMatchingValues(this string value, string regexPattern, RegexOptions options) - { - foreach (Match match in GetMatches(value, regexPattern, options)) - { - if (match.Success) - { - yield return match.Value; - } - } - } - - /// - /// Uses regular expressions to split a string into parts. - /// - /// The input string. - /// The regular expression pattern. - /// The splitted string array - public static string[] Split(this string value, string regexPattern) - { - return value.Split(regexPattern, RegexOptions.None); - } - - /// - /// Uses regular expressions to split a string into parts. - /// - /// The input string. - /// The regular expression pattern. - /// The regular expression options. - /// The splitted string array - public static string[] Split(this string value, string regexPattern, RegexOptions options) - { - return Regex.Split(value, regexPattern, options); - } - - /// - /// Splits the given string into words and returns a string array. - /// - /// The input string. - /// The splitted string array - public static string[] GetWords(this string value) - { - return value.Split(@"\W"); - } - - /// - /// Gets the nth "word" of a given string, where "words" are substrings separated by a given separator - /// - /// The string from which the word should be retrieved. - /// Index of the word (0-based). - /// - /// The word at position n of the string. - /// Trying to retrieve a word at a position lower than 0 or at a position where no word exists results in an exception. - /// - /// Originally contributed by MMathews - public static string GetWordByIndex(this string value, int index) - { - var words = value.GetWords(); - - if ((index < 0) || (index > words.Length - 1)) - { - throw new IndexOutOfRangeException("The word number is out of range."); - } - - return words[index]; - } - - #endregion - - #region · Bytes & Base64 · - - /// - /// Converts the string to a byte-array using the default encoding - /// - /// The input string. - /// The created byte array - public static byte[] ToBytes(this string value) - { - return value.ToBytes(null); - } - - /// - /// Converts the string to a byte-array using the supplied encoding - /// - /// The input string. - /// The encoding to be used. - /// The created byte array - /// - /// var value = "Hello World"; - /// var ansiBytes = value.ToBytes(Encoding.GetEncoding(1252)); // 1252 = ANSI - /// var utf8Bytes = value.ToBytes(Encoding.UTF8); - /// - public static byte[] ToBytes(this string value, Encoding encoding) - { - encoding = (encoding ?? Encoding.Default); - return encoding.GetBytes(value); - } - - /// - /// Encodes the input value to a Base64 string using the default encoding. - /// - /// The input value. - /// The Base 64 encoded string - public static string EncodeBase64(this string value) - { - return value.EncodeBase64(null); - } - - /// - /// Encodes the input value to a Base64 string using the supplied encoding. - /// - /// The input value. - /// The encoding. - /// The Base 64 encoded string - public static string EncodeBase64(this string value, Encoding encoding) - { - encoding = (encoding ?? Encoding.UTF8); - - var bytes = encoding.GetBytes(value); - - return Convert.ToBase64String(bytes); - } - - /// - /// Decodes a Base 64 encoded value to a string using the default encoding. - /// - /// The Base 64 encoded value. - /// The decoded string - public static string DecodeBase64(this string encodedValue) - { - return encodedValue.DecodeBase64(null); - } - - /// - /// Decodes a Base 64 encoded value to a string using the supplied encoding. - /// - /// The Base 64 encoded value. - /// The encoding. - /// The decoded string - public static string DecodeBase64(this string encodedValue, Encoding encoding) - { - encoding = (encoding ?? Encoding.UTF8); - - var bytes = Convert.FromBase64String(encodedValue); - - return encoding.GetString(bytes); - } - - #endregion - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/TextReaderExtensions.cs --- a/Chronosv2/source/Extensions/TextReaderExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace Chronos.Extensions -{ - /// - /// Extension methods for the TextReader class and its sub classes (StreamReader, StringReader) - /// - public static class TextReaderExtensions - { - #region · Extensions · - - /// - /// The method provides an iterator through all lines of the text reader. - /// - /// The text reader. - /// The iterator - /// - /// - /// using(var reader = fileInfo.OpenText()) { - /// foreach(var line in reader.IterateLines()) { - /// // ... - /// } - /// } - /// - /// Contributed by OlivierJ - public static IEnumerable IterateLines(this TextReader reader) - { - string line = null; - - while ((line = reader.ReadLine()) != null) - { - yield return line; - } - } - - /// - /// The method executes the passed delegate /lambda expression) for all lines of the text reader. - /// - /// The text reader. - /// The action. - /// - /// - /// using(var reader = fileInfo.OpenText()) { - /// reader.IterateLines(l => Console.WriteLine(l)); - /// } - /// - /// Contributed by OlivierJ - public static void IterateLines(this TextReader reader, Action action) - { - foreach (var line in reader.IterateLines()) - { - action(line); - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/TypeExtensions.cs --- a/Chronosv2/source/Extensions/TypeExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -using System; -using System.Reflection; - -namespace Chronos.Extensions -{ - /// - /// Extension methods for the reflection meta data type "Type" - /// - public static class TypeExtensions - { - #region · Extensions · - - /// - /// Creates and returns an instance of the desired type - /// - /// The type to be instanciated. - /// Optional constructor parameters - /// The instanciated object - /// - /// - /// var type = Type.GetType(".NET full qualified class Type") - /// var instance = type.CreateInstance(); - /// - /// - public static object CreateInstance(this Type type, params object[] constructorParameters) - { - return CreateInstance(type, constructorParameters); - } - - /// - /// Creates and returns an instance of the desired type casted to the generic parameter type T - /// - /// The data type the instance is casted to. - /// The type to be instanciated. - /// Optional constructor parameters - /// The instanciated object - /// - /// - /// var type = Type.GetType(".NET full qualified class Type") - /// var instance = type.CreateInstance<IDataType>(); - /// - /// - public static T CreateInstance(this Type type, params object[] constructorParameters) - { - var instance = Activator.CreateInstance(type, constructorParameters); - return (T)instance; - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/AdornerExtensions.cs --- a/Chronosv2/source/Extensions/Windows/AdornerExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -using System.Windows; -using System.Windows.Documents; -using System.Windows.Controls; - -namespace Chronos.Presentation.Controls.Adorner -{ - public static class AdornerExtensions - { - #region · Extension Methods · - - public static void TryRemoveAdorners(this UIElement elem) - where T : System.Windows.Documents.Adorner - { - AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(elem); - - if (adornerLayer != null) - { - adornerLayer.RemoveAdorners(elem); - } - } - - public static void RemoveAdorners(this AdornerLayer adr, UIElement elem) - where T : System.Windows.Documents.Adorner - { - System.Windows.Documents.Adorner[] adorners = adr.GetAdorners(elem); - - if (adorners == null) - { - return; - } - - for (int i = adorners.Length - 1; i >= 0; i--) - { - if (adorners[i] is T) - { - adr.Remove(adorners[i]); - } - } - } - - public static void TryAddAdorner(this UIElement elem, System.Windows.Documents.Adorner adorner) - where T : System.Windows.Documents.Adorner - { - AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(elem); - - if (adornerLayer != null && !adornerLayer.ContainsAdorner(elem)) - { - adornerLayer.Add(adorner); - Panel.SetZIndex(adornerLayer, Panel.GetZIndex(elem)); - } - } - - public static bool ContainsAdorner(this AdornerLayer adr, UIElement elem) - where T : System.Windows.Documents.Adorner - { - System.Windows.Documents.Adorner[] adorners = adr.GetAdorners(elem); - - if (adorners == null) - { - return false; - } - - for (int i = adorners.Length - 1; i >= 0; i--) - { - if (adorners[i] is T) - { - return true; - } - } - - return false; - } - - public static void RemoveAllAdorners(this AdornerLayer adr, UIElement elem) - { - System.Windows.Documents.Adorner[] adorners = adr.GetAdorners(elem); - - if (adorners == null) - { - return; - } - - foreach (var toRemove in adorners) - { - adr.Remove(toRemove); - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/ApplicationExtensions.cs --- a/Chronosv2/source/Extensions/Windows/ApplicationExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -using System.Security.Permissions; -using System.Windows; -using System.Windows.Threading; -using System.Windows.Media; - -namespace Chronos.Extensions.Windows -{ - /// - /// Application extensions - /// - public static class ApplicationExtensions - { - #region · Extension Methods · - - public static RenderTier GetRenderTier(this Application application) - { - return (RenderTier)(RenderCapability.Tier / 0x10000); - } - - /// - /// Forces the WPF message pump to process all enqueued messages - /// that are above the input parameter DispatcherPriority. - /// - /// The DispatcherPriority to use - /// as the lowest level of messages to get processed - [SecurityPermissionAttribute(SecurityAction.Demand, - Flags = SecurityPermissionFlag.UnmanagedCode)] - public static void DoEvents(this Application application, DispatcherPriority priority) - { - DispatcherFrame frame = new DispatcherFrame(); - DispatcherOperation dispatcherOperation = - Dispatcher.CurrentDispatcher.BeginInvoke(priority, - new DispatcherOperationCallback(ExitFrameOperation), frame); - - Dispatcher.PushFrame(frame); - - if (dispatcherOperation.Status != DispatcherOperationStatus.Completed) - { - dispatcherOperation.Abort(); - } - } - - /// - /// Forces the WPF message pump to process all enqueued messages - /// that are DispatcherPriority.Background or above - /// - [SecurityPermissionAttribute(SecurityAction.Demand, - Flags = SecurityPermissionFlag.UnmanagedCode)] - public static void DoEvents(this Application application) - { - application.DoEvents(DispatcherPriority.Background); - } - - /// - /// Stops the dispatcher from continuing - /// - private static object ExitFrameOperation(object obj) - { - ((DispatcherFrame)obj).Continue = false; - - return null; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/BitmapSourceExtensions.cs --- a/Chronosv2/source/Extensions/Windows/BitmapSourceExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -using System; -using System.Drawing; -using System.IO; -using System.Windows.Media.Imaging; - -namespace Chronos.Extensions.Windows -{ - /// - /// Extension methods for the System.Windows.Media.Imaging.BitmapSource class - /// - public static class BitmapSourceExtensions - { - #region · Extensions · - - /// - /// Create a System.Drawing.Bitmap from the passed WPF BitmapSource instance - /// - /// The bitmap source. - /// The generated bitmap - public static Bitmap ToBitmap(this BitmapSource bitmapSource) - { - var encoder = new BmpBitmapEncoder(); - encoder.Frames.Add(BitmapFrame.Create(bitmapSource)); - - using (var stream = new MemoryStream()) - { - encoder.Save(stream); - - // Nested construction required to prevent issues from closing the underlying stream - return new Bitmap(new Bitmap(stream)); - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/Chronos.Extensions.Windows.csproj --- a/Chronosv2/source/Extensions/Windows/Chronos.Extensions.Windows.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {F5F26463-32DA-4685-B361-B984EDF5A5F2} - Library - Properties - Chronos.Extensions.Windows - Chronos.Extensions.Windows - v4.0 - 512 - - - - - - - - - - - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/DispatcherObjectExtensions.cs --- a/Chronosv2/source/Extensions/Windows/DispatcherObjectExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -using System; -using System.Windows.Threading; - -namespace Chronos.Extensions.Windows -{ - /// - /// Provides a set of commonly used Dispatcher extension methods - /// - public static class DispatcherObjectExtensions - { - #region · Extensions · - - /// - /// Executes the specified at the priority - /// on the thread on which the DispatcherObject is associated with. - /// - /// The dispatcher object. - /// The action. - public static void InvokeAsynchronously(this DispatcherObject dispatcherObject, Action action) - { - dispatcherObject.Dispatcher.BeginInvoke(DispatcherPriority.Normal, action); - } - - /// - /// Executes the specified at the priority - /// on the thread on which the DispatcherObject is associated with. - /// - /// The dispatcher object. - /// The action. - public static void InvokeAsynchronouslyInBackground(this DispatcherObject dispatcherObject, Action action) - { - dispatcherObject.Dispatcher.BeginInvoke(DispatcherPriority.Background, action); - } - - /// - /// Executes the specified at the priority - /// on the thread on which the DispatcherObject is associated with. - /// - /// The dispatcher object. - /// The action. - public static void Invoke(this DispatcherObject dispatcherObject, Action action) - { - dispatcherObject.Dispatcher.Invoke(action); - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/FrameworkElementExtensions.cs --- a/Chronosv2/source/Extensions/Windows/FrameworkElementExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -using System; -using System.Threading; -using System.Windows; -using System.Windows.Input; -using System.Windows.Threading; - -namespace Chronos.Extensions.Windows -{ - public static class FrameworkElementExtensions - { - /// - /// Set focus to UIElement - /// - /// The element to set focus on - public static void SetFocus(this FrameworkElement element) - { - //Focus in a callback to run on another thread, ensuring the main - //UI thread is initialized by the time focus is set - ThreadPool.QueueUserWorkItem - ( - delegate(object theElement) - { - FrameworkElement elem = (FrameworkElement)theElement; - - elem.InvokeAsynchronouslyInBackground - ( - () => - { - bool result = elem.Focus(); - Keyboard.Focus(elem); - } - ); - }, element - ); - } - - public static void MoveFocus(this IInputElement element, FocusNavigationDirection direction) - { - //Focus in a callback to run on another thread, ensuring the main - //UI thread is initialized by the time focus is set - ThreadPool.QueueUserWorkItem - ( - delegate(object theElement) - { - FrameworkElement elem = (FrameworkElement)theElement; - - elem.InvokeAsynchronouslyInBackground - ( - () => - { - elem.Focus(); - Keyboard.Focus(elem); - elem.MoveFocus(new TraversalRequest(direction)); - } - ); - }, element - ); - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/PanelExtensions.cs --- a/Chronosv2/source/Extensions/Windows/PanelExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; - -namespace Chronos.Extensions.Windows -{ - /// - /// Extensions methods for the WPF control. - /// - public static class PanelExtensions - { - #region · Extension Methods · - - /// - /// Brings the element to the front of the z-order. - /// - /// The canvas. - /// The element. - public static void BringToFront(this Panel panel, UIElement element) - { - int index = Panel.GetZIndex(element); - Panel.SetZIndex(element, panel.Children.Count + 1); - - #region · Define ZIndex Order · - - UIElement[] sortAux = new UIElement[panel.Children.Count]; - - panel.Children.CopyTo(sortAux, 0); - - Array.Sort(sortAux, new Comparison(delegate(UIElement a, UIElement b) - { - int aIndex = Canvas.GetZIndex(a); - int bIndex = Canvas.GetZIndex(b); - - if (aIndex > bIndex) - { - return 1; - } - else if (aIndex == bIndex) - { - return 0; - } - else - { - return -1; - } - })); - - #endregion - - for (int i = 0; i < sortAux.Length; i++) - { - Panel.SetZIndex(sortAux[i], i); - } - } - - /// - /// Brings the element to the bottom of the z-order. - /// - /// The panel. - /// The element. - public static void BringToBottom(this Panel panel, UIElement element) - { - int index = Panel.GetZIndex(element); - Panel.SetZIndex(element, -1); - - #region · Define ZIndex Order · - - UIElement[] sortAux = new UIElement[panel.Children.Count]; - - panel.Children.CopyTo(sortAux, 0); - - Array.Sort(sortAux, new Comparison(delegate(UIElement a, UIElement b) - { - int aIndex = Canvas.GetZIndex(a); - int bIndex = Canvas.GetZIndex(b); - - if (aIndex > bIndex) - { - return 1; - } - else if (aIndex == bIndex) - { - return 0; - } - else - { - return -1; - } - })); - - #endregion - - for (int i = 0; i < sortAux.Length; i++) - { - Panel.SetZIndex(sortAux[i], i); - } - } - - /// - /// Moves the specified element to the given position. - /// - /// The element. - /// The position. - public static void Move(this UIElement element, Point position) - { - element.Move(position.X, position.Y); - } - - /// - /// Moves the specified element to the given position. - /// - /// The element. - /// The left. - /// The top. - public static void Move(this UIElement element, double left, double top) - { - element.MoveLeft(left); - element.MoveTop(top); - } - - /// - /// Moves the specified element to the given left position. - /// - /// The element. - /// The left. - public static void MoveLeft(this UIElement element, double left) - { - Canvas.SetLeft(element, left); - } - - /// - /// Moves the specified element to the given top position. - /// - /// The element. - /// The top. - public static void MoveTop(this UIElement element, double top) - { - Canvas.SetTop(element, top); - } - - /// - /// Sets the value of the ZIndex attached property for a given object. - /// - /// The element. - /// The zindex. - public static void SetZIndex(this UIElement element, int zindex) - { - Canvas.SetZIndex(element, zindex); - } - - /// - /// Gets the canvas left position. - /// - /// The element. - /// - public static Point GetPosition(this UIElement element) - { - return new Point(Canvas.GetLeft(element), Canvas.GetTop(element)); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Extensions/Windows/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -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")] -[assembly: AssemblyDescription("Windows Extension Methods")] diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/RenderTier.cs --- a/Chronosv2/source/Extensions/Windows/RenderTier.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Chronos.Extensions.Windows -{ - public enum RenderTier - { - Tier0 = 0, - Tier1 = 1, - Tier2 = 2 - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/Windows/UIElementExtensions.cs --- a/Chronosv2/source/Extensions/Windows/UIElementExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -using System.Windows; -using System.Windows.Media; -using System.Windows.Media.Imaging; - -namespace Chronos.Extensions.Windows -{ - /// - /// Extension methods for the System.Windows.UIElement class - /// - public static class UIElementExtensions - { - #region · Extensions · - - /// - /// Gets the parent of an . - /// - /// - /// The element. - /// - public static T GetParent(this UIElement element) where T : UIElement - { - // Walk the VisualTree to obtain the DesktopItem of the DragThumb - DependencyObject parent = VisualTreeHelper.GetParent(element); - - while (parent != null && !(parent is T)) - { - parent = VisualTreeHelper.GetParent(parent); - } - - return parent as T; - } - - /// - /// Renders the ui element into a bitmap frame. - /// - /// The UI element. - /// The created bitmap frame - public static BitmapSource RenderToBitmap(this UIElement element) - { - return element.RenderToBitmap(1); - } - - /// - /// Renders the ui element into a bitmap frame using the specified scale. - /// - /// The UI element. - /// The scale (default: 1). - /// The created bitmap frame - public static BitmapSource RenderToBitmap(this UIElement element, double scale) - { - var renderWidth = (int)(element.RenderSize.Width * scale); - var renderHeight = (int)(element.RenderSize.Height * scale); - - var renderTarget = new RenderTargetBitmap(renderWidth, renderHeight, 96, 96, PixelFormats.Pbgra32); - var sourceBrush = new VisualBrush(element); - - var drawingVisual = new DrawingVisual(); - var drawingContext = drawingVisual.RenderOpen(); - - using (drawingContext) - { - drawingContext.PushTransform(new ScaleTransform(scale, scale)); - drawingContext.DrawRectangle(sourceBrush, null, new Rect(new Point(0, 0), new Point(element.RenderSize.Width, element.RenderSize.Height))); - } - - renderTarget.Render(drawingVisual); - - return renderTarget; - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Extensions/XmlNodeExtensions.cs --- a/Chronosv2/source/Extensions/XmlNodeExtensions.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -using System; -using System.Xml; - -namespace Chronos.Extensions -{ - /// - /// Extension methods for the XmlNode / XmlDocument classes and its sub classes - /// - public static class XmlNodeExtensions - { - #region · Extensions · - - /// - /// Appends a child to a XML node - /// - /// The parent node. - /// The name of the child node. - /// The newly cerated XML node - public static XmlNode CreateChildNode(this XmlNode parentNode, string name) - { - XmlDocument document = (parentNode is XmlDocument ? (XmlDocument)parentNode : parentNode.OwnerDocument); - XmlNode node = document.CreateElement(name); - - parentNode.AppendChild(node); - - return node; - } - - /// - /// Appends a child to a XML node - /// - /// The parent node. - /// The name of the child node. - /// The node namespace. - /// The newly cerated XML node - public static XmlNode CreateChildNode(this XmlNode parentNode, string name, string namespaceUri) - { - XmlDocument document = (parentNode is XmlDocument ? (XmlDocument)parentNode : parentNode.OwnerDocument); - XmlNode node = document.CreateElement(name, namespaceUri); - - parentNode.AppendChild(node); - - return node; - } - - /// - /// Appends a CData section to a XML node - /// - /// The parent node. - /// The created CData Section - public static XmlCDataSection CreateCDataSection(this XmlNode parentNode) - { - return parentNode.CreateCDataSection(string.Empty); - } - - /// - /// Appends a CData section to a XML node and prefills the provided data - /// - /// The parent node. - /// The CData section value. - /// The created CData Section - public static XmlCDataSection CreateCDataSection(this XmlNode parentNode, string data) - { - XmlDocument document = (parentNode is XmlDocument ? (XmlDocument)parentNode : parentNode.OwnerDocument); - XmlCDataSection node = document.CreateCDataSection(data); - - parentNode.AppendChild(node); - - return node; - } - - /// - /// Returns the value of a nested CData section. - /// - /// The parent node. - /// The CData section content - public static string GetCDataSection(this XmlNode parentNode) - { - foreach (var node in parentNode.ChildNodes) - { - if (node is XmlCDataSection) - { - return ((XmlCDataSection)node).Value; - } - } - - return null; - } - - /// - /// Gets an attribute value - /// - /// The node. - /// The Name of the attribute. - /// The attribute value - public static string GetAttribute(this XmlNode node, string attributeName) - { - return GetAttribute(node, attributeName, null); - } - - /// - /// Gets an attribute value - /// - /// The node. - /// The Name of the attribute. - /// The default value to be returned if no matching attribute exists. - /// The attribute value - public static string GetAttribute(this XmlNode node, string attributeName, string defaultValue) - { - XmlAttribute attribute = node.Attributes[attributeName]; - - return (attribute != null ? attribute.InnerText : defaultValue); - } - - /// - /// Gets an attribute value converted to the specified data type - /// - /// The desired return data type - /// The node. - /// The Name of the attribute. - /// The attribute value - public static T GetAttribute(this XmlNode node, string attributeName) - { - return GetAttribute(node, attributeName, default(T)); - } - - /// - /// Gets an attribute value converted to the specified data type - /// - /// The desired return data type - /// The node. - /// The Name of the attribute. - /// The default value to be returned if no matching attribute exists. - /// The attribute value - public static T GetAttribute(this XmlNode node, string attributeName, T defaultValue) - { - var value = GetAttribute(node, attributeName); - - return (value.IsNotEmpty() ? value.ConvertTo(defaultValue) : defaultValue); - } - - /// - /// Creates or updates an attribute with the passed value. - /// - /// The node. - /// The name. - /// The value. - public static void SetAttribute(this XmlNode node, string name, object value) - { - SetAttribute(node, name, value != null ? value.ToString() : null); - } - - /// - /// Creates or updates an attribute with the passed value. - /// - /// The node. - /// The name. - /// The value. - public static void SetAttribute(this XmlNode node, string name, string value) - { - if (node != null) - { - var attribute = node.Attributes[name, node.NamespaceURI]; - - if (attribute == null) - { - attribute = node.OwnerDocument.CreateAttribute(name, node.OwnerDocument.NamespaceURI); - node.Attributes.Append(attribute); - } - - attribute.InnerText = value; - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Interop/Chronos.Interop.csproj --- a/Chronosv2/source/Interop/Chronos.Interop.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {3A90897C-B83C-422E-9E81-DD90245079F0} - Library - Properties - Chronos.Interop - Chronos.Interop - v4.0 - 512 - - - - - - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - false - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - Properties\SolutionInfo.cs - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Interop/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Interop/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -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("Win32 Interop")] -[assembly: AssemblyDescription("Win32 Interop functions")] \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Interop/Win32Interop.cs --- a/Chronosv2/source/Interop/Win32Interop.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,502 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Windows; - -namespace Chronos.Interop -{ - /// - /// Win32 Interop Functions - /// - /// - /// http://blogs.msdn.com/llobo/archive/2006/08/01/Maximizing-window-_2800_with-WindowStyle_3D00_None_2900_-considering-Taskbar.aspx - /// http://social.msdn.microsoft.com/forums/en-US/wpf/thread/e77c3b58-41f6-4534-8a92-be0f8287b734/ - /// - public static class Win32Interop - { - #region · Consts · - - /// - /// Sets a new extended window style - /// - public static readonly Int32 GWL_EXSTYLE = -20; - - /// - /// Layered Windows - /// - public static readonly Int32 WS_EX_LAYERED = 0x00080000; - - /// - /// Transparent window - /// - public static readonly Int32 WS_EX_TRANSPARENT = 0x00000020; - - private static readonly Int32 MONITOR_DEFAULTTONEAREST = 0x00000002; - - /// - /// Stop flashing. The system restores the window to its original state. - /// - public const UInt32 FLASHW_STOP = 0; - - /// - /// Flash the window caption. - /// - public const UInt32 FLASHW_CAPTION = 1; - - /// - /// Flash the taskbar button. - /// - public const UInt32 FLASHW_TRAY = 2; - - /// - /// Flash both the window caption and taskbar button. - /// This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags. - /// - public const UInt32 FLASHW_ALL = 3; - - /// - /// Flash continuously, until the FLASHW_STOP flag is set. - /// - public const UInt32 FLASHW_TIMER = 4; - - /// - /// Flash continuously until the window comes to the foreground. - /// - public const UInt32 FLASHW_TIMERNOFG = 12; - - #endregion - - #region · Inner Types · - - [StructLayout(LayoutKind.Sequential)] - private struct FLASHWINFO - { - public UInt32 cbSize; - public IntPtr hwnd; - public UInt32 dwFlags; - public UInt32 uCount; - public UInt32 dwTimeout; - } - - // Struct we'll need to pass to the function - [StructLayout(LayoutKind.Sequential)] - private struct LASTINPUTINFO - { - public UInt32 cbSize; - public UInt32 dwTime; - } - - /// - /// POINT aka POINTAPI - /// - [StructLayout(LayoutKind.Sequential)] - public struct POINT - { - #region · Fields · - - /// - /// x coordinate of point. - /// - public int X; - /// - /// y coordinate of point. - /// - public int Y; - - #endregion - - #region · Constructors · - - /// - /// Construct a point of coordinates (x,y). - /// - public POINT(int x, int y) - { - this.X = x; - this.Y = y; - } - - #endregion - } - - /// - /// The MINMAXINFO structure contains information about a window's maximized size and - /// position and its minimum and maximum tracking size. - /// - [StructLayout(LayoutKind.Sequential)] - public struct MINMAXINFO - { - /// - /// Reserved; do not use. - /// - public POINT ptReserved; - - /// - /// Specifies the maximized width (POINT.x) and the maximized height (POINT.y) of the window. - /// For top-level windows, this value is based on the width of the primary monitor. - /// - public POINT ptMaxSize; - - /// - /// Specifies the position of the left side of the maximized window (POINT.x) and - /// the position of the top of the maximized window (POINT.y). - /// For top-level windows, this value is based on the position of the primary monitor. - /// - public POINT ptMaxPosition; - - /// - /// Specifies the minimum tracking width (POINT.x) and the minimum tracking height (POINT.y) of the window. - /// This value can be obtained programmatically from the system metrics SM_CXMINTRACK and SM_CYMINTRACK. - /// - public POINT ptMinTrackSize; - - /// - /// Specifies the maximum tracking width (POINT.x) and the maximum tracking height (POINT.y) of the window. - /// This value is based on the size of the virtual screen and can be obtained programmatically from the - /// system metrics SM_CXMAXTRACK and SM_CYMAXTRACK. - /// - public POINT ptMaxTrackSize; - }; - - /// - /// The MONITORINFO structure contains information about a display monitor. - /// - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] - public class MONITORINFO - { - /// - /// The size of the structure, in bytes. - /// - public int cbSize = Marshal.SizeOf(typeof(MONITORINFO)); - - /// - /// A RECT structure that specifies the display monitor rectangle, expressed in virtual-screen coordinates. - /// Note that if the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values. - /// - public RECT rcMonitor = new RECT(); - - /// - /// A RECT structure that specifies the work area rectangle of the display monitor, expressed in virtual-screen coordinates. - /// Note that if the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values. - /// - public RECT rcWork = new RECT(); - - /// - /// A set of flags that represent attributes of the display monitor. - /// - public int dwFlags = 0; - } - - /// Win32 - [StructLayout(LayoutKind.Sequential, Pack = 0)] - public struct RECT - { - #region · Operators · - - /// Determine if 2 RECT are equal (deep compare) - public static bool operator ==(RECT rect1, RECT rect2) - { - return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right && rect1.bottom == rect2.bottom); - } - - /// Determine if 2 RECT are different(deep compare) - public static bool operator !=(RECT rect1, RECT rect2) - { - return !(rect1 == rect2); - } - - #endregion - - #region · Static Members · - - /// Win32 - public static readonly RECT Empty = new RECT(); - - #endregion - - #region · Public Fields · - - /// Win32 - public int left; - /// Win32 - public int top; - /// Win32 - public int right; - /// Win32 - public int bottom; - - #endregion - - #region · Properties · - - /// Win32 - public int Width - { - get { return Math.Abs(right - left); } // Abs needed for BIDI OS - } - - /// Win32 - public int Height - { - get { return bottom - top; } - } - - /// Win32 - public bool IsEmpty - { - get - { - // BUGBUG : On Bidi OS (hebrew arabic) left > right - return left >= right || top >= bottom; - } - } - - #endregion - - #region · Constructors · - - /// - /// Win32 - /// - /// The left. - /// The top. - /// The right. - /// The bottom. - public RECT(int left, int top, int right, int bottom) - { - this.left = left; - this.top = top; - this.right = right; - this.bottom = bottom; - } - - /// - /// Win32 - /// - /// The rc SRC. - public RECT(RECT rcSrc) - { - this.left = rcSrc.left; - this.top = rcSrc.top; - this.right = rcSrc.right; - this.bottom = rcSrc.bottom; - } - - #endregion - - #region · Methods · - - /// - /// Return a user friendly representation of this struct - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - if (this == RECT.Empty) - { - return "RECT {Empty}"; - } - return "RECT { left : " + left + " / top : " + top + " / right : " + right + " / bottom : " + bottom + " }"; - } - - /// - /// Determine if 2 RECT are equal (deep compare) - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - if (!(obj is Rect)) - { - return false; - } - - return (this == (RECT)obj); - } - - /// - /// Return the HashCode for this struct (not garanteed to be unique) - /// - /// - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. - /// - public override int GetHashCode() - { - return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode(); - } - - #endregion - } - - #endregion - - #region · Static Methods · - - public static void FlashWindow(IntPtr handle) - { - IntPtr hWnd = handle; - FLASHWINFO fInfo = new FLASHWINFO(); - - fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); - fInfo.hwnd = hWnd; - fInfo.dwFlags = Win32Interop.FLASHW_ALL | - Win32Interop.FLASHW_TIMERNOFG | - Win32Interop.FLASHW_CAPTION; - - fInfo.uCount = UInt32.MaxValue; - fInfo.dwTimeout = 0; - - FlashWindowEx(ref fInfo); - } - - /// - /// Gets the application idle time - /// - /// - /// http://www.geekpedia.com/tutorial210_Retrieving-the-Operating-System-Idle-Time-Uptime-and-Last-Input-Time.html - /// - /// - public static int GetIdleTime() - { - // Get the system uptime - int systemUptime = Environment.TickCount; - // The tick at which the last input was recorded - int lastInputTicks = 0; - // The number of ticks that passed since last input - int idleTicks = 0; - - // Set the struct - LASTINPUTINFO lastInputInfo = new LASTINPUTINFO(); - lastInputInfo.cbSize = (uint)Marshal.SizeOf(lastInputInfo); - lastInputInfo.dwTime = 0; - - // If we have a value from the function - if (GetLastInputInfo(ref lastInputInfo)) - { - // Get the number of ticks at the point when the last activity was seen - lastInputTicks = (int)lastInputInfo.dwTime; - // Number of idle ticks = system uptime ticks - number of ticks at last input - idleTicks = systemUptime - lastInputTicks; - } - - return (idleTicks / 1000); - } - - /// - /// Window Proc - /// - /// The HWND. - /// The MSG. - /// The w param. - /// The l param. - /// if set to true [handled]. - /// - public static System.IntPtr WindowProc( - System.IntPtr hwnd, - int msg, - System.IntPtr wParam, - System.IntPtr lParam, - ref bool handled) - { - switch (msg) - { - case 0x0024:/* WM_GETMINMAXINFO */ - WmGetMinMaxInfo(hwnd, lParam); - handled = true; - break; - } - - return (System.IntPtr)0; - } - - /// - /// Get the min max size of a window - /// - /// The HWND. - /// The l param. - public static void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam) - { - Win32Interop.MINMAXINFO mmi = (Win32Interop.MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(Win32Interop.MINMAXINFO)); - - // Adjust the maximized size and position to fit the work area of the correct monitor - System.IntPtr monitor = Win32Interop.MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); - - if (monitor != System.IntPtr.Zero) - { - Win32Interop.MONITORINFO monitorInfo = new Win32Interop.MONITORINFO(); - Win32Interop.GetMonitorInfo(monitor, monitorInfo); - Win32Interop.RECT rcWorkArea = monitorInfo.rcWork; - Win32Interop.RECT rcMonitorArea = monitorInfo.rcMonitor; - - mmi.ptMaxPosition.X = Math.Abs(rcWorkArea.left - rcMonitorArea.left); - mmi.ptMaxPosition.Y = Math.Abs(rcWorkArea.top - rcMonitorArea.top); - mmi.ptMaxSize.X = Math.Abs(rcWorkArea.right - rcWorkArea.left); - mmi.ptMaxSize.Y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top); - } - - Marshal.StructureToPtr(mmi, lParam, true); - } - - #endregion - - #region · P/Invoke Functions · - - [DllImport("user32.dll")] - static extern Int32 FlashWindowEx(ref FLASHWINFO pwfi); - - [DllImport("user32.dll")] - static extern bool GetLastInputInfo(ref LASTINPUTINFO plii); - - /// - /// Gets information about a display monitor. - /// - /// The h monitor. - /// The lpmi. - /// - [DllImport("user32")] - internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi); - - /// - /// Gets a handle to the display monitor that has the largest area of intersection with the bounding rectangle of a specified windo - /// - /// The handle. - /// The flags. - /// - [DllImport("User32")] - internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags); - - /// - /// Gets the cursor's position, in screen coordinates. - /// - /// - /// - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern bool GetCursorPos(out POINT pt); - - /// - /// Gets information about the specified window. - /// The function also retrieves the 32-bit (long) value at the specified offset into the extra window memory. - /// - /// - /// - /// - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern Int32 GetWindowLong(IntPtr hWnd, Int32 nIndex); - - /// - /// Changes an attribute of the specified window. - /// The function also sets the 32-bit (long) value at the specified offset into the extra window memory. - /// - /// - /// - /// - /// - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern Int32 SetWindowLong(IntPtr hWnd, Int32 nIndex, Int32 newVal); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Main.cs --- a/Chronosv2/source/Main.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -using System; -using NLog; - -namespace Chronos -{ - /// - /// Application entry point class - /// - public static class ChronosMain - { - /// - /// Entry Point - /// - /// The args. - [STAThread] - public static void Main(params string[] args) - { - if (SingleInstance.InitializeAsFirstInstance("Chronos")) - { - var application = new App(); - - application.InitializeComponent(); - - if (args != null && args.Length > 0) - { - application.Run(args); - } - else - { - application.Run(); - } - - // Allow single instance code to perform cleanup operations - SingleInstance.Cleanup(); - } - } - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Model/UserLogin.cs --- a/Chronosv2/source/Model/UserLogin.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -using System.ComponentModel; -using Chronos.Presentation.ViewModel; - -namespace Chronos.Model -{ - public sealed class UserLogin - : ObservableObject, IDataErrorInfo - { - #region · Fields · - - private string userId; - private string password; - private int workYear; - - #endregion - - #region · IDataErrorInfo Members · - - public string Error - { - get { return null; } - } - - public string this[string columnName] - { - get { return null; } - } - - #endregion - - #region · Properties · - - public string UserId - { - get { return this.userId; } - set - { - if (this.userId != value) - { - this.userId = value; - this.NotifyPropertyChanged(() => UserId); - } - } - } - - public string Password - { - get { return this.password; } - set - { - if (this.password != value) - { - this.password = value; - this.NotifyPropertyChanged(() => Password); - } - } - } - - public int WorkYear - { - get { return this.workYear; } - set - { - if (this.workYear != value) - { - this.workYear = value; - this.NotifyPropertyChanged(() => WorkYear); - } - } - } - - #endregion - - #region · Constructors · - - public UserLogin() - { - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Navigation/Chronos.Modules.Navigation.csproj --- a/Chronosv2/source/Modules/Navigation/Chronos.Modules.Navigation.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {276B4110-E91B-45EB-BFD3-1983CB871B2F} - Library - Properties - Chronos.Modules.Navigation - Chronos.Modules.Navigation - v4.0 - 512 - - - - - - - - - - - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Navigation/NavigationRoutes.cs --- a/Chronosv2/source/Modules/Navigation/NavigationRoutes.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -using System; - -namespace Chronos.Modules.Navigation -{ - /// - /// Navigation route definitions - /// - public static class NavigationRoutes - { - #region · Application · - - /// - /// Route for the login view - /// - public const string Login = "Authentication/Login"; - - /// - /// Route for the about box view - /// - public const string About = "Application/About"; - - #endregion - - #region · Configuration · - - /// - /// Route for the companies view - /// - public const string Companies = "Configuration/Business"; - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Navigation/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Modules/Navigation/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -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("Modules Navigation Helpers")] -[assembly: AssemblyDescription("Modules Navigation Helpers")] diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Chronos.Modules.Sample.csproj --- a/Chronosv2/source/Modules/Sample/Chronos.Modules.Sample.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {97C6B5F9-E5E4-4E1C-AA9F-2ED840DB0AD9} - library - Properties - Chronos.Modules.Sample - Chronos.Modules.Sample - v4.0 - Client - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - - - - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\Lib\nRoute\nRoute.Framework.dll - - - - - - - - - - 4.0 - - - - - - - - Properties\SolutionInfo.cs - - - - EmpresaView.xaml - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - UserControl - MSBuild:Compile - - - - - {66D734BC-132C-4252-9CBD-78DF2585D52D} - Chronos.Presentation.Controls - - - {4C9AD768-6AB8-43B1-833A-C8CC520471B1} - Chronos.Presentation.Core - - - {AAB3929F-049B-469A-AAEB-BBABEE03FE0A} - Chronos.Presentation.ViewModel - - - {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7} - Chronos.Presentation.Windows - - - {276B4110-E91B-45EB-BFD3-1983CB871B2F} - Chronos.Modules.Navigation - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Models/EmpresaEntity.cs --- a/Chronosv2/source/Modules/Sample/Models/EmpresaEntity.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,344 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Chronos.Modules.Sample.Models -{ - public partial class EmpresaEntity - : INotifyPropertyChanged, IDataErrorInfo - { - #region · INotifyPropertyChanged Members · - - public event PropertyChangedEventHandler PropertyChanged; - - #endregion - - #region · Fields · - - private string _idEmpresa; - private string _cif; - private string _idEpigrafeIae; - private string _idCnae; - private string _nombre; - private string _nombreComercial; - private string _idTipoVia; - private string _direccion; - private string _numeroBloque; - private string _piso; - private string _puerta; - private string _codigoPostal; - private string _ciudad; - private string _provincia; - private string _pais; - private string _telefono1; - private string _telefono2; - private string _fax1; - private string _fax2; - private string _www; - private string _email; - - #endregion - - #region · Properties · - - public string IdEmpresa - { - get { return _idEmpresa; } - set - { - if (_idEmpresa != value) - { - _idEmpresa = value; - OnPropertyChanged("IdEmpresa"); - } - } - } - - public string Cif - { - get { return _cif; } - set - { - if (_cif != value) - { - _cif = value; - OnPropertyChanged("Cif"); - } - } - } - - public string IdEpigrafeIae - { - get { return _idEpigrafeIae; } - set - { - if (_idEpigrafeIae != value) - { - _idEpigrafeIae = value; - OnPropertyChanged("IdEpigrafeIae"); - } - } - } - - public string IdCnae - { - get { return _idCnae; } - set - { - if (_idCnae != value) - { - _idCnae = value; - OnPropertyChanged("IdCnae"); - } - } - } - - public string Nombre - { - get { return _nombre; } - set - { - if (_nombre != value) - { - _nombre = value; - OnPropertyChanged("Nombre"); - } - } - } - - public string NombreComercial - { - get { return _nombreComercial; } - set - { - if (_nombreComercial != value) - { - _nombreComercial = value; - OnPropertyChanged("NombreComercial"); - } - } - } - - public string IdTipoVia - { - get { return _idTipoVia; } - set - { - if (_idTipoVia != value) - { - _idTipoVia = value; - OnPropertyChanged("IdTipoVia"); - } - } - } - - public string Direccion - { - get { return _direccion; } - set - { - if (_direccion != value) - { - _direccion = value; - OnPropertyChanged("Direccion"); - } - } - } - - public string NumeroBloque - { - get { return _numeroBloque; } - set - { - if (_numeroBloque != value) - { - _numeroBloque = value; - OnPropertyChanged("NumeroBloque"); - } - } - } - - public string Piso - { - get { return _piso; } - set - { - if (_piso != value) - { - _piso = value; - OnPropertyChanged("Piso"); - } - } - } - - public string Puerta - { - get { return _puerta; } - set - { - if (_puerta != value) - { - _puerta = value; - OnPropertyChanged("Puerta"); - } - } - } - - public string CodigoPostal - { - get { return _codigoPostal; } - set - { - if (_codigoPostal != value) - { - _codigoPostal = value; - OnPropertyChanged("CodigoPostal"); - } - } - } - - public string Ciudad - { - get { return _ciudad; } - set - { - if (_ciudad != value) - { - _ciudad = value; - OnPropertyChanged("Ciudad"); - } - } - } - - public string Provincia - { - get { return _provincia; } - set - { - if (_provincia != value) - { - _provincia = value; - OnPropertyChanged("Provincia"); - } - } - } - - public string Pais - { - get { return _pais; } - set - { - if (_pais != value) - { - _pais = value; - OnPropertyChanged("Pais"); - } - } - } - - public string Telefono1 - { - get { return _telefono1; } - set - { - if (_telefono1 != value) - { - _telefono1 = value; - OnPropertyChanged("Telefono1"); - } - } - } - - public string Telefono2 - { - get { return _telefono2; } - set - { - if (_telefono2 != value) - { - _telefono2 = value; - OnPropertyChanged("Telefono2"); - } - } - } - - public string Fax1 - { - get { return _fax1; } - set - { - if (_fax1 != value) - { - _fax1 = value; - OnPropertyChanged("Fax1"); - } - } - } - - public string Fax2 - { - get { return _fax2; } - set - { - if (_fax2 != value) - { - _fax2 = value; - OnPropertyChanged("Fax2"); - } - } - } - - public string Www - { - get { return _www; } - set - { - if (_www != value) - { - _www = value; - OnPropertyChanged("Www"); - } - } - } - - public string Email - { - get { return _email; } - set - { - if (_email != value) - { - _email = value; - OnPropertyChanged("Email"); - } - } - } - - #endregion - - #region · IDataErrorInfo Members · - - public string Error - { - get { return null; } - } - - public string this[string columnName] - { - get { return null; } - } - - #endregion - - #region · ChangeTracking · - - protected virtual void OnPropertyChanged(String propertyName) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Modules/Sample/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -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("Sample Module")] -[assembly: AssemblyDescription("Sample Module")] diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Properties/Resources.Designer.cs --- a/Chronosv2/source/Modules/Sample/Properties/Resources.Designer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Chronos.Modules.Sample.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Chronos.Modules.Sample.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Properties/Resources.resx --- a/Chronosv2/source/Modules/Sample/Properties/Resources.resx Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Properties/Settings.Designer.cs --- a/Chronosv2/source/Modules/Sample/Properties/Settings.Designer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Chronos.Modules.Sample.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Properties/Settings.settings --- a/Chronosv2/source/Modules/Sample/Properties/Settings.settings Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/ViewModels/EmpresaViewModel.cs --- a/Chronosv2/source/Modules/Sample/ViewModels/EmpresaViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,423 +0,0 @@ -using System.ComponentModel; -using Chronos.Modules.Navigation; -using Chronos.Modules.Sample.Models; -using Chronos.Presentation.Core.Navigation; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.ViewModel; -using nRoute.Components; - -namespace Chronos.Modules.Sample.ViewModels -{ - public sealed class EmpresaViewModel - : WorkspaceViewModel - { - #region · PropertyChangedEventArgs Cached Instances · - - private static readonly PropertyChangedEventArgs IdEmpresaChangedArgs = CreateArgs(x => x.IdEmpresa); - private static readonly PropertyChangedEventArgs CifChangedArgs = CreateArgs(x => x.Cif); - private static readonly PropertyChangedEventArgs IdEpigrafeIaeChangedArgs = CreateArgs(x => x.IdEpigrafeIae); - private static readonly PropertyChangedEventArgs IdCnaeChangedArgs = CreateArgs(x => x.IdCnae); - private static readonly PropertyChangedEventArgs NombreChangedArgs = CreateArgs(x => x.Nombre); - private static readonly PropertyChangedEventArgs NombreComercialChangedArgs = CreateArgs(x => x.NombreComercial); - private static readonly PropertyChangedEventArgs IdTipoViaChangedArgs = CreateArgs(x => x.IdTipoVia); - private static readonly PropertyChangedEventArgs DireccionChangedArgs = CreateArgs(x => x.Direccion); - private static readonly PropertyChangedEventArgs NumeroBloqueChangedArgs = CreateArgs(x => x.NumeroBloque); - private static readonly PropertyChangedEventArgs PisoChangedArgs = CreateArgs(x => x.Piso); - private static readonly PropertyChangedEventArgs PuertaChangedArgs = CreateArgs(x => x.Puerta); - private static readonly PropertyChangedEventArgs CodigoPostalChangedArgs = CreateArgs(x => x.CodigoPostal); - private static readonly PropertyChangedEventArgs CiudadChangedArgs = CreateArgs(x => x.Ciudad); - private static readonly PropertyChangedEventArgs ProvinciaChangedArgs = CreateArgs(x => x.Provincia); - private static readonly PropertyChangedEventArgs PaisChangedArgs = CreateArgs(x => x.Pais); - private static readonly PropertyChangedEventArgs Telefono1ChangedArgs = CreateArgs(x => x.Telefono1); - private static readonly PropertyChangedEventArgs Telefono2ChangedArgs = CreateArgs(x => x.Telefono2); - private static readonly PropertyChangedEventArgs Fax1ChangedArgs = CreateArgs(x => x.Fax1); - private static readonly PropertyChangedEventArgs Fax2ChangedArgs = CreateArgs(x => x.Fax2); - private static readonly PropertyChangedEventArgs WwwChangedArgs = CreateArgs(x => x.Www); - private static readonly PropertyChangedEventArgs EmailChangedArgs = CreateArgs(x => x.Email); - - #endregion - - #region · Model Data · - - public string IdEmpresa - { - get { return this.Entity.IdEmpresa; } - set - { - if (this.Entity.IdEmpresa != value) - { - this.Entity.IdEmpresa = value; - this.NotifyPropertyChanged(IdEmpresaChangedArgs); - } - } - } - - public string Cif - { - get { return this.Entity.Cif; } - set - { - if (this.Entity.Cif != value) - { - this.Entity.Cif = value; - this.NotifyPropertyChanged(CifChangedArgs); - } - } - } - - public string IdEpigrafeIae - { - get { return this.Entity.IdEpigrafeIae; } - set - { - if (this.Entity.IdEpigrafeIae != value) - { - this.Entity.IdEpigrafeIae = value; - this.NotifyPropertyChanged(IdEpigrafeIaeChangedArgs); - } - } - } - - public string IdCnae - { - get { return this.Entity.IdCnae; } - set - { - if (this.Entity.IdCnae != value) - { - this.Entity.IdCnae = value; - this.NotifyPropertyChanged(IdCnaeChangedArgs); - } - } - } - - public string Nombre - { - get { return this.Entity.Nombre; } - set - { - if (this.Entity.Nombre != value) - { - this.Entity.Nombre = value; - this.NotifyPropertyChanged(NombreChangedArgs); - } - } - } - - public string NombreComercial - { - get { return this.Entity.NombreComercial; } - set - { - if (this.Entity.NombreComercial != value) - { - this.Entity.NombreComercial = value; - this.NotifyPropertyChanged(NombreComercialChangedArgs); - } - } - } - - public string IdTipoVia - { - get { return this.Entity.IdTipoVia; } - set - { - if (this.Entity.IdTipoVia != value) - { - this.Entity.IdTipoVia = value; - this.NotifyPropertyChanged(IdTipoViaChangedArgs); - } - } - } - - public string Direccion - { - get { return this.Entity.Direccion; } - set - { - if (this.Entity.Direccion != value) - { - this.Entity.Direccion = value; - this.NotifyPropertyChanged(DireccionChangedArgs); - } - } - } - - public string NumeroBloque - { - get { return this.Entity.NumeroBloque; } - set - { - if (this.Entity.NumeroBloque != value) - { - this.Entity.NumeroBloque = value; - this.NotifyPropertyChanged(NumeroBloqueChangedArgs); - } - } - } - - public string Piso - { - get { return this.Entity.Piso; } - set - { - if (this.Entity.Piso != value) - { - this.Entity.Piso = value; - this.NotifyPropertyChanged(PisoChangedArgs); - } - } - } - - public string Puerta - { - get { return this.Entity.Puerta; } - set - { - if (this.Entity.Puerta != value) - { - this.Entity.Puerta = value; - this.NotifyPropertyChanged(PuertaChangedArgs); - } - } - } - - public string CodigoPostal - { - get { return this.Entity.CodigoPostal; } - set - { - if (this.Entity.CodigoPostal != value) - { - this.Entity.CodigoPostal = value; - this.NotifyPropertyChanged(CodigoPostalChangedArgs); - } - } - } - - public string Ciudad - { - get { return this.Entity.Ciudad; } - set - { - if (this.Entity.Ciudad != value) - { - this.Entity.Ciudad = value; - this.NotifyPropertyChanged(CiudadChangedArgs); - } - } - } - - public string Provincia - { - get { return this.Entity.Provincia; } - set - { - if (this.Entity.Provincia != value) - { - this.Entity.Provincia = value; - this.NotifyPropertyChanged(ProvinciaChangedArgs); - } - } - } - - public string Pais - { - get { return this.Entity.Pais; } - set - { - if (this.Entity.Pais != value) - { - this.Entity.Pais = value; - this.NotifyPropertyChanged(PaisChangedArgs); - } - } - } - - public string Telefono1 - { - get { return this.Entity.Telefono1; } - set - { - if (this.Entity.Telefono1 != value) - { - this.Entity.Telefono1 = value; - this.NotifyPropertyChanged(Telefono1ChangedArgs); - } - } - } - - public string Telefono2 - { - get { return this.Entity.Telefono2; } - set - { - if (this.Entity.Telefono2 != value) - { - this.Entity.Telefono2 = value; - this.NotifyPropertyChanged(Telefono2ChangedArgs); - } - } - } - - public string Fax1 - { - get { return this.Entity.Fax1; } - set - { - if (this.Entity.Fax1 != value) - { - this.Entity.Fax1 = value; - this.NotifyPropertyChanged(Fax1ChangedArgs); - } - } - } - - public string Fax2 - { - get { return this.Entity.Fax2; } - set - { - if (this.Entity.Fax2 != value) - { - this.Entity.Fax2 = value; - this.NotifyPropertyChanged(Fax2ChangedArgs); - } - } - } - - public string Www - { - get { return this.Entity.Www; } - set - { - if (this.Entity.Www != value) - { - this.Entity.Www = value; - this.NotifyPropertyChanged(WwwChangedArgs); - } - } - } - - public string Email - { - get { return this.Entity.Email; } - set - { - if (this.Entity.Email != value) - { - this.Entity.Email = value; - this.NotifyPropertyChanged(EmailChangedArgs); - } - } - } - - #endregion - - #region · Properties · - - /// - /// Gets the navigation URL - /// - /// - public override string NavigationRoute - { - get { return NavigationRoutes.Companies; } - } - - #endregion - - #region · Constructors · - - public EmpresaViewModel() - : base() - { - } - - #endregion - - #region · Overriden Methods · - - protected override void OnInitialize(nRoute.Components.ParametersCollection requestParameters) - { - if (requestParameters.ContainsKey(NavigationParams.NavigationParamsKey)) - { - object[] rparams = requestParameters.GetValueOrDefault(NavigationParams.NavigationParamsKey, null); - - if (rparams != null && rparams[0] is int) - { - int value = (int)rparams[0]; - } - } - } - - protected override void InitializePropertyStates() - { - this.PropertyStates.Add(e => e.IdEmpresa); - this.PropertyStates.Add(e => e.Nombre); - this.PropertyStates.Add(e => e.Cif); - this.PropertyStates.Add(e => e.IdEpigrafeIae); - this.PropertyStates.Add(e => e.IdCnae); - this.PropertyStates.Add(e => e.NombreComercial); - this.PropertyStates.Add(e => e.IdTipoVia); - this.PropertyStates.Add(e => e.Direccion); - this.PropertyStates.Add(e => e.NumeroBloque); - this.PropertyStates.Add(e => e.Piso); - this.PropertyStates.Add(e => e.Puerta); - this.PropertyStates.Add(e => e.CodigoPostal); - this.PropertyStates.Add(e => e.Ciudad); - this.PropertyStates.Add(e => e.Provincia); - this.PropertyStates.Add(e => e.Pais); - this.PropertyStates.Add(e => e.Telefono1); - this.PropertyStates.Add(e => e.Telefono2); - this.PropertyStates.Add(e => e.Fax1); - this.PropertyStates.Add(e => e.Fax2); - this.PropertyStates.Add(e => e.Www); - this.PropertyStates.Add(e => e.Email); - } - - protected override void OnViewModeChanged() - { - base.OnViewModeChanged(); - - if (this.PropertyStates.Count > 0) - { - bool editing = this.ViewMode == Chronos.Presentation.Core.Windows.ViewModeType.Add || - this.ViewMode == Chronos.Presentation.Core.Windows.ViewModeType.Edit; - - this.PropertyStates[x => x.IdEmpresa].IsEditable = this.ViewMode == ViewModeType.ViewOnly; - this.PropertyStates[x => x.Nombre].IsEditable = editing; - this.PropertyStates[x => x.Cif].IsEditable = editing; - this.PropertyStates[x => x.NombreComercial].IsEditable = editing; - this.PropertyStates[x => x.IdEpigrafeIae].IsEditable = editing; - this.PropertyStates[x => x.IdCnae].IsEditable = editing; - this.PropertyStates[x => x.NombreComercial].IsEditable = editing; - this.PropertyStates[x => x.IdTipoVia].IsEditable = editing; - this.PropertyStates[x => x.Direccion].IsEditable = editing; - this.PropertyStates[x => x.NumeroBloque].IsEditable = editing; - this.PropertyStates[x => x.Piso].IsEditable = editing; - this.PropertyStates[x => x.Puerta].IsEditable = editing; - this.PropertyStates[x => x.CodigoPostal].IsEditable = editing; - this.PropertyStates[x => x.Ciudad].IsEditable = editing; - this.PropertyStates[x => x.Provincia].IsEditable = editing; - this.PropertyStates[x => x.Pais].IsEditable = editing; - this.PropertyStates[x => x.Telefono1].IsEditable = editing; - this.PropertyStates[x => x.Telefono2].IsEditable = editing; - this.PropertyStates[x => x.Fax1].IsEditable = editing; - this.PropertyStates[x => x.Fax2].IsEditable = editing; - this.PropertyStates[x => x.Www].IsEditable = editing; - this.PropertyStates[x => x.Email].IsEditable = editing; - } - } - - #endregion - - #region · Command Actions · - - protected override void OnInquiryAction(InquiryActionResult result) - { - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Views/EmpresaView.xaml --- a/Chronosv2/source/Modules/Sample/Views/EmpresaView.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,369 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Modules/Sample/Views/EmpresaView.xaml.cs --- a/Chronosv2/source/Modules/Sample/Views/EmpresaView.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Chronos.Modules.Navigation; -using Chronos.Modules.Sample.ViewModels; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Windows.Controls; -using nRoute.Components.Composition; -using nRoute.Navigation.Mapping; -using nRoute.ViewModels; - -namespace Chronos.Modules.Sample.Views -{ - /// - /// Interaction logic for EmpresaView.xaml - /// - [MapNavigationContent(NavigationRoutes.Companies)] - [DefineViewViewModel(typeof(EmpresaView), typeof(EmpresaViewModel))] - public partial class EmpresaView - : WindowElement - { - #region · Constructors · - - [ResolveConstructor] - public EmpresaView([ResolveViewModel(typeof(EmpresaView))]INavigationViewModel viewModel) - { - InitializeComponent(); - - this.DataContext = viewModel; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/NLog.config --- a/Chronosv2/source/NLog.config Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Adorner/TextBlockAdorner.cs --- a/Chronosv2/source/Presentation/Controls/Adorner/TextBlockAdorner.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace Chronos.Presentation.Controls.Adorner -{ - public sealed class TextBlockAdorner - : System.Windows.Documents.Adorner - { - #region · Fields · - - private readonly TextBlock adornerTextBlock; - - #endregion - - #region · Properties · - - protected override int VisualChildrenCount - { - get { return 1; } - } - - #endregion - - #region · Constructors · - - public TextBlockAdorner(UIElement adornedElement, string label, Style labelStyle) - : base(adornedElement) - { - this.adornerTextBlock = new TextBlock { Style = labelStyle, Text = label }; - } - - #endregion - - #region · Overriden Methods · - - protected override Size MeasureOverride(Size constraint) - { - this.adornerTextBlock.Measure(constraint); - - return constraint; - } - - protected override Size ArrangeOverride(Size finalSize) - { - this.adornerTextBlock.Arrange(new Rect(finalSize)); - - return finalSize; - } - - protected override Visual GetVisualChild(int index) - { - return this.adornerTextBlock; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Chronos.Presentation.Controls.csproj --- a/Chronosv2/source/Presentation/Controls/Chronos.Presentation.Controls.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {66D734BC-132C-4252-9CBD-78DF2585D52D} - library - Properties - Chronos.Presentation.Controls - Chronos.Presentation.Controls - v4.0 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - - - 3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - - - - - - - 4.0.20310.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - ..\..\..\Lib\nRoute\nRoute.Framework.dll - - - - - 3.5 - - - False - C:\Program Files (x86)\Microsoft SDKs\Expression\Blend Preview for .NET 4\Interactivity\Libraries\WPF\System.Windows.Interactivity.dll - - - - 3.5 - - - - - 3.0 - - - 3.0 - - - 3.0 - - - 3.0 - - - - - Properties\SolutionInfo.cs - - - - - - HeaderNotification.xaml - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - {AA911078-3A2A-41B1-B779-3C8B55E1B8E3} - Chronos.Extensions - - - {F5F26463-32DA-4685-B361-B984EDF5A5F2} - Chronos.Extensions.Windows - - - {F3061A2B-7688-4B26-8D5B-E556EAFE1D49} - Chronos.Presentation.DragAndDrop - - - {4C9AD768-6AB8-43B1-833A-C8CC520471B1} - Chronos.Presentation.Core - - - {AAB3929F-049B-469A-AAEB-BBABEE03FE0A} - Chronos.Presentation.ViewModel - - - - - Designer - MSBuild:Compile - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Events/WeakPropertyChangeNotifier.cs --- a/Chronosv2/source/Presentation/Controls/Events/WeakPropertyChangeNotifier.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows; -using System.Windows.Data; - -namespace Chronos.Presentation.Controls.Events -{ - /// - /// http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/ - /// - public sealed class WeakPropertyChangeNotifier - : DependencyObject, IDisposable - { - #region Member Variables - private readonly WeakReference _propertySource; - #endregion // Member Variables - - #region Constructor - public WeakPropertyChangeNotifier(DependencyObject propertySource, string path) - : this(propertySource, new PropertyPath(path)) - { - } - public WeakPropertyChangeNotifier(DependencyObject propertySource, DependencyProperty property) - : this(propertySource, new PropertyPath(property)) - { - } - public WeakPropertyChangeNotifier(DependencyObject propertySource, PropertyPath property) - { - if (null == propertySource) - throw new ArgumentNullException("propertySource"); - if (null == property) - throw new ArgumentNullException("property"); - - this._propertySource = new WeakReference(propertySource); - - Binding binding = new Binding(); - binding.Path = property; - binding.Mode = BindingMode.OneWay; - binding.Source = propertySource; - BindingOperations.SetBinding(this, ValueProperty, binding); - } - #endregion // Constructor - - #region PropertySource - public DependencyObject PropertySource - { - get - { - try - { - // note, it is possible that accessing the target property - // will result in an exception so i’ve wrapped this check - // in a try catch - return this._propertySource.IsAlive - ? this._propertySource.Target as DependencyObject - : null; - } - catch - { - return null; - } - } - } - #endregion // PropertySource - - #region Value - /// - /// Identifies the dependency property - /// - public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", - typeof(object), typeof(WeakPropertyChangeNotifier), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnPropertyChanged))); - - private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - WeakPropertyChangeNotifier notifier = (WeakPropertyChangeNotifier)d; - if (null != notifier.ValueChanged) - notifier.ValueChanged(notifier, EventArgs.Empty); - } - - /// - /// Returns/sets the value of the property - /// - /// - [Description("Returns/sets the value of the property")] - [Category("Behavior")] - [Bindable(true)] - public object Value - { - get - { - return (object)this.GetValue(ValueProperty); - } - set - { - this.SetValue(ValueProperty, value); - } - } - #endregion //Value - - #region Events - public event EventHandler ValueChanged; - #endregion // Events - - #region IDisposable Members - public void Dispose() - { - BindingOperations.ClearBinding(this, ValueProperty); - } - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/HeaderNotification.xaml --- a/Chronosv2/source/Presentation/Controls/HeaderNotification.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - Collapsed - - - - - - - - - - - - - - - - - - Visible - - - - - - - - - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/HeaderNotification.xaml.cs --- a/Chronosv2/source/Presentation/Controls/HeaderNotification.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Threading; - -namespace Chronos.Presentation.Controls -{ - [TemplateVisualState(Name = HIDDEN_STATENAME, GroupName = NOTIFICATION_STATEGROUP)] - [TemplateVisualState(Name = VISIBLE_STATENAME, GroupName = NOTIFICATION_STATEGROUP)] - public partial class HeaderNotification - : UserControl - { - #region · Constants · - - private const string NOTIFICATION_STATEGROUP = "NotificationStateGroup"; - private const string HIDDEN_STATENAME = "HiddenState"; - private const string VISIBLE_STATENAME = "VisibleState"; - private readonly static TimeSpan TRANSITION_TIMEOUT = TimeSpan.FromMilliseconds(600); - - #endregion - - #region · Dependency Properties · - - /// - /// Identifies the MessageText dependency property. - /// - public static readonly DependencyProperty MessageTextProperty = - DependencyProperty.Register("MessageText", typeof(String), typeof(HeaderNotification), - new FrameworkPropertyMetadata(String.Empty, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(OnMessageTextChanged))); - - #endregion - - #region · Dependency Properties Callback Handlers · - - private static void OnMessageTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d != null) - { - if (e.NewValue != null) - { - HeaderNotification element = d as HeaderNotification; - - element.ShowNotification(e.NewValue as String); - } - } - } - - #endregion - - #region · Fields · - - private readonly Object syncObject = new Object(); - private Queue messages; - private InteractiveMessage currentMessage; - private DispatcherTimer stateTimer; - - #endregion - - #region · Properties · - - public string MessageText - { - get { return (String)base.GetValue(HeaderNotification.MessageTextProperty); } - set { base.SetValue(HeaderNotification.MessageTextProperty, value); } - } - - #endregion - - #region · Constructors · - - public HeaderNotification() - { - InitializeComponent(); - - // set up - this.messages = new Queue(); - this.stateTimer = new DispatcherTimer(); - this.stateTimer.Interval = TRANSITION_TIMEOUT; - this.stateTimer.Tick += new EventHandler(StateTimer_Tick); - } - - #endregion - - #region · Methods · - - public void ShowNotification(string notification) - { - // basic checks - if (String.IsNullOrWhiteSpace(notification)) - { - return; - } - - // show or enque message - lock (syncObject) - { - // if no items are queued then show the message, else enque - var message = new InteractiveMessage() { Message = notification }; - - if (this.messages.Count == 0 && this.currentMessage == null) - { - ShowMessage(message); - } - else - { - messages.Enqueue(message); - } - } - } - - #endregion - - #region · Event Handlers · - - private void StateTimer_Tick(object sender, EventArgs e) - { - this.stateTimer.Stop(); - this.ProcessQueue(); - } - - private void CloseButton_Click(object sender, RoutedEventArgs e) - { - // basic check - if (stateTimer.IsEnabled) - { - return; - } - - // we stop the timers and start transitioning - VisualStateManager.GoToState(this, HIDDEN_STATENAME, true); - - // and transition - this.stateTimer.Start(); - } - - private void Header_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) - { - // basic check - if (this.stateTimer.IsEnabled) - { - return; - } - - // we stop the timers and start transitioning - VisualStateManager.GoToState(this, HIDDEN_STATENAME, true); - - // and transition - this.stateTimer.Start(); - } - - #endregion - - #region · Helpers · - - private void ProcessQueue() - { - lock (syncObject) - { - if (messages.Count == 0) - { - currentMessage = null; - } - else - { - ShowMessage(messages.Dequeue()); - } - } - } - - private void ShowMessage(InteractiveMessage message) - { - this.HeaderText.Text = message.Message; - VisualStateManager.GoToState(this, VISIBLE_STATENAME, true); - this.currentMessage = message; - } - - #endregion - - #region · Internal Class · - - class InteractiveMessage - { - #region · Properties · - - public string Message - { - get; - set; - } - - #endregion - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Interactivity/Behaviors/Watermark/PasswordBoxWatermarkBehavior.cs --- a/Chronosv2/source/Presentation/Controls/Interactivity/Behaviors/Watermark/PasswordBoxWatermarkBehavior.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using Chronos.Presentation.Controls.Adorner; -using Chronos.Presentation.Controls.Events; - -namespace Chronos.Presentation.Controls.Interactivity.Behaviors -{ - /// - /// http://blindmeis.wordpress.com/2010/07/16/wpf-watermark-textbox-behavior/ - /// - public sealed class PasswordBoxWatermarkBehavior - : System.Windows.Interactivity.Behavior - { - #region · Attached Properties · - - public static readonly DependencyProperty LabelProperty = - DependencyProperty.RegisterAttached("Label", typeof(string), typeof(PasswordBoxWatermarkBehavior)); - - public static readonly DependencyProperty LabelStyleProperty = - DependencyProperty.RegisterAttached("LabelStyle", typeof(Style), typeof(PasswordBoxWatermarkBehavior)); - - #endregion - - #region · Fields · - - private TextBlockAdorner adorner; - private WeakPropertyChangeNotifier notifier; - - #endregion - - #region · Properties · - - public string Label - { - get { return (string)base.GetValue(LabelProperty); } - set { base.SetValue(LabelProperty, value); } - } - - public Style LabelStyle - { - get { return (Style)base.GetValue(LabelStyleProperty); } - set { base.SetValue(LabelStyleProperty, value); } - } - - #endregion - - #region · Overriden Methods · - - protected override void OnAttached() - { - base.OnAttached(); - - this.AssociatedObject.Loaded += this.AssociatedObjectLoaded; - this.AssociatedObject.PasswordChanged += this.AssociatedObjectPasswordChanged; - } - - protected override void OnDetaching() - { - base.OnDetaching(); - this.AssociatedObject.Loaded -= this.AssociatedObjectLoaded; - this.AssociatedObject.PasswordChanged -= this.AssociatedObjectPasswordChanged; - - this.notifier = null; - } - - #endregion - - #region · Private Methods · - - private void AssociatedObjectPasswordChanged(object sender, System.Windows.RoutedEventArgs e) - { - this.UpdateAdorner(); - } - - private void AssociatedObjectLoaded(object sender, System.Windows.RoutedEventArgs e) - { - this.adorner = new TextBlockAdorner(this.AssociatedObject, this.Label, this.LabelStyle); - - this.UpdateAdorner(); - - //AddValueChanged for IsFocused in a weak manner - this.notifier = new WeakPropertyChangeNotifier(this.AssociatedObject, UIElement.IsFocusedProperty); - this.notifier.ValueChanged += new EventHandler(this.UpdateAdorner); - } - - private void UpdateAdorner(object sender, EventArgs e) - { - this.UpdateAdorner(); - } - - private void UpdateAdorner() - { - if (!String.IsNullOrEmpty(this.AssociatedObject.Password) || this.AssociatedObject.IsFocused) - { - // Hide the Watermark Label if the adorner layer is visible - this.AssociatedObject.TryRemoveAdorners(); - } - else - { - // Show the Watermark Label if the adorner layer is visible - this.AssociatedObject.TryAddAdorner(adorner); - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Interactivity/Behaviors/Watermark/TextBoxWatermarkBehavior.cs --- a/Chronosv2/source/Presentation/Controls/Interactivity/Behaviors/Watermark/TextBoxWatermarkBehavior.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using Chronos.Presentation.Controls.Adorner; -using Chronos.Presentation.Controls.Events; - -namespace Chronos.Presentation.Controls.Interactivity.Behaviors -{ - /// - /// http://blindmeis.wordpress.com/2010/07/16/wpf-watermark-textbox-behavior/ - /// - public sealed class TextBoxWatermarkBehavior - : System.Windows.Interactivity.Behavior - { - #region · Attached Properties · - - public static readonly DependencyProperty LabelProperty = - DependencyProperty.RegisterAttached("Label", typeof(string), typeof(TextBoxWatermarkBehavior)); - - public static readonly DependencyProperty LabelStyleProperty = - DependencyProperty.RegisterAttached("LabelStyle", typeof(Style), typeof(TextBoxWatermarkBehavior)); - - #endregion - - #region · Fields · - - private TextBlockAdorner adorner; - private WeakPropertyChangeNotifier notifier; - - #endregion - - #region · Properties · - - public string Label - { - get { return (string)base.GetValue(LabelProperty); } - set { base.SetValue(LabelProperty, value); } - } - - public Style LabelStyle - { - get { return (Style)base.GetValue(LabelStyleProperty); } - set { base.SetValue(LabelStyleProperty, value); } - } - - #endregion - - #region · Overriden Methods · - - protected override void OnAttached() - { - base.OnAttached(); - - this.AssociatedObject.Loaded += this.AssociatedObjectLoaded; - this.AssociatedObject.TextChanged += this.AssociatedObjectTextChanged; - } - - protected override void OnDetaching() - { - base.OnDetaching(); - - this.AssociatedObject.Loaded -= this.AssociatedObjectLoaded; - this.AssociatedObject.TextChanged -= this.AssociatedObjectTextChanged; - - this.notifier = null; - } - - #endregion - - #region · Private Methods · - - private void AssociatedObjectTextChanged(object sender, TextChangedEventArgs e) - { - this.UpdateAdorner(); - } - - private void AssociatedObjectLoaded(object sender, System.Windows.RoutedEventArgs e) - { - this.adorner = new TextBlockAdorner(this.AssociatedObject, this.Label, this.LabelStyle); - - this.UpdateAdorner(); - - //AddValueChanged for IsFocused in a weak manner - this.notifier = new WeakPropertyChangeNotifier(this.AssociatedObject, UIElement.IsFocusedProperty); - this.notifier.ValueChanged += new EventHandler(this.UpdateAdorner); - } - - private void UpdateAdorner(object sender, EventArgs e) - { - this.UpdateAdorner(); - } - - private void UpdateAdorner() - { - if (!String.IsNullOrEmpty(this.AssociatedObject.Text) || this.AssociatedObject.IsFocused) - { - // Hide the Watermark Label if the adorner layer is visible - this.AssociatedObject.TryRemoveAdorners(); - } - else - { - // Show the Watermark Label if the adorner layer is visible - this.AssociatedObject.TryAddAdorner(adorner); - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Presentation/Controls/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Markup; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Windows Presentation Foundation Controls")] -[assembly: AssemblyDescription("Windows Presentation Foundation control library")] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.None //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Controls")] -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Controls.Interactivity.Behaviors")] \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Properties/Resources.Designer.cs --- a/Chronosv2/source/Presentation/Controls/Properties/Resources.Designer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.21006.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Chronos.Presentation.Controls.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Chronos.Presentation.Controls.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Properties/Resources.resx --- a/Chronosv2/source/Presentation/Controls/Properties/Resources.resx Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Properties/Settings.Designer.cs --- a/Chronosv2/source/Presentation/Controls/Properties/Settings.Designer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.21006.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Chronos.Presentation.Controls.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/Properties/Settings.settings --- a/Chronosv2/source/Presentation/Controls/Properties/Settings.settings Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Controls/SplitButton.cs --- a/Chronosv2/source/Presentation/Controls/SplitButton.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -using System.ComponentModel; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Markup; - -namespace Chronos.Presentation.Controls -{ - /// - /// Implemetation of a Split Button - /// - [ContentProperty("Items")] - [DefaultProperty("Items")] - public partial class SplitButton - : Button - { - #region · Dependency Properties · - - // AddOwner Dependency properties - public static readonly DependencyProperty IsContextMenuOpenProperty = - DependencyProperty.Register( - "IsContextMenuOpen", - typeof(bool), - typeof(SplitButton), - new FrameworkPropertyMetadata(false, - new PropertyChangedCallback(OnIsContextMenuOpenChanged))); - - public static readonly DependencyProperty PlacementProperty = - ContextMenuService.PlacementProperty.AddOwner( - typeof(SplitButton), - new FrameworkPropertyMetadata(PlacementMode.Bottom, - new PropertyChangedCallback(OnPlacementChanged))); - - public static readonly DependencyProperty PlacementRectangleProperty = - ContextMenuService.PlacementRectangleProperty.AddOwner( - typeof(SplitButton), - new FrameworkPropertyMetadata(Rect.Empty, - new PropertyChangedCallback(OnPlacementRectangleChanged))); - - public static readonly DependencyProperty HorizontalOffsetProperty = - ContextMenuService.HorizontalOffsetProperty.AddOwner( - typeof(SplitButton), - new FrameworkPropertyMetadata(0.0, - new PropertyChangedCallback(OnHorizontalOffsetChanged))); - - public static readonly DependencyProperty VerticalOffsetProperty = - ContextMenuService.VerticalOffsetProperty.AddOwner( - typeof(SplitButton), - new FrameworkPropertyMetadata(0.0, - new PropertyChangedCallback(OnVerticalOffsetChanged))); - - #endregion - - #region · Dependency Properties Callbacks · - - private static void OnIsContextMenuOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - SplitButton s = (SplitButton)d; - s.EnsureContextMenuIsValid(); - - if (!s.ContextMenu.HasItems) - { - return; - } - - bool value = (bool)e.NewValue; - - if (value && !s.ContextMenu.IsOpen) - { - s.ContextMenu.IsOpen = true; - } - else if (!value && s.ContextMenu.IsOpen) - { - s.ContextMenu.IsOpen = false; - } - } - - /// - /// Placement Property changed callback, pass the value through to the buttons context menu - /// - private static void OnPlacementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - SplitButton s = d as SplitButton; - - if (s == null) - { - return; - } - - s.EnsureContextMenuIsValid(); - s.ContextMenu.Placement = (PlacementMode)e.NewValue; - } - - /// - /// PlacementRectangle Property changed callback, pass the value through to the buttons context menu - /// - private static void OnPlacementRectangleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - SplitButton s = d as SplitButton; - - if (s == null) - { - return; - } - - s.EnsureContextMenuIsValid(); - s.ContextMenu.PlacementRectangle = (Rect)e.NewValue; - } - - /// - /// HorizontalOffset Property changed callback, pass the value through to the buttons context menu - /// - private static void OnHorizontalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - SplitButton s = d as SplitButton; - - if (s == null) - { - return; - } - - s.EnsureContextMenuIsValid(); - s.ContextMenu.HorizontalOffset = (double)e.NewValue; - } - - /// - /// VerticalOffset Property changed callback, pass the value through to the buttons context menu - /// - private static void OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - SplitButton s = d as SplitButton; - if (s == null) - { - return; - } - - s.EnsureContextMenuIsValid(); - s.ContextMenu.VerticalOffset = (double)e.NewValue; - } - - #endregion - - #region · Static Constructor · - - /// - /// Static Constructor - /// - static SplitButton() - { - DefaultStyleKeyProperty.OverrideMetadata( - typeof(SplitButton), - new FrameworkPropertyMetadata(typeof(SplitButton))); - } - - #endregion - - #region · Properties · - - /// - /// The Split Button's Items property maps to the base classes ContextMenu.Items property - /// - public ItemCollection Items - { - get - { - this.EnsureContextMenuIsValid(); - - return this.ContextMenu.Items; - } - } - - /// - /// Gets or sets the IsContextMenuOpen property. - /// - public bool IsContextMenuOpen - { - get { return (bool)GetValue(IsContextMenuOpenProperty); } - set { SetValue(IsContextMenuOpenProperty, value); } - } - - /// - /// Placement of the Context menu - /// - public PlacementMode Placement - { - get { return (PlacementMode)GetValue(PlacementProperty); } - set { SetValue(PlacementProperty, value); } - } - - /// - /// PlacementRectangle of the Context menu - /// - public Rect PlacementRectangle - { - get { return (Rect)GetValue(PlacementRectangleProperty); } - set { SetValue(PlacementRectangleProperty, value); } - } - - /// - /// HorizontalOffset of the Context menu - /// - public double HorizontalOffset - { - get { return (double)GetValue(HorizontalOffsetProperty); } - set { SetValue(HorizontalOffsetProperty, value); } - } - - /// - /// VerticalOffset of the Context menu - /// - public double VerticalOffset - { - get { return (double)GetValue(VerticalOffsetProperty); } - set { SetValue(VerticalOffsetProperty, value); } - } - - #endregion - - #region · Constructors · - - public SplitButton() - : base() - { - } - - #endregion - - #region · Overriden Methods · - - /// - /// Handles the Base Buttons OnClick event - /// - protected override void OnClick() - { - this.OnDropdown(); - } - - #endregion - - #region · Private Methods · - - /// - /// Make sure the Context menu is not null - /// - private void EnsureContextMenuIsValid() - { - if (this.ContextMenu == null) - { - this.ContextMenu = new ContextMenu(); - this.ContextMenu.PlacementTarget = this; - this.ContextMenu.Placement = this.Placement; - - this.ContextMenu.Opened += ((sender, routedEventArgs) => IsContextMenuOpen = true); - this.ContextMenu.Closed += ((sender, routedEventArgs) => IsContextMenuOpen = false); - } - } - - private void OnDropdown() - { - this.EnsureContextMenuIsValid(); - - if (!this.ContextMenu.HasItems) - { - return; - } - - this.ContextMenu.IsOpen = !IsContextMenuOpen; // open it if closed, close it if open - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Chronos.Presentation.Core.csproj --- a/Chronosv2/source/Presentation/Core/Chronos.Presentation.Core.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {4C9AD768-6AB8-43B1-833A-C8CC520471B1} - Library - Properties - Chronos.Presentation.Core - Chronos.Presentation.Core - v4.0 - 512 - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Configuration/IWidgetConfigurationService.cs --- a/Chronosv2/source/Presentation/Core/Configuration/IWidgetConfigurationService.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using System.Configuration; -using Chronos.Presentation.Core.Widgets; - -namespace Chronos.Presentation.Core.Configuration -{ - public interface IWidgetConfigurationService - { - #region · Methods · - - IEnumerable GetWidgets(); - - T GetWidgetConfigurationSection(string sectionName) - where T: ConfigurationSection; - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Navigation/INavigationService.cs --- a/Chronosv2/source/Presentation/Core/Navigation/INavigationService.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - -using nRoute.Navigation; - -namespace Chronos.Presentation.Core.Navigation -{ - /// - /// Interface for view navigation services - /// - public interface INavigationService - { - #region · Methods · - - /// - /// Performs the navigation to the given target - /// - /// - void Navigate(string target); - - /// - /// Performs the navigation to the given target - /// - /// - void Navigate(NavigateMode mode, string target); - - /// - /// Performs the navigation to the given target - /// - /// - void Navigate(string target, params object[] args); - - /// - /// Performs the navigation to the given target - /// - /// - void Navigate(NavigateMode mode, string target, params object[] args); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Navigation/NavigatedInfo.cs --- a/Chronosv2/source/Presentation/Core/Navigation/NavigatedInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -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 nRoute.Navigation; - -namespace Chronos.Presentation.Core.Navigation -{ - public sealed class NavigatedInfo - { - #region · Fields · - - private NavigationRequest request; - private string title; - private Guid windowId; - - #endregion - - #region · Properties · - - public NavigationRequest Request - { - get { return this.request; } - } - - public string Title - { - get { return this.title; } - } - - public Guid Id - { - get { return this.windowId; } - } - - #endregion - - #region · Constructors · - - public NavigatedInfo(NavigationRequest request, string title, Guid windowId) - { - this.request = request; - this.title = title; - this.windowId = windowId; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Navigation/NavigatingCancelInfo.cs --- a/Chronosv2/source/Presentation/Core/Navigation/NavigatingCancelInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -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 nRoute.Navigation; - -namespace Chronos.Presentation.Core.Navigation -{ - public sealed class NavigatingCancelInfo - { - #region · Fields · - - private NavigationRequest request; - - #endregion - - #region · Properties · - - public NavigationRequest Request - { - get { return this.request; } - } - - public bool Cancel - { - get; - set; - } - - #endregion - - #region · Constructors · - - public NavigatingCancelInfo(NavigationRequest request) - { - this.request = request; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Navigation/NavigationFailedInfo.cs --- a/Chronosv2/source/Presentation/Core/Navigation/NavigationFailedInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -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 nRoute.Navigation; - -namespace Chronos.Presentation.Core.Navigation -{ - public sealed class NavigationFailedInfo - { - #region · Fields · - - private NavigationRequest request; - - #endregion - - #region · Properties · - - public NavigationRequest Request - { - get { return this.request; } - } - - #endregion - - #region · Constructors · - - public NavigationFailedInfo(NavigationRequest request) - { - this.request = request; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Navigation/NavigationParams.cs --- a/Chronosv2/source/Presentation/Core/Navigation/NavigationParams.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -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; -using System.Text; - -namespace Chronos.Presentation.Core.Navigation -{ - /// - /// Helper class that holds constant values related to navigation support - /// - public static class NavigationParams - { - #region · Constants · - - /// - /// Navigation initalization parameters key - /// - public static readonly string NavigationParamsKey = "NavigationParamsKey"; - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Presentation/Core/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -using System; -using System.Reflection; -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")] -[assembly: AssemblyDescription("Presentation Core")] \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Services/IShowMessageViewService.cs --- a/Chronosv2/source/Presentation/Core/Services/IShowMessageViewService.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -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 Chronos.Presentation.Core.Windows; - -namespace Chronos.Presentation.Core.Services -{ - /// - /// Interface for modal messages view services - /// - public interface IShowMessageViewService - { - #region · Properties · - - /// - /// Gets or sets the message caption - /// - string Caption - { - get; - set; - } - - /// - /// Gets or sets the message text - /// - string Text - { - get; - set; - } - - /// - /// Gets or sets the message buttons - /// - DialogButton ButtonSetup - { - get; - set; - } - - #endregion - - #region · Methods · - - /// - /// Shows a new message window - /// - /// - DialogResult ShowMessage(); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IBookmarkViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IBookmarkViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -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 nRoute.Components; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for ViewModels that supports bookmarking - /// - public interface IBookmarkViewModel - { - #region · Commands · - - /// - /// Gets the bookmark current command - /// - ActionCommand BookmarkCurrentCommand - { - get; - } - - /// - /// Gets the clear bookmarks command - /// - ActionCommand ClearBookmarksCommand - { - get; - } - - /// - /// Gets the organize bookmarks command - /// - ActionCommand OrganizeBookmarksCommand - { - get; - } - - /// - /// Gets the create shortcut command - /// - ActionCommand CreateShortcutCommand - { - get; - } - - #endregion - - #region · Properties · - - /// - /// Gets a value indicating if there are available bookmarks - /// - bool HasBookMarks - { - get; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IClosableViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IClosableViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -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 nRoute.Components; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for closable ViewModel implementations - /// - public interface IClosableViewModel - : IObservableObject - { - #region · Commands · - - /// - /// Gets the close command - /// - ActionCommand CloseCommand - { - get; - } - - #endregion - - #region · Properties · - - /// - /// Gets the viewmodel identifier - /// - Guid Id - { - get; - } - - /// - /// Gets or sets the viewmodel title - /// - string Title - { - get; - set; - } - - #endregion - - #region · Methods · - - /// - /// Closes the viewmodel - /// - void Close(); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/ICollectionItemChanged.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/ICollectionItemChanged.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -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; -using System.Text; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for collections that supports item change notifications - /// - /// - /// - public interface ICollectionItemChanged - { - #region · Events · - - /// - /// Occurs when a property of an item collection has been changed - /// - event EventHandler> ItemChanged; - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IEntityViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IEntityViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -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.ComponentModel; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for entity viewmodel implementations - /// - /// - public interface IEntityViewModel : - IDataErrorInfo where TEntity : class, new() - { - #region · Properties · - - /// - /// Gets a value indicating wheter this instance is valid - /// - bool IsValid - { - get; - } - - /// - /// Gets a value indicating wheter this instance has changes - /// - bool HasChanges - { - get; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/INavigationViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/INavigationViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -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 nRoute.Components; -using nRoute.Navigation; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for navigation viewmodel implementations - /// - public interface INavigationViewModel - : IClosableViewModel, ISupportNavigationLifecycle, ISupportNavigationState - { - #region · Commands · - - /// - /// Gets the open new window command - /// - ActionCommand NewWindowCommand - { - get; - } - - /// - /// Gets the restore window command. - /// - /// The restore window command. - ActionCommand RestoreCommand - { - get; - } - - #endregion - - #region · Properties · - - /// - /// Gets the navigation route - /// - string NavigationRoute - { - get; - } - - /// - /// Gets a value indicating wheter the viewmodel has available relations - /// - bool HasRelations - { - get; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IObservableObject.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IObservableObject.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -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.ComponentModel; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for observable object implementations - /// - public interface IObservableObject - : INotifyPropertyChanged - { - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IShortcutViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IShortcutViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -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 nRoute.Components; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for shortcut viewmodel implementations - /// - public interface IShortcutViewModel - : IClosableViewModel - { - #region · Commands · - - /// - /// Gets the open command - /// - ActionCommand OpenCommand - { - get; - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets the shortcut target - /// - string Target - { - get; - set; - } - - /// - /// Gets or sets the shortcut navigation parameters - /// - string Parameters - { - get; - set; - } - - /// - /// Gets or sets the shortcut icon style - /// - string IconStyle - { - get; - set; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IWidgetViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IWidgetViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -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.Presentation.Core.ViewModel -{ - /// - /// Interface for widget viewmodel implementations - /// - public interface IWidgetViewModel - : IClosableViewModel - { - #region · Properties · - - /// - /// Gets the widget description - /// - string Description - { - get; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IWindowViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IWindowViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -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 Chronos.Presentation.Core.Windows; -using nRoute.Components; - -namespace Chronos.Presentation.Core.ViewModel -{ - public interface IWindowViewModel - : INavigationViewModel - { - #region · Commands · - - /// - /// Gets the inquiry data command - /// - ActionCommand InquiryCommand - { - get; - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets the - /// - ViewModeType ViewMode - { - get; - set; - } - - /// - /// Gets or sets the status message text - /// - string StatusMessage - { - get; - set; - } - - /// - /// Gets or sets the notification message text - /// - string NotificationMessage - { - get; - set; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/IWorkspaceViewModel.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/IWorkspaceViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -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 Chronos.Presentation.Core.Windows; -using nRoute.Components; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Interface for workspace viewmodel implementations - /// - /// - public interface IWorkspaceViewModel - : IWindowViewModel, IEntityViewModel, INavigationViewModel, IBookmarkViewModel where TEntity : class, new() - { - #region · Events · - - /// - /// Occurs when the view mode has changed - /// - event EventHandler ViewModeChanged; - - #endregion - - #region · Commands · - - /// - /// Gets the add new command - /// - ActionCommand AddNewCommand - { - get; - } - - /// - /// Gets the delete command - /// - ActionCommand DeleteCommand - { - get; - } - - /// - /// Gets the discard changes command - /// - ActionCommand DiscardCommand - { - get; - } - - /// - /// Gets the edit command - /// - ActionCommand EditCommand - { - get; - } - - /// - /// Gets the save changes command - /// - ActionCommand SaveCommand - { - get; - } - - /// - /// Gets the print command - /// - ActionCommand PrintCommand - { - get; - } - - /// - /// Gets the print preview command - /// - ActionCommand PrintPreviewCommand - { - get; - } - - /// - /// Gets the show form help command - /// - ActionCommand ShowFormHelpCommand - { - get; - } - - /// - /// Gets the show zoom window command - /// - ActionCommand ShowZoomWindowCommand - { - get; - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets a value indicating whether the zoom window is shown - /// - bool ShowZoomWindow - { - get; - set; - } - - /// - /// Gets or sets the zoom level - /// - double ZoomLevel - { - get; - set; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/ViewModel/ItemChangedEventArgs.cs --- a/Chronosv2/source/Presentation/Core/ViewModel/ItemChangedEventArgs.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -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; -using System.Text; - -namespace Chronos.Presentation.Core.ViewModel -{ - /// - /// Event argument for the currentchanged eventhandler - /// - /// - /// - public sealed class ItemChangedEventArgs - : EventArgs - { - #region · Properties · - - /// - /// Gets or sets the current item. - /// - /// The current item. - public T Item - { - get; - private set; - } - - /// - /// Gets or sets the current viewmodel. - /// - /// The current viewmodel. - public V ItemViewModel - { - get; - private set; - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - /// The current item. - /// The current viewmodel. - public ItemChangedEventArgs(T item, V itemViewModel) - : base() - { - this.Item = item; - this.ItemViewModel = itemViewModel; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/VirtualDesktops/IVirtualDesktop.cs --- a/Chronosv2/source/Presentation/Core/VirtualDesktops/IVirtualDesktop.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -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.ObjectModel; -using System.Windows; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.Windows; - -namespace Chronos.Presentation.Core.VirtualDesktops -{ - /// - /// Interface for virtual desktop implementations - /// - public interface IVirtualDesktop - { - #region · Properties · - - /// - /// Gets the desktop identifier - /// - Guid Id - { - get; - } - - /// - /// Gets the list of active Windows - /// - ReadOnlyObservableCollection ActiveWindows - { - get; - } - - #endregion - - #region · Methods · - - /// - /// Activates the desktop instance - /// - void Activate(); - - /// - /// Deactivates the desktop instance - /// - void Deactivate(); - - /// - /// Shows the desktop - /// - void ShowDesktop(); - - /// - /// Saves the desktop to disk - /// - void Save(); - - /// - /// Creates a new shortcut with the given title and target - /// - /// - /// - void CreateShortcut(string title, string target) where T : IShortcutViewModel, new(); - - /// - /// Creates a new shortcut with the given title, target and position - /// - /// - /// - void CreateShortcut(string title, string target, Point position) where T : IShortcutViewModel, new(); - - /// - /// Shows a new instance of the given element type - /// - void Show() where T: IDesktopElement, new(); - - /// - /// Shows a new instance of the given element type - /// - void Show(Point position) where T : IDesktopElement, new(); - - /// - /// Shows the given instance - /// - /// - void Show(IDesktopElement instance); - - /// - /// Shows the given instance - /// - /// - void Show(IDesktopElement instance, Point position); - - /// - /// Shows the given instance - /// - /// A instance - void Show(IWindow window); - - /// - /// Closes the element with given identifier - /// - /// - void Close(Guid id); - - /// - /// Closes all the elements - /// - /// The identifier. - void CloseAll(); - - /// - /// Restores the window with the given identifier - /// - /// The identifier. - void Restore(Guid id); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/VirtualDesktops/IVirtualDesktopManager.cs --- a/Chronosv2/source/Presentation/Core/VirtualDesktops/IVirtualDesktopManager.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -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.ObjectModel; -using System.Windows; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.Windows; - -namespace Chronos.Presentation.Core.VirtualDesktops -{ - /// - /// Interface for virtual desktop manager implementations - /// - public interface IVirtualDesktopManager - { - #region · Properties · - - /// - /// Gets the active desktop windows. - /// - /// The active desktop windows. - ReadOnlyObservableCollection ActiveDesktopWindows - { - get; - } - - /// - /// Gets a value indicating whether there is an active virtual desktop. - /// - /// - /// true if there are an active virtual desktop; otherwise, false. - /// - bool HasDesktopActive - { - get; - } - - #endregion - - #region · Methods · - - /// - /// Activates the default desktop - /// - void ActivateDefaultDesktop(); - - /// - /// Switches the active desktop - /// - void SwitchDesktop(); - - /// - /// Shows the desktop - /// - void ShowDesktop(); - - /// - /// Saves all the desktops to disk - /// - void SaveAllDesktops(); - - /// - /// Saves the active desktop to disk. - /// - void SaveCurrentDesktop(); - - /// - /// Creates a new shortcut with the given title and target - /// - /// - /// - void CreateShortcut(string title, string target) where T : IShortcutViewModel, new(); - - /// - /// Creates a new shortcut with the given title, target and position - /// - /// - /// - void CreateShortcut(string title, string target, Point position) where T : IShortcutViewModel, new(); - - /// - /// Shows a new instance of the specified type in the active desktop. - /// - void Show() where T : IDesktopElement, new(); - - /// - /// Shows a new instance of the specified type in the active desktop. - /// - /// The position. - void Show(Point position) where T : IDesktopElement, new(); - - /// - /// Shows the given - /// - /// - void Show(IDesktopElement instance); - - /// - /// Shows the given - /// - /// - void Show(IDesktopElement instance, Point position); - - /// - /// Shows the given as a normal Window - /// - /// - void Show(IWindow element); - - /// - /// Shows the given instance - /// - /// - DialogResult ShowDialog(IModalVindow element); - - /// - /// Closes the object with the given identifier - /// - /// The element identifier. - void Close(Guid id); - - /// - /// Closes all the elements - /// - void CloseAll(); - - /// - /// Closes the current dialog - /// - void CloseDialog(); - - /// - /// Restores the window with the given identifier - /// - /// The element identifier. - void Restore(Guid id); - - /// - /// Registers the given desktop instance - /// - /// - void RegisterDesktop(DependencyObject d); - - /// - /// Registers the given modal container instance - /// - /// - void RegisterModalContainer(DependencyObject d); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Widgets/IWidget.cs --- a/Chronosv2/source/Presentation/Core/Widgets/IWidget.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -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.Windows; - -namespace Chronos.Presentation.Core.Widgets -{ - /// - /// Interface for widget definition implementations - /// - public interface IWidget - { - #region · Properties · - - /// - /// Gets the widget title - /// - string Title - { - get; - } - - /// - /// Gets the widget description - /// - string Description - { - get; - } - - /// - /// Gets the widget group - /// - string Group - { - get; - } - - /// - /// Gets the widget icon style - /// - string IconStyle - { - get; - } - - #endregion - - #region · Methods · - - /// - /// Creates the widget view - /// - /// - FrameworkElement CreateView(); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/DialogButton.cs --- a/Chronosv2/source/Presentation/Core/Windows/DialogButton.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -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; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// Specifies the buttons that are displayed on a message window. - /// - [Serializable] - public enum DialogButton - { - /// - /// The message box displays an OK button. - /// - Ok = 0, - /// - /// The message box displays OK and Cancel buttons. - /// - OkCancel = 1, - /// - /// The message box displays Yes and No buttons. - /// - YesNo = 4, - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/DialogResult.cs --- a/Chronosv2/source/Presentation/Core/Windows/DialogResult.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -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; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// Specifies which dialog box button that a user clicks. - /// - [Serializable] - public enum DialogResult - { - /// - /// The message box returns no result. - /// - None = 0, - /// - /// The result value of the message box is OK. - /// - Ok = 1, - /// - /// The result value of the message box is Cancel. - /// - Cancel = 2, - /// - /// The result value of the message box is Yes. - /// - Yes = 6, - /// - /// The result value of the message box is No. - /// - No = 7, - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/IActiveAware.cs --- a/Chronosv2/source/Presentation/Core/Windows/IActiveAware.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -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.Presentation.Core.Windows -{ - /// - /// Allows an object to provide information about whether it is active or not. - /// - public interface IActiveAware - { - #region · Properties · - - /// - /// Gets or sets a value indicating whether the element is active. - /// - /// - /// true if this instance is active; otherwise, false. - /// - bool IsActive - { - get; - } - - #endregion - - #region · Methods · - - /// - /// Activates the element - /// - void Activate(); - - /// - /// Deactivates the element - /// - void Deactivate(); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/IDesktopElement.cs --- a/Chronosv2/source/Presentation/Core/Windows/IDesktopElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -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.Controls; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// Interface for desktop element implementations - /// - public interface IDesktopElement - { - #region · Properties · - - /// - /// Gets the element identifier - /// - Guid Id - { - get; - } - - /// - /// Gets the element parent - /// - Panel Parent - { - get; - set; - } - - /// - /// Gets or sets a value indicating whether the element can be dragged - /// - bool CanDrag - { - get; - set; - } - - /// - /// Gets or sets a value indicating whether the element can be resized - /// - bool CanResize - { - get; - set; - } - - /// - /// Gets or sets the element - /// - StartupPosition StartupLocation - { - get; - set; - } - - #endregion - - #region · Methods · - - /// - /// Activates the element - /// - void Activate(); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/IModalVindow.cs --- a/Chronosv2/source/Presentation/Core/Windows/IModalVindow.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -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.ComponentModel; -using System.Windows.Input; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// Interface for modal window implementations - /// - public interface IModalVindow - : IWindow - { - #region · Properties · - - /// - /// Gets or sets the - /// - DialogResult DialogResult - { - get; - } - - #endregion - - #region · Methods · - - /// - /// Shows the window as a modal dialog - /// - /// - DialogResult ShowDialog(); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/IWindow.cs --- a/Chronosv2/source/Presentation/Core/Windows/IWindow.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* -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.ComponentModel; -using System.Windows; -using System.Windows.Input; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// - /// - public interface IWindow - : IDesktopElement - { - #region · Events · - - /// - /// Occurs when the window state has changed - /// - event EventHandler WindowStateChanged; - - /// - /// Occurs when the window is about to be closed - /// - event CancelEventHandler Closing; - - /// - /// Occurs when the window is closed - /// - event EventHandler Closed; - - #endregion - - #region · Commands · - - /// - /// Gets the close window command - /// - ICommand CloseCommand - { - get; - } - - /// - /// Gets the maximize window command - /// - ICommand MaximizeCommand - { - get; - } - - /// - /// Gets the minimize window command - /// - ICommand MinimizeCommand - { - get; - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets the window title - /// - string Title - { - get; - set; - } - - /// - /// Gets or sets a value that indicates whether the maximize button is shown - /// - bool ShowMaximizeButton - { - get; - set; - } - - /// - /// Gets or sets a value that indicates whether the minimize button is shown - /// - bool ShowMinimizeButton - { - get; - set; - } - - /// - /// Gets or sets a value that indicates whether the close button is shown - /// - bool ShowCloseButton - { - get; - set; - } - - /// - /// Gets or sets the current - /// - ViewModeType ViewMode - { - get; - set; - } - - /// - /// Gets or sets the - /// - WindowState WindowState - { - get; - set; - } - - #endregion - - #region · Methods · - - /// - /// Shows the window - /// - void Show(); - - /// - /// Closes the window - /// - void Close(); - - /// - /// Hides the window - /// - void Hide(); - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/StartupPosition.cs --- a/Chronosv2/source/Presentation/Core/Windows/StartupPosition.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -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; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// Specifies the position that a - /// will be shown in when it is first opened. - /// - [Serializable] - public enum StartupPosition - { - /// - /// The startup location of a - /// is the center of the parent control that owns it. - /// - CenterParent, - /// - /// The startup location of a - /// is set from code, or defers to the default Windows location. - /// - Manual, - /// - /// The startup location of a - /// is the center of the screen that contains the mouse cursor. - /// - WindowsDefaultLocation - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/ViewModeType.cs --- a/Chronosv2/source/Presentation/Core/Windows/ViewModeType.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -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; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// Used by the ViewModel to set the state of all - /// the data of a particular views data to the correct state - /// - [Serializable] - public enum ViewModeType - { - /// - /// Default mode - /// - Default, - /// - /// Adding new - /// - Add, - /// - /// Edit mode - /// - Edit, - /// - /// View only mode - /// - ViewOnly, - /// - /// Busy mode - /// - Busy - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Core/Windows/WindowStartupPosition.cs --- a/Chronosv2/source/Presentation/Core/Windows/WindowStartupPosition.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -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; - -namespace Chronos.Presentation.Core.Windows -{ - /// - /// Specifies the position that a Window will be shown in when it is first opened. - /// Used by the property. - /// - [Serializable] - public enum WindowStartupPosition - { - /// - /// The startup location of a - /// is the center of the parent control that owns it. - /// - CenterParent, - /// - /// The startup location of a - /// is set from code, or defers to the default Windows location. - /// - Manual, - /// - /// The startup location of a - /// is the center of the screen that contains the mouse cursor. - /// - WindowsDefaultLocation - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/Chronos.Presentation.ViewModel.csproj --- a/Chronosv2/source/Presentation/ViewModel/Chronos.Presentation.ViewModel.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {AAB3929F-049B-469A-AAEB-BBABEE03FE0A} - Library - Properties - Chronos.Presentation.ViewModel - Chronos.Presentation.ViewModel - v4.0 - 512 - - - - - - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\..\Lib\NLog\NLog.dll - - - ..\..\..\Lib\nRoute\nRoute.Framework.dll - - - - - - - - - - - - - - Properties\SolutionInfo.cs - - - - - - - - - - - - - - - - - - - - - - {AA911078-3A2A-41B1-B779-3C8B55E1B8E3} - Chronos.Extensions - - - {4C9AD768-6AB8-43B1-833A-C8CC520471B1} - Chronos.Presentation.Core - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/ClosableViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/ClosableViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.VirtualDesktops; -using NLog; -using nRoute.Components; -using nRoute.Components.Messaging; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Base class for closeable view models - /// - public abstract class ClosableViewModel - : ViewModelBase, IClosableViewModel - { - #region · NotifyPropertyChanged Cached Instances · - - private static readonly PropertyChangedEventArgs IdChangedArgs = CreateArgs(x => x.Id); - private static readonly PropertyChangedEventArgs TitleChangedArgs = CreateArgs(x => x.Title); - - #endregion - - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Fields · - - private Guid id; - private ActionCommand closeCommand; - private string title; - private List observers; - - #endregion - - #region · Commands · - - /// - /// Gets the Close Command - /// - public ActionCommand CloseCommand - { - get - { - if (this.closeCommand == null) - { - this.closeCommand = new ActionCommand - ( - () => Close(), - () => CanClose() - ); - } - - return this.closeCommand; - } - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets the unique identifier. - /// - /// The id. - public Guid Id - { - get { return this.id; } - set - { - if (this.id != value) - { - this.id = value; - this.NotifyPropertyChanged(IdChangedArgs); - } - } - } - - /// - /// Returns the user-friendly name of this object. - /// Child classes can set this property to a new value, - /// or override it to determine the value on-demand. - /// - public virtual string Title - { - get { return this.title; } - set - { - if (this.title != value) - { - this.title = value; - this.NotifyPropertyChanged(TitleChangedArgs); - } - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected ClosableViewModel() - : base() - { - this.Id = Guid.NewGuid(); - this.observers = new List(); - } - - #endregion - - #region · Messaging Methods · - - protected void Subscribe(Action payloadHandler) - where T: class - { - this.Subscribe(payloadHandler, ThreadOption.BackgroundThread); - } - - protected void Subscribe(Action payloadHandler, ThreadOption threadOption) - where T: class - { - ChannelObserver observer = new ChannelObserver((l) => payloadHandler(l)); - - observer.Subscribe(threadOption); - - this.observers.Add(observer); - } - - protected void Publish(T message) - where T: class - { - Channel.Publish(message, true); - } - - protected void Publish(T message, bool async) - where T: class - { - Channel.Publish(message, async); - } - - #endregion - - #region · Command Actions · - - /// - /// Determines whether the view related to this view model can be closed. - /// - /// - /// true if the related view can be closed; otherwise, false. - /// - public virtual bool CanClose() - { - return true; - } - - /// - /// Called when the related view is being closed. - /// - public virtual void Close() - { - if (this.observers != null) - { - this.observers.ForEach(o => o.Unsubscribe()); - this.observers.Clear(); - this.observers = null; - } - - this.GetService().Close(this.Id); - - this.id = Guid.Empty; - this.title = null; - this.closeCommand = null; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/CollectionTransforms.cs --- a/Chronosv2/source/Presentation/ViewModel/CollectionTransforms.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.ComponentModel; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// ObservableCollection transform extension methods - /// - public static class CollectionTransforms - { - #region · Methods · - - /// - /// Transforms the give collection to a collection - /// - /// - /// - /// - /// - /// - /// - /// - public static CollectionViewModel Transform( - this ObservableCollection sourceCollection, - Func setup, - Func coerce, - Action teardown = null) where TSource: INotifyPropertyChanged where TTarget: INotifyPropertyChanged - { - return new CollectionViewModel(sourceCollection, setup, coerce, teardown); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/CollectionViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/CollectionViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,570 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Linq; -using Chronos.Extensions; -using Chronos.Presentation.Core.ViewModel; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// ViewModel Collection - /// - /// The type of the source. - /// The type of the target. - public class CollectionViewModel - : IList, ICollection, IEnumerable, ICollectionItemChanged, IList, ICollection, IEnumerable, INotifyCollectionChanged, IDisposable - where TSource: INotifyPropertyChanged - where TTarget: INotifyPropertyChanged - { - #region · Events · - - public event NotifyCollectionChangedEventHandler CollectionChanged; - public event EventHandler> ItemChanged; - - #endregion - - #region · Fields · - - private bool disposed; - private ObservableCollection sourceCollection; - private ObservableCollection items; - private readonly Func setup; - private readonly Func coerce; - private readonly Action teardown; - - #endregion - - #region · Protected Properties · - - /// - /// Gets the list of target items - /// - protected ObservableCollection Items - { - get - { - if (this.items == null) - { - this.items = new ObservableCollection(); - } - - return this.items; - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - /// The source collection. - /// The setup function. - /// The coerce function. - /// The teardown function. - public CollectionViewModel( - ObservableCollection sourceCollection, Func setup, Func coerce, Action teardown = null) - { - this.setup = setup; - this.coerce = coerce; - this.teardown = teardown; - this.sourceCollection = sourceCollection; - - List targetItems = new List(sourceCollection.Select(setup)); - - targetItems.ForEach(i => i.PropertyChanged += (x, y) => this.NotifyItemChanged(this.coerce(i), i)); - - this.Items.AddRange(targetItems); - - var notifyCollectionChanged = this.Items as INotifyCollectionChanged; - - if (notifyCollectionChanged != null) - { - notifyCollectionChanged.CollectionChanged += this.OnSourceCollectionChanged; - } - } - - #endregion - - #region · IDisposable Members · - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - this.Dispose(true); - } - - /// - /// Releases unmanaged and - optionally - managed resources - /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected virtual void Dispose(bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - // Cleanup managed resources - this.Clear(); - - var notifyCollectionChanged = this.sourceCollection as INotifyCollectionChanged; - - if (notifyCollectionChanged != null) - { - notifyCollectionChanged.CollectionChanged -= this.OnSourceCollectionChanged; - } - } - - // Cleanup unmanaged resources - - // Mark the object as disposed - this.disposed = true; - } - } - - #endregion - - #region · IList Members · - - /// - /// Gets or sets the at the specified index. - /// - /// - public TTarget this[int index] - { - get { return this.Items[index]; } - set { this.Items[index] = value; } - } - - /// - /// Gets the number of elements contained in the . - /// - /// - /// - /// The number of elements contained in the . - /// - public int Count - { - get { return this.Items.Count; } - } - - /// - /// Gets a value indicating whether the is read-only. - /// - /// - /// true if the is read-only; otherwise, false. - /// - public bool IsReadOnly - { - get { return false; } - } - - /// - /// Determines whether the contains a specific value. - /// - /// The object to locate in the . - /// - /// true if is found in the ; otherwise, false. - /// - public bool Contains(TTarget item) - { - return this.Items.Contains(item); - } - - /// - /// Adds an item to the . - /// - /// The object to add to the . - /// - /// The is read-only. - /// - public void Add(TTarget item) - { - TSource source = this.coerce(item); - - item.PropertyChanged += (x, y) => this.NotifyItemChanged(source, item); - - this.sourceCollection.Add(source); - this.Items.Add(item); - } - - /// - /// Inserts an item to the at the specified index. - /// - /// The zero-based index at which should be inserted. - /// The object to insert into the . - /// - /// is not a valid index in the . - /// - /// - /// The is read-only. - /// - public void Insert(int index, TTarget item) - { - TSource source = this.coerce(item); - - item.PropertyChanged += (x, y) => this.NotifyItemChanged(source, item); - - this.sourceCollection.Insert(index, source); - this.Items.Insert(index, item); - } - - /// - /// Determines the index of a specific item in the . - /// - /// The object to locate in the . - /// - /// The index of if found in the list; otherwise, -1. - /// - public int IndexOf(TTarget item) - { - return this.Items.IndexOf(item); - } - - /// - /// Removes the first occurrence of a specific object from the . - /// - /// The object to remove from the . - /// - /// true if was successfully removed from the ; otherwise, false. This method also returns false if is not found in the original . - /// - /// - /// The is read-only. - /// - public bool Remove(TTarget item) - { - if (this.teardown != null) - { - this.teardown(item); - } - - item.PropertyChanged -= (x, y) => this.NotifyItemChanged(this.coerce(item), item); - - this.Items.Remove(item); - this.sourceCollection.Remove(this.coerce(item)); - - return true; - } - - /// - /// Removes the item at the specified index. - /// - /// The zero-based index of the item to remove. - /// - /// is not a valid index in the . - /// - /// - /// The is read-only. - /// - public void RemoveAt(int index) - { - if (this.teardown != null) - { - this.teardown(this.Items[index]); - } - - TTarget target = this[index]; - - target.PropertyChanged -= (x, y) => this.NotifyItemChanged(this.coerce(target), target); - - this.Items.RemoveAt(index); - this.sourceCollection.RemoveAt(index); - } - - /// - /// Removes all items from the . - /// - /// - /// The is read-only. - /// - public void Clear() - { - if (this.teardown != null) - { - this.Items.ForEach(target => this.teardown(target)); - } - - this.Items.ForEach(target => target.PropertyChanged -= (x, y) => this.NotifyItemChanged(this.coerce(target), target)); - - this.sourceCollection.Clear(); - this.Items.Clear(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// A that can be used to iterate through the collection. - /// - public IEnumerator GetEnumerator() - { - return this.Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - IEnumerator IEnumerable.GetEnumerator() - { - return this.Items.GetEnumerator(); - } - - /// - /// Copies the elements of the to an , starting at a particular index. - /// - /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. - /// The zero-based index in at which copying begins. - /// - /// is null. - /// - /// - /// is less than 0. - /// - /// - /// is multidimensional. - /// -or- - /// is equal to or greater than the length of . - /// -or- - /// The number of elements in the source is greater than the available space from to the end of the destination . - /// -or- - /// Type cannot be cast automatically to the type of the destination . - /// - void ICollection.CopyTo(TTarget[] array, int arrayIndex) - { - throw new NotImplementedException(); - } - - #endregion - - #region · IList Members · - - /// - /// Adds an item to the . - /// - /// The to add to the . - /// - /// The position into which the new element was inserted. - /// - /// - /// The is read-only. - /// -or- - /// The has a fixed size. - /// - int IList.Add(object value) - { - this.Add((TTarget)value); - - return this.IndexOf((TTarget)value); - } - - /// - /// Removes all items from the . - /// - /// - /// The is read-only. - /// - void IList.Clear() - { - this.Clear(); - } - - /// - /// Determines whether the contains a specific value. - /// - /// The to locate in the . - /// - /// true if the is found in the ; otherwise, false. - /// - bool IList.Contains(object value) - { - return this.Contains((TTarget)value); - } - - /// - /// Determines the index of a specific item in the . - /// - /// The to locate in the . - /// - /// The index of if found in the list; otherwise, -1. - /// - int IList.IndexOf(object value) - { - return this.IndexOf((TTarget)value); - } - - /// - /// Inserts an item to the at the specified index. - /// - /// The zero-based index at which should be inserted. - /// The to insert into the . - /// - /// is not a valid index in the . - /// - /// - /// The is read-only. - /// -or- - /// The has a fixed size. - /// - /// - /// is null reference in the . - /// - void IList.Insert(int index, object value) - { - this.Insert(index, (TTarget)value); - } - - /// - /// Gets a value indicating whether the has a fixed size. - /// - /// - /// true if the has a fixed size; otherwise, false. - /// - bool IList.IsFixedSize - { - get { return false; } - } - - /// - /// Gets a value indicating whether the is read-only. - /// - /// - /// true if the is read-only; otherwise, false. - /// - bool IList.IsReadOnly - { - get { return false; } - } - - /// - /// Removes the first occurrence of a specific object from the . - /// - /// The to remove from the . - /// - /// The is read-only. - /// -or- - /// The has a fixed size. - /// - void IList.Remove(object value) - { - this.Remove((TTarget)value); - } - - /// - /// Removes the item at the specified index. - /// - /// The zero-based index of the item to remove. - /// - /// is not a valid index in the . - /// - /// - /// The is read-only. - /// - void IList.RemoveAt(int index) - { - this.RemoveAt(index); - } - - /// - /// Gets or sets the at the specified index. - /// - /// - object IList.this[int index] - { - get { return this[index]; } - set { this[index] = (TTarget)value; } - } - - /// - /// Copies the elements of the to an , starting at a particular index. - /// - /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. - /// The zero-based index in at which copying begins. - /// - /// is null. - /// - /// - /// is less than zero. - /// - /// - /// is multidimensional. - /// -or- - /// is equal to or greater than the length of . - /// -or- - /// The number of elements in the source is greater than the available space from to the end of the destination . - /// - /// - /// The type of the source cannot be cast automatically to the type of the destination . - /// - void ICollection.CopyTo(Array array, int index) - { - throw new NotImplementedException(); - } - - /// - /// Gets the number of elements contained in the . - /// - /// - /// - /// The number of elements contained in the . - /// - int ICollection.Count - { - get { return this.Count; } - } - - /// - /// Gets a value indicating whether access to the is synchronized (thread safe). - /// - /// - /// true if access to the is synchronized (thread safe); otherwise, false. - /// - bool ICollection.IsSynchronized - { - get { return false; } - } - - /// - /// Gets an object that can be used to synchronize access to the . - /// - /// - /// - /// An object that can be used to synchronize access to the . - /// - object ICollection.SyncRoot - { - get { return null; } - } - - #endregion - - #region · Change Tracking Methods · - - private void NotifyItemChanged(TSource source, TTarget target) - { - if (this.ItemChanged != null) - { - this.ItemChanged(this, new ItemChangedEventArgs(source, target)); - } - } - - private void OnSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) - { - if (this.CollectionChanged != null) - { - this.CollectionChanged(this, e); - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/EntityViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/EntityViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -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.ComponentModel; -using Chronos.Presentation.Core.ViewModel; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Base class for entity viewmodel implementations - /// - /// - public abstract class EntityViewModel - : ViewModelBase, IEntityViewModel where TEntity : class, IDataErrorInfo, new() - { - #region · Fields · - - private TEntity entity; - - #endregion - - #region · IEntityViewModel Properties · - - /// - /// Gets the entity model instance - /// - public TEntity Entity - { - get { return this.entity; } - } - - /// - /// Gets value indicating whether this instance is valid - /// - public virtual bool IsValid - { - get { return String.IsNullOrEmpty(this.Error); } - } - - /// - /// Gets value indicating whether this instance has changes - /// - public virtual bool HasChanges - { - get { return false; } - } - - /// - /// Gets an error message indicating what is wrong with this object. - /// - /// - /// An error message indicating what is wrong with this object. The default is - /// an empty string (""). - /// - public virtual string Error - { - get - { - if (this.Entity != null) - { - return this.Entity.Error; - } - - return null; - } - } - - /// - /// Gets the error message for the property with the given name. - /// - /// The name of the property whose error message to get. - /// The error message for the property. The default is an empty string (""). - public virtual string this[string columnName] - { - get - { - if (this.Entity != null) - { - return this.Entity[columnName]; - } - - return null; - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class - /// - protected EntityViewModel() - : base() - { - this.entity = new TEntity(); - } - - /// - /// Initializes a new instance of the class - /// with the given entity model - /// - /// - protected EntityViewModel(TEntity entity) - : this() - { - this.entity = entity; - } - - #endregion - } -} - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/ExternalShortcutViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/ExternalShortcutViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -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.Diagnostics; -using System.Threading.Tasks; -using Chronos.Presentation.Core.Services; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Windows; -using NLog; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// External shortcut viewmodel class - /// - public sealed class ExternalShortcutViewModel - : ShortcutViewModel - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Consts · - - private static readonly string DefaultIconStyle = "ArrowRight01IconStyle"; - - #endregion - - #region · Properties · - - /// - /// Gets or sets the shortcut icon style. - /// - /// The icon style. - public override string IconStyle - { - get - { - if (String.IsNullOrWhiteSpace(base.IconStyle)) - { - return DefaultIconStyle; - } - - return base.IconStyle; - } - set { base.IconStyle = value; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public ExternalShortcutViewModel() - : base() - { - } - - #endregion - - #region · Command Execution · - - /// - /// Called when the is executed. - /// - protected override void OnOpen() - { - Task task = Task.Factory.StartNew( - () => - { - Logger.Debug("Ejecución de un acceso directo ({0})", this.Target); - - using (Process process = new Process()) - { - process.StartInfo.FileName = this.Target.ToString(); - process.StartInfo.UseShellExecute = true; - process.StartInfo.LoadUserProfile = true; - process.Start(); - } - }) - .ContinueWith((t) => - { - Logger.ErrorException("Error durante la ejecución de un acceso directo ({0})", t.Exception.InnerException); - - IShowMessageViewService showMessageService = this.GetViewService(); - - showMessageService.ButtonSetup = DialogButton.Ok; - showMessageService.Caption = "Problema con el acceso directo"; - showMessageService.Text = - String.Format( - "Ha ocurrido un error durante la ejecución del acceso directo '{0}'", - this.Title); - - if (showMessageService.ShowMessage() == DialogResult.Yes) - { - this.GetService().Close(this.Id); - } - }, TaskContinuationOptions.OnlyOnFaulted); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/InternalShortcutViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/InternalShortcutViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -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 Chronos.Presentation.Core.Navigation; -using NLog; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Internal shortcut viewmodel class - /// - public sealed class InternalShortcutViewModel - : ShortcutViewModel - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Consts · - - private static readonly string DefaultIconStyle = "WindowIconStyle"; - - #endregion - - #region · Properties · - - /// - /// Gets or sets the shortcut icon style. - /// - /// The icon style. - public override string IconStyle - { - get - { - if (String.IsNullOrWhiteSpace(base.IconStyle)) - { - return DefaultIconStyle; - } - - return base.IconStyle; - } - set { base.IconStyle = value; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public InternalShortcutViewModel() - : base() - { - } - - #endregion - - #region · Command Execution · - - /// - /// Called when the is executed. - /// - protected override void OnOpen() - { - Logger.Debug("Ejecución de un acceso directo ({0})", this.Target); - - this.GetService().Navigate(this.Target, 10, 20, "BBB"); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/NavigationViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/NavigationViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -using System; -using Chronos.Presentation.Core.Navigation; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.VirtualDesktops; -using NLog; -using nRoute.Components; -using nRoute.Navigation; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// base class for navigation based viewmodel implementations - /// - public abstract class NavigationViewModel - : ClosableViewModel, INavigationViewModel - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Fields · - - #region · Commands · - - private ActionCommand newWindowCommand; - private ActionCommand restoreCommand; - - #endregion - - #endregion - - #region · INavigationViewModel Commands · - - /// - /// Gets the open new window command - /// - public ActionCommand NewWindowCommand - { - get - { - if (this.newWindowCommand == null) - { - this.newWindowCommand = new ActionCommand - ( - () => OnOpenNewWindow(), - () => CanOpenNewWindow() - ); - } - - return this.newWindowCommand; - } - } - - /// - /// Gets the restore command - /// - public ActionCommand RestoreCommand - { - get - { - if (this.restoreCommand == null) - { - this.restoreCommand = new ActionCommand - ( - () => OnRestore(), - () => CanRestore() - ); - } - - return this.restoreCommand; - } - } - - #endregion - - #region · INavigationViewModel Properties · - - /// - /// Gets the navigation route - /// - public virtual string NavigationRoute - { - get { return String.Empty; } - } - - /// - /// Gets a value indicating if the viewmodel has available relations - /// - public virtual bool HasRelations - { - get { return false; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected NavigationViewModel() - : base() - { - } - - #endregion - - #region · Methods · - - public override void Close() - { - this.newWindowCommand = null; - this.restoreCommand = null; - - base.Close(); - } - - #endregion - - #region · Navigation Methods · - - /// - /// Performs the navigation to the given target - /// - /// - protected void Navigate(string target) - { - this.Navigate(NavigateMode.New, target, null); - } - - /// - /// Performs the navigation to the given target - /// - /// - protected void Navigate(NavigateMode mode, string target) - { - this.Navigate(mode, target, null); - } - - /// - /// Performs the navigation to the given target - /// - /// - protected void Navigate(string target, params object[] args) - { - this.Navigate(NavigateMode.New, target, args); - } - - /// - /// Performs the navigation to the given target - /// - /// - protected void Navigate(NavigateMode mode, string target, params object[] args) - { - this.GetService().Navigate(mode, target, args); - } - - #endregion - - #region · ISupportNavigationLifecycle Members · - - /// - /// Closings the specified confirm callback. - /// - /// The confirm callback. - void ISupportNavigationLifecycle.Closing(System.Action confirmCallback) - { - this.OnClosing(confirmCallback); - } - - /// - /// Initializes the specified request parameters. - /// - /// The request parameters. - void ISupportNavigationLifecycle.Initialize(ParametersCollection requestParameters) - { - this.OnInitialize(requestParameters); - } - - #endregion - - #region · ISupportNavigationState Members · - - /// - /// Restores the state. - /// - /// The state. - void ISupportNavigationState.RestoreState(ParametersCollection state) - { - this.OnRestoreState(state); - } - - /// - /// Saves the state. - /// - /// - ParametersCollection ISupportNavigationState.SaveState() - { - return this.OnSaveState(); - } - - #endregion - - #region · Command Actions · - - protected virtual bool CanOpenNewWindow() - { - return !String.IsNullOrEmpty(this.NavigationRoute); - } - - protected virtual void OnOpenNewWindow() - { - Logger.Debug("Abrir una nueva ventana '{0}'", this.GetType()); - - this.GetService().Navigate(this.NavigationRoute); - } - - protected virtual bool CanRestore() - { - return true; - } - - protected virtual void OnRestore() - { - Logger.Debug("Restaurar ventana '{0}'", this.GetType()); - - this.GetService().Restore(this.Id); - } - - #endregion - - #region · Protected Methods · - - /// - /// Called when closing. - /// - /// The confirm callback. - protected virtual void OnClosing(Action confirmCallback) - { - confirmCallback(false); - } - - /// - /// Called when the window is going to be initialized after navigation. - /// - /// The request parameters. - protected virtual void OnInitialize(ParametersCollection requestParameters) - { - } - - /// - /// Called when restore state. - /// - /// The state. - protected virtual void OnRestoreState(ParametersCollection state) - { - } - - /// - /// Called when save state. - /// - /// - protected virtual ParametersCollection OnSaveState() - { - return null; - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/ObservableObject.cs --- a/Chronosv2/source/Presentation/ViewModel/ObservableObject.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -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.ComponentModel; -using System.Linq.Expressions; -using System.Windows.Threading; -using Chronos.Presentation.Core.ViewModel; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Base class for observable objects viewmodels - /// - public abstract class ObservableObject - : IObservableObject - { - #region · Static Methods · - - public static PropertyChangedEventArgs CreateArgs(Expression> propertyExpression) - { - return new PropertyChangedEventArgs(propertyExpression.GetPropertyName()); - } - - #endregion - - #region · INotifyPropertyChanged Members · - - public event PropertyChangedEventHandler PropertyChanged; - - #endregion - - #region · Fields · - - private readonly Dispatcher dispatcher; - - #endregion - - #region · Protected Properties · - - /// - /// Gets the Dispatcher this DispatcherObject is associated with. - /// - protected Dispatcher Dispatcher - { - get { return this.dispatcher; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected ObservableObject() - { - this.dispatcher = Dispatcher.CurrentDispatcher; - } - - #endregion - - #region · Protected Methods · - - /// - /// Executes the specified at the priority - /// on the thread on which the DispatcherObject is associated with. - /// - /// The dispatcher object. - /// The action. - protected void InvokeAsynchronously(Action action) - { - this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, action); - } - - /// - /// Executes the specified at the priority - /// on the thread on which the DispatcherObject is associated with. - /// - /// The dispatcher object. - /// The action. - protected void InvokeAsynchronouslyInBackground(Action action) - { - this.Dispatcher.BeginInvoke(DispatcherPriority.Background, action); - } - - /// - /// Executes the specified at the priority - /// on the thread on which the DispatcherObject is associated with. - /// - /// The dispatcher object. - /// The action. - protected void Invoke(Action action) - { - if (this.Dispatcher.CheckAccess()) - { - action.Invoke(); - } - else - { - this.Dispatcher.Invoke(action); - } - } - - /// - /// Notifies all properties changed. - /// - protected void NotifyAllPropertiesChanged() - { - this.NotifyPropertyChanged((string)null); - } - - /// - /// Notifies the property changed. - /// - /// - /// The property. - protected virtual void NotifyPropertyChanged(Expression> property) - { - this.NotifyPropertyChanged(property.CreateChangeEventArgs()); - } - - /// - /// Notifies the property changed. - /// - /// Name of the property. - protected virtual void NotifyPropertyChanged(string propertyName) - { - this.NotifyPropertyChanged(new PropertyChangedEventArgs(propertyName)); - } - - /// - /// Notifies the property changed. - /// - /// Name of the property. - protected virtual void NotifyPropertyChanged(PropertyChangedEventArgs args) - { - if (this.PropertyChanged != null) - { - this.PropertyChanged(this, args); - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Presentation/ViewModel/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -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("")] - -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.ViewModel")] \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/PropertyState.cs --- a/Chronosv2/source/Presentation/ViewModel/PropertyState.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -The MIT License - -Copyright (c) 2009-2010. Carlos Guzmn 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.ComponentModel; -using System.Linq.Expressions; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Represents a property state - /// - /// - public sealed class PropertyState - : ObservableObject where T: class - { - #region PropertyChangedEventArgs Cached Instances - - private static readonly PropertyChangedEventArgs IsEditableChangedArgs = CreateArgs>(x => x.IsEditable); - private static readonly PropertyChangedEventArgs IsReadOnlyChangedArgs = CreateArgs>(x => x.IsReadOnly); - - #endregion - - #region Fields - - private string name; - private bool isEditable; - - #endregion - - #region Properties - - /// - /// Gets the property name - /// - public string PropertyName - { - get { return this.name; } - } - - /// - /// Gets or sets a value that indicates whether the property is editable - /// - public bool IsEditable - { - get { return this.isEditable; } - set - { - this.isEditable = value; - this.NotifyPropertyChanged(IsEditableChangedArgs); - this.NotifyPropertyChanged(IsReadOnlyChangedArgs); - } - } - - /// - /// Gets or sets a value that indicates whether the property is readonly - /// - public bool IsReadOnly - { - get { return !this.isEditable; } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// Name of the property. - public PropertyState(string propertyName) - { - this.name = propertyName; - } - - /// - /// Initializes a new instance of the class. - /// - /// The property expression. - public PropertyState(Expression> propertyExpression) - { - this.name = propertyExpression.GetPropertyName(); - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/PropertyStateCollection.cs --- a/Chronosv2/source/Presentation/ViewModel/PropertyStateCollection.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,299 +0,0 @@ -/* -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; -using System.Linq.Expressions; -using System.Collections; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// collection - /// - /// - public sealed class PropertyStateCollection - : IList>, ICollection>, IEnumerable>, IList, ICollection, IEnumerable - where T: class - { - #region · Fields · - - private IList> innerList; - - #endregion - - #region · Indexers · - - /// - /// Gets the with the specified property name. - /// - /// - public PropertyState this[string propertyName] - { - get { return this.innerList.FirstOrDefault(o => o.PropertyName == propertyName); } - } - - /// - /// Gets the with the specified property. - /// - /// - public PropertyState this[Expression> property] - { - get { return this.innerList.FirstOrDefault(o => o.PropertyName == property.GetPropertyName()); } - } - - #endregion - - #region · Properties · - - /// - /// Gets the number of property states in the collection. - /// - /// The number of property states in the collection. - public int Count - { - get { return this.innerList.Count; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public PropertyStateCollection() - { - this.innerList = new List>(); - } - - #endregion - - #region · Methods · - - /// - /// Adds a new instance for the specified property name. - /// - /// Name of the property. - /// - public PropertyState Add(string propertyName) - { - PropertyState editor = new PropertyState(propertyName); - - this.innerList.Add(editor); - - return editor; - } - - /// - /// Adds the specified property expression. - /// - /// The property expression. - /// - public PropertyState Add(Expression> propertyExpression) - { - PropertyState editor = new PropertyState(propertyExpression); - - this.innerList.Add(editor); - - return editor; - } - - /// - /// Removes all items from the . - /// - public void Clear() - { - if (this.innerList != null) - { - this.innerList.Clear(); - this.innerList = null; - } - } - - #endregion - - #region · IList> Members · - - public int IndexOf(PropertyState item) - { - return this.innerList.IndexOf(item); - } - - public void Insert(int index, PropertyState item) - { - this.innerList.Insert(index, item); - } - - public void RemoveAt(int index) - { - this.innerList.RemoveAt(index); - } - - public PropertyState this[int index] - { - get { return this.innerList[index]; } - set { this.innerList[index] = value; } - } - - public void Add(PropertyState item) - { - this.innerList.Add(item); - } - - public bool Contains(PropertyState item) - { - return this.innerList.Contains(item); - } - - public void CopyTo(PropertyState[] array, int arrayIndex) - { - this.innerList.CopyTo(array, arrayIndex); - } - - public bool IsReadOnly - { - get { return this.innerList.IsReadOnly; } - } - - public bool Remove(PropertyState item) - { - return this.innerList.Remove(item); - } - - public IEnumerator> GetEnumerator() - { - return this.innerList.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return this.innerList.GetEnumerator(); - } - - #endregion - - #region · ICollection Members· - - void ICollection>.Add(PropertyState item) - { - this.Add(item); - } - - void ICollection>.Clear() - { - this.Clear(); - } - - bool ICollection>.Contains(PropertyState item) - { - return this.Contains(item); - } - - void ICollection>.CopyTo(PropertyState[] array, int arrayIndex) - { - this.CopyTo(array, arrayIndex); - } - - int ICollection>.Count - { - get { return this.innerList.Count; } - } - - bool ICollection>.IsReadOnly - { - get { return this.IsReadOnly; } - } - - bool ICollection>.Remove(PropertyState item) - { - return this.Remove(item); - } - - IEnumerator> IEnumerable>.GetEnumerator() - { - return this.GetEnumerator(); - } - - #endregion - - #region · IList Members · - - public int Add(object value) - { - this.innerList.Add((PropertyState)value); - - return this.IndexOf(value); - } - - public bool Contains(object value) - { - return this.Contains((PropertyState)value); - } - - public int IndexOf(object value) - { - return this.IndexOf((PropertyState)value); - } - - public void Insert(int index, object value) - { - this.Insert(index, (PropertyState)value); - } - - public bool IsFixedSize - { - get { return ((IList)this.innerList).IsFixedSize; } - } - - public void Remove(object value) - { - this.Remove((PropertyState)value); - } - - object IList.this[int index] - { - get { return this[index]; } - set { this[index] = (PropertyState)value; } - } - - public void CopyTo(Array array, int index) - { - this.CopyTo((PropertyState[])array, index); - } - - public bool IsSynchronized - { - get { return ((IList)this.innerList).IsSynchronized; } - } - - public object SyncRoot - { - get { return ((IList)this.innerList).SyncRoot; } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/ShortcutGroupViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/ShortcutGroupViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Chronos.Presentation.Core.Services; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.Windows; -using NLog; -using nRoute.Components; - -namespace Chronos.Presentation.ViewModel -{ - public sealed class ShortcutGroupViewModel - : ClosableViewModel - { - #region · Constants · - - private const string DefaultIconStyle = "FolderIconStyle"; - - #endregion - - #region · NotifyPropertyChanged Cached Instances · - - private static readonly PropertyChangedEventArgs IconStyleChangedArgs = CreateArgs(x => x.IconStyle); - - #endregion - - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Fields · - - private string iconStyle; - private List shortcuts; - - #endregion - - #region · Properties · - - /// - /// Gets or sets the shortcut icon style. - /// - /// The icon style. - public string IconStyle - { - get - { - if (String.IsNullOrWhiteSpace(this.iconStyle)) - { - return DefaultIconStyle; - } - - return this.iconStyle; - } - set { this.iconStyle = value; } - } - - public List Shortcuts - { - get - { - if (this.shortcuts == null) - { - this.shortcuts = new List(); - } - - return this.shortcuts; - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public ShortcutGroupViewModel() - : base() - { - } - - #endregion - - #region · Overriden Methods · - - /// - /// Determines whether the view related to this view model can be closed. - /// - /// - /// true if the related view can be closed; otherwise, false. - /// - public override bool CanClose() - { - return true; - } - - /// - /// Called when the related view is being closed. - /// - public override void Close() - { - IShowMessageViewService showMessageService = this.GetViewService(); - - showMessageService.ButtonSetup = DialogButton.YesNo; - showMessageService.Caption = "Eliminar grupo de accesos directos"; - showMessageService.Text = - String.Format( - "¿Está seguro de que desea eliminar permanentemente este grupo de accesos directos? {0}{1}", - Environment.NewLine, - this.Title); - - if (showMessageService.ShowMessage() == DialogResult.Yes) - { - Logger.Debug("Eliminando grupo de accesos directos '{0}'", this.Title); - - base.Close(); - - this.iconStyle = null; - - if (this.shortcuts != null) - { - this.shortcuts.Clear(); - this.shortcuts = null; - } - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/ShortcutViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/ShortcutViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ -/* -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.ComponentModel; -using Chronos.Presentation.Core.Services; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.Windows; -using NLog; -using nRoute.Components; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Base class for shortcut viewmodel implementations - /// - public abstract class ShortcutViewModel - : ClosableViewModel, IShortcutViewModel - { - #region · NotifyPropertyChanged Cached Instances · - - private static readonly PropertyChangedEventArgs IconStyleChangedArgs = CreateArgs(x => x.IconStyle); - private static readonly PropertyChangedEventArgs TargetChangedArgs = CreateArgs(x => x.Target); - private static readonly PropertyChangedEventArgs ParametersChangedArgs = CreateArgs(x => x.Parameters); - - #endregion - - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Fields · - - private string target; - private string parameters; - private string iconStyle; - - #region · Commands · - - private ActionCommand openCommand; - - #endregion - - #endregion - - #region · Commands · - - /// - /// Gets the open command. - /// - /// The open command. - public ActionCommand OpenCommand - { - get - { - if (this.openCommand == null) - { - this.openCommand = new ActionCommand(() => OnOpen()); - } - - return this.openCommand; - } - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets the icon style. - /// - /// The icon style. - public virtual string IconStyle - { - get { return this.iconStyle; } - set - { - if (this.iconStyle != value) - { - this.iconStyle = value; - this.NotifyPropertyChanged(IconStyleChangedArgs); - } - } - } - - /// - /// Gets or sets the shortcut target. - /// - /// The shortcut target. - public virtual string Target - { - get { return this.target; } - set - { - if (this.target != value) - { - this.target = value; - this.NotifyPropertyChanged(TargetChangedArgs); - } - } - } - - /// - /// Gets or sets the shortcut navigation parameters - /// - public virtual string Parameters - { - get { return this.parameters; } - set - { - if (this.parameters != value) - { - this.parameters = value; - this.NotifyPropertyChanged(ParametersChangedArgs); - } - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected ShortcutViewModel() - : base() - { - } - - #endregion - - #region · Command Actions · - - /// - /// Called when the is executed. - /// - protected abstract void OnOpen(); - - #endregion - - #region · Overriden Methods · - - /// - /// Determines whether the view related to this view model can be closed. - /// - /// - /// true if the related view can be closed; otherwise, false. - /// - public override bool CanClose() - { - return true; - } - - /// - /// Called when the related view is being closed. - /// - public override void Close() - { - IShowMessageViewService showMessageService = this.GetViewService(); - - showMessageService.ButtonSetup = DialogButton.YesNo; - showMessageService.Caption = "Eliminar acceso directo"; - showMessageService.Text = - String.Format( - "¿Está seguro de que desea eliminar permanentemente este acceso directo? {0}{1}", - Environment.NewLine, - this.Title); - - if (showMessageService.ShowMessage() == DialogResult.Yes) - { - Logger.Debug("Eliminando acceso directo '{0}'", this.Target); - - base.Close(); - - this.target = null; - this.parameters = null; - this.iconStyle = null; - this.openCommand = null; - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/ViewModel.cd --- a/Chronosv2/source/Presentation/ViewModel/ViewModel.cd Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ - - - - - - AAAAAAAACAAIAIAAAAAAAIAAgACAAAAQAAQAAAIAAAA= - ObservableObject.cs - - - - - - - AAAAAAAACAAAAAAAAgAAAAAAAAAQAAAAAAAAAAAgAEA= - ViewModelBase.cs - - - - - - - AAACACAAQAIAAEAAAAAAAEAAAABQAgAAAAAAAACAAgA= - ClosableViewModel.cs - - - - - - - AAEAAAQEBAJAAABBAAAAgAAKAAACiAAABAAEBACAAAA= - NavigationViewModel.cs - - - - - - - mwiAiQTI0AuJa/lIfks6QNNKOwiFaSkNlAXBNYCWIUA= - WorkspaceViewModel.cs - - - - - - - AAAAAAAAAAAgAEAAIAAAAAAAAAAAAAAAAAAAAACAAAA= - WidgetViewModel.cs - - - - - - - AAAAAQEAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA= - ExternalShortcutViewModel.cs - - - - - - AAAAAQEAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA= - InternalShortcutViewModel.cs - - - - - - AAAAAQEAAAIAAAAAIIAAQCAAAFAAAgAAAIIAAACAAAE= - ShortcutViewModel.cs - - - - - - - EAAAABAACAAAAUAACAgAAAAAAAAQAAAAAAAAAAAgAAA= - EntityViewModel.cs - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/ViewModelBase.cs --- a/Chronosv2/source/Presentation/ViewModel/ViewModelBase.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -using nRoute.Services; -using nRoute.ViewServices; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Provides a base class for Applications to inherit from. - /// - public abstract class ViewModelBase - : ObservableObject - { - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected ViewModelBase() - : base() - { - } - - #endregion - - #region · Protected Methods · - - /// - /// Gets the requested service instance. - /// - /// The type of the service. - /// - protected TService GetService() where TService : class - { - return ServiceLocator.GetService(); - } - - /// - /// Gets the requested view service. - /// - /// The type of the view service. - /// - protected TViewService GetViewService() where TViewService : class - { - return ViewServiceLocator.GetViewService(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/WidgetViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/WidgetViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -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.ComponentModel; -using Chronos.Presentation.Core.ViewModel; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Base class for widgets viewmodel imeplementations - /// - public abstract class WidgetViewModel - : ClosableViewModel, IWidgetViewModel - { - #region · NotifyPropertyChanged Cached Instances · - - private static readonly PropertyChangedEventArgs DescriptionChangedArgs = CreateArgs(x => x.Description); - - #endregion - - #region · Fields · - - private string description; - - #endregion - - #region · Properties · - - /// - /// Returns the widget description. - /// - public virtual string Description - { - get { return this.description; } - set - { - if (this.description != value) - { - this.description = value; - this.NotifyPropertyChanged(DescriptionChangedArgs); - } - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected WidgetViewModel() - : base() - { - } - - #endregion - - #region · Command Actions · - - /// - /// Called when the related view is being closed. - /// - public override void Close() - { - base.Close(); - - this.description = null; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/WindowViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/WindowViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,442 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading; -using System.Threading.Tasks; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.Windows; -using NLog; -using nRoute.Components; - -namespace Chronos.Presentation.ViewModel -{ - public abstract class WindowViewModel - : NavigationViewModel, IWindowViewModel where TEntity: class, new() - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Inner Types · - - [Serializable] - protected enum InquiryActionResultType - { - DataFetched, - RequestedNew, - DataNotFound - } - - protected sealed class InquiryActionResult - where TResult : class - { - #region · Properties · - - public TResult Data - { - get; - set; - } - - public InquiryActionResultType Result - { - get; - set; - } - - #endregion - - #region · Constructors · - - public InquiryActionResult() - { - } - - #endregion - } - - #endregion - - #region · PropertyChangedEventArgs Cached Instances · - - private static readonly PropertyChangedEventArgs ViewModeChangedArgs = CreateArgs>(x => x.ViewMode); - private static readonly PropertyChangedEventArgs StatusMessageChangedArgs = CreateArgs>(x => x.StatusMessage); - private static readonly PropertyChangedEventArgs NotificationMessageChangedArgs = CreateArgs>(x => x.NotificationMessage); - - #endregion - - #region · Events · - - /// - /// Occurs when view mode is changed. - /// - public event EventHandler ViewModeChanged; - - #endregion - - #region · Fields · - - private TEntity originalEntity; - private string statusMessage; - private string notificationMessage; - private TEntity entity; - private ViewModeType viewMode; - private PropertyStateCollection propertyStates; - - #region · Commands · - - private ActionCommand inquiryCommand; - - #endregion - - #endregion - - #region · Properties · - - /// - /// Gets the property state collection - /// - public PropertyStateCollection PropertyStates - { - get - { - if (this.propertyStates == null) - { - this.propertyStates = new PropertyStateCollection(); - } - - return this.propertyStates; - } - } - - /// - /// Gets or sets the state of the smart part. - /// - /// The state of the smart part. - public ViewModeType ViewMode - { - get { return this.viewMode; } - set - { - if (this.viewMode != value) - { - this.viewMode = value; - try - { - this.OnViewModeChanged(); - } - catch - { -#warning TODO: This is done to prevent DataGrid erroros when discarding changes on new records - } - } - } - } - - /// - /// Gets the inquiry data command - /// - public ActionCommand InquiryCommand - { - get - { - if (this.inquiryCommand == null) - { - this.inquiryCommand = new ActionCommand - ( - () => OnInquiryData(), - () => CanInquiryData() - ); - } - - return this.inquiryCommand; - } - } - - /// - /// Gets or sets the status message text - /// - public string StatusMessage - { - get { return this.statusMessage; } - set - { - if (this.statusMessage != value) - { - this.statusMessage = value; - this.NotifyPropertyChanged(StatusMessageChangedArgs); - } - } - } - - /// - /// Gets or sets the notification message text - /// - public string NotificationMessage - { - get { return this.notificationMessage; } - set - { - if (this.notificationMessage != value) - { - this.notificationMessage = value; - this.NotifyPropertyChanged(NotificationMessageChangedArgs); - } - } - } - - #endregion - - #region · Protected Properties · - - /// - /// Gets or sets the data model. - /// - /// The data model. - protected TEntity Entity - { - get { return this.entity; } - private set - { - if (!Object.ReferenceEquals(this.entity, value)) - { - this.entity = value; - } - } - } - - protected TEntity OriginalEntity - { - get { return this.originalEntity; } - set { this.originalEntity = value; } - } - - #endregion - - #region · Constructors · - - protected WindowViewModel() - : base() - { - this.InitializePropertyStates(); - - this.Entity = new TEntity(); - this.ViewMode = ViewModeType.ViewOnly; - } - - #endregion - - #region · Command Actions · - - #region · Inquiry · - - protected virtual bool CanInquiryData() - { - return (this.ViewMode == ViewModeType.ViewOnly); - } - - protected void OnInquiryData() - { - InquiryActionResult result = new InquiryActionResult - { - Result = InquiryActionResultType.DataNotFound - }; - - this.ViewMode = ViewModeType.Busy; - this.StatusMessage = "Obteniendo datos, espere por favor ..."; - - Task task = Task.Factory.StartNew - ( - (o) => - { - Logger.Debug("Obteniendo datos '{0}'", this.Entity.ToString()); - - this.OnInquiryAction(result); - }, result - ); - - task.ContinueWith - ( - (t) => - { - Logger.Debug("Error al obtener datos '{0}'", t.Exception.InnerException.ToString()); - - this.OnInquiryActionFailed(); - - Exception exception = null; - this.OriginalEntity = null; - - if (t.Exception.InnerException != null) - { - exception = t.Exception.InnerException; - } - else - { - exception = t.Exception; - } - - this.NotificationMessage = exception.Message; - }, - CancellationToken.None, - TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent, - TaskScheduler.FromCurrentSynchronizationContext() - ); - - task.ContinueWith - ( - _ => - { - Logger.Debug("Datos obtenidos correctamente '{0}'", this.Entity.ToString()); - - this.StatusMessage = null; - this.OnInquiryActionComplete(result); - }, - CancellationToken.None, - TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent, - TaskScheduler.FromCurrentSynchronizationContext() - ); - } - - protected abstract void OnInquiryAction(InquiryActionResult result); - - protected virtual void OnInquiryActionComplete(InquiryActionResult result) - { - switch (result.Result) - { - case InquiryActionResultType.DataNotFound: - this.OriginalEntity = null; - - this.ResetDataModel(); - - this.ViewMode = ViewModeType.ViewOnly; - break; - - case InquiryActionResultType.RequestedNew: - throw new InvalidOperationException("Requested New is not valid on this type of ViewModel"); - - case InquiryActionResultType.DataFetched: - this.ResetDataModel(result.Data); - - this.OriginalEntity = this.entity; - this.ViewMode = ViewModeType.ViewOnly; - break; - } - } - - protected virtual void OnInquiryActionFailed() - { - this.ViewMode = ViewModeType.ViewOnly; - } - - #endregion - - #endregion - - #region · Overriden Methods · - - /// - /// Called when the related view is being closed. - /// - public override void Close() - { - Logger.Debug("Cerrar ventana '{0}'", this.GetType()); - - if (this.originalEntity != null) - { - this.originalEntity = null; - } - if (this.entity != null) - { - this.entity = null; - } - if (this.propertyStates != null) - { - this.propertyStates.Clear(); - this.propertyStates = null; - } - - this.inquiryCommand = null; - this.statusMessage = null; - this.notificationMessage = null; - - base.Close(); - } - - #endregion - - #region · DataModel Reset Methods · - - protected void ResetDataModel() - { - Logger.Debug("Resetar model '{0}'", this.GetType()); - this.ResetDataModel(new TEntity()); - Logger.Debug("Model reseteado '{0}'", this.GetType()); - } - - protected virtual void ResetDataModel(TEntity model) - { - this.OnResetingDataModel(this.Entity, model); - - this.OriginalEntity = null; - this.Entity = model; - - this.OnResetedDataModel(model); - } - - protected virtual void OnResetingDataModel(TEntity oldModel, TEntity newModel) - { - } - - protected virtual void OnResetedDataModel(TEntity newModel) - { - this.NotifyAllPropertiesChanged(); - } - - #endregion - - #region · Protected Methods · - - protected virtual void InitializePropertyStates() - { - } - - protected virtual void OnViewModeChanged() - { - if (this.ViewModeChanged != null) - { - this.ViewModeChanged(this, new EventArgs()); - } - - this.NotifyPropertyChanged(ViewModeChangedArgs); - } - - protected virtual void UpdateAllowedUserActions() - { - this.Invoke - ( - () => - { - this.InquiryCommand.RequeryCanExecute(); - } - ); - } - - protected override void NotifyPropertyChanged(PropertyChangedEventArgs args) - { - if (args != StatusMessageChangedArgs) - { - this.StatusMessage = null; - } - if (args != NotificationMessageChangedArgs) - { - this.NotificationMessage = null; - } - - this.UpdateAllowedUserActions(); - base.NotifyPropertyChanged(args); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/ViewModel/WorkspaceViewModel.cs --- a/Chronosv2/source/Presentation/ViewModel/WorkspaceViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1042 +0,0 @@ -/* -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.ComponentModel; -using System.Threading; -using System.Threading.Tasks; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Windows; -using NLog; -using nRoute.Components; - -namespace Chronos.Presentation.ViewModel -{ - /// - /// Base application class for workspace windows - /// - /// The type of the data model. - public abstract class WorkspaceViewModel : - WindowViewModel, IWorkspaceViewModel where TEntity : class, INotifyPropertyChanged, IDataErrorInfo, new() - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · PropertyChangedEventArgs Cached Instances · - - private static readonly PropertyChangedEventArgs HasBookmarksChangedArgs = CreateArgs>(x => x.HasBookMarks); - private static readonly PropertyChangedEventArgs HasRelationsChangedArgs = CreateArgs>(x => x.HasRelations); - private static readonly PropertyChangedEventArgs ShowZoomWindowChangedArgs = CreateArgs>(x => x.ShowZoomWindow); - private static readonly PropertyChangedEventArgs ZoomLevelChangedArgs = CreateArgs>(x => x.ZoomLevel); - - #endregion - - #region · Fields · - - private bool hasBookMarks; - private bool showZoomWindow; - private double zoomLevel; - - #region · Commands · - - private ActionCommand addNewCommand; - private ActionCommand editCommand; - private ActionCommand deleteCommand; - private ActionCommand saveCommand; - private ActionCommand discardCommand; - private ActionCommand printCommand; - private ActionCommand printPreviewCommand; - private ActionCommand createShortcutCommand; - private ActionCommand bookmarkCurrentCommand; - private ActionCommand clearBookmarksCommand; - private ActionCommand organizeBookmarksCommand; - private ActionCommand showFormHelpCommand; - private ActionCommand showZoomWindowCommand; - - #endregion - - #endregion - - #region · IWorkspaceViewModel Commands · - - /// - /// Gets the add new command - public ActionCommand AddNewCommand - { - get - { - if (this.addNewCommand == null) - { - this.addNewCommand = new ActionCommand - ( - () => OnAddNew(), - () => CanAddNew() - ); - } - - return this.addNewCommand; - } - } - - /// - /// Gets the edit command - /// - public ActionCommand EditCommand - { - get - { - if (this.editCommand == null) - { - this.editCommand = new ActionCommand - ( - () => OnEdit(), - () => CanEdit() - ); - } - - return this.editCommand; - } - } - - /// - /// Gets the delete command - /// - public ActionCommand DeleteCommand - { - get - { - if (this.deleteCommand == null) - { - this.deleteCommand = new ActionCommand - ( - () => OnDelete(), - () => CanDelete() - ); - } - - return this.deleteCommand; - } - } - - /// - /// Gets the save command - /// - public ActionCommand SaveCommand - { - get - { - if (this.saveCommand == null) - { - this.saveCommand = new ActionCommand - ( - () => OnSave(), - () => CanSave() - ); - } - - return this.saveCommand; - } - } - - /// - /// Gets the discard command - /// - public ActionCommand DiscardCommand - { - get - { - if (this.discardCommand == null) - { - this.discardCommand = new ActionCommand - ( - () => OnDiscard(), - () => CanDiscard() - ); - } - - return this.discardCommand; - } - } - - /// - /// Gets the print command - /// - public ActionCommand PrintCommand - { - get - { - if (this.printCommand == null) - { - this.printCommand = new ActionCommand - ( - () => OnPrint(), - () => CanPrint() - ); - } - - return this.printCommand; - } - } - - /// - /// Gets the print preview command - /// - public ActionCommand PrintPreviewCommand - { - get - { - if (this.printPreviewCommand == null) - { - this.printPreviewCommand = new ActionCommand - ( - () => OnPrintPreview(), - () => CanPrintPreview() - ); - } - - return this.printPreviewCommand; - } - } - - /// - /// Gets the show form help command - /// - public ActionCommand ShowFormHelpCommand - { - get - { - if (this.showFormHelpCommand == null) - { - this.showFormHelpCommand = new ActionCommand - ( - () => OnShowFormHelp(), - () => CanShowFormHelp() - ); - } - - return this.showFormHelpCommand; - } - } - - /// - /// Gets the show zoom window command - /// - public ActionCommand ShowZoomWindowCommand - { - get - { - if (this.showZoomWindowCommand == null) - { - this.showZoomWindowCommand = new ActionCommand - ( - () => OnShowZoomWindow(), - () => CanShowZoomWindow() - ); - } - - return this.showZoomWindowCommand; - } - } - - #endregion - - #region · IBookmarkViewModel Commands · - - /// - /// Gets the bookmark current command - /// - public ActionCommand BookmarkCurrentCommand - { - get - { - if (this.bookmarkCurrentCommand == null) - { - this.bookmarkCurrentCommand = new ActionCommand - ( - () => OnBookmarkCurrent(), - () => CanBookmarkCurrent() - ); - } - - return this.bookmarkCurrentCommand; - } - } - - /// - /// Gets the clear bookmarks command - /// - public ActionCommand ClearBookmarksCommand - { - get - { - if (this.clearBookmarksCommand == null) - { - this.clearBookmarksCommand = new ActionCommand - ( - () => OnClearBookmarks(), - () => CanClearBookmarks() - ); - } - - return this.clearBookmarksCommand; - } - } - - /// - /// Gets the organize bookmarks command - /// - public ActionCommand OrganizeBookmarksCommand - { - get - { - if (this.organizeBookmarksCommand == null) - { - this.organizeBookmarksCommand = new ActionCommand - ( - () => OnOrganizeBookmarks(), - () => CanOrganizeBookmarks() - ); - } - - return this.organizeBookmarksCommand; - } - } - - /// - /// Gets the create shortcut command - /// - public ActionCommand CreateShortcutCommand - { - get - { - if (this.createShortcutCommand == null) - { - this.createShortcutCommand = new ActionCommand - ( - () => OnCreateShortcut(), - () => CanCreateShortcut() - ); - } - - return this.createShortcutCommand; - } - } - - #endregion - - #region · IBookmarkViewModel Properties · - - /// - /// Gets a value indicating if there are available bookmarks - /// - public bool HasBookMarks - { - get { return this.hasBookMarks; } - set - { - if (this.hasBookMarks != value) - { - this.hasBookMarks = value; - this.NotifyPropertyChanged(HasBookmarksChangedArgs); - } - } - } - - #endregion - - #region · IEntityViewModel Properties & Indexers · - - /// - /// Gets an error message indicating what is wrong with this object. - /// - /// - /// An error message indicating what is wrong with this object. The default is - /// an empty string (""). - /// - public virtual string Error - { - get - { - if (this.IsEditing && - this.Entity != null) - { - return this.Entity.Error; - } - - return null; - } - } - - /// - /// Gets the error message for the property with the given name. - /// - /// The name of the property whose error message to get. - /// The error message for the property. The default is an empty string (""). - public virtual string this[string columnName] - { - get - { - if (this.IsEditing && - this.Entity != null) - { - return this.Entity[columnName]; - } - - return null; - } - } - - /// - /// Gets a value indicating wheter this instance is valid - /// - public virtual bool IsValid - { - get { return String.IsNullOrEmpty(this.Error); } - } - - /// - /// Gets a value indicating wheter this instance has changes - /// - public virtual bool HasChanges - { - get { return false; } - } - - #endregion - - #region · IWorkspaceViewModel Properties · - - /// - /// Gets or sets a value indicating whether the zoom window is shown - /// - public bool ShowZoomWindow - { - get { return this.showZoomWindow; } - set - { - if (this.showZoomWindow != value) - { - this.showZoomWindow = value; - this.NotifyPropertyChanged(ShowZoomWindowChangedArgs); - } - } - } - - /// - /// Gets or sets the zoom level - /// - public double ZoomLevel - { - get { return this.zoomLevel; } - set - { - if (this.zoomLevel != value) - { - this.zoomLevel = value; - this.NotifyPropertyChanged(ZoomLevelChangedArgs); - } - } - } - - #endregion - - #region · Private Properties · - - private bool IsEditing - { - get - { - return this.ViewMode == ViewModeType.Add || - this.ViewMode == ViewModeType.Edit; - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected WorkspaceViewModel() - : base() - { - this.ZoomLevel = 100; - } - - #endregion - - #region · Command Actions · - - #region · Add New · - - protected virtual bool CanAddNew() - { - return false; - } - - protected virtual void OnAddNew() - { - Logger.Debug("Add new '{0}", typeof(TEntity)); - - this.ViewMode = ViewModeType.Add; - - TEntity newEntity = new TEntity(); - - this.FillDefaultValues(); - - this.ResetDataModel(newEntity); - } - - #endregion - - #region · Edit · - - protected virtual bool CanEdit() - { - return (this.ViewMode == ViewModeType.ViewOnly && - this.OriginalEntity == this.Entity); - } - - protected virtual void OnEdit() - { - Logger.Debug("Edit '{0}", this.Entity.ToString()); - - this.ViewMode = ViewModeType.Edit; - } - - #endregion - - #region · Delete · - - protected virtual bool CanDelete() - { - return (this.ViewMode == ViewModeType.ViewOnly && - this.OriginalEntity == this.Entity); - } - - protected void OnDelete() - { - this.ViewMode = ViewModeType.Busy; - - Task task = Task.Factory.StartNew - ( - () => - { - Logger.Debug("Delete '{0}", this.Entity.ToString()); - - this.OnDeleteAction(); - } - ); - - task.ContinueWith - ( - _ => - { - Logger.Debug("Delete successful '{0}'", this.Entity.ToString()); - - this.OnDeleteActionComplete(); - }, - CancellationToken.None, - TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent, - TaskScheduler.FromCurrentSynchronizationContext() - ); - - task.ContinueWith - ( - (t) => - { - Logger.Debug("Error at delete '{0}'", t.Exception.ToString()); - - this.OnDeleteActionFailed(ViewModeType.ViewOnly); - - Exception exception = null; - - if (t.Exception.InnerException != null) - { - exception = t.Exception.InnerException; - } - else - { - exception = t.Exception; - } - - this.NotificationMessage = exception.Message; - }, - CancellationToken.None, - TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent, - TaskScheduler.FromCurrentSynchronizationContext() - ); - } - - protected virtual void OnDeleteAction() - { - } - - protected virtual void OnDeleteActionComplete() - { - this.ResetDataModel(); - - this.ViewMode = ViewModeType.ViewOnly; - } - - protected virtual void OnDeleteActionFailed(ViewModeType previousViewMode) - { - this.ViewMode = previousViewMode; - } - - #endregion - - #region · Save · - - protected virtual bool CanSave() - { - return ((this.ViewMode == ViewModeType.Add || - this.ViewMode == ViewModeType.Edit) && - this.IsValid && this.HasChanges); - } - - protected void OnSave() - { - ViewModeType previousViewMode = this.ViewMode; - - this.ViewMode = ViewModeType.Busy; - this.StatusMessage = "Saving changes, please wait ..."; - - Task task = Task.Factory.StartNew - ( - () => - { - Logger.Debug("Save changes '{0}'", this.Entity); - - if (this.Entity != null && this.HasChanges) - { - this.OnSaveAction(); - } - } - ); - - task.ContinueWith - ( - _ => - { - Logger.Debug("Save changes successful '{0}'", this.Entity); - - this.OnSaveActionComplete(); - }, - CancellationToken.None, - TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent, - TaskScheduler.FromCurrentSynchronizationContext() - ); - - task.ContinueWith - ( - (t) => - { - Logger.Debug("Error at save changes '{0}'", t.Exception.ToString()); - - this.OnSaveActionFailed(previousViewMode); - - Exception exception = null; - - if (t.Exception.InnerException != null) - { - exception = t.Exception.InnerException; - } - else - { - exception = t.Exception; - } - - this.NotificationMessage = exception.Message; - }, - CancellationToken.None, - TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent, - TaskScheduler.FromCurrentSynchronizationContext() - ); - } - - protected virtual void OnSaveAction() - { - } - - protected virtual void OnSaveActionComplete() - { - this.ResetDataModel(); - - this.ViewMode = ViewModeType.ViewOnly; - } - - protected virtual void OnSaveActionFailed(ViewModeType previousViewMode) - { - this.ViewMode = previousViewMode; - } - - #endregion - - #region · Discard · - - protected virtual bool CanDiscard() - { - return (this.ViewMode == ViewModeType.Add || - this.ViewMode == ViewModeType.Edit); - } - - protected virtual void OnDiscard() - { - this.ViewMode = ViewModeType.Busy; - - this.ResetDataModel(); - - this.ViewMode = ViewModeType.ViewOnly; - } - - #endregion - - #region · Inquiry · - - protected override void OnInquiryActionComplete(InquiryActionResult result) - { - switch (result.Result) - { - case InquiryActionResultType.RequestedNew: - this.OnAddNew(); - break; - - default: - base.OnInquiryActionComplete(result); - break; - } - } - - #endregion - - #region · Print · - - protected virtual bool CanPrint() - { - return false; - } - - protected void OnPrint() - { - this.ViewMode = ViewModeType.Busy; - - Task.Factory.StartNew( - () => - { - Task task = Task.Factory.StartNew - ( - () => - { - this.OnPrintAction(); - } - ); - - task.ContinueWith( - (t) => - { - Logger.Debug("Error al imprimir '{0}'", this.NavigationRoute); - - this.Invoke( - () => - { - this.OnPrintActionFailed(); - - Exception exception = null; - - if (t.Exception.InnerException != null) - { - exception = t.Exception.InnerException; - } - else - { - exception = t.Exception; - } - - this.NotificationMessage = exception.Message; - }); - }, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent); - - task.ContinueWith( - _ => - { - Logger.Debug("Impresion finalizada correctamente '{0}'", this.NavigationRoute); - - this.Invoke( - () => - { - this.StatusMessage = null; - this.OnPrintActionComplete(); - }); - }, TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent); - }); - } - - protected virtual void OnPrintAction() - { - } - - protected virtual void OnPrintActionComplete() - { - this.ViewMode = ViewModeType.ViewOnly; - } - - protected virtual void OnPrintActionFailed() - { - this.ViewMode = ViewModeType.ViewOnly; - } - - #endregion - - #region · Print Preview · - - protected virtual bool CanPrintPreview() - { - return false; - } - - protected void OnPrintPreview() - { - this.ViewMode = ViewModeType.Busy; - - Task.Factory.StartNew( - () => - { - Task task = Task.Factory.StartNew - ( - () => - { - this.OnPrintPreviewAction(); - } - ); - - task.ContinueWith( - (t) => - { - Logger.Debug("Error al mostrar la vista previa '{0}'", this.NavigationRoute); - - this.Invoke( - () => - { - this.OnPrintPreviewActionFailed(); - - Exception exception = null; - - if (t.Exception.InnerException != null) - { - exception = t.Exception.InnerException; - } - else - { - exception = t.Exception; - } - - this.NotificationMessage = exception.Message; - }); - }, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent); - - task.ContinueWith( - _ => - { - Logger.Debug("Impresion finalizada correctamente '{0}'", this.NavigationRoute); - - this.Invoke( - () => - { - this.StatusMessage = null; - this.OnPrintPreviewActionComplete(); - }); - }, TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent); - }); - } - - protected virtual void OnPrintPreviewAction() - { - } - - protected virtual void OnPrintPreviewActionComplete() - { - this.ViewMode = ViewModeType.ViewOnly; - } - - protected virtual void OnPrintPreviewActionFailed() - { - this.ViewMode = ViewModeType.ViewOnly; - } - - #endregion - - #region · Bookmark Current Command · - - protected virtual bool CanBookmarkCurrent() - { - return this.ViewMode == ViewModeType.ViewOnly && - (this.OriginalEntity != null && this.OriginalEntity == this.Entity); - } - - protected virtual void OnBookmarkCurrent() - { - } - - #endregion - - #region · Clear Bookmarks Command · - - protected virtual bool CanClearBookmarks() - { - return this.ViewMode == ViewModeType.ViewOnly; - } - - protected virtual void OnClearBookmarks() - { - } - - #endregion - - #region · Organize Bookmarks Command · - - protected virtual bool CanOrganizeBookmarks() - { - return this.ViewMode == ViewModeType.ViewOnly; - } - - protected virtual void OnOrganizeBookmarks() - { - } - - #endregion - - #region · Create Shortcut Command · - - protected virtual bool CanCreateShortcut() - { - return !String.IsNullOrEmpty(this.NavigationRoute); - } - - protected virtual void OnCreateShortcut() - { - this.GetService().CreateShortcut(this.Title, this.NavigationRoute); - } - - #endregion - - #region · Show Form Help Command · - - private bool CanShowFormHelp() - { - return false; - } - - private void OnShowFormHelp() - { - } - - #endregion - - #region · Show Zoom Window Command · - - private bool CanShowZoomWindow() - { - return true; - } - - private void OnShowZoomWindow() - { - this.ShowZoomWindow = !this.ShowZoomWindow; - } - - #endregion - - #endregion - - #region · Overriden Methods · - - /// - /// Called when the related view is being closed. - /// - public override void Close() - { - Logger.Debug("Cerrar ventana '{0}'", this.GetType()); - - this.addNewCommand = null; - this.editCommand = null; - this.deleteCommand = null; - this.saveCommand = null; - this.discardCommand = null; - this.printCommand = null; - this.printPreviewCommand = null; - this.createShortcutCommand = null; - this.bookmarkCurrentCommand = null; - this.clearBookmarksCommand = null; - this.organizeBookmarksCommand = null; - this.showFormHelpCommand = null; - this.showZoomWindowCommand = null; - this.hasBookMarks = false; - this.showZoomWindow = false; - this.zoomLevel = 0; - - base.Close(); - } - - #endregion - - #region · Protected Methods · - - protected virtual void FillDefaultValues() - { - } - - protected override void UpdateAllowedUserActions() - { - this.Invoke - ( - () => - { - this.AddNewCommand.RequeryCanExecute(); - this.EditCommand.RequeryCanExecute(); - this.DeleteCommand.RequeryCanExecute(); - this.SaveCommand.RequeryCanExecute(); - this.DiscardCommand.RequeryCanExecute(); - this.InquiryCommand.RequeryCanExecute(); - this.NewWindowCommand.RequeryCanExecute(); - this.CreateShortcutCommand.RequeryCanExecute(); - this.BookmarkCurrentCommand.RequeryCanExecute(); - this.ClearBookmarksCommand.RequeryCanExecute(); - this.OrganizeBookmarksCommand.RequeryCanExecute(); - this.PrintCommand.RequeryCanExecute(); - this.PrintPreviewCommand.RequeryCanExecute(); - this.ShowFormHelpCommand.RequeryCanExecute(); - this.ShowZoomWindowCommand.RequeryCanExecute(); - } - ); - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidget.cs --- a/Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidget.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -using System; -using Chronos.Presentation.Core.Widgets; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Calendar widget definition - /// - public sealed class CalendarWidget - : IWidget - { - #region · Properties · - - /// - /// Gets the widget title - /// - /// - public string Title - { - get { return "Calendar"; } - } - - /// - /// Gets the widget description - /// - /// - public string Description - { - get { return "Calendar"; } - } - - /// - /// Gets the widget group - /// - /// - public string Group - { - get { return "Tools"; } - } - - /// - /// Gets the widget icon style - /// - /// - public string IconStyle - { - get { return String.Empty; } - } - - #endregion - - #region · Methods · - - /// - /// Creates the widget view - /// - /// - public System.Windows.FrameworkElement CreateView() - { - return new CalendarWidgetView(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidgetView.xaml --- a/Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidgetView.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidgetView.xaml.cs --- a/Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidgetView.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -using Chronos.Presentation.Windows.Controls; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Calendar Widget View - /// - public partial class CalendarWidgetView - : WidgetElement - { - /// - /// Initializes a new instance of the class. - /// - public CalendarWidgetView() - { - InitializeComponent(); - - this.DataContext = new CalendarWidgetViewModel(); - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidgetViewModel.cs --- a/Chronosv2/source/Presentation/Widgets/Calendar/CalendarWidgetViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -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 Chronos.Presentation.ViewModel; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Calendar Widget View Model - /// - public sealed class CalendarWidgetViewModel - : WidgetViewModel - { - #region · Properties · - - /// - /// Gets the current selected date - /// - public DateTime SelectedDate - { - get; - set; - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class - /// - public CalendarWidgetViewModel() - : base() - { - } - - #endregion - } -} - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Chronos.Presentation.Widgets.csproj --- a/Chronosv2/source/Presentation/Widgets/Chronos.Presentation.Widgets.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {2CF0AED5-C924-4536-95D4-AA338BFCDA23} - Library - Properties - Chronos.Presentation.Widgets - Chronos.Presentation.Widgets - v4.0 - 512 - - - - - - - - - - - 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 - - - - - CalendarWidgetView.xaml - - - - - ClockWidgetView.xaml - - - - - NavigatorWidgetView.xaml - - - - True - True - Settings.settings - - - - - {AA911078-3A2A-41B1-B779-3C8B55E1B8E3} - Chronos.Extensions - - - {F3061A2B-7688-4B26-8D5B-E556EAFE1D49} - Chronos.Presentation.DragAndDrop - - - {66D734BC-132C-4252-9CBD-78DF2585D52D} - Chronos.Presentation.Controls - - - {4C9AD768-6AB8-43B1-833A-C8CC520471B1} - Chronos.Presentation.Core - - - {AAB3929F-049B-469A-AAEB-BBABEE03FE0A} - Chronos.Presentation.ViewModel - - - {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7} - Chronos.Presentation.Windows - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Clock/ClockWidget.cs --- a/Chronosv2/source/Presentation/Widgets/Clock/ClockWidget.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -using System; -using Chronos.Presentation.Core.Widgets; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Clock widget definition - /// - public sealed class ClockWidget - : IWidget - { - #region · Properties · - - /// - /// Gets the widget title - /// - /// - public string Title - { - get { return "Digital Clock"; } - } - - /// - /// Gets the widget description - /// - /// - public string Description - { - get { return "Digital Clock"; } - } - - /// - /// Gets the widget group - /// - /// - public string Group - { - get { return "Tools"; } - } - - /// - /// Gets the widget icon style - /// - /// - public string IconStyle - { - get { return String.Empty; } - } - - #endregion - - #region · Methods · - - /// - /// Creates the widget view - /// - /// - public System.Windows.FrameworkElement CreateView() - { - return new ClockWidgetView(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Clock/ClockWidgetView.xaml --- a/Chronosv2/source/Presentation/Widgets/Clock/ClockWidgetView.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Clock/ClockWidgetView.xaml.cs --- a/Chronosv2/source/Presentation/Widgets/Clock/ClockWidgetView.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -using System; -using System.Windows; -using Chronos.Presentation.Windows.Controls; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Clock Widget View - /// - public partial class ClockWidgetView - : WidgetElement - { - #region · Dependency Properties · - - public static readonly DependencyProperty SecondsProperty = DependencyProperty.Register( - "Seconds", typeof(string), typeof(ClockWidgetView), new PropertyMetadata("00")); - - public static readonly DependencyProperty MinutesProperty = DependencyProperty.Register( - "Minutes", typeof(string), typeof(ClockWidgetView), new PropertyMetadata("00")); - - public static readonly DependencyProperty HoursProperty = DependencyProperty.Register( - "Hours", typeof(string), typeof(ClockWidgetView), new PropertyMetadata("00")); - - public static readonly DependencyProperty PmAmProperty = DependencyProperty.Register( - "PmAm", typeof(string), typeof(ClockWidgetView), new PropertyMetadata(string.Empty)); - - public static readonly DependencyProperty Hours24Property = DependencyProperty.Register( - "Hours24", typeof(bool), typeof(ClockWidgetView), new PropertyMetadata(true)); - - public static readonly DependencyProperty DateProperty = DependencyProperty.Register( - "Date", typeof(string), typeof(ClockWidgetView), new PropertyMetadata(String.Empty)); - - public static readonly DependencyProperty DayOfWeekProperty = DependencyProperty.Register( - "DayOfWeek", typeof(string), typeof(ClockWidgetView), new PropertyMetadata(String.Empty)); - - public static readonly DependencyProperty AngleProperty = DependencyProperty.Register( - "Angle", typeof(int), typeof(ClockWidgetView), new PropertyMetadata(0)); - - #endregion - - #region · Properties · - - public string Seconds - { - get { return (string)this.GetValue(SecondsProperty); } - set { this.SetValue(SecondsProperty, value); } - } - - public string Minutes - { - get { return (string)this.GetValue(MinutesProperty); } - set { this.SetValue(MinutesProperty, value); } - } - - public string Hours - { - get { return (string)this.GetValue(HoursProperty); } - set { this.SetValue(HoursProperty, value); } - } - - public string PmAm - { - get { return (string)this.GetValue(PmAmProperty); } - set { this.SetValue(PmAmProperty, value); } - } - - public bool Hours24 - { - get { return (bool)this.GetValue(Hours24Property); } - set { this.SetValue(Hours24Property, value); } - } - - public string Date - { - get { return (string)this.GetValue(DateProperty); } - set { this.SetValue(DateProperty, value); } - } - - public string DayOfWeek - { - get { return (string)this.GetValue(DayOfWeekProperty); } - set { this.SetValue(DayOfWeekProperty, value); } - } - - public int Angle - { - get { return (int)this.GetValue(AngleProperty); } - set { this.SetValue(AngleProperty, value); } - } - - #endregion - - #region · Constuctors · - - /// - /// Initializes a new instance of the class. - /// - public ClockWidgetView() - { - InitializeComponent(); - - this.DataContext = new ClockWidgetViewModel(); - } - - #endregion - - #region · Methods · - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - - ((ClockWidgetViewModel)this.DataContext).Start(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Clock/ClockWidgetViewModel.cs --- a/Chronosv2/source/Presentation/Widgets/Clock/ClockWidgetViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,307 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Media; -using System.Windows.Threading; -using Chronos.Presentation.ViewModel; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Based on http://moonydesk.codeplex.com/ - /// - public sealed class ClockWidgetViewModel - : WidgetViewModel - { - #region · Fields · - - private Point degreeStartPoint; - private Point degreeCurrentPoint; - private bool isLargeArc; - private int dayOfYear; - private int year; - private string seconds; - private string minutes; - private string hours; - private string pmAm; - private bool hours24; - private string date; - private string dayOfWeek; - private int angle; - - #endregion - - #region · Properties · - - public Point DegreeStartPoint - { - get { return this.degreeStartPoint; } - set - { - if (this.degreeStartPoint != value) - { - this.degreeStartPoint = value; - - this.NotifyPropertyChanged(() => DegreeStartPoint); - } - } - } - - public Point DegreeCurrentPoint - { - get { return this.degreeCurrentPoint; } - set - { - if (this.degreeCurrentPoint != value) - { - this.degreeCurrentPoint = value; - - this.NotifyPropertyChanged(() => DegreeCurrentPoint); - } - } - } - - public bool IsLargeArc - { - get { return this.isLargeArc; } - set - { - if (this.isLargeArc != value) - { - this.isLargeArc = value; - - this.NotifyPropertyChanged(() => IsLargeArc); - } - } - } - - public string Seconds - { - get { return this.seconds; } - set - { - if (this.seconds != value) - { - this.seconds = value; - - this.NotifyPropertyChanged(() => Seconds); - } - } - } - - public string Minutes - { - get { return this.minutes; } - set - { - if (this.minutes != value) - { - this.minutes = value; - - this.NotifyPropertyChanged(() => Minutes); - } - } - } - - public string Hours - { - get { return this.hours; } - set - { - if (this.hours != value) - { - this.hours = value; - - this.NotifyPropertyChanged(() => Hours); - } - } - } - - public string PmAm - { - get { return this.pmAm; } - set - { - if (this.pmAm != value) - { - this.pmAm = value; - - this.NotifyPropertyChanged(() => PmAm); - } - } - } - - public bool Hours24 - { - get { return this.hours24; } - set - { - if (this.hours24 != value) - { - this.hours24 = value; - - this.NotifyPropertyChanged(() => Hours24); - } - } - } - - public string Date - { - get { return this.date; } - set - { - if (this.date != value) - { - this.date = value; - - this.NotifyPropertyChanged(() => Date); - } - } - } - - public string DayOfWeek - { - get { return this.dayOfWeek; } - set - { - if (this.dayOfWeek != value) - { - this.dayOfWeek = value; - - this.NotifyPropertyChanged(() => DayOfWeek); - } - } - } - - public int Angle - { - get { return this.angle; } - set - { - if (this.angle != value) - { - this.angle = value; - - this.NotifyPropertyChanged(() => Angle); - } - } - } - - public int DayOfYear - { - get { return this.dayOfYear; } - set - { - if (this.dayOfYear != value) - { - this.dayOfYear = value; - - this.NotifyPropertyChanged(() => DayOfYear); - } - } - } - - public int Year - { - get { return this.year; } - set - { - if (this.year != value) - { - this.year = value; - - this.NotifyPropertyChanged(() => DayOfYear); - } - } - } - - #endregion - - #region · Constructors · - - public ClockWidgetViewModel() - : base() - { - this.DayOfYear = -1; - this.Year = -1; - this.Angle = -4; - this.Hours24 = Properties.Settings.Default.hours24; - this.DegreeStartPoint = new Point(110, 10); - this.DegreeCurrentPoint = new Point(110, 210); - } - - #endregion - - #region · Methods · - - public void Start() - { - DispatcherTimer timer = new DispatcherTimer(); - - timer.Interval = TimeSpan.FromSeconds(0.1); - timer.Tick += new EventHandler(OnTimerTick); - timer.Start(); - - this.SetCurTime(); - } - - #endregion - - #region · Private Methods · - - /// - /// Set current time - /// - private void SetCurTime() - { - DateTime now = DateTime.Now; - - this.SetDeg((now.Second + now.Millisecond / 1000.0) * 6); - this.Seconds = now.Second.ToString("00"); - this.Minutes = now.Minute.ToString("00"); - - if (this.Hours24) - { - this.Hours = now.Hour.ToString("00"); - this.PmAm = String.Empty; - } - else - { - this.Hours = now.ToString("hh"); - this.PmAm = now.ToString("tt"); - } - - if (now.DayOfYear != this.DayOfYear || now.Year != this.Year) - { - this.Date = now.ToString("d MMMM yyyy"); - this.DayOfWeek = now.ToString("dddd"); - this.DayOfYear = now.DayOfYear; - this.Year = now.Year; - } - } - - /// - /// Set seconds arc degree - /// - /// - private void SetDeg(double degree) - { - double offset = this.DegreeStartPoint.X; - double x = Math.Cos((degree - 90) * Math.PI / 180) * 100.0 + offset; - double y = Math.Sin((degree - 90) * Math.PI / 180) * 100.0 + offset; - - this.DegreeCurrentPoint = new Point(x, y); - this.IsLargeArc = (degree > 180); - } - - #endregion - - #region · Event Handlers · - - private void OnTimerTick(object sender, EventArgs e) - { - this.SetCurTime(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidget.cs --- a/Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidget.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -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 Chronos.Presentation.Core.Widgets; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Navigator Widget Definition - /// - public sealed class NavigatorWidget - : IWidget - { - #region · Properties · - - /// - /// Gets the widget title - /// - /// - public string Title - { - get { return "Navigator"; } - } - - /// - /// Gets the widget description - /// - /// - public string Description - { - get { return "Browse and search application functions"; } - } - - /// - /// Gets the widget group - /// - /// - public string Group - { - get { return "System"; } - } - - /// - /// Gets the widget icon style - /// - /// - public string IconStyle - { - get { return String.Empty; } - } - - #endregion - - #region · Methods · - - /// - /// Creates the widget view - /// - /// - public System.Windows.FrameworkElement CreateView() - { - return new NavigatorWidgetView(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidgetView.xaml --- a/Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidgetView.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidgetView.xaml.cs --- a/Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidgetView.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -using Chronos.Presentation.Windows.Controls; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Navigator Widget View - /// - public partial class NavigatorWidgetView - : WidgetElement - { - /// - /// Initializes a new instance of the class. - /// - public NavigatorWidgetView() - { - InitializeComponent(); - - this.DataContext = new NavigatorWidgetViewModel(); - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidgetViewModel.cs --- a/Chronosv2/source/Presentation/Widgets/Navigator/NavigatorWidgetViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -/* -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.Collections.ObjectModel; -using System.Linq; -using System.Windows.Input; -using Chronos.Extensions; -using Chronos.Presentation.Core.Navigation; -using Chronos.Presentation.ViewModel; -using Chronos.Presentation.Windows; -using nRoute.Components; -using nRoute.Services; -using nRoute.SiteMaps; - -namespace Chronos.Presentation.Widgets -{ - /// - /// Navigator Widget ViewModel - /// - /// - /// http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx - /// - public sealed class NavigatorWidgetViewModel - : WidgetViewModel - { - #region · Fields · - - private readonly ReadOnlyCollection functions; - private readonly SiteMapNode rootOption; - private List filteredFunctions; - private string filterText; - private ICommand navigateToCommand; - - #endregion - - #region · Commands · - - /// - /// Gets the navigation command - /// - public ICommand NavigateToCommand - { - get - { - if (this.navigateToCommand == null) - { - this.navigateToCommand = new ActionCommand - ( - x => OnNavigateTo(x), - x => CanNavigate() - ); - } - - return this.navigateToCommand; - } - } - - #endregion - - #region · Properties · - - #region · FirstGeneration · - - /// - /// Returns a read-only collection containing the first application option - /// in the tree, to which the TreeView can bind. - /// - public ReadOnlyCollection Functions - { - get - { - if (String.IsNullOrEmpty(this.filterText)) - { - return this.functions; - } - else - { - return new ReadOnlyCollection(this.filteredFunctions); - } - } - } - - #endregion - - #region · FilterText · - - /// - /// Gets/sets a fragment of the name to filter for. - /// - public string FilterText - { - get { return this.filterText; } - set - { - if (value != filterText) - { - this.filterText = value; - this.PerformFilter(); - } - } - } - - #endregion - - #endregion - - #region · Constructor · - - /// - /// Initializes a new instance of the class. - /// - public NavigatorWidgetViewModel() - : base() - { - if (!DesignMode.IsInDesignMode) - { - this.rootOption = SiteMapService.SiteMap.RootNode; - this.filteredFunctions = new List(); - this.functions = new ReadOnlyCollection(this.rootOption.ChildNodes.OfType().ToArray()); - } - } - - #endregion - - #region · Command Actions · - - /// - /// Returns a value indcating whether the navigation command can be executed - /// - /// - private bool CanNavigate() - { - return this.filteredFunctions != null && this.filteredFunctions.Count == 1; - } - - /// - /// Handles the navigation command - /// - private void OnNavigateTo(string url) - { - ServiceLocator.GetService().Navigate(url); - } - - #endregion - - #region · Search Logic · - - private void PerformFilter() - { - this.VerifyMatchingOptionEnumerator(); - } - - private void VerifyMatchingOptionEnumerator() - { - // Clear current matching options - this.filteredFunctions.Clear(); - - // Perform filter if needed - if (!String.IsNullOrEmpty(this.filterText)) - { - this.filteredFunctions.AddRange(this.FindMatches(this.filterText)); - } - - // Notify changes - this.NotifyPropertyChanged(() => Functions); - } - - private List FindMatches(string filterText) - { - var nodes = from node in this.rootOption - .ChildNodes - .OfType() - .Traverse(node => ((node.ChildNodes) != null ? node.ChildNodes.OfType() : null)) - where node.Title.StartsWith(filterText, StringComparison.OrdinalIgnoreCase) && (node.ChildNodes == null || node.ChildNodes.Count == 0) - select node; - - return nodes.ToList(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Presentation/Widgets/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Markup; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("chronos")] -[assembly: AssemblyDescription("Desktop Widgets")] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.None //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Widgets")] \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Properties/Settings.Designer.cs --- a/Chronosv2/source/Presentation/Widgets/Properties/Settings.Designer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Chronos.Presentation.Widgets.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int color { - get { - return ((int)(this["color"])); - } - set { - this["color"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool hours24 { - get { - return ((bool)(this["hours24"])); - } - set { - this["hours24"] = value; - } - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/Properties/Settings.settings --- a/Chronosv2/source/Presentation/Widgets/Properties/Settings.settings Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - 0 - - - True - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Widgets/app.config --- a/Chronosv2/source/Presentation/Widgets/app.config Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - - -
- - - - - - 0 - - - True - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/ActiveDesktopChangedInfo.cs --- a/Chronosv2/source/Presentation/Windows/ActiveDesktopChangedInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -using Chronos.Presentation.Core.VirtualDesktops; - -namespace Chronos.Presentation.Windows -{ - /// - /// Actived desktop changed payload - /// - public sealed class ActiveDesktopChangedInfo - { - #region · Fields · - - private IVirtualDesktop newActiveDesktop; - - #endregion - - #region · Properties · - - /// - /// Gets the new active desktop. - /// - /// The new active desktop. - public IVirtualDesktop NewActiveDesktop - { - get { return this.newActiveDesktop; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - /// The new active desktop. - public ActiveDesktopChangedInfo(IVirtualDesktop newActiveDesktop) - { - this.newActiveDesktop = newActiveDesktop; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Chronos.Presentation.Windows.csproj --- a/Chronosv2/source/Presentation/Windows/Chronos.Presentation.Windows.csproj Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {1EC718BA-8BD7-4403-B5B4-1CFD2253D2E7} - library - Properties - Chronos.Presentation.Windows - Chronos.Presentation.Windows - v4.0 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - - - 3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - - - - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - ..\..\..\Lib\NLog\NLog.dll - - - ..\..\..\Lib\nRoute\nRoute.Framework.dll - - - - 3.5 - - - - - - - - - - - - - Properties\SolutionInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - - - - - {AA911078-3A2A-41B1-B779-3C8B55E1B8E3} - Chronos.Extensions - - - {F5F26463-32DA-4685-B361-B984EDF5A5F2} - Chronos.Extensions.Windows - - - {4C9AD768-6AB8-43B1-833A-C8CC520471B1} - Chronos.Presentation.Core - - - {AAB3929F-049B-469A-AAEB-BBABEE03FE0A} - Chronos.Presentation.ViewModel - - - - - 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 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/Desktop.cs --- a/Chronosv2/source/Presentation/Windows/Controls/Desktop.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +0,0 @@ -/* -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.Diagnostics; -using System.Linq; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using Chronos.Extensions.Windows; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.ViewModel; - -namespace Chronos.Presentation.Windows.Controls -{ - /// - /// Virtual desktop representation using a control - /// - public class Desktop - : Canvas - { - #region · Dependency Properties · - - /// - /// Identifies the Id dependency property. - /// - public static readonly DependencyProperty IdProperty = - DependencyProperty.Register("Id", typeof(Guid), typeof(Desktop), - new FrameworkPropertyMetadata(Guid.NewGuid())); - - #endregion - - #region · Routed Commands · - - public static RoutedCommand GroupCommand = new RoutedCommand(); - - #endregion - - #region · Static Constructor · - - /// - /// Initializes the class. - /// - static Desktop() - { - Desktop.DefaultStyleKeyProperty.OverrideMetadata(typeof(Desktop), - new FrameworkPropertyMetadata(typeof(Desktop))); - - KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata( - typeof(Desktop), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); - } - - #endregion - - #region · Fields · - - private Point? rubberbandSelectionStartPoint; - private SelectionService selectionService; - - #endregion - - #region · Properties · - - /// - /// Gets or sets the element id. - /// - /// The id. - public Guid Id - { - get { return (Guid)base.GetValue(IdProperty); } - set { base.SetValue(IdProperty, value); } - } - - #endregion - - #region · Internal Properties · - - internal SelectionService SelectionService - { - get - { - if (this.selectionService == null) - { - this.selectionService = new SelectionService(this); - } - - return this.selectionService; - } - } - - #endregion - - #region · Constructor · - - /// - /// Initializes a new instance of the class. - /// - public Desktop() - : base() - { - this.CommandBindings.Add(new CommandBinding(Desktop.GroupCommand, GroupExecuted, CanGroup)); - } - - #endregion - - #region · Methods · - - /// - /// Adds the new desktop element. - /// - /// The new desktop element. - /// The position. - public void AddElement(DesktopElement element) - { - element.Parent = this; - - this.Children.Add(element); - - this.DeactivateAll(); - element.Activate(); - } - - /// - /// Adds the new desktop element. - /// - /// The new desktop element. - /// The position. - public void AddElement(DesktopElement element, Point position) - { - element.Parent = this; - - this.Children.Add(element); - - element.Move(Math.Max(0, position.X), Math.Max(0, position.Y)); - element.SetZIndex(0); - - this.DeactivateAll(); - element.Activate(); - } - - /// - /// Removes the given element from the desktop. - /// - /// The element. - public void RemoveElement(DesktopElement instance) - { - Debug.Assert(instance is UIElement, "instance"); - - this.Children.Remove(instance as UIElement); - } - - public void Activate() - { - // Deactivate all Desktop elements - this.DeactivateAll(); - - this.SetFocus(); - } - - #endregion - - #region · Mouse Handling Methods · - - /// - /// Invoked when an unhandled  attached event - /// reaches an element in its route that is derived from this class. - /// Implement this method to add class handling for this event. - /// - /// The - /// that contains the event data. This event data reports details about the mouse button that was pressed and the handled state. - /// - protected override void OnMouseDown(MouseButtonEventArgs e) - { - if (Object.ReferenceEquals(e.Source, this)) - { - this.Activate(); - - // in case that this click is the start of a - // drag operation we cache the start point - this.rubberbandSelectionStartPoint = new Point?(e.GetPosition(this)); - - // if you click directly on the canvas all - // selected items are 'de-selected' - SelectionService.ClearSelection(); - - e.Handled = true; - } - - base.OnMouseDown(e); - } - - /// - /// Invoked when an unhandled  attached event - /// reaches an element in its route that is derived from this class. - /// Implement this method to add class handling for this event. - /// - /// The that contains the event data. - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - // if mouse button is not pressed we have no drag operation, ... - if (e.LeftButton != MouseButtonState.Pressed) - { - this.rubberbandSelectionStartPoint = null; - } - else if (this.rubberbandSelectionStartPoint.HasValue) // ... but if mouse button is pressed and start - // point value is set we do have one - { - // create rubberband adorner - AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); - - if (adornerLayer != null) - { - RubberbandAdorner adorner = new RubberbandAdorner(this, rubberbandSelectionStartPoint); - - if (adorner != null) - { - adornerLayer.Add(adorner); - } - } - - e.Handled = true; - } - } - - #endregion - - #region · Internal Methods · - - /// - /// Called when a gets activated. - /// - /// The id. - internal void OnActivatedElement(Guid id) - { - this.InvokeAsynchronouslyInBackground - ( - () => - { - this.Children.OfType() - .Where(e => e.Id != id) - .ToList() - .ForEach(element => element.Deactivate()); - } - ); - } - - #endregion - - #region · Private Methods · - - private void GroupExecuted(object sender, ExecutedRoutedEventArgs e) - { - var items = from item in this.SelectionService.CurrentSelection.OfType() - select item; - - ShortcutGroupElement group = new ShortcutGroupElement(); - ShortcutGroupViewModel vm = new ShortcutGroupViewModel(); - Point position = items.First().GetPosition(); - - foreach (DesktopElement item in items) - { - vm.Shortcuts.Add(item.DataContext as IShortcutViewModel); - - this.RemoveElement(item); - } - - group.DataContext = vm; - - this.SelectionService.ClearSelection(); - - this.InvokeAsynchronouslyInBackground - ( - () => - { - this.AddElement(group, position); - } - ); - } - - private void CanGroup(object sender, CanExecuteRoutedEventArgs e) - { - int count = (from item in this.SelectionService.CurrentSelection.OfType() - select item).Count(); - - e.CanExecute = (count > 1); - } - - private void DeactivateAll() - { - this.InvokeAsynchronouslyInBackground - ( - () => - { - this.SelectionService.ClearSelection(); - - this.Children - .OfType() - .ToList() - .ForEach(element => element.Deactivate()); - } - ); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/DesktopElement.cs --- a/Chronosv2/source/Presentation/Windows/Controls/DesktopElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,865 +0,0 @@ -/* -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.Controls; -using System.Windows.Input; -using Chronos.Extensions.Windows; -using Chronos.Presentation.Core.Windows; - -namespace Chronos.Presentation.Windows.Controls -{ - /// - /// Base class for elements (shortcuts, widgets,...) - /// - [TemplatePart(Name = DesktopElement.PART_Dragger, Type = typeof(FrameworkElement))] - public abstract class DesktopElement - : ContentControl, IDesktopElement, IActiveAware - { - #region · Constants · - - protected const string PART_Dragger = "PART_Dragger"; - protected const int ResizeSideThichness = 5; - protected const int ResizeCornerSize = 5; - - #endregion - - #region · Dependency Properties · - - /// - /// Identifies the Id dependency property. - /// - public static readonly DependencyProperty IdProperty = - DependencyProperty.Register("Id", typeof(Guid), typeof(DesktopElement), - new FrameworkPropertyMetadata(Guid.NewGuid())); - - /// - /// Identifies the WindowStartupLocation dependency property. - /// - public static readonly DependencyProperty StartupLocationProperty = - DependencyProperty.Register("StartupLocation", typeof(StartupPosition), typeof(WindowElement), - new FrameworkPropertyMetadata(StartupPosition.CenterParent, FrameworkPropertyMetadataOptions.AffectsArrange)); - - /// - /// Identifies the CanResize dependency property. - /// - public static readonly DependencyProperty CanResizeProperty = - DependencyProperty.Register("CanResize", typeof(bool), typeof(DesktopElement), - new FrameworkPropertyMetadata(true)); - - /// - /// Identifies the CanDrag dependency property. - /// - public static readonly DependencyProperty CanDragProperty = - DependencyProperty.Register("CanDrag", typeof(bool), typeof(DesktopElement), - new FrameworkPropertyMetadata(true)); - - /// - /// Identifies the CanClose dependency property. - /// - public static readonly DependencyProperty CanCloseProperty = - DependencyProperty.Register("CanClose", typeof(bool), typeof(DesktopElement), - new FrameworkPropertyMetadata(true)); - - /// - /// Identifies the ConstraintToParent dependency property. - /// - public static readonly DependencyProperty ConstraintToParentProperty = - DependencyProperty.Register("ConstraintToParent", typeof(bool), typeof(DesktopElement), - new FrameworkPropertyMetadata(false)); - - /// - /// Identifies the IsActive dependency property - /// - public static readonly DependencyProperty IsActiveProperty = - DependencyProperty.Register("IsActive", - typeof(bool), - typeof(DesktopElement), - new FrameworkPropertyMetadata(false)); - - #endregion - - #region · Static Constructors · - - /// - /// Initializes the class. - /// - static DesktopElement() - { - // set the key to reference the style for this control - FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata( - typeof(DesktopElement), new FrameworkPropertyMetadata(typeof(DesktopElement))); - } - - #endregion - - #region · Static Routed Events · - - /// - /// Occurs when a desktop element is activated - /// - public static readonly RoutedEvent ActivatedEvent = EventManager. - RegisterRoutedEvent("Activated", RoutingStrategy.Bubble, - typeof(RoutedEventHandler), typeof(DesktopElement)); - - /// - /// Occurs when a desktop element is deactivated - /// - public static readonly RoutedEvent DeactivatedEvent = EventManager. - RegisterRoutedEvent("Deactivated", RoutingStrategy.Bubble, - typeof(RoutedEventHandler), typeof(DesktopElement)); - - #endregion - - #region · Events · - - /// - /// Occurs when the element becomes activated - /// - public event RoutedEventHandler Activated - { - add { base.AddHandler(DesktopElement.ActivatedEvent, value); } - remove { base.RemoveHandler(DesktopElement.ActivatedEvent, value); } - } - - /// - /// Occurs when the element becomes deactivated - /// - public event RoutedEventHandler Deactivated - { - add { base.AddHandler(DesktopElement.DeactivatedEvent, value); } - remove { base.RemoveHandler(DesktopElement.DeactivatedEvent, value); } - } - - #endregion - - #region · Fields · - - private Panel parent; - private FrameworkElement partDragger; - private DragOrResizeStatus previewDragOrResizeStatus; - private DragOrResizeStatus dragOrResizeStatus; - private Point startMousePosition; - private Point previousMousePosition; - private Point oldPosition; - private Size originalSize; - private Size previousSize; - private bool isInitialized; - private bool oldCanResize; - - #endregion - - #region · Properties · - - /// - /// Gets or sets the element id. - /// - /// The id. - public Guid Id - { - get { return (Guid)base.GetValue(IdProperty); } - set { base.SetValue(IdProperty, value); } - } - - /// - /// Gets the window parent control - /// - public new Panel Parent - { - get { return this.parent; } - set { this.parent = value; } - } - - /// - /// Gets or sets the position of the window when first shown. - /// - public StartupPosition StartupLocation - { - get { return (StartupPosition)base.GetValue(StartupLocationProperty); } - set { base.SetValue(StartupLocationProperty, value); } - } - - /// - /// Gets or sets a value indicating whether the element can be resized - /// - public bool CanResize - { - get { return (bool)base.GetValue(CanResizeProperty); } - set { base.SetValue(CanResizeProperty, value); } - } - - /// - /// Gets a value indicating whether the element can be dragged. - /// - /// true if this instance can drag; otherwise, false. - public virtual bool CanDrag - { - get { return (bool)base.GetValue(CanDragProperty); } - set { base.SetValue(CanDragProperty, value); } - } - - /// - /// Gets a value indicating whether the element can be closed. - /// - /// true if this instance can be closed; otherwise, false. - public virtual bool CanClose - { - get { return (bool)base.GetValue(CanCloseProperty); } - set { base.SetValue(CanCloseProperty, value); } - } - - /// - /// Gets a value indicating whether the element should be constrained to parent. - /// - /// true if this instance can drag; otherwise, false. - public virtual bool ConstraintToParent - { - get { return (bool)base.GetValue(ConstraintToParentProperty); } - set { base.SetValue(ConstraintToParentProperty, value); } - } - - /// - /// Gets or sets a value indicating whether the element is active. - /// - /// - /// true if this instance is active; otherwise, false. - /// - public virtual bool IsActive - { - get { return (bool)base.GetValue(IsActiveProperty); } - } - - #endregion - - #region · Protected Properties · - - /// - /// Gets the current drag or resize status - /// - protected DragOrResizeStatus DragOrResizeStatus - { - get { return this.dragOrResizeStatus; } - } - - /// - /// Gets or sets the old element position. - /// - protected Point OldPosition - { - get { return this.oldPosition; } - set { this.oldPosition = value; } - } - - /// - /// Gets or sets the original element size - /// - protected Size OriginalSize - { - get { return this.originalSize; } - set { this.originalSize = value; } - } - - /// - /// Gets the parent . - /// - /// The parent desktop. - protected Desktop ParentDesktop - { - //get { return this.GetParent(); } - get { return this.parent as Desktop; } - } - - protected FrameworkElement PartDragger - { - get { return this.partDragger; } - set { this.partDragger = value; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - protected DesktopElement() - { - this.previewDragOrResizeStatus = DragOrResizeStatus.None; - this.dragOrResizeStatus = DragOrResizeStatus.None; - this.startMousePosition = new Point(); - this.oldCanResize = this.CanResize; - } - - #endregion - - #region · Methods · - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - - this.PartDragger = this.GetTemplateChild(DesktopElement.PART_Dragger) as FrameworkElement; - } - - /// - /// Attempts to bring the element to the foreground and activates it. - /// - public void Activate() - { - this.OnActivated(); - } - - /// - /// Deactivates the element - /// - public void Deactivate() - { - this.OnDeactivated(); - } - - /// - /// Closes the desktop element - /// - public virtual void Close() - { - if (this.Parent != null) - { - this.Parent.Children.Remove(this); - } - - // Clean up - this.Id = Guid.Empty; - this.previewDragOrResizeStatus = DragOrResizeStatus.None; - this.dragOrResizeStatus = DragOrResizeStatus.None; - this.startMousePosition = new Point(); - this.previousMousePosition = new Point(); - this.oldPosition = new Point(); - this.previousSize = Size.Empty; - this.originalSize = Size.Empty; - this.isInitialized = false; - this.oldCanResize = false; - this.partDragger = null; - this.parent = null; - this.Content = null; - this.DataContext = null; - } - - #endregion - - #region · Protected Methods · - - /// - /// Raises the event, using the specified information as part of the eventual event data. - /// - /// Details of the old and new size involved in the change. - protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) - { - base.OnRenderSizeChanged(sizeInfo); - - if (!this.isInitialized) - { - this.RefreshCalculatedVisualProperties(); - - this.OriginalSize = new Size(this.ActualWidth, this.ActualHeight); - this.isInitialized = true; - } - } - - protected void RefreshCalculatedVisualProperties() - { - if (!DesignMode.IsInDesignMode) - { - switch (this.StartupLocation) - { - case StartupPosition.CenterParent: - if (!this.ConstraintToParent && - this.GetParent() != null) - { - this.MoveElement - ( - (this.GetParent().ActualWidth - this.ActualWidth) / 2, - (this.GetParent().ActualHeight - this.ActualHeight) / 2 - (this.GetParent().ActualHeight - this.Parent.ActualHeight) - ); - } - else if (this.Parent != null) - { - this.MoveElement - ( - (this.Parent.ActualWidth - this.ActualWidth) / 2, - (this.Parent.ActualHeight - this.ActualHeight) / 2 - ); - } - break; - - case StartupPosition.Manual: - break; - - case StartupPosition.WindowsDefaultLocation: - this.MoveElement(5, 5); - break; - } - } - } - - /// - /// Raises the event. - /// - protected virtual void OnActivated() - { - if (!(bool)this.GetValue(DesktopElement.IsActiveProperty)) - { - if (this.ParentDesktop != null) - { - this.ParentDesktop.OnActivatedElement(this.Id); - this.ParentDesktop.BringToFront(this); - } - - this.GiveFocus(); - - base.SetValue(DesktopElement.IsActiveProperty, true); - - RoutedEventArgs e = new RoutedEventArgs(DesktopElement.ActivatedEvent, this); - base.RaiseEvent(e); - } - } - - /// - /// Raises the event. - /// - protected virtual void OnDeactivated() - { - if (this.IsActive) - { - base.SetValue(DesktopElement.IsActiveProperty, false); - - RoutedEventArgs e = new RoutedEventArgs(DesktopElement.DeactivatedEvent, this); - base.RaiseEvent(e); - } - } - - /// - /// Focuses the element - /// - protected virtual void GiveFocus() - { - this.SetFocus(); - } - - #endregion - - #region · Protected Element Move/Resize Methods · - - protected virtual void MoveElement(double x, double y) - { - this.Move(x, y); - } - - protected virtual void MoveElementLeft(double value) - { - this.MoveLeft(value); - } - - protected virtual void MoveElementTop(double value) - { - this.MoveTop(value); - } - - protected virtual void AdjustBounds(Point mousePosition) - { - Point position = this.GetPosition(); - - if (this.Parent != null) - { - Vector changeFromStart = Point.Subtract(mousePosition, this.startMousePosition); - - if (this.dragOrResizeStatus == DragOrResizeStatus.Drag) - { - if (this.CanDrag) - { - double x = position.X + changeFromStart.X; - double y = position.Y + changeFromStart.Y; - - if (this.ConstraintToParent) - { - if (x < 0) - { - x = 0; - } - if (y < 0) - { - y = 0; - } - if (y + this.ActualHeight > this.ParentDesktop.ActualHeight) - { - y = this.ParentDesktop.ActualHeight - this.ActualHeight; - } - if (x + this.ActualWidth > this.ParentDesktop.ActualWidth) - { - x = this.ParentDesktop.ActualWidth - this.ActualWidth; - } - } - - if (x != position.X || y != position.Y) - { - this.MoveElement(x, y); - } - } - } - else - { - Size size = this.RenderSize; - Vector changeFromPrevious = Point.Subtract(mousePosition, this.previousMousePosition); - - if (this.dragOrResizeStatus.IsOnRight) - { - if (size.Width + changeFromPrevious.X > this.MinWidth) - { - size.Width += changeFromPrevious.X; - } - } - else if (this.dragOrResizeStatus.IsOnLeft) - { - if (size.Width - changeFromStart.X > this.MinWidth) - { - this.MoveElementLeft(position.X + changeFromStart.X); - size.Width -= changeFromStart.X; - } - } - - if (this.dragOrResizeStatus.IsOnBottom) - { - if (size.Height + changeFromPrevious.Y > this.MinHeight) - { - size.Height += changeFromPrevious.Y; - } - } - else if (this.dragOrResizeStatus.IsOnTop) - { - if (size.Height - changeFromStart.Y > this.MinHeight) - { - this.MoveElementTop(position.Y + changeFromStart.Y); - size.Height -= changeFromStart.Y; - } - } - - this.Width = size.Width; - this.Height = size.Height; - } - } - } - - #endregion - - #region · Mouse Handling Methods · - - /// - /// Invoked when an unhandled attached routed event - /// reaches an element in its route that is derived from this class. - /// Implement this method to add class handling for this event. - /// - /// - /// The that contains the event data. - /// The event data reports that one or more mouse buttons were pressed. - /// - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - if (!this.IsActive) - { - this.OnActivated(); - } - - base.OnPreviewMouseDown(e); - } - - /// - /// Invoked when an unhandled  routed event - /// reaches an element in its route that is derived from this class. - /// Implement this method to add class handling for this event. - /// - /// - /// The that contains the event data. - /// The event data reports that the left mouse button was pressed. - /// - protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) - { - if (!e.Handled - && e.ClickCount == 1 - && e.Source == this) - { - if (this.dragOrResizeStatus == DragOrResizeStatus.None && - this.previewDragOrResizeStatus != DragOrResizeStatus.None) - { - e.Handled = true; - - this.dragOrResizeStatus = this.previewDragOrResizeStatus; - this.startMousePosition = this.previousMousePosition = e.GetPosition(this); - - this.CaptureMouse(); - } - } - - base.OnPreviewMouseLeftButtonDown(e); - } - - /// - /// Invoked when an unhandled  attached event - /// reaches an element in its route that is derived from this class. - /// Implement this method to add class handling for this event. - /// - /// The that contains the event data. - protected override void OnPreviewMouseMove(MouseEventArgs e) - { - if (this.dragOrResizeStatus == DragOrResizeStatus.None) - { - // http://www.switchonthecode.com/tutorials/wpf-snippet-reliably-getting-the-mouse-position - Point point = e.GetPosition(this); - - this.previewDragOrResizeStatus = this.GetDragOrResizeMode(point); - - if (!this.CanResize - && this.previewDragOrResizeStatus != DragOrResizeStatus.Drag - && this.previewDragOrResizeStatus != DragOrResizeStatus.None) - { - this.previewDragOrResizeStatus = DragOrResizeStatus.None; - } - - this.SetResizeCursor(this.previewDragOrResizeStatus); - } - else if (this.IsMouseCaptured) - { - if (e.MouseDevice.LeftButton == MouseButtonState.Pressed) - { - // http://www.switchonthecode.com/tutorials/wpf-snippet-reliably-getting-the-mouse-position - Point point = e.GetPosition(this); - - if (Math.Abs(point.X - this.previousMousePosition.X) > SystemParameters.MinimumHorizontalDragDistance || - Math.Abs(point.Y - this.previousMousePosition.Y) > SystemParameters.MinimumVerticalDragDistance) - { - e.Handled = true; - - this.AdjustBounds(point); - this.previousMousePosition = point; - } - } - else - { - this.CancelDragOrResize(); - } - } - else - { - this.CancelDragOrResize(); - } - - base.OnPreviewMouseMove(e); - } - - /// - /// Invoked when an unhandled  routed event reaches an element - /// in its route that is derived from this class. Implement this method to add class handling for this event. - /// - /// - /// The that contains the event data. The event data reports - /// that the left mouse button was released. - /// - protected override void OnPreviewMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e) - { - if (this.IsMouseCaptured) - { - e.Handled = true; - this.CancelDragOrResize(); - } - - base.OnPreviewMouseLeftButtonUp(e); - } - - #endregion - - #region · Drag and Resize Methods · - - private DragOrResizeStatus GetDragOrResizeMode(Point position) - { - DragOrResizeStatus status = DragOrResizeStatus.None; - - if (this.CanDrag && - this.partDragger != null && - this.partDragger.IsMouseOver) - { - status = DragOrResizeStatus.Drag; - } - else if (this.CanResize) - { - if (position.X <= ResizeSideThichness) // left - { - status = this.GetLeftDragStatus(position); - } - else if (this.ActualWidth - position.X <= ResizeSideThichness) // right - { - status = this.GetRightDragStatus(position); - } - else if (position.Y <= ResizeSideThichness) // top - { - status = this.GetTopDragStatus(position); - } - else if (this.ActualHeight - position.Y <= ResizeSideThichness) // bottom - { - status = this.GetBottomDragStatus(position); - } - } - - return status; - } - - private DragOrResizeStatus GetBottomDragStatus(Point position) - { - DragOrResizeStatus status; - - if (position.X <= ResizeCornerSize) - { - status = DragOrResizeStatus.BottomLeft; - } - else if (this.ActualWidth - position.X <= ResizeCornerSize) - { - status = DragOrResizeStatus.BottomRight; - } - else - { - status = DragOrResizeStatus.BottomCenter; - } - - return status; - } - - private DragOrResizeStatus GetTopDragStatus(Point position) - { - DragOrResizeStatus status; - - if (position.X <= ResizeCornerSize) - { - status = DragOrResizeStatus.TopLeft; - } - else if (this.ActualWidth - position.X <= ResizeCornerSize) - { - status = DragOrResizeStatus.TopRight; - } - else - { - status = DragOrResizeStatus.TopCenter; - } - - return status; - } - - private DragOrResizeStatus GetRightDragStatus(Point position) - { - DragOrResizeStatus status; - - if (position.Y <= ResizeCornerSize) - { - status = DragOrResizeStatus.TopRight; - } - else if (this.ActualHeight - position.Y <= ResizeCornerSize) - { - status = DragOrResizeStatus.BottomRight; - } - else - { - status = DragOrResizeStatus.MiddleRight; - } - - return status; - } - - private DragOrResizeStatus GetLeftDragStatus(Point position) - { - DragOrResizeStatus status; - - if (position.Y <= ResizeCornerSize) - { - status = DragOrResizeStatus.TopLeft; - } - else if (this.ActualHeight - position.Y <= ResizeCornerSize) - { - status = DragOrResizeStatus.BottomLeft; - } - else - { - status = DragOrResizeStatus.MiddleLeft; - } - - return status; - } - - private void CancelDragOrResize() - { - this.Cursor = null; - this.dragOrResizeStatus = DragOrResizeStatus.None; - this.previewDragOrResizeStatus = DragOrResizeStatus.None; - - this.ReleaseMouseCapture(); - } - - private void SetResizeCursor(DragOrResizeStatus resizeStatus) - { - if (this.CanResize || this.CanDrag) - { - if (resizeStatus.IsDragging) - { - this.Cursor = null; - } - else if (resizeStatus.IsOnTopLeftOrBottomRight) - { - this.Cursor = Cursors.SizeNWSE; - } - else if (resizeStatus.IsOnTopRightOrBottomLeft) - { - this.Cursor = Cursors.SizeNESW; - } - else if (resizeStatus.IsOnTopRightOrBottomLeft) - { - this.Cursor = Cursors.SizeNESW; - } - else if (resizeStatus.IsOnTopCenterOrBottomCenter) - { - this.Cursor = Cursors.SizeNS; - } - else if (resizeStatus.IsOnMiddleLeftOrMiddleRight) - { - this.Cursor = Cursors.SizeWE; - } - else if (this.Cursor != null) - { - this.Cursor = null; - } - } - else if (this.Cursor != null) - { - this.Cursor = null; - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/DragOrResizeStatus.cs --- a/Chronosv2/source/Presentation/Windows/Controls/DragOrResizeStatus.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -using System; - -namespace Chronos.Presentation.Windows.Controls -{ - /// - /// Structure for the possible drag and/or resize statuses - /// - [Serializable] - public struct DragOrResizeStatus - { - #region · Consts · - - const byte _TopLeft = 9; - const byte _TopCenter = 10; - const byte _TopRight = 12; - const byte _MiddleLeft = 17; - const byte _Drag = 18; - const byte _MiddleRight = 20; - const byte _BottomLeft = 33; - const byte _BottomCenter = 34; - const byte _BottomRight = 36; - const byte _Left = 1; - const byte _HMiddle = 2; - const byte _Right = 4; - const byte _Top = 8; - const byte _VCenter = 16; - const byte _Bottom = 32; - - #endregion - - #region · Static Members · - - /// - /// No resize or drag status - /// - public static readonly DragOrResizeStatus None = new DragOrResizeStatus { value = 0 }; - /// - /// Identifies the top/left resize status - /// - public static readonly DragOrResizeStatus TopLeft = new DragOrResizeStatus { value = _TopLeft }; - /// - /// Identifies the top/center resize status - /// - public static readonly DragOrResizeStatus TopCenter = new DragOrResizeStatus { value = _TopCenter }; - /// - /// /// Identifies the top/right resize status - /// - public static readonly DragOrResizeStatus TopRight = new DragOrResizeStatus { value = _TopRight }; - /// - /// /// Identifies the middle/left resize status - /// - public static readonly DragOrResizeStatus MiddleLeft = new DragOrResizeStatus { value = _MiddleLeft }; - /// - /// Identifies the dragging status - /// - public static readonly DragOrResizeStatus Drag = new DragOrResizeStatus { value = _Drag }; - /// - /// Identifies the middle/right resize status - /// - public static readonly DragOrResizeStatus MiddleRight = new DragOrResizeStatus { value = _MiddleRight }; - /// - /// /// Identifies the bottom/left resize status - /// - public static readonly DragOrResizeStatus BottomLeft = new DragOrResizeStatus { value = _BottomLeft }; - /// - /// Identifies the bottom/center resize status - /// - public static readonly DragOrResizeStatus BottomCenter = new DragOrResizeStatus { value = _BottomCenter }; - /// - /// Identifies the bottom/right resize status - /// - public static readonly DragOrResizeStatus BottomRight = new DragOrResizeStatus { value = _BottomRight }; - - #endregion - - #region · Operators · - - /// - /// Implements the operator ==. - /// - /// The x. - /// The y. - /// The result of the operator. - public static bool operator ==(DragOrResizeStatus x, DragOrResizeStatus y) - { - return x.Equals(y); - } - - /// - /// Implements the operator !=. - /// - /// The x. - /// The y. - /// The result of the operator. - public static bool operator !=(DragOrResizeStatus x, DragOrResizeStatus y) - { - return !x.Equals(y); - } - - #endregion - - #region · Fields · - - private byte value; - - #endregion - - #region · Properties · - - /// - /// Gets a value the resize status is on left. - /// - public bool IsOnLeft - { - get { return (this.value & _Left) == _Left; } - } - - /// - /// Gets a value the resize status is on horizontal middle. - /// - public bool IsOnHMiddle - { - get { return (this.value & _HMiddle) == _HMiddle; } - } - - /// - /// Gets a value the resize status is on right. - /// - public bool IsOnRight - { - get { return (this.value & _Right) == _Right; } - } - - /// - /// Gets a value the resize status is on top. - /// - public bool IsOnTop - { - get { return (this.value & _Top) == _Top; } - } - - /// - /// Gets a value the resize status is on vertical center. - /// - public bool IsOnVCenter - { - get { return (this.value & _VCenter) == _VCenter; } - } - - /// - /// Gets a value the resize status is on bottom. - /// - public bool IsOnBottom - { - get { return (this.value & _Bottom) == _Bottom; } - } - - /// - /// Gets a value the resize status is on top/left or bottom/right. - /// - public bool IsOnTopLeftOrBottomRight - { - get { return this.value == _TopLeft || this.value == _BottomRight; } - } - - /// - /// Gets a value the resize status is on top/right or bottom/center. - /// - public bool IsOnTopRightOrBottomLeft - { - get { return this.value == _TopRight || this.value == _BottomLeft; } - } - - /// - /// Gets a value the resize status is on top/center or bottom/center. - /// - public bool IsOnTopCenterOrBottomCenter - { - get { return this.value == _TopCenter || this.value == _BottomCenter; } - } - - /// - /// Gets a value the resize status is on middle/left or middle/right. - /// - public bool IsOnMiddleLeftOrMiddleRight - { - get { return this.value == _MiddleLeft || this.value == _MiddleRight; } - } - - /// - /// Gets a value the status is dragging - /// - public bool IsDragging - { - get { return this.value == _Drag; } - } - - #endregion - - #region · Methods · - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - if (obj == null || this.GetType() != obj.GetType()) - { - return false; - } - - return ((DragOrResizeStatus)obj).value == this.value; - } - - /// - /// Returns a hash code for this instance. - /// - /// - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. - /// - public override int GetHashCode() - { - return this.value.GetHashCode(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/MessageWindowElement.cs --- a/Chronosv2/source/Presentation/Windows/Controls/MessageWindowElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -/* -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.Input; -using Chronos.Extensions.Windows; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Windows; -using nRoute.Services; - -namespace Chronos.Presentation.Windows.Controls -{ - /// - /// Provides the ability to create modal message windows (like messageboxes) - /// - public sealed class MessageWindowElement - : WindowElement - { - #region · Dependency Properties · - - /// - /// Identifies the Buttons dependency property. - /// - public static readonly DependencyProperty ButtonsProperty = - DependencyProperty.Register("Buttons", typeof(DialogButton), typeof(MessageWindowElement), - new FrameworkPropertyMetadata(DialogButton.Ok)); - - #endregion - - #region · Sync Object · - - static readonly object SyncObject = new object(); - - #endregion - - #region · Static Commands · - - /// - /// Accept command - /// - public static RoutedCommand AcceptCommand; - - /// - /// Cancel command - /// - public static RoutedCommand CancelCommand; - - #endregion - - #region · Static Constructors · - - /// - /// Initializes the class. - /// - static MessageWindowElement() - { - MessageWindowElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(MessageWindowElement), - new FrameworkPropertyMetadata(typeof(MessageWindowElement))); - - KeyboardNavigation.IsTabStopProperty.OverrideMetadata(typeof(MessageWindowElement), - new FrameworkPropertyMetadata(false)); - - MessageWindowElement.AcceptCommand = new RoutedCommand("Accept", typeof(MessageWindowElement)); - MessageWindowElement.CancelCommand = new RoutedCommand("Cancel", typeof(MessageWindowElement)); - } - - #endregion - - #region · Show "Factory" Methods · - - /// - /// Shows a new with the given message - /// - /// - /// - public static DialogResult Show(string message) - { - return MessageWindowElement.Show("Message", message, DialogButton.OkCancel); - } - - /// - /// Shows a new with the given caption and message - /// - /// - /// - /// - public static DialogResult Show(string caption, string message) - { - return MessageWindowElement.Show(caption, message, DialogButton.OkCancel); - } - - /// - /// Shows a new with the given caption, message and buttons - /// - /// - /// - /// - /// - public static DialogResult Show(string caption, string message, DialogButton buttons) - { - lock (SyncObject) - { - DialogResult result = DialogResult.None; - - System.Windows.Application.Current.Dispatcher.Invoke( - (Action)delegate - { - MessageWindowElement window = new MessageWindowElement - { - Title = caption, - Content = message, - Buttons = buttons, - StartupLocation = StartupPosition.CenterParent - }; - - result = ServiceLocator.GetService().ShowDialog(window); - }); - - return result; - } - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets the button combination to be shown - /// - public DialogButton Buttons - { - get { return (DialogButton)base.GetValue(MessageWindowElement.ButtonsProperty); } - set { base.SetValue(MessageWindowElement.ButtonsProperty, value); } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class - /// - public MessageWindowElement() - : base() - { - CommandBinding bindinAccept = new CommandBinding(MessageWindowElement.AcceptCommand, new ExecutedRoutedEventHandler(OnAccept)); - this.CommandBindings.Add(bindinAccept); - - CommandBinding bindingCancel = new CommandBinding(MessageWindowElement.CancelCommand, new ExecutedRoutedEventHandler(OnCancel)); - this.CommandBindings.Add(bindingCancel); - } - - #endregion - - #region · Protected Methods · - - /// - /// Focuses the window - /// - protected override void GiveFocus() - { - this.SetFocus(); - } - - #endregion - - #region · Command Actions · - - private void OnAccept(object sender, ExecutedRoutedEventArgs e) - { - if (this.Buttons == DialogButton.Ok || - this.Buttons == DialogButton.OkCancel) - { - this.DialogResult = DialogResult.Ok; - } - else - { - this.DialogResult = DialogResult.Yes; - } - - this.Hide(); - } - - private void OnCancel(object sender, ExecutedRoutedEventArgs e) - { - if (this.Buttons == DialogButton.OkCancel) - { - this.DialogResult = DialogResult.Cancel; - } - else - { - this.DialogResult = DialogResult.No; - } - - this.Hide(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/ShortcutElement.cs --- a/Chronosv2/source/Presentation/Windows/Controls/ShortcutElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -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.Controls; -using System.Windows.Input; - -namespace Chronos.Presentation.Windows.Controls -{ - /// - /// Provides the ability to display shortcuts in a control. - /// - public sealed class ShortcutElement - : DesktopElement, ISelectable - { - #region · Dependency Properties · - - /// - /// Identifies the IsSelected dependency property - /// - public static readonly DependencyProperty IsSelectedProperty = - DependencyProperty.Register("IsSelected", - typeof(bool), - typeof(ShortcutElement), - new FrameworkPropertyMetadata(false)); - - #endregion - - #region · Static Constructors · - - /// - /// Initializes the class. - /// - static ShortcutElement() - { - // set the key to reference the style for this control - ShortcutElement.DefaultStyleKeyProperty.OverrideMetadata( - typeof(ShortcutElement), new FrameworkPropertyMetadata(typeof(ShortcutElement))); - - Control.IsTabStopProperty.OverrideMetadata(typeof(ShortcutElement), - new FrameworkPropertyMetadata(false)); - - KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata( - typeof(ShortcutElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.None)); - - KeyboardNavigation.TabNavigationProperty.OverrideMetadata( - typeof(ShortcutElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.None)); - - KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata( - typeof(ShortcutElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.None)); - } - - #endregion - - #region · ISelectable Members · - - public Guid ParentId - { - get; - set; - } - - public bool IsSelected - { - get { return (bool)base.GetValue(IsSelectedProperty); } - set { base.SetValue(IsSelectedProperty, value); } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public ShortcutElement() - : base() - { - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/ShortcutGroupElement.cs --- a/Chronosv2/source/Presentation/Windows/Controls/ShortcutGroupElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; - -namespace Chronos.Presentation.Windows.Controls -{ - public sealed class ShortcutGroupElement - : DesktopElement, ISelectable - { - #region · Dependency Properties · - - /// - /// Identifies the IsSelected dependency property - /// - public static readonly DependencyProperty IsSelectedProperty = - DependencyProperty.Register("IsSelected", - typeof(bool), - typeof(ShortcutGroupElement), - new FrameworkPropertyMetadata(false)); - - #endregion - - #region · Static Constructors · - - /// - /// Initializes the class. - /// - static ShortcutGroupElement() - { - // set the key to reference the style for this control - ShortcutGroupElement.DefaultStyleKeyProperty.OverrideMetadata( - typeof(ShortcutGroupElement), new FrameworkPropertyMetadata(typeof(ShortcutGroupElement))); - - Control.IsTabStopProperty.OverrideMetadata(typeof(ShortcutGroupElement), - new FrameworkPropertyMetadata(false)); - - KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata( - typeof(ShortcutGroupElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.None)); - - KeyboardNavigation.TabNavigationProperty.OverrideMetadata( - typeof(ShortcutGroupElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.None)); - - KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata( - typeof(ShortcutGroupElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.None)); - } - - #endregion - - #region · ISelectable Members · - - public Guid ParentId - { - get; - set; - } - - public bool IsSelected - { - get { return (bool)base.GetValue(IsSelectedProperty); } - set { base.SetValue(IsSelectedProperty, value); } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public ShortcutGroupElement() - : base() - { - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/WidgetElement.cs --- a/Chronosv2/source/Presentation/Windows/Controls/WidgetElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,270 +0,0 @@ -/* -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.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Media; -using Chronos.Extensions.Windows; - -namespace Chronos.Presentation.Windows.Controls -{ - /// - /// Provides the ability to create, configure, show, and manage the lifetime of widgets - /// - [TemplatePart(Name = WidgetElement.PART_MinimizeButton, Type = typeof(ButtonBase))] - [TemplatePart(Name = WidgetElement.PART_CloseButton, Type = typeof(ButtonBase))] - [TemplatePart(Name = WidgetElement.PART_ContentPresenter, Type = typeof(ContentPresenter))] - public class WidgetElement - : DesktopElement - { - #region · Constants · - - private const string PART_ContentPresenter = "PART_ContentPresenter"; - private const string PART_MinimizeButton = "PART_MinimizeButton"; - private const string PART_CloseButton = "PART_CloseButton"; - - #endregion - - #region · Dependency Properties · - - /// - /// Identifies the Title dependency property. - /// - public static readonly DependencyProperty TitleProperty = - DependencyProperty.Register("Title", typeof(String), typeof(WidgetElement), - new FrameworkPropertyMetadata(String.Empty)); - - /// - /// Identifies the WindowState dependency property. - /// - public static readonly DependencyProperty WidgetStateProperty = - DependencyProperty.Register("WidgetState", typeof(WindowState), typeof(WidgetElement), - new FrameworkPropertyMetadata(WindowState.Normal)); - - /// - /// Identifies the ShowMinimizeButton dependency property. - /// - public static readonly DependencyProperty ShowMinimizeButtonProperty = - DependencyProperty.Register("ShowMinimizeButton", typeof(bool), typeof(WidgetElement), - new FrameworkPropertyMetadata(true)); - - #endregion - - #region · Routed Commands · - - /// - /// Minimize window command - /// - public static RoutedCommand MinimizeCommand; - - #endregion - - #region · Static Constructor · - - /// - /// Initializes the class. - /// - static WidgetElement() - { - WidgetElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(WidgetElement), - new FrameworkPropertyMetadata(typeof(WidgetElement))); - - WidgetElement.MinimizeCommand = new RoutedCommand("Minimize", typeof(WidgetElement)); - - Control.IsTabStopProperty.OverrideMetadata(typeof(WidgetElement), - new FrameworkPropertyMetadata(false)); - - KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata( - typeof(WidgetElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); - - KeyboardNavigation.TabNavigationProperty.OverrideMetadata( - typeof(WidgetElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); - - KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata( - typeof(WidgetElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once)); - - if (!DesignMode.IsInDesignMode - && Application.Current.GetRenderTier() != RenderTier.Tier2) - { - WidgetElement.CacheModeProperty.OverrideMetadata(typeof(WidgetElement), - new FrameworkPropertyMetadata(new BitmapCache { EnableClearType = true, RenderAtScale = 1, SnapsToDevicePixels = true })); - } - } - - #endregion - - #region · Fields · - - private Size previousSize; - - #endregion - - #region · Properties · - - /// - /// Gets or sets a value that indicates whether a window is restored or minimized. - /// This is a dependency property. - /// - /// A that determines whether a window is restored, minimized, or maximized. The default is Normal (restored). - public WindowState WidgetState - { - get { return (WindowState)base.GetValue(WidgetStateProperty); } - set - { - if ((WindowState)this.GetValue(WidgetStateProperty) != value) - { - base.SetValue(WidgetStateProperty, value); - } - - this.AdjustLayout(); - } - } - - /// - /// Gets a value that indicates whether the minimize button is visible. - /// This is a dependency property. - /// - public bool ShowMinimizeButton - { - get { return (bool)base.GetValue(ShowMinimizeButtonProperty); } - set { base.SetValue(ShowMinimizeButtonProperty, value); } - } - - /// - /// Gets or sets the Widget title - /// - public string Title - { - get { return (string)base.GetValue(TitleProperty); } - set { base.SetValue(TitleProperty, value); } - } - - #endregion - - #region · Internal Properties · - - /// - /// Gets the Widget real Height based on the . - /// - /// Used for Widget serialization on class - internal double RealHeight - { - get - { - if (this.WidgetState == WindowState.Minimized) - { - return this.previousSize.Height; - } - - return this.Height; - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public WidgetElement() - : base() - { - CommandBinding bindingMinimize = new CommandBinding(WidgetElement.MinimizeCommand, new ExecutedRoutedEventHandler(this.OnMinimizeWindow)); - this.CommandBindings.Add(bindingMinimize); - } - - #endregion - - #region · Methods · - - /// - /// Closes the desktop element - /// - public override void Close() - { - this.CommandBindings.Clear(); - - base.Close(); - } - - #endregion - - #region · Protected Methods - - /// - /// Focuses the window - /// - protected override void GiveFocus() - { - this.MoveFocus(FocusNavigationDirection.Next); - } - - #endregion - - #region · Command Actions · - - /// - /// Occurs when the widget is going to be minimized - /// - /// - /// - private void OnMinimizeWindow(object sender, ExecutedRoutedEventArgs e) - { - if (this.WidgetState != WindowState.Minimized) - { - this.WidgetState = WindowState.Minimized; - } - else - { - this.WidgetState = WindowState.Normal; - } - } - - #endregion - - #region · Private Methods · - - private void AdjustLayout() - { - if (this.WidgetState == WindowState.Minimized) - { - this.previousSize = new Size(this.Width, this.Height); - this.Height = 35; - this.CanResize = false; - } - else - { - this.Height = this.previousSize.Height; - this.previousSize = new Size(this.Width, this.Height); - this.CanResize = true; - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Controls/WindowElement.cs --- a/Chronosv2/source/Presentation/Windows/Controls/WindowElement.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,801 +0,0 @@ -/* -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.ComponentModel; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; -using System.Windows.Threading; -using Chronos.Extensions.Windows; -using Chronos.Presentation.Core.Windows; -using nRoute.Components; - -namespace Chronos.Presentation.Windows.Controls -{ - /// - /// Provides the ability to create, configure, show, and manage the lifetime of windows - /// - [TemplatePart(Name = WindowElement.PART_CloseButton, Type = typeof(ButtonBase))] - [TemplatePart(Name = WindowElement.PART_ContentPresenter, Type = typeof(ContentPresenter))] - [TemplateVisualState(Name = NormalVisualState, GroupName = WindowStateGroup)] - [TemplateVisualState(Name = MinimizedVisualState, GroupName = WindowStateGroup)] - [TemplateVisualState(Name = MaximizedVisualState, GroupName = WindowStateGroup)] - public class WindowElement - : DesktopElement, IWindow, IModalVindow - { - #region · Constants · - - #region · Template Parts · - - private const string PART_ContentPresenter = "PART_ContentPresenter"; - private const string PART_Root = "PART_Root"; - private const string PART_MaximizeButton = "PART_MaximizeButton"; - private const string PART_MinimizeButton = "PART_MinimizeButton"; - private const string PART_CloseButton = "PART_CloseButton"; - - #endregion - - #region · Visual States · - - private const string WindowStateGroup = "WindowState"; - private const string NormalVisualState = "Normal"; - private const string MinimizedVisualState = "Minimized"; - private const string MaximizedVisualState = "Maximized"; - - #endregion - - #region · Misc · - - private const int MaximizeMargin = 20; - - #endregion - - #endregion - - #region · Dependency Properties · - - /// - /// Identifies the Title dependency property. - /// - public static readonly DependencyProperty TitleProperty = - DependencyProperty.Register("Title", typeof(String), typeof(WindowElement), - new FrameworkPropertyMetadata(String.Empty)); - - /// - /// Identifies the WindowState dependency property. - /// - public static readonly DependencyProperty WindowStateProperty = - DependencyProperty.Register("WindowState", typeof(WindowState), typeof(WindowElement), - new FrameworkPropertyMetadata(WindowState.Normal)); - - /// - /// Identifies the ShowCloseButton dependency property. - /// - public static readonly DependencyProperty ShowCloseButtonProperty = - DependencyProperty.Register("ShowCloseButton", typeof(bool), typeof(WindowElement), - new FrameworkPropertyMetadata(true)); - - /// - /// Identifies the ShowMaximizeButton dependency property. - /// - public static readonly DependencyProperty ShowMaximizeButtonProperty = - DependencyProperty.Register("ShowMaximizeButton", typeof(bool), typeof(WindowElement), - new FrameworkPropertyMetadata(true)); - - /// - /// Identifies the ShowMinimizeButton dependency property. - /// - public static readonly DependencyProperty ShowMinimizeButtonProperty = - DependencyProperty.Register("ShowMinimizeButton", typeof(bool), typeof(WindowElement), - new FrameworkPropertyMetadata(true)); - - /// - /// Identifies the DialogResult dependency property. - /// - public static readonly DependencyProperty DialogResultProperty = - DependencyProperty.Register("DialogResult", typeof(DialogResult), typeof(WindowElement), - new FrameworkPropertyMetadata(DialogResult.None)); - - /// - /// Identifies the ViewMode dependency property. - /// - public static readonly DependencyProperty ViewModeProperty = - DependencyProperty.Register("ViewMode", typeof(ViewModeType), typeof(WindowElement), - new FrameworkPropertyMetadata(ViewModeType.Default, - new PropertyChangedCallback(OnViewModeChanged))); - - #endregion - - #region · Dependency Properties Callback Handlers · - - private static void OnViewModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d != null) - { - WindowElement window = d as WindowElement; - - if (window.IsActive) - { - ViewModeType oldViewModel = (ViewModeType)e.OldValue; - - if (oldViewModel == ViewModeType.Add - || oldViewModel == ViewModeType.Edit) - { - window.UpdateActiveElementBindings(); - } - else - { - window.MoveFocus(FocusNavigationDirection.Next); - } - } - } - } - - #endregion - - #region · Static members · - - /// - /// Container panel for modal windows - /// - public static Panel ModalContainerPanel; - - #endregion - - #region · Static Constructor · - - /// - /// Initializes the class. - /// - static WindowElement() - { - WindowElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowElement), - new FrameworkPropertyMetadata(typeof(WindowElement))); - - KeyboardNavigation.IsTabStopProperty.OverrideMetadata(typeof(WindowElement), - new FrameworkPropertyMetadata(false)); - - KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata( - typeof(WindowElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Local)); - - KeyboardNavigation.TabNavigationProperty.OverrideMetadata( - typeof(WindowElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); - - KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata( - typeof(WindowElement), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once)); - - if (!DesignMode.IsInDesignMode - && Application.Current.GetRenderTier() != RenderTier.Tier2) - { - WindowElement.CacheModeProperty.OverrideMetadata(typeof(WindowElement), - new FrameworkPropertyMetadata(new BitmapCache { EnableClearType = true, RenderAtScale = 1, SnapsToDevicePixels = true })); - } - } - - #endregion - - #region · Events · - - /// - /// Occurs when the window is about to close. - /// - public event EventHandler Closed; - - /// - /// Occurs directly after System.Windows.Window.Close() is called, and can be - /// handled to cancel window closure. - /// - public event CancelEventHandler Closing; - - /// - /// Occurs when the window's System.Windows.Window.WindowState property changes. - /// - public event EventHandler WindowStateChanged; - - #endregion - - #region · Fields · - - private ContentPresenter contentPresenter; - private DispatcherFrame dispatcherFrame; - private WindowState oldWindowState; - private bool isShowed; - private bool isModal; - - #region · Commands · - - private ICommand minimizeCommand; - private ICommand maximizeCommand; - private ICommand closeCommand; - - #endregion - - #endregion - - #region · IWindow Commands · - - /// - /// Gets the maximize window command - /// - /// - public ICommand MaximizeCommand - { - get - { - if (this.maximizeCommand == null) - { - this.maximizeCommand = new ActionCommand(() => OnMaximizeWindow()); - } - - return this.maximizeCommand; - } - } - - /// - /// Gets the minimize window command - /// - /// - public ICommand MinimizeCommand - { - get - { - if (this.minimizeCommand == null) - { - this.minimizeCommand = new ActionCommand(() => OnMinimizeWindow()); - } - - return this.minimizeCommand; - } - } - - /// - /// Gets the close window command - /// - /// - public ICommand CloseCommand - { - get - { - if (this.closeCommand == null) - { - this.closeCommand = new ActionCommand(() => OnCloseWindow()); - } - - return this.closeCommand; - } - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets a window's title. This is a dependency property. - /// - public String Title - { - get { return (String)base.GetValue(WindowElement.TitleProperty); } - set { base.SetValue(WindowElement.TitleProperty, value); } - } - - /// - /// Gets the dialog result - /// - public DialogResult DialogResult - { - get { return (DialogResult)base.GetValue(DialogResultProperty); } - set { base.SetValue(DialogResultProperty, value); } - } - - /// - /// Gets or sets a value that indicates whether a window is restored, minimized, or maximized. - /// This is a dependency property. - /// - /// A that determines whether a window is restored, minimized, or maximized. The default is Normal (restored). - public WindowState WindowState - { - get { return (WindowState)base.GetValue(WindowStateProperty); } - set - { - if ((WindowState)this.GetValue(WindowStateProperty) != value) - { - if (this.oldWindowState == System.Windows.WindowState.Maximized - && this.WindowState == System.Windows.WindowState.Minimized - && value == System.Windows.WindowState.Normal) - { - this.UpdateWindowState(this.WindowState, this.oldWindowState); - - base.SetValue(WindowStateProperty, this.oldWindowState); - } - else - { - this.UpdateWindowState(this.WindowState, value); - - base.SetValue(WindowStateProperty, value); - } - - if (this.WindowStateChanged != null) - { - this.WindowStateChanged(this, EventArgs.Empty); - } - } - } - } - - /// - /// Gets a value that indicates whether the close button is visible. - /// This is a dependency property. - /// - public bool ShowCloseButton - { - get { return (bool)base.GetValue(ShowCloseButtonProperty); } - set { base.SetValue(ShowCloseButtonProperty, value); } - } - - /// - /// Gets a value that indicates whether the maximize button is visible. - /// This is a dependency property. - /// - public bool ShowMaximizeButton - { - get { return (bool)base.GetValue(ShowMaximizeButtonProperty); } - set { base.SetValue(ShowMaximizeButtonProperty, value); } - } - - /// - /// Gets a value that indicates whether the minimize button is visible. - /// This is a dependency property. - /// - public bool ShowMinimizeButton - { - get { return (bool)base.GetValue(ShowMinimizeButtonProperty); } - set { base.SetValue(ShowMinimizeButtonProperty, value); } - } - - /// - /// Gets a value indicating whether the element can be dragged. - /// - /// true if this instance can drag; otherwise, false. - public override bool CanDrag - { - get { return (bool)base.GetValue(CanDragProperty) && this.WindowState == System.Windows.WindowState.Normal; } - set { base.SetValue(CanDragProperty, value); } - } - - /// - /// Gets the view mode - /// - public ViewModeType ViewMode - { - get { return (ViewModeType)base.GetValue(ViewModeProperty); } - set - { - base.SetValue(ViewModeProperty, value); - - if (value == ViewModeType.Busy) - { - this.GiveFocus(); - Application.Current.DoEvents(); - } - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public WindowElement() - : base() - { - } - - #endregion - - #region · Methods · - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - - this.contentPresenter = this.GetTemplateChild(WindowElement.PART_ContentPresenter) as ContentPresenter; - } - - /// - /// Shows the window - /// - public void Show() - { - if (!this.isShowed) - { - this.isShowed = true; - } - - this.OnActivated(); - } - - /// - /// Shows the window as a modal dialog - /// - public DialogResult ShowDialog() - { - this.Parent = WindowElement.ModalContainerPanel; - this.isModal = true; - - this.LockKeyboardNavigation(); - this.LockMouseOutside(); - - this.Show(); - - // Set DialogResult default value - this.DialogResult = DialogResult.None; - - try - { - // Push the current thread to a modal state - ComponentDispatcher.PushModal(); - - // Create a DispatcherFrame instance and use it to start a message loop - this.dispatcherFrame = new DispatcherFrame(); - Dispatcher.PushFrame(this.dispatcherFrame); - } - finally - { - // Pop the current thread from modal state - ComponentDispatcher.PopModal(); - } - - return this.DialogResult; - } - - /// - /// Manually closes a . - /// - public override void Close() - { - CancelEventArgs e = new CancelEventArgs(); - - if (this.Closing != null) - { - this.Closing(this, e); - } - - if (!e.Cancel) - { - this.LockMouseOutside(false); - - // Clean up - this.maximizeCommand = null; - this.minimizeCommand = null; - this.closeCommand = null; - this.dispatcherFrame = null; - this.isModal = false; - this.isShowed = false; - - this.CommandBindings.Clear(); - - base.Close(); - - if (this.Closed != null) - { - this.Closed(this, EventArgs.Empty); - } - } - } - - /// - /// Hides the Window - /// - public void Hide() - { - this.Visibility = System.Windows.Visibility.Collapsed; - - if (this.isModal && this.dispatcherFrame != null) - { - this.dispatcherFrame.Continue = false; - this.dispatcherFrame = null; - } - } - - #endregion - - #region · Protected Methods · - - /// - /// Focuses the window - /// - protected override void GiveFocus() - { - this.MoveFocus(FocusNavigationDirection.Next); - } - - /// - /// Invoked when an unhandled  attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event. - /// - /// The that contains the event data. - protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) - { - base.OnGotKeyboardFocus(e); - this.OnActivated(); - } - - protected override void OnPreviewKeyDown(KeyEventArgs e) - { - if ((e.Key == Key.Enter || e.Key == Key.Return) && - Keyboard.Modifiers == ModifierKeys.None) - { - if (e.OriginalSource != this) - { - if (e.OriginalSource is DataGridCell || - e.OriginalSource is ComboBoxItem) - { - } - else - { - FocusNavigationDirection direction = FocusNavigationDirection.Next; - UIElement element = e.OriginalSource as UIElement; - - if (element != null) - { - element.MoveFocus(new TraversalRequest(direction)); - e.Handled = true; - } - } - } - } - - base.OnPreviewKeyDown(e); - } - - #endregion - - #region · Command Execution Methods · - - protected virtual void OnCloseWindow() - { - if (this.isModal) - { - this.Hide(); - } - else - { - this.Close(); - } - } - - protected virtual void OnMaximizeWindow() - { - if (this.WindowState != WindowState.Maximized) - { - this.WindowState = WindowState.Maximized; - } - else - { - this.WindowState = WindowState.Normal; - } - } - - protected virtual void OnMinimizeWindow() - { - if (this.WindowState != WindowState.Minimized) - { - this.WindowState = WindowState.Minimized; - } - else - { - this.WindowState = WindowState.Normal; - } - } - - #endregion - - #region · Private Methods · - - /// - /// http://blogs.msdn.com/b/ryantrem/archive/2010/04/09/globally-updating-binding-sources-in-wpf.aspx - /// - private void UpdateActiveElementBindings() - { - if (Keyboard.FocusedElement != null && - Keyboard.FocusedElement is DependencyObject) - { - DependencyObject element = (DependencyObject)Keyboard.FocusedElement; - LocalValueEnumerator localValueEnumerator = element.GetLocalValueEnumerator(); - - while (localValueEnumerator.MoveNext()) - { - BindingExpressionBase bindingExpression = BindingOperations.GetBindingExpressionBase(element, localValueEnumerator.Current.Property); - - if (bindingExpression != null) - { - bindingExpression.UpdateSource(); - bindingExpression.UpdateTarget(); - } - } - } - } - - private void LockKeyboardNavigation() - { - KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Cycle); - KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.None); - KeyboardNavigation.SetControlTabNavigation(this, KeyboardNavigationMode.None); - } - - private void LockMouseOutside() - { - this.LockMouseOutside(true); - } - - private void LockMouseOutside(bool doLock) - { - if (doLock) - { - Debug.Assert(WindowElement.ModalContainerPanel != null); - - Binding wBinding = new Binding("ActualWidth"); - Binding hBinding = new Binding("ActualHeight"); - Canvas fence = new Canvas(); - - wBinding.Source = WindowElement.ModalContainerPanel; - hBinding.Source = WindowElement.ModalContainerPanel; - - fence.SetBinding(Canvas.WidthProperty, wBinding); - fence.SetBinding(Canvas.HeightProperty, hBinding); - - fence.Background = new SolidColorBrush(Color.FromArgb(141, 162, 174, 255)); - fence.Opacity = 0.5; - - WindowElement.ModalContainerPanel.Children.Add(this); - WindowElement.ModalContainerPanel.Children.Add(fence); - WindowElement.ModalContainerPanel.BringToBottom(fence); - WindowElement.ModalContainerPanel.Visibility = System.Windows.Visibility.Visible; - } - else - { - Debug.Assert(WindowElement.ModalContainerPanel != null); - - for (int i = 0; i < WindowElement.ModalContainerPanel.Children.Count; i++) - { - UIElement target = WindowElement.ModalContainerPanel.Children[i]; - - if (target is Panel) - { - WindowElement.ModalContainerPanel.Children.Remove(target); - break; - } - } - - WindowElement.ModalContainerPanel.Children.Remove(this); - WindowElement.ModalContainerPanel.Visibility = System.Windows.Visibility.Hidden; - } - } - - private void UpdateWindowState(WindowState oldWindowState, WindowState newWindowState) - { - if (newWindowState == WindowState.Maximized) - { - if (oldWindowState == System.Windows.WindowState.Minimized) - { - this.Visibility = System.Windows.Visibility.Visible; - } - - VisualStateManager.GoToState(this, MaximizedVisualState, true); - - ScaleTransform st = this.contentPresenter.LayoutTransform as ScaleTransform; - - if (st != null) - { - this.OldPosition = this.GetPosition(); - - if (this.ConstraintToParent) - { - if (this.ActualWidth > this.ActualHeight) - { - st.ScaleX = Math.Round((this.Parent.ActualWidth - MaximizeMargin) / this.OriginalSize.Width, 2); - } - else - { - st.ScaleY = Math.Round((this.Parent.ActualHeight - MaximizeMargin) / this.OriginalSize.Height, 2); - } - - Application.Current.DoEvents(); - - this.MoveElement - ( - (this.Parent.ActualWidth - this.ActualWidth) / 2, - (this.Parent.ActualHeight - this.ActualHeight) / 2 - ); - } - else - { - double scaleX = Math.Round(this.GetParent().ActualWidth / this.OriginalSize.Width, 2); - double scaleY = Math.Round(this.GetParent().ActualHeight / this.OriginalSize.Height, 2); - - if (scaleX < scaleY) - { - st.ScaleX = (scaleX > 2.5) ? 2.5 : scaleX; - } - else - { - st.ScaleY = (scaleY > 2.5) ? 2.5 : scaleY; - } - - Application.Current.DoEvents(); - - this.MoveElement - ( - (this.GetParent().ActualWidth- this.ActualWidth) / 2, - (this.GetParent().ActualHeight - this.ActualHeight) / 2 - (this.GetParent().ActualHeight - this.Parent.ActualHeight) - ); - } - } - - this.Parent.BringToFront(this); - } - else if (newWindowState == WindowState.Normal) - { - this.Visibility = System.Windows.Visibility.Visible; - - VisualStateManager.GoToState(this, NormalVisualState, true); - - if (oldWindowState == WindowState.Minimized) - { - this.Activate(); - } - else if (oldWindowState == WindowState.Maximized) - { - ScaleTransform st = this.contentPresenter.LayoutTransform as ScaleTransform; - - if (st != null) - { - st.ScaleX = 1.0; - } - } - - this.MoveElement(this.OldPosition.X, this.OldPosition.Y); - } - else if (newWindowState == WindowState.Minimized) - { - VisualStateManager.GoToState(this, MinimizedVisualState, true); - - this.Visibility = Visibility.Collapsed; - this.oldWindowState = oldWindowState; - this.OldPosition = this.GetPosition(); - - this.OnDeactivated(); - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Converters/BooleanToVisibilityConverter.cs --- a/Chronosv2/source/Presentation/Windows/Converters/BooleanToVisibilityConverter.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -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.Data; - -namespace Chronos.Presentation.Windows.Converters -{ - /// - /// Value converter for visibility values - /// - public sealed class BooleanToVisibilityConverter : IValueConverter - { - #region · IValueConverter Members · - - /// - /// Converts a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - return (((bool)value) ? Visibility.Visible : Visibility.Collapsed); - } - - /// - /// Converts a value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - throw new NotImplementedException(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Converters/StringToStyleConverter.cs --- a/Chronosv2/source/Presentation/Windows/Converters/StringToStyleConverter.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -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.Data; - -namespace Chronos.Presentation.Windows.Converters -{ - /// - /// Value converter for style identifiers - /// - public sealed class StringToStyleConverter : IValueConverter - { - #region · IValueConverter Members · - - /// - /// Converts a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - return Application.Current.FindResource(value); - } - - /// - /// Converts a value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - throw new NotImplementedException(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Converters/ZoomTransformConverter.cs --- a/Chronosv2/source/Presentation/Windows/Converters/ZoomTransformConverter.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -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.Data; - -namespace Chronos.Presentation.Windows.Converters -{ - /// - /// Value converter for zoom transformation values - /// - public sealed class ZoomTransformConverter : IValueConverter - { - #region · IValueConverter Members · - - /// - /// Converts a value. - /// - /// The value produced by the binding source. - /// The type of the binding target property. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - return (double)value / 100; - } - - /// - /// Converts a value. - /// - /// The value that is produced by the binding target. - /// The type to convert to. - /// The converter parameter to use. - /// The culture to use in the converter. - /// - /// A converted value. If the method returns null, the valid null value is used. - /// - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - return (double)value * 100; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/DesignMode.cs --- a/Chronosv2/source/Presentation/Windows/DesignMode.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -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.ComponentModel; -using System.Windows; - -namespace Chronos.Presentation.Windows -{ - /// - /// Helper class to detect design mode - /// - public static class DesignMode - { - #region · Members · - - private static bool? _isInDesignMode; - - #endregion - - #region · Properties · - - /// - /// Gets a value indicating whether the control is in design mode (running in Blend - /// or Visual Studio). - /// - public static bool IsInDesignMode - { - get - { - if (!_isInDesignMode.HasValue) - { - var prop = DesignerProperties.IsInDesignModeProperty; - _isInDesignMode - = (bool)DependencyPropertyDescriptor - .FromProperty(prop, typeof(FrameworkElement)) - .Metadata.DefaultValue; - } - - return _isInDesignMode.Value; - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/DesktopSerializer.cs --- a/Chronosv2/source/Presentation/Windows/DesktopSerializer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,240 +0,0 @@ -/* -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.Globalization; -using System.IO; -using System.Linq; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; -using System.Xml; -using System.Xml.Linq; -using Chronos.Extensions.Windows; -using Chronos.Presentation.Core.Services; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.Windows.Controls; -using nRoute.ViewServices; - -namespace Chronos.Presentation.Windows -{ - /// - /// Desktop serializer for and - /// contents. - /// - internal static class DesktopSerializer - { - #region · Save/Load Methods · - - /// - /// Loads the contents of the specified filename in the given instance. - /// - /// The desktop. - /// The filename. - public static void Load(Desktop desktop, string filename) - { - XElement root = LoadFromFile(filename); - - if (root == null) - { - return; - } - - // Widget Deserialization - IEnumerable widgetsXML = root.Elements("WidgetElements").Elements("WidgetElement"); - - foreach (XElement widgetXML in widgetsXML) - { - Guid id = new Guid(widgetXML.Element("Id").Value); - WidgetElement item = DeserializeWidget(widgetXML, id, 0, 0); - - desktop.AddElement(item, item.GetPosition()); - } - - // Shortcut Deserialization - IEnumerable shortcutsXML = root.Elements("ShortcutElements").Elements("ShortcutElement"); - int ti = 0; - - foreach (XElement shortcutXML in shortcutsXML) - { - Guid id = new Guid(shortcutXML.Element("Id").Value); - ShortcutElement item = DeserializeShortcut(shortcutXML, id, 0, 0); - - item.TabIndex = ++ti; - - desktop.AddElement(item, item.GetPosition()); - } - } - - /// - /// Saves the contents of the specified instance in the given file. - /// - /// The desktop. - /// The filename. - public static void Save(Desktop desktop, string filename) - { - IEnumerable widgets = desktop.Children.OfType(); - IEnumerable shortcuts = desktop.Children.OfType(); - - XElement widgetsItemsXML = SerializeWidgets(widgets); - XElement shortcutsItemsXML = SerializeShortcuts(shortcuts); - - XElement root = new XElement("Root"); - - root.Add(widgetsItemsXML); - root.Add(shortcutsItemsXML); - - SaveFile(filename, root); - } - - #endregion - - #region · Serialization Methods · - - private static XElement LoadFromFile(string filename) - { - try - { - if (File.Exists(filename)) - { - return XElement.Load(filename); - } - } - catch (Exception) - { - IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService(); - - showMessageService.ButtonSetup = DialogButton.Ok; - showMessageService.Caption = "Error loading the desktop"; - showMessageService.Text = "It was not possible to load the desktop."; - - showMessageService.ShowMessage(); - } - - return null; - } - - private static void SaveFile(string filename, XElement xElement) - { - try - { - xElement.Save(filename); - } - catch (Exception) - { - IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService(); - - showMessageService.ButtonSetup = DialogButton.Ok; - showMessageService.Caption = "Failed to save your desktop state"; - showMessageService.Text = "Unable to save your desktop state."; - - showMessageService.ShowMessage(); - } - } - - private static XElement SerializeWidgets(IEnumerable widgets) - { - XElement serializedItems = new XElement - ("WidgetElements", - from item in widgets - select new XElement - ("WidgetElement", - new XElement("Type", item.GetType().AssemblyQualifiedName), - new XElement("Left", Canvas.GetLeft(item)), - new XElement("Top", Canvas.GetTop(item)), - new XElement("Width", item.Width), - new XElement("Height", item.RealHeight), - new XElement("Id", item.Id), - new XElement("zIndex", Canvas.GetZIndex(item)), - new XElement("WidgetState", item.WidgetState), - new XElement("ShowMinimizeButton", item.ShowMinimizeButton) - ) - ); - - return serializedItems; - } - - private static WidgetElement DeserializeWidget(XElement itemXML, Guid id, double offsetX, double offsetY) - { - WidgetElement item = (WidgetElement)Activator.CreateInstance(Type.GetType(itemXML.Element("Type").Value)); - - item.ShowMinimizeButton = Boolean.Parse(itemXML.Element("ShowMinimizeButton").Value); - item.StartupLocation = StartupPosition.Manual; - - item.Move(Double.Parse(itemXML.Element("Left").Value, CultureInfo.InvariantCulture) + offsetX, - Double.Parse(itemXML.Element("Top").Value, CultureInfo.InvariantCulture) + offsetY); - item.SetZIndex(Int32.Parse(itemXML.Element("zIndex").Value)); - - WindowState widgetState = (WindowState)Enum.Parse(typeof(WindowState), itemXML.Element("WidgetState").Value as String); - - item.Width = Double.Parse(itemXML.Element("Width").Value, CultureInfo.InvariantCulture); - item.Height = Double.Parse(itemXML.Element("Height").Value, CultureInfo.InvariantCulture); - - if (widgetState == WindowState.Minimized) - { - item.WidgetState = widgetState; - } - - return item; - } - - private static XElement SerializeShortcuts(IEnumerable shortcuts) - { - XElement serializedItems = new XElement("ShortcutElements", - from item in shortcuts - let contentXaml = XamlWriter.Save(((ShortcutElement)item).DataContext) - select new XElement("ShortcutElement", - new XElement("Left", Canvas.GetLeft(item)), - new XElement("Top", Canvas.GetTop(item)), - new XElement("Width", item.Width), - new XElement("Height", item.Height), - new XElement("Id", item.Id), - new XElement("zIndex", Canvas.GetZIndex(item)), - new XElement("DataContext", contentXaml) - )); - - return serializedItems; - } - - private static ShortcutElement DeserializeShortcut(XElement itemXML, Guid id, double offsetX, double offsetY) - { - ShortcutElement item = new ShortcutElement - { - DataContext = XamlReader.Load(XmlReader.Create(new StringReader(itemXML.Element("DataContext").Value))), - Width = Double.Parse(itemXML.Element("Width").Value, CultureInfo.InvariantCulture), - Height = Double.Parse(itemXML.Element("Height").Value, CultureInfo.InvariantCulture) - }; - - item.StartupLocation = StartupPosition.Manual; - item.Move(Double.Parse(itemXML.Element("Left").Value, CultureInfo.InvariantCulture) + offsetX, - Double.Parse(itemXML.Element("Top").Value, CultureInfo.InvariantCulture) + offsetY); - item.SetZIndex(Int32.Parse(itemXML.Element("zIndex").Value)); - - return item; - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Helpers/PasswordBoxHelper.cs --- a/Chronosv2/source/Presentation/Windows/Helpers/PasswordBoxHelper.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -namespace Chronos.Presentation.Windows.Helpers -{ - /// - /// This class adds binding capabilities to the standard WPF PasswordBox. - /// - /// - /// http://www.codeproject.com/Articles/37167/Binding-Passwords.aspx - /// - public static class PasswordBoxHelper - { - #region · Static Members · - - private static bool IsUpdating = false; - - #endregion - - #region · Attached Properties · - - /// - /// BoundPassword Attached Dependency Property - /// - public static readonly DependencyProperty BoundPasswordProperty = - DependencyProperty.RegisterAttached("BoundPassword", - typeof(string), - typeof(PasswordBoxHelper), - new FrameworkPropertyMetadata(string.Empty, OnBoundPasswordChanged)); - - #endregion - - #region · Attached Property Get/Set Methods · - - /// - /// Gets the BoundPassword property. - /// - public static string GetBoundPassword(DependencyObject d) - { - return (string)d.GetValue(BoundPasswordProperty); - } - - /// - /// Sets the BoundPassword property. - /// - public static void SetBoundPassword(DependencyObject d, string value) - { - d.SetValue(BoundPasswordProperty, value); - } - - #endregion - - #region · Attached Properties Callbacks · - - /// - /// Handles changes to the BoundPassword property. - /// - private static void OnBoundPasswordChanged( - DependencyObject d, - DependencyPropertyChangedEventArgs e) - { - PasswordBox password = d as PasswordBox; - - if (password != null) - { - // Disconnect the handler while we're updating. - password.PasswordChanged -= PasswordChanged; - } - - if (e.NewValue != null) - { - if (!IsUpdating) - { - password.Password = e.NewValue.ToString(); - } - } - else - { - password.Password = string.Empty; - } - - // Now, reconnect the handler. - password.PasswordChanged += new RoutedEventHandler(PasswordChanged); - } - - /// - /// Handles the password change event. - /// - static void PasswordChanged(object sender, RoutedEventArgs e) - { - PasswordBox password = sender as PasswordBox; - IsUpdating = true; - SetBoundPassword(password, password.Password); - IsUpdating = false; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/IGroupable.cs --- a/Chronosv2/source/Presentation/Windows/IGroupable.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -using System; - -namespace Chronos.Presentation.Windows -{ - /// - /// Common interface for items that can be grouped - /// on the ; used by - /// - public interface IGroupable - { - #region · Properties · - - /// - /// Gets the item id. - /// - /// The id. - Guid Id - { - get; - } - - /// - /// Gets or sets the item parent id. - /// - /// The parent id. - Guid ParentId - { - get; - set; - } - - /// - /// Gets or sets a value indicating whether the item is a group. - /// - /// true if this instance is group; otherwise, false. - bool IsGroup - { - get; - set; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/ISelectable.cs --- a/Chronosv2/source/Presentation/Windows/ISelectable.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -The MIT License - -Copyright (c) <2009> 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; - -namespace Chronos.Presentation.Windows -{ - /// - /// Common interface for items that can be selected - /// on the ; used by - /// - public interface ISelectable - { - #region · Properties · - - Guid ParentId - { - get; - set; - } - - /// - /// Gets or sets a value indicating whether the item is selected. - /// - /// - /// true if this instance is selected; otherwise, false. - /// - bool IsSelected - { - get; - set; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Navigation/NavigationService.cs --- a/Chronosv2/source/Presentation/Windows/Navigation/NavigationService.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -/* -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.Diagnostics; -using System.Linq; -using System.Threading; -using System.Windows; -using System.Windows.Threading; -using Chronos.Extensions; -using Chronos.Presentation.Core.Navigation; -using Chronos.Presentation.Core.Services; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.Windows.Controls; -using nRoute.Components; -using nRoute.Components.Composition; -using nRoute.Components.Messaging; -using nRoute.Components.Routing; -using nRoute.Navigation; -using nRoute.Services; -using nRoute.SiteMaps; -using nRoute.ViewServices; - -namespace Chronos.Presentation.Windows.Navigation -{ - /// - /// Contains methods to support navigation. - /// - [MapService(typeof(INavigationService), - InitializationMode=InitializationMode.OnDemand, - Lifetime=InstanceLifetime.Singleton)] - public sealed class NavigationService - : INavigationService, INavigationHandler - { - #region · Constructors · - - /// - /// Initializes a new instance of the class - /// - public NavigationService() - { - // Set this as the default navigation handler - nRoute.Navigation.NavigationService.DefaultNavigationHandler = this; - } - - #endregion - - #region · Methods · - - /// - /// Performs the navigation to the given target - /// - /// - public void Navigate(string target) - { - this.Navigate(NavigateMode.New, target, null); - } - - /// - /// Performs the navigation to the given target - /// - /// - public void Navigate(NavigateMode mode, string target) - { - this.Navigate(mode, target, null); - } - - /// - /// Performs the navigation to the given target - /// - /// - public void Navigate(string target, params object[] args) - { - this.Navigate(NavigateMode.New, target, args); - } - - /// - /// Performs the navigation to the given target - /// - /// - public void Navigate(NavigateMode mode, string target, params object[] args) - { - if (String.IsNullOrEmpty(target)) - { - IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService(); - - showMessageService.ButtonSetup = DialogButton.Ok; - showMessageService.Caption = "Warning"; - showMessageService.Text = "Option not mapped to a view."; - - showMessageService.ShowMessage(); - - return; - } - - Application.Current.Dispatcher.BeginInvoke - ( - DispatcherPriority.Background, - new ThreadStart - ( - delegate - { - ParametersCollection navParams = null; - string area = null; - - if (args != null && args.Length > 0) - { - navParams = new ParametersCollection(); - navParams.Add(NavigationParams.NavigationParamsKey, args); - } - - var smnode = SiteMapService.SiteMap.RootNode.ChildNodes - .OfType() - .Traverse(node => ((node.ChildNodes) != null ? node.ChildNodes.OfType() : null)) - .Where(n => n.Url == target).SingleOrDefault(); - - if (smnode != null) - { - area = smnode.SiteArea; - } - - NavigationRequest request = new NavigationRequest(target, navParams, area, mode); - IDisposable navigationToken = nRoute.Navigation.NavigationService.Navigate(request); - - if (navigationToken != null) - { - navigationToken.Dispose(); - navigationToken = null; - } - } - ) - ); - } - - #endregion - - #region · INavigationHandler Members · - - void INavigationHandler.ProcessRequest(NavigationRequest request, Action requestCallback) - { - Debug.Assert(request != null, "request"); - Debug.Assert(requestCallback != null, "requestCallback"); - - NavigatingCancelInfo info = new NavigatingCancelInfo(request); - - if (!info.Cancel) - { - // change state - Channel.Public.OnNext(info); - - // Check if the navigation needs to be canceled - if (!info.Cancel) - { - requestCallback(true); - } - else - { - requestCallback(false); - } - } - else - { - requestCallback(false); - } - } - - /// - /// Process the given instance - /// - /// - void INavigationHandler.ProcessResponse(NavigationResponse response) - { - // basic check - if (response == null) - { - throw new ArgumentNullException("response"); - } - - // we check if the navigation was successfull or not - if (response.Status != ResponseStatus.Success) - { - this.PublishNavigationFailedInfo(response.Request); - - IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService(); - - showMessageService.ButtonSetup = DialogButton.Ok; - showMessageService.Caption = "Chronos - Error en la navegación"; - showMessageService.Text = - ((response.Error != null) ? response.Error.Message : String.Format("No ha sido posible resolver la navegación solicitada ({0})", response.Request.RequestUrl)); - - showMessageService.ShowMessage(); - } - else - { - Application.Current.Dispatcher.BeginInvoke - ( - DispatcherPriority.Background, - new ThreadStart - ( - () => - { - WindowElement window = response.Content as WindowElement; - - if (response.ResponseParameters != null && - response.ResponseParameters.Count > 0) - { - ISupportNavigationLifecycle supporter = nRoute.Navigation.NavigationService.GetSupporter(response.Content); - - if (supporter != null) - { - supporter.Initialize(response.ResponseParameters); - } - } - - this.PublishNavigatedInfo(window.Title, response); - - if (response.Request.NavigationMode == NavigateMode.Modal) - { - ServiceLocator.GetService().ShowDialog(window); - } - else - { - ServiceLocator.GetService().Show(window); - } - } - ) - ); - } - } - - #endregion - - #region · Request Validation · - - /// - /// Validates the given instance - /// - /// - /// /// Returns as to if the request was validated or not, if not validated it woun't be processed. - private bool ValidateRequest(NavigationRequest request) - { - // basic check - if (request == null) - { - throw new ArgumentNullException("request"); - } - - // by default - return true; - } - - #endregion - - #region · Private Methods · - - private void OnNavigationCancelled() - { - Channel.Public.OnNext(new NavigationFailedInfo(null)); - } - - private void PublishNavigationFailedInfo(NavigationRequest request) - { - Channel.Public.OnNext(new NavigationFailedInfo(request)); - } - - private void PublishNavigatedInfo(string title, NavigationResponse response) - { - Channel.Public.OnNext - ( - new NavigatedInfo - ( - response.Request, - title, - (response.Content as WindowElement).Id - ), - true - ); - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Presentation/Windows/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Markup; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("chronos")] -[assembly: AssemblyDescription("")] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.None //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Windows.Controls")] -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Windows.Converters")] -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Windows.SiteMaps")] -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Windows.Helpers")] -[assembly: XmlnsDefinition("http://chronos/schemas/2010/xaml", "Chronos.Presentation.Windows")] diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/RubberbandAdorner.cs --- a/Chronosv2/source/Presentation/Windows/RubberbandAdorner.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -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.Documents; -using System.Windows.Input; -using System.Windows.Media; -using Chronos.Presentation.Windows.Controls; - -namespace Chronos.Presentation.Windows -{ - /// - /// Addorner for the rubber band selection - /// - public class RubberbandAdorner : Adorner - { - #region · Fields · - - private Point? startPoint; - private Point? endPoint; - private Pen rubberbandPen; - private Desktop desktop; - private Brush backgroundBrush; - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - /// The canvas. - /// The drag start point. - public RubberbandAdorner(Desktop canvas, Point? dragStartPoint) - : base(canvas) - { - ColorConverter cconverter = new ColorConverter(); - - this.desktop = canvas; - this.startPoint = dragStartPoint; - this.rubberbandPen = new Pen(new SolidColorBrush((Color)cconverter.ConvertFrom("#FF7AA3D4")), 1); - this.rubberbandPen.DashStyle = new DashStyle(); - this.backgroundBrush = new SolidColorBrush((Color)cconverter.ConvertFrom("#FFC5D5E9")); - this.backgroundBrush.Opacity = 0.40; - } - - #endregion - - #region · Protected Methods · - - /// - /// Invoked when an unhandled  attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event. - /// - /// The that contains the event data. - protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e) - { - if (e.LeftButton == MouseButtonState.Pressed) - { - if (!this.IsMouseCaptured) - { - this.CaptureMouse(); - } - - endPoint = e.GetPosition(this); - - this.UpdateSelection(); - this.InvalidateVisual(); - } - else - { - if (this.IsMouseCaptured) - { - this.ReleaseMouseCapture(); - } - } - - e.Handled = true; - } - - /// - /// Invoked when an unhandled  routed event - /// reaches an element in its route that is derived from this class. - /// Implement this method to add class handling for this event. - /// - /// The that contains the event data. - /// The event data reports that the mouse button was released. - protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e) - { - // release mouse capture - if (this.IsMouseCaptured) - { - this.ReleaseMouseCapture(); - } - - // remove this adorner from adorner layer - AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.desktop); - if (adornerLayer != null) - { - adornerLayer.Remove(this); - } - - e.Handled = true; - } - - /// - /// When overridden in a derived class, participates in rendering operations that are directed by the layout system. The rendering instructions for this element are not used directly when this method is invoked, and are instead preserved for later asynchronous use by layout and drawing. - /// - /// The drawing instructions for a specific element. This context is provided to the layout system. - protected override void OnRender(DrawingContext drawingContext) - { - base.OnRender(drawingContext); - - // without a background the OnMouseMove event would not be fired! - // Alternative: implement a Canvas as a child of this adorner, like - // the ConnectionAdorner does. - drawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(RenderSize)); - - if (this.startPoint.HasValue && this.endPoint.HasValue) - { - drawingContext.DrawRectangle(this.backgroundBrush, rubberbandPen, new Rect(this.startPoint.Value, this.endPoint.Value)); - } - } - - #endregion - - #region · Private Methods · - - private void UpdateSelection() - { - desktop.SelectionService.ClearSelection(); - - Rect rubberBand = new Rect(startPoint.Value, endPoint.Value); - - foreach (UIElement item in desktop.Children) - { - Rect itemRect = VisualTreeHelper.GetDescendantBounds(item); - Rect itemBounds = item.TransformToAncestor(desktop).TransformBounds(itemRect); - - if (rubberBand.Contains(itemBounds)) - { - if (item is ISelectable) - { - ISelectable di = item as ISelectable; - - if (di.ParentId == Guid.Empty) - { - desktop.SelectionService.AddToSelection(di); - } - } - } - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/SelectionService.cs --- a/Chronosv2/source/Presentation/Windows/SelectionService.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -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; -using Chronos.Presentation.Windows.Controls; - -namespace Chronos.Presentation.Windows -{ - internal sealed class SelectionService - { - #region · Fields · - - private Desktop canvas; - private List currentSelection; - - #endregion - - #region · Internal Properties · - - internal List CurrentSelection - { - get - { - if (currentSelection == null) - { - currentSelection = new List(); - } - - return currentSelection; - } - } - - #endregion - - #region · Constructors · - - public SelectionService(Desktop canvas) - { - this.canvas = canvas; - } - - #endregion - - #region · Internal Methods · - - internal void SelectItem(ISelectable item) - { - this.ClearSelection(); - this.AddToSelection(item); - } - - internal void AddToSelection(ISelectable item) - { - if (item is IGroupable) - { - List groupItems = this.GetGroupMembers(item as IGroupable); - - foreach (ISelectable groupItem in groupItems) - { - groupItem.IsSelected = true; - this.CurrentSelection.Add(groupItem); - } - } - else - { - item.IsSelected = true; - this.CurrentSelection.Add(item); - } - } - - internal void RemoveFromSelection(ISelectable item) - { - if (item is IGroupable) - { - List groupItems = GetGroupMembers(item as IGroupable); - - foreach (ISelectable groupItem in groupItems) - { - groupItem.IsSelected = false; - this.CurrentSelection.Remove(groupItem); - } - } - else - { - item.IsSelected = false; - this.CurrentSelection.Remove(item); - } - } - - internal void ClearSelection() - { - this.CurrentSelection.ForEach(item => item.IsSelected = false); - this.CurrentSelection.Clear(); - } - - internal void SelectAll() - { - this.ClearSelection(); - this.CurrentSelection.AddRange(canvas.Children.OfType()); - this.CurrentSelection.ForEach(item => item.IsSelected = true); - } - - internal List GetGroupMembers(IGroupable item) - { - IEnumerable list = canvas.Children.OfType(); - IGroupable rootItem = this.GetRoot(list, item); - - return GetGroupMembers(list, rootItem); - } - - internal IGroupable GetGroupRoot(IGroupable item) - { - IEnumerable list = this.canvas.Children.OfType(); - - return this.GetRoot(list, item); - } - - #endregion - - #region · Private Methods · - - private IGroupable GetRoot(IEnumerable list, IGroupable node) - { - if (node == null || node.ParentId == Guid.Empty) - { - return node; - } - else - { - foreach (IGroupable item in list) - { - if (item.Id == node.ParentId) - { - return this.GetRoot(list, item); - } - } - - return null; - } - } - - private List GetGroupMembers(IEnumerable list, IGroupable parent) - { - List groupMembers = new List(); - groupMembers.Add(parent); - - var children = list.Where(node => node.ParentId == parent.Id); - - foreach (IGroupable child in children) - { - groupMembers.AddRange(this.GetGroupMembers(list, child)); - } - - return groupMembers; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/SiteMaps/CommandSiteMapNode.cs --- a/Chronosv2/source/Presentation/Windows/SiteMaps/CommandSiteMapNode.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -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.Runtime.Serialization; -using System.Windows.Input; -using nRoute.Components; -using nRoute.SiteMaps; - -namespace Chronos.Presentation.Windows.SiteMaps -{ - /// - /// Command based sitemap node - /// - public sealed class CommandSiteMapNode - : NavigationNode - { - #region · Fields · - - private ICommand executeCommand; - - #endregion - - #region · Properties · - - /// - /// Gets the execute command. - /// - /// The execute command. - [IgnoreDataMember] - public ICommand ExecuteCommand - { - get - { - if (!this.HasChildNodes && !String.IsNullOrWhiteSpace(this.Url)) - { - this.executeCommand = new ActionCommand(() => Execute()); - } - - return this.executeCommand; - } - } - - #endregion - - #region · Constructors · - - public CommandSiteMapNode() - : base() - { - } - - #endregion - - #region · Overriden Methods · - - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - return this.Title; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/ViewServices/ShowMessageViewService.cs --- a/Chronosv2/source/Presentation/Windows/ViewServices/ShowMessageViewService.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -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 Chronos.Presentation.Core.Services; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.Windows.Controls; -using nRoute.Components.Composition; -using nRoute.ViewServices; - -namespace Chronos.Presentation.Windows.ViewServices -{ - /// - /// Modal messages view service - /// - [MapViewService(typeof(IShowMessageViewService), ShowMessageViewService.SERVICE_NAME, - InitializationMode = InitializationMode.OnDemand, Lifetime = ViewServiceLifetime.PerInstance)] - public sealed class ShowMessageViewService - : IShowMessageViewService - { - #region · Constants · - - private const string SERVICE_NAME = "ChronosMessageBoxViewService"; - - #endregion - - #region · Properties · - - /// - /// Gets or sets the message caption - /// - /// - public string Caption - { - get; - set; - } - - /// - /// Gets or sets the message text - /// - /// - public string Text - { - get; - set; - } - - /// - /// Gets or sets the message buttons - /// - /// - public DialogButton ButtonSetup - { - get; - set; - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public ShowMessageViewService() - { - } - - #endregion - - #region · Methods · - - /// - /// Shows a new message window - /// - /// - public DialogResult ShowMessage() - { - return MessageWindowElement.Show(this.Caption ?? String.Empty, this.Text, this.ButtonSetup); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/VirtualDesktop.cs --- a/Chronosv2/source/Presentation/Windows/VirtualDesktop.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,391 +0,0 @@ -/* -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.ObjectModel; -using System.Linq; -using System.Windows; -using System.Windows.Threading; -using Chronos.Extensions.Windows; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.Windows.Controls; -using NLog; -using nRoute.Components.Messaging; - -namespace Chronos.Presentation.Windows -{ - /// - /// Virtual desktop class - /// - public sealed class VirtualDesktop - : DispatcherObject, IVirtualDesktop - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Fields · - - private Desktop desktop; - private ObservableCollection activeWindows; - private ReadOnlyObservableCollection activeWindowsWrapper; - private bool hasBeenActivated; - - #endregion - - #region · Properties · - - public Guid Id - { - get - { - if (this.desktop != null) - { - return this.desktop.Id; - } - - return Guid.Empty; - } - } - - /// - /// Gets the list of active Windows - /// - public ReadOnlyObservableCollection ActiveWindows - { - get - { - if (this.activeWindowsWrapper == null) - { - this.activeWindowsWrapper = new ReadOnlyObservableCollection(this.Windows); - } - - return this.activeWindowsWrapper; - } - } - - #endregion - - #region · Private Properties · - - private ObservableCollection Windows - { - get - { - if (this.activeWindows == null) - { - this.activeWindows = new ObservableCollection(); - } - - return this.activeWindows; - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of class - /// - internal VirtualDesktop(Desktop desktop) - { - this.desktop = desktop; - } - - #endregion - - #region · Desktop Actions · - - /// - /// Activates the desktop instance - /// - public void Activate() - { - this.InvokeAsynchronouslyInBackground( - () => - { - if (!this.hasBeenActivated) - { - this.Load(); - this.hasBeenActivated = true; - - this.desktop.Activate(); - } - - this.desktop.Visibility = Visibility.Visible; - - Channel.Public.OnNext(new ActiveDesktopChangedInfo(this), true); - }); - } - - /// - /// Deactivates the desktop instance - /// - public void Deactivate() - { - this.Invoke( - () => - { - this.desktop.Visibility = Visibility.Hidden; - }); - } - - /// - /// Shows the desktop - /// - public void ShowDesktop() - { - this.InvokeAsynchronouslyInBackground - ( - () => - { - this.desktop.Children - .OfType() - .ToList() - .ForEach(window => window.WindowState = WindowState.Minimized); - } - ); - } - - /// - /// Saves desktop contents to disk - /// - public void Save() - { - this.Invoke( - () => - { - DesktopSerializer.Save(this.desktop, this.GetXamlFilename()); - }); - } - - #endregion - - #region · Window Methods · - - /// - /// Shows the given window instance - /// - public void Show(IWindow window) - { - this.InvokeAsynchronouslyInBackground - ( - () => - { - WindowElement element = window as WindowElement; - - this.desktop.AddElement(element); - - element.Show(); - - this.InvokeAsynchronouslyInBackground - ( - () => - { - if (element.DataContext is INavigationViewModel) - { - INavigationViewModel windowViewModel = element.DataContext as INavigationViewModel; - - ((IClosableViewModel)windowViewModel).Title = element.Title; - - this.Windows.Add(windowViewModel); - } - } - ); - } - ); - } - - /// - /// Restores the window with the given Id - /// - /// - public void Restore(Guid id) - { - this.InvokeAsynchronouslyInBackground - ( - () => - { - IWindow window = this.desktop.Children.OfType().Where(wc => wc.Id == id).SingleOrDefault(); - - if (window != null) - { - window.WindowState = WindowState.Normal; - window.Activate(); - } - } - ); - } - - #endregion - - #region · Shortcut Methods · - - /// - /// Creates a new shortcut with the given title and target - /// - /// - /// - public void CreateShortcut(string title, string target) where T : IShortcutViewModel, new() - { - this.CreateShortcut(title, target, new Point(0, 0)); - } - - /// - /// Creates a new shortcut with the given title and target - /// - /// - /// - public void CreateShortcut(string title, string target, Point point) where T : IShortcutViewModel, new() - { - T shortcut = new T - { - Title = title, - Target = target - }; - - ShortcutElement element = new ShortcutElement - { - DataContext = shortcut - }; - - this.Show(element, point); - } - - #endregion - - #region · IDesktopElement Methods · - - public void Show() where T : IDesktopElement, new() - { - this.Show(new T()); - } - - public void Show(Point position) where T : IDesktopElement, new() - { - this.Show(new T(), position); - } - - public void Show(IDesktopElement element) - { - this.InvokeAsynchronously( - () => - { - DesktopElement desktopElement = element as DesktopElement; - - this.desktop.AddElement(desktopElement); - }); - } - - public void Show(IDesktopElement element, Point position) - { - this.InvokeAsynchronously( - () => - { - DesktopElement desktopElement = element as DesktopElement; - - desktopElement.StartupLocation = StartupPosition.Manual; - - this.desktop.AddElement(desktopElement, position); - }); - } - - #endregion - - #region · Common Methods · - - /// - /// Closes all - /// - public void CloseAll() - { - this.Invoke( - () => - { - this.desktop.Children - .OfType() - .ToList() - .ForEach(e => this.Close(e.Id)); - - this.hasBeenActivated = false; - }); - } - - /// - /// Closes the element with the given Id - /// - /// The id. - public void Close(Guid id) - { - DesktopElement instance = this.desktop.Children.OfType().Where(x => x.Id == id).FirstOrDefault(); - - if (instance != null) - { - if (instance is WindowElement) - { - this.Windows.Remove((instance as WindowElement).DataContext as INavigationViewModel); - } - - instance.Close(); - } - } - - #endregion - - #region · Private Methods · - - /// - /// Loads desktop contents from disk - /// - private void Load() - { - this.Invoke( - () => - { - DesktopSerializer.Load(this.desktop, this.GetXamlFilename()); - }); - } - - private string GetXamlFilename() - { - return String.Format("{0}.xaml", this.desktop.Name); - } - - private void RemoveElement(DesktopElement element) - { - this.InvokeAsynchronouslyInBackground( - () => - { - this.desktop.RemoveElement(element); - }); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Presentation/Windows/VirtualDesktopManager.cs --- a/Chronosv2/source/Presentation/Windows/VirtualDesktopManager.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,547 +0,0 @@ -/* -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.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Threading; -using Chronos.Extensions.Windows; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.Windows.Controls; -using NLog; -using nRoute.Components.Composition; -using nRoute.Services; - -namespace Chronos.Presentation.Windows -{ - [MapService(typeof(IVirtualDesktopManager), - InitializationMode=InitializationMode.OnDemand, - Lifetime=InstanceLifetime.Singleton)] - public sealed class VirtualDesktopManager - : DispatcherObject, IVirtualDesktopManager - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Attached Properties · - - /// - /// Identifies the IsDesktopCanvas dependency property. - /// - public static readonly DependencyProperty IsDesktopProperty = - DependencyProperty.RegisterAttached("IsDesktop", typeof(bool), typeof(VirtualDesktopManager), - new FrameworkPropertyMetadata((bool)false, - new PropertyChangedCallback(OnIsDesktop))); - - /// - /// Identifies the IsModalContainer dependency property. - /// - public static readonly DependencyProperty IsIsModalContainerProperty = - DependencyProperty.RegisterAttached("IsModalContainer", typeof(bool), typeof(VirtualDesktopManager), - new FrameworkPropertyMetadata((bool)false, - new PropertyChangedCallback(OnIsModalContainer))); - - #endregion - - #region · Attached Property Get/Set Methods · - - /// - /// Gets the value of the IsDesktopCanvas attached property - /// - /// - /// - public static bool GetIsDesktop(DependencyObject d) - { - return (bool)d.GetValue(IsDesktopProperty); - } - - /// - /// Sets the value of the IsDesktopCanvas attached property - /// - /// - /// - public static void SetIsDesktop(DependencyObject d, bool value) - { - d.SetValue(IsDesktopProperty, value); - } - - /// - /// Gets the value of the IsModalContainer attached property - /// - /// - /// - public static bool GetIsModalContainer(DependencyObject d) - { - return (bool)d.GetValue(IsIsModalContainerProperty); - } - - /// - /// Sets the value of the IsModalContainer attached property - /// - /// - /// - public static void SetIsModalContainer(DependencyObject d, bool value) - { - d.SetValue(IsIsModalContainerProperty, value); - } - - #endregion - - #region · Attached Properties Callbacks · - - private static void OnIsDesktop(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d != null) - { - IVirtualDesktopManager service; - - if (ServiceLocator.TryGetService(out service)) - { - service.RegisterDesktop(d); - } - } - } - - private static void OnIsModalContainer(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d != null) - { - IVirtualDesktopManager service; - - if (ServiceLocator.TryGetService(out service)) - { - service.RegisterModalContainer(d); - } - } - } - - #endregion - - #region · Fields · - - private List virtualDesktops; - private IVirtualDesktop activeDesktop; - - #endregion - - #region · Properties · - - public ReadOnlyObservableCollection ActiveDesktopWindows - { - get { return this.ActiveDesktop.ActiveWindows; } - } - - public bool HasDesktopActive - { - get { return (this.ActiveDesktop != null); } - } - - #endregion - - #region · Private Properties · - - private List Desktops - { - get - { - if (this.virtualDesktops == null) - { - this.virtualDesktops = new List(); - } - - return this.virtualDesktops; - } - } - - private IVirtualDesktop ActiveDesktop - { - get { return this.activeDesktop; } - set - { - if (this.activeDesktop != value) - { - this.activeDesktop = value; - } - } - } - - #endregion - - #region · Constructors · - - public VirtualDesktopManager() - { - } - - #endregion - - #region · Virtual Desktop Actions · - - /// - /// Activates the default desktop - /// - public void ActivateDefaultDesktop() - { - Logger.Debug("Activar el escritorio virtual por defecto"); - - Debug.Assert(this.Desktops.Count > 0, "There are no desktop registered"); - - this.ActiveDesktop = this.Desktops.First(); - this.ActiveDesktop.Activate(); - } - - /// - /// Switches the active desktop - /// - public void SwitchDesktop() - { - Logger.Debug("Cambiar el escritorio virtual activo"); - - Debug.Assert(this.Desktops.Count > 0, "There are no desktop registered"); - - if (!this.HasDesktopActive) - { - this.ActivateDefaultDesktop(); - } - else - { - IVirtualDesktop currentDesktop = this.ActiveDesktop; - - this.Desktops - .ToList() - .ForEach(vd => vd.Deactivate()); - - this.ActiveDesktop = null; - - IVirtualDesktop desktop = this.Desktops.Where(vd => vd.Id != currentDesktop.Id).FirstOrDefault(); - - if (desktop != null) - { - this.ActiveDesktop = desktop; - this.ActiveDesktop.Activate(); - } - else - { - this.ActivateDefaultDesktop(); - } - } - } - - /// - /// Shows the desktop - /// - public void ShowDesktop() - { - Logger.Debug("Mostrar el escritorio virtual activo"); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.ShowDesktop(); - } - - /// - /// Saves the active desktop to disk - /// - public void SaveCurrentDesktop() - { - Logger.Debug("Guardar los cambios del escritorio virtual activo"); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Save(); - } - - public void SaveAllDesktops() - { - Logger.Debug("Guardar los cambios de todos los escritorios virtuales"); - - this.Desktops - .ToList() - .ForEach(vd => vd.Save()); - } - - #endregion - - #region · Window Methods · - - /// - /// Shows the given window instance - /// - /// A instance - public void Show(IWindow window) - { - Logger.Debug("Mostrar una nueva ventana ({0})", window); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Show(window); - } - - /// - /// Shows the dialog. - /// - /// The window. - /// - public DialogResult ShowDialog(IModalVindow window) - { - Logger.Debug("Mostrar una nueva ventana modal ({0})", window); - - DialogResult dialogResult = DialogResult.None; - - this.Invoke - ( - delegate - { - try - { - dialogResult = window.ShowDialog(); - } - finally - { - if (window != null) - { - window.Close(); - window = null; - } - } - } - ); - - return dialogResult; - } - - /// - /// Closes the current dialog - /// - public void CloseDialog() - { - Logger.Debug("Cierre de la ventana modal activa"); - - this.VerifyActiveDesktop(); - - this.Invoke( - delegate - { - WindowElement window = WindowElement.ModalContainerPanel.Children.OfType().FirstOrDefault(); - - if (window != null) - { - window.Hide(); - } - }); - } - - /// - /// Restores the window with the given Id - /// - /// - public void Restore(Guid id) - { - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Restore(id); - } - - #endregion - - #region · Shortcut Methods · - - /// - /// Creates a new shortcut with the given title and target - /// - /// - /// - public void CreateShortcut(string title, string target) - where T : IShortcutViewModel, new() - { - Logger.Debug("Crear un nuevo acceso directo en el escritorio virtual activo ({0} - {1})", title, target); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.CreateShortcut(title, target); - } - - /// - /// Creates a new shortcut with the given title and target - /// - /// - /// - public void CreateShortcut(string title, string target, Point position) - where T : IShortcutViewModel, new() - { - Logger.Debug("Crear un nuevo acceso directo en el escritorio virtual activo ({0} - {1})", title, target); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.CreateShortcut(title, target, position); - } - - #endregion - - #region · IDesktopElement Methods · - - public void Show() - where T : IDesktopElement, new() - { - Logger.Debug("Mostrar un nuevo elemento en el escritorio virtual activo ({0})", typeof(T)); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Show(); - } - - public void Show(Point position) - where T : IDesktopElement, new() - { - Logger.Debug("Mostrar un nuevo elemento en el escritorio virtual activo ({0})", typeof(T)); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Show(position); - } - - public void Show(IDesktopElement instance) - { - Logger.Debug("Mostrar un nuevo elemento en el escritorio virtual activo ({0})", instance.GetType()); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Show(instance); - } - - public void Show(IDesktopElement instance, Point position) - { - Logger.Debug("Mostrar un nuevo elemento en el escritorio virtual activo ({0})", instance.GetType()); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Show(instance, position); - } - - #endregion - - #region · Common Methods · - - /// - /// Closes the given element with the given Id - /// - /// The id. - public void Close(Guid id) - { - Logger.Debug("Cerrar un elemento en el escritorio virtual activo ({0})", id); - - this.VerifyActiveDesktop(); - - this.ActiveDesktop.Close(id); - } - - /// - /// Closes all - /// - public void CloseAll() - { - Logger.Debug("Cerrar todos los elementos en el escritorio virtual activo"); - - this.VerifyActiveDesktop(); - - this.Desktops - .ToList() - .ForEach(vd => vd.CloseAll()); - - this.DeactivateAll(); - } - - #endregion - - #region · Desktop registration Methods · - - /// - /// Attach the given dependency object as a Desktop to the Window manager - /// - /// - public void RegisterDesktop(DependencyObject d) - { - Logger.Debug("Registro de escritorio virtual ({0})", d); - - Debug.Assert(d != null, "do"); - Debug.Assert(d is Desktop, "do is not an instance of Desktop"); - - Desktop desktop = d as Desktop; - - if (desktop != null) - { - if (this.Desktops.Where(vd => vd.Id == desktop.Id).Count() == 0) - { - this.Desktops.Add(new VirtualDesktop(desktop)); - } - } - } - - /// - /// Attach the given dependency object as a Modal Container to the Window manager - /// - /// - public void RegisterModalContainer(DependencyObject d) - { - Logger.Debug("Registro de contenedor para ventanas modales ({0})", d); - - Panel container = d as Panel; - - if (container != null) - { - WindowElement.ModalContainerPanel = container; - } - } - - #endregion - - #region · Private Methods · - - private void VerifyActiveDesktop() - { - if (!this.HasDesktopActive) - { - this.ActivateDefaultDesktop(); - } - } - - private void DeactivateAll() - { - this.Desktops - .AsParallel() - .ForAll(vd => vd.Deactivate()); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Properties/AssemblyInfo.cs --- a/Chronosv2/source/Properties/AssemblyInfo.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -[assembly: AssemblyTitle("chronos")] -[assembly: AssemblyDescription("chronos executable")] -[assembly: AssemblyConfiguration("")] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Properties/Resources.Designer.cs --- a/Chronosv2/source/Properties/Resources.Designer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.21006.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Chronos.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Chronos.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Properties/Resources.resx --- a/Chronosv2/source/Properties/Resources.resx Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Properties/Settings.Designer.cs --- a/Chronosv2/source/Properties/Settings.Designer.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.21006.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Chronos.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Properties/Settings.settings --- a/Chronosv2/source/Properties/Settings.settings Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Services/WidgetConfigurationService.cs --- a/Chronosv2/source/Services/WidgetConfigurationService.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using Chronos.Configuration; -using Chronos.Presentation.Core.Configuration; -using Chronos.Presentation.Core.Widgets; -using NLog; -using nRoute.Components.Composition; -using nRoute.Services; - -namespace Chronos.Services -{ - [MapService(typeof(IWidgetConfigurationService), - InitializationMode = InitializationMode.OnDemand, - Lifetime = InstanceLifetime.Singleton)] - public sealed class WidgetConfigurationService - : IWidgetConfigurationService - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · SyncObject · - - private static readonly object SyncObject = new object(); - - #endregion - - #region · Constants · - - private static readonly string RootConfigFile = "Widgets.config"; - private static readonly string RootSection = "chronoserp.widgets"; - - #endregion - - #region · Fields · - - private List widgets; - - #endregion - - #region · Constructors · - - public WidgetConfigurationService() - { - } - - #endregion - - #region · Methods · - - public IEnumerable GetWidgets() - { - lock (SyncObject) - { - if (this.widgets == null) - { - WidgetsSectionHandler section = ConfigurationManager.GetSection(RootSection) as WidgetsSectionHandler; - - if (section != null) - { - this.widgets = new List(); - - foreach (WidgetConfigurationElement widgetConfig in section.Widgets) - { - IWidget widget = this.CreateWidgetDefinition(widgetConfig); - - if (widget == null) - { - Logger.Debug("Widget not found {0} - {1}", widgetConfig.Id, widgetConfig.Type); - } - else - { - this.widgets.Add(widget); - } - } - } - } - } - - return this.widgets; - } - - public T GetWidgetConfigurationSection(string sectionName) - where T: ConfigurationSection - { - throw new NotImplementedException(); - } - - #endregion - - #region · Private Methods · - - private IWidget CreateWidgetDefinition(WidgetConfigurationElement widgetConfig) - { - IWidget widget = null; - - try - { - widget = Activator.CreateInstance(Type.GetType(widgetConfig.Type)) as IWidget; - } - catch (Exception ex) - { - Logger.ErrorException - ( - String.Format("Widget not found {0} - {1}", widgetConfig.Id, widgetConfig.Type), - ex - ); - } - - return widget; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Shell.xaml --- a/Chronosv2/source/Shell.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Shell.xaml.cs --- a/Chronosv2/source/Shell.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -using System; -using System.Windows; -using System.Windows.Input; -using Chronos.Interop; -using Chronos.ViewModel; -using WinInterop = System.Windows.Interop; - -namespace Chronos -{ - /// - /// Shell Window - /// - public partial class Shell - : Window - { - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public Shell() - { - InitializeComponent(); - } - - #endregion - - #region · Event Handlers · - - protected override void OnPreviewKeyDown(KeyEventArgs e) - { - if (e.SystemKey == Key.Space && e.Key == Key.System) - { - // Disable Window's ControlBox Menu - e.Handled = true; - } - - base.OnPreviewKeyDown(e); - } - - protected override void OnSourceInitialized(EventArgs e) - { - base.OnSourceInitialized(e); - - IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle; - WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(Win32Interop.WindowProc)); - - ShellViewModel vm = new ShellViewModel(); - vm.WindowState = System.Windows.WindowState.Maximized; - - this.DataContext = vm; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/SingleInstance.cs --- a/Chronosv2/source/SingleInstance.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.Remoting; -using System.Runtime.Remoting.Channels; -using System.Runtime.Remoting.Channels.Ipc; -using System.Runtime.Serialization.Formatters; -using System.Threading; -using System.Windows; - -namespace Chronos -{ - public static class SingleInstance - { - #region · Consts · - - private const string RemoteServiceName = "SingleInstanceApplicationService"; - - #endregion - - #region · Inner Types · - - private class IpcRemoteService : MarshalByRefObject - { - #region · Methods · - - /// Activate the first instance of the application. - /// Command line arguemnts to proxy. - public void InvokeFirstInstance(IList args) - { - if (Application.Current != null && !Application.Current.Dispatcher.HasShutdownStarted) - { - Application.Current.Dispatcher.BeginInvoke((Action)((arg) => SingleInstance.ActivateFirstInstance((IList)arg)), args); - } - } - - /// Overrides the default lease lifetime of 5 minutes so that it never expires. - public override object InitializeLifetimeService() - { - return null; - } - - #endregion - } - - #endregion - - #region · Events · - - public static event EventHandler SingleInstanceActivated; - - #endregion - - #region · Fields · - - private static Mutex SingleInstanceMutex; - private static IpcServerChannel Channel; - - #endregion - - #region · Methods · - - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static void SafeDispose(ref T disposable) where T : IDisposable - { - // Dispose can safely be called on an object multiple times. - IDisposable t = disposable; - disposable = default(T); - - if (null != t) - { - t.Dispose(); - } - } - - public static bool InitializeAsFirstInstance(string applicationName) - { - IList commandLineArgs = Environment.GetCommandLineArgs() ?? new string[0]; - - // Build a repeatable machine unique name for the channel. - string appId = applicationName + Environment.UserName; - string channelName = String.Format("{0}:SingleInstanceIPCChannel", appId); - - bool isFirstInstance; - - SingleInstanceMutex = new Mutex(true, appId, out isFirstInstance); - - if (isFirstInstance) - { - CreateRemoteService(channelName); - } - else - { - SignalFirstInstance(channelName, commandLineArgs); - } - - return isFirstInstance; - } - - public static void Cleanup() - { - SafeDispose(ref SingleInstanceMutex); - - if (Channel != null) - { - ChannelServices.UnregisterChannel(Channel); - Channel = null; - } - } - - #endregion - - #region · Private Methods · - - private static void CreateRemoteService(string channelName) - { - Channel = new IpcServerChannel( - new Dictionary - { - { "name", channelName }, - { "portName", channelName }, - { "exclusiveAddressUse", "false" }, - }, - new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full }); - - ChannelServices.RegisterChannel(Channel, true); - RemotingServices.Marshal(new IpcRemoteService(), RemoteServiceName); - } - - private static void SignalFirstInstance(string channelName, IList args) - { - var secondInstanceChannel = new IpcClientChannel(); - ChannelServices.RegisterChannel(secondInstanceChannel, true); - - string remotingServiceUrl = String.Format("ipc://{0}/{1}", channelName, RemoteServiceName); - - // Obtain a reference to the remoting service exposed by the first instance of the application - var firstInstanceRemoteServiceReference = (IpcRemoteService)RemotingServices.Connect(typeof(IpcRemoteService), remotingServiceUrl); - - // Pass along the current arguments to the first instance if it's up and accepting requests. - if (firstInstanceRemoteServiceReference != null) - { - firstInstanceRemoteServiceReference.InvokeFirstInstance(args); - } - } - - private static void ActivateFirstInstance(IList args) - { - if (Application.Current != null && !Application.Current.Dispatcher.HasShutdownStarted) - { - var handler = SingleInstanceActivated; - - if (handler != null) - { - handler(Application.Current, new SingleInstanceEventArgs { Args = args }); - } - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/SingleInstanceEventArgs.cs --- a/Chronosv2/source/SingleInstanceEventArgs.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Chronos -{ - public sealed class SingleInstanceEventArgs - : EventArgs - { - #region · Properties · - - public IList Args - { - get; - internal set; - } - - #endregion - - #region · Constructors · - - public SingleInstanceEventArgs() - { - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/SplashScreen.png Binary file Chronosv2/source/SplashScreen.png has changed diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Themes/Metro/Brushes.xaml --- a/Chronosv2/source/Themes/Metro/Brushes.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Themes/Metro/Colors.xaml --- a/Chronosv2/source/Themes/Metro/Colors.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - #FF0097 - #A200FF - #00ABA9 - #8CBF26 - #996600 - #FF0097 - #F09609 - #1BA1E2 - #FFB2E0F4 - #E51400 - #339933 - - - #FF000000 - #FFFFFFFF - #FFCCCCCC - #FF7F7F7F - #FF333333 - #FFB9B9B9 - #FFD8D8D9 - #FF9D9D9D - #FFF7F7F7 - #FFE0E0E0 - #FFA59F93 - #7FFFFFFF - #7FA9A9A9 - #A5F7F7F7 - #5EC9C9C9 - #FF414141 - #FF000000 - #FFFFFFFF - - #FFFFFFFF - #FFBABABA - #FF303030 - - - - #00FFFFFF - - #19FFFFFF - - #34FFFFFF - - #A5FFFFFF - - #D8FFFFFF - - - - #00000000 - - #3F000000 - - #59000000 - - #99000000 - - #CC000000 - - - #052A2E31 - #152A2E31 - #252A2E31 - #352A2E31 - #FFDC000C - #FFDC020D - #FFCA000C - #FFFF9298 - #FFFDC8C8 - #DDD43940 - #59F7D8DB - #FFF7D8DB - #FFDB000C - - #33878787 - #33959595 - #4C000000 - #4C000000 - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Themes/Metro/ControlStyles.xaml --- a/Chronosv2/source/Themes/Metro/ControlStyles.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Visible - - - - - - - - - - - - - - Visible - - - - - - - - - - - Visible - - - - - - - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Visible - - - - - - - - - - - Visible - - - - - - - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Themes/Metro/ShortcutStyles.xaml --- a/Chronosv2/source/Themes/Metro/ShortcutStyles.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Themes/Metro/VectorIconStyles.xaml --- a/Chronosv2/source/Themes/Metro/VectorIconStyles.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,532 +0,0 @@ - - - - - - - - - M14.850012,14.816025 L14.850012,19.689024 L12.350012,19.688017 L12.350012,14.817032 z M12.350012,12.318017 L14.850012,12.318017 L14.850012,14.81601 L12.350012,14.817017 z M7.478004,12.318017 L12.350004,12.318017 L12.350004,14.817017 L7.478004,14.81601 z M14.850016,12.318014 L19.721016,12.318014 L19.721016,14.816014 L14.850016,14.816014 z M12.350012,7.4439993 L14.850012,7.4439993 L14.850012,12.317 L12.350012,12.317 z M13.365828,4.1472683 C11.00667,4.1472683 8.648138,5.0485125 6.8496189,6.8510017 C3.2465689,10.448992 3.2465689,16.285994 6.8496189,19.885998 C10.446657,23.484995 16.283749,23.484995 19.885792,19.885998 C23.482861,16.285994 23.482861,10.448992 19.885792,6.8510017 C18.08477,5.0485125 15.724987,4.1472683 13.365828,4.1472683 z M13.366085,0 C16.787008,0 20.207804,1.3049996 22.817842,3.9149988 C27.319893,8.420002 27.931902,15.332016 24.663877,20.497997 L31.688,27.522987 L27.517895,31.691992 L20.492826,24.665995 C15.326735,27.931007 8.4146442,27.323982 3.9135711,22.816996 C-1.3045237,17.599012 -1.3045237,9.1370115 3.9135711,3.9149988 C6.5241137,1.3049996 9.9451618,0 13.366085,0 z - M7.1869717,11.792021 L19.779972,11.792021 L19.779972,15.068021 L7.1869717,15.068021 z M13.365903,4.1472678 C11.006564,4.1472678 8.64785,5.0485125 6.8493843,6.8510022 C3.2474489,10.448992 3.2474489,16.285995 6.8493843,19.885998 C10.446316,23.484997 16.284241,23.484997 19.886175,19.885998 C23.483168,16.285995 23.483168,10.448992 19.886175,6.8510022 C18.085207,5.0485125 15.725243,4.1472678 13.365903,4.1472678 z M13.366041,0 C16.786736,0 20.207186,1.3049994 22.817162,3.914999 C27.320086,8.420002 27.931099,15.332016 24.66412,20.497997 L31.688,27.522987 L27.51808,31.691994 L20.493162,24.665995 C15.327284,27.931007 8.4154015,27.323982 3.9134545,22.816998 C-1.3044848,17.599012 -1.3044848,9.1370115 3.9134545,3.914999 C6.5244079,1.3049994 9.9453459,0 13.366041,0 z - M191.535,484.43L208.913,494.463L208.913,489.308L216.441,489.308C220.142,489.308,224.326,494.163,224.326,494.163C224.326,494.163,223.186,482.746,219,480.842C214.813,478.94,208.913,479.55,208.913,479.55L208.913,474.396L191.535,484.43z - M224.326,533.43L206.949,543.463L206.949,538.309L199.42,538.309C195.72,538.309,191.535,543.162,191.535,543.162C191.535,543.162,192.676,531.746,196.861,529.842C201.049,527.939,206.949,528.551,206.949,528.551L206.949,523.396L224.326,533.43z - M191.535,583.43L208.913,573.396L208.913,578.553L216.441,578.553C220.142,578.553,224.326,573.697,224.326,573.697C224.326,573.697,223.186,585.115,219,587.018C214.813,588.92,208.913,588.311,208.913,588.311L208.913,593.465L191.535,583.43z - M224.326,627.43L206.949,617.396L206.949,622.553L199.42,622.553C195.72,622.553,191.535,617.697,191.535,617.697C191.535,617.697,192.676,629.115,196.861,631.018C201.049,632.92,206.949,632.311,206.949,632.311L206.949,637.465L224.326,627.43z - M2.7340088,0 L8.0660095,5.3320007 13.39798,0 16.132996,2.7340088 10.800995,8.0659943 16.132996,13.397995 13.39798,16.132004 8.0669861,10.800003 2.7340088,16.132004 0,13.397995 5.3320007,8.0659943 0,2.7340088 z - F1M87.335,401.287C85.045,401.287,83.193,399.432,83.193,397.144C83.193,394.855,85.045,393.002,87.335,393.002C89.621,393.002,91.477,394.855,91.477,397.144C91.477,399.432,89.621,401.287,87.335,401.287 M100,395.89C100,395.569,99.736,395.308,99.418,395.308L98.349,395.308C98.025,395.308,97.688,395.058,97.598,394.749L96.144,391.354C95.989,391.077,96.04,390.664,96.267,390.437L96.99,389.714C97.217,389.486,97.217,389.115,96.99,388.89L95.25,387.148C95.024,386.921,94.653,386.921,94.422,387.148L93.639,387.936C93.409,388.163,92.99,388.225,92.708,388.076L89.754,386.896C89.446,386.81,89.193,386.474,89.193,386.154L89.193,385.059C89.193,384.739,88.93,384.478,88.611,384.478L86.147,384.478C85.827,384.478,85.564,384.739,85.564,385.059L85.564,386.154C85.564,386.474,85.312,386.812,85.008,386.906L81.582,388.373C81.309,388.534,80.899,388.479,80.67,388.255L79.901,387.485C79.676,387.26,79.305,387.26,79.078,387.485L77.336,389.228C77.107,389.455,77.107,389.826,77.336,390.053L78.172,390.892C78.402,391.119,78.465,391.533,78.316,391.819L77.152,394.746C77.066,395.058,76.732,395.308,76.41,395.308L75.248,395.308C74.929,395.308,74.669,395.569,74.669,395.89L74.669,398.353C74.669,398.675,74.929,398.937,75.248,398.937L76.41,398.937C76.732,398.937,77.069,399.187,77.163,399.494L78.592,402.863C78.755,403.14,78.699,403.552,78.477,403.779L77.675,404.576C77.449,404.803,77.449,405.172,77.675,405.399L79.419,407.141C79.646,407.368,80.017,407.368,80.24,407.141L81.096,406.29C81.323,406.062,81.734,406.001,82.021,406.153L85.008,407.346C85.312,407.434,85.564,407.77,85.564,408.088L85.564,409.229C85.564,409.549,85.827,409.811,86.147,409.811L88.611,409.811C88.93,409.811,89.193,409.549,89.193,409.229L89.193,408.088C89.193,407.77,89.443,407.434,89.754,407.341L93.094,405.923C93.372,405.766,93.78,405.82,94.01,406.045L94.763,406.803C94.99,407.027,95.361,407.027,95.588,406.803L97.331,405.059C97.558,404.833,97.558,404.462,97.331,404.236L96.526,403.435C96.304,403.207,96.241,402.792,96.393,402.509L97.603,399.496C97.688,399.187,98.025,398.937,98.349,398.935L99.418,398.935C99.736,398.935,100,398.673,100,398.353z - M130.858,401.287C128.568,401.287,126.717,399.432,126.717,397.144C126.717,394.855,128.568,393.002,130.858,393.002C133.145,393.002,135,394.855,135,397.144C135,399.432,133.145,401.287,130.858,401.287z M143.523,395.89C143.523,395.569,143.259,395.308,142.941,395.308L141.873,395.308C141.549,395.308,141.211,395.058,141.122,394.749L139.667,391.354C139.512,391.077,139.563,390.664,139.79,390.437L140.513,389.714C140.74,389.486,140.74,389.115,140.513,388.89L138.773,387.148C138.547,386.921,138.176,386.921,137.945,387.148L137.163,387.936C136.933,388.163,136.514,388.225,136.232,388.076L133.278,386.896C132.969,386.81,132.717,386.474,132.717,386.154L132.717,385.059C132.717,384.739,132.453,384.478,132.135,384.478L129.671,384.478C129.351,384.478,129.088,384.739,129.088,385.059L129.088,386.154C129.088,386.474,128.835,386.812,128.531,386.906L125.105,388.373C124.832,388.534,124.422,388.479,124.193,388.255L123.425,387.485C123.199,387.26,122.828,387.26,122.601,387.485L120.86,389.228C120.631,389.455,120.631,389.826,120.86,390.053L121.695,390.892C121.926,391.119,121.988,391.533,121.84,391.819L120.675,394.746C120.59,395.058,120.256,395.308,119.933,395.308L118.771,395.308C118.452,395.308,118.192,395.569,118.192,395.89L118.192,398.353C118.192,398.675,118.452,398.937,118.771,398.937L119.933,398.937C120.256,398.937,120.593,399.187,120.686,399.494L122.115,402.863C122.279,403.14,122.223,403.552,122,403.779L121.198,404.576C120.972,404.803,120.972,405.172,121.198,405.399L122.942,407.141C123.169,407.368,123.541,407.368,123.763,407.141L124.62,406.29C124.847,406.062,125.258,406.001,125.544,406.153L128.531,407.346C128.835,407.434,129.088,407.77,129.088,408.088L129.088,409.229C129.088,409.549,129.351,409.811,129.671,409.811L132.135,409.811C132.453,409.811,132.717,409.549,132.717,409.229L132.717,408.088C132.717,407.77,132.966,407.434,133.278,407.341L136.618,405.923C136.896,405.766,137.304,405.82,137.534,406.045L138.287,406.803C138.514,407.027,138.885,407.027,139.111,406.803L140.854,405.059C141.082,404.833,141.082,404.462,140.854,404.236L140.05,403.435C139.827,403.207,139.765,402.792,139.916,402.509L141.126,399.496C141.211,399.187,141.549,398.937,141.873,398.935L142.941,398.935C143.259,398.935,143.523,398.673,143.523,398.353L143.523,395.89z - M23.061251,18.390268 C22.647099,18.389917 22.225912,18.461004 21.81444,18.611288 C19.930418,19.298267 18.964405,21.380262 19.651409,23.262276 C20.338427,25.144258 22.418434,26.115263 24.303463,25.427246 C26.184479,24.740267 27.153482,22.657267 26.466478,20.774277 C25.929758,19.303978 24.540365,18.39152 23.061251,18.390268 z M20.454292,11.184546 C20.67009,11.174767 20.879616,11.304605 20.958429,11.518292 L21.287426,12.419291 C21.382429,12.681314 21.691437,12.882301 21.972431,12.861305 L24.75647,12.944313 C25.032475,12.9813 25.359474,12.805305 25.479469,12.549294 L25.887478,11.666302 C26.009474,11.409314 26.313478,11.298291 26.568485,11.418317 L28.522499,12.328287 C28.777508,12.445292 28.8885,12.750314 28.770504,13.006294 L28.392494,13.817296 C28.274496,14.073307 28.355505,14.428287 28.566505,14.610293 L30.783524,16.966274 C30.950533,17.192287 31.302526,17.297297 31.568535,17.199276 L32.448547,16.879299 C32.709538,16.783291 33.005547,16.919277 33.101555,17.183285 L33.841553,19.209278 C33.937561,19.472279 33.798553,19.76729 33.537548,19.862291 L32.658543,20.183275 C32.392532,20.284288 32.189545,20.590286 32.21254,20.869278 L32.122543,23.712255 C32.082531,23.990271 32.258545,24.313267 32.510548,24.433262 L33.413555,24.851259 C33.668549,24.969271 33.779556,25.274261 33.660553,25.528259 L32.749546,27.486261 C32.630543,27.73925 32.325546,27.85125 32.071529,27.734245 L31.224522,27.337244 C30.967531,27.221247 30.615522,27.29925 30.434521,27.511255 L28.112492,29.681261 C27.883501,29.851244 27.779495,30.202255 27.873491,30.464249 L28.217505,31.40324 C28.313498,31.666241 28.175495,31.961254 27.9135,32.056255 L25.886471,32.796242 C25.622477,32.89225 25.328466,32.756233 25.231466,32.492226 L24.889467,31.553234 C24.793459,31.29225 24.485456,31.09123 24.207455,31.110243 L21.392424,31.027235 C21.111429,30.988234 20.79142,31.162245 20.673422,31.417248 L20.223421,32.374245 C20.108414,32.628242 19.803417,32.740242 19.54841,32.620247 L17.590399,31.711254 C17.336382,31.593243 17.225389,31.289259 17.343388,31.034254 L17.76339,30.138262 C17.878395,29.884233 17.801399,29.528248 17.583395,29.350239 L15.39537,27.007259 C15.226377,26.782253 14.874368,26.678249 14.609365,26.775265 L13.653347,27.125269 C13.391352,27.22027 13.097342,27.082272 13.001348,26.817257 L12.261335,24.791262 C12.164334,24.527256 12.300337,24.23325 12.562348,24.137272 L13.518352,23.789282 C13.784361,23.692266 13.98436,23.386269 13.960358,23.104256 L14.039352,20.346268 C14.076356,20.067278 13.900359,19.74428 13.642345,19.62627 L12.703341,19.187275 C12.447342,19.070272 12.33534,18.764273 12.455338,18.509268 L13.364343,16.553282 C13.483348,16.298277 13.788359,16.187284 14.042358,16.305296 L14.905358,16.707302 C15.161373,16.822292 15.515366,16.745296 15.691378,16.530302 L18.069391,14.295292 C18.291393,14.125309 18.397398,13.771306 18.301405,13.509283 L17.972391,12.607308 C17.876396,12.345316 18.01539,12.050303 18.277401,11.954295 L20.305422,11.214308 C20.354361,11.196495 20.404493,11.186803 20.454292,11.184546 z M9.1660004,6.3320084 C7.6000061,6.3320084 6.3330078,7.5999851 6.3330078,9.1659966 C6.3330078,10.731001 7.6000061,12.000991 9.1660004,12.000991 C10.731003,12.000991 12,10.731001 12,9.1659966 C12,7.5999851 10.731003,6.3320084 9.1660004,6.3320084 z M8.3540039,0.5 L10.040009,0.5 C10.258011,0.49999997 10.438004,0.67898583 10.438004,0.89697301 L10.438004,1.6469742 C10.438004,1.8649919 10.611008,2.0950031 10.822006,2.1550012 L12.843002,2.961978 C13.036011,3.0629916 13.323013,3.0209994 13.480011,2.8649931 L14.016006,2.3269985 C14.174011,2.1709921 14.427002,2.1709921 14.582001,2.3269985 L15.772003,3.5179787 C15.928009,3.6729777 15.928009,3.926976 15.772003,4.0820055 L15.278,4.5759945 C15.122009,4.7320004 15.087006,5.0149903 15.193008,5.2049928 L16.189011,7.5269871 C16.25,7.7389927 16.481003,7.9090066 16.703003,7.9090066 L17.434006,7.9090066 C17.651001,7.9090066 17.832001,8.0889988 17.832001,8.3079929 L17.832001,9.9929934 C17.832001,10.211987 17.651001,10.391004 17.434006,10.391004 L16.703003,10.391004 C16.481003,10.392987 16.25,10.563002 16.192001,10.775007 L15.363998,12.836991 C15.26001,13.030992 15.303009,13.314012 15.455002,13.470018 L16.006012,14.018999 C16.162003,14.172991 16.162003,14.42699 16.006012,14.581012 L14.813004,15.775014 C14.658005,15.927999 14.404007,15.927999 14.249008,15.775014 L13.734009,15.256001 C13.577011,15.103016 13.297012,15.064991 13.10701,15.172993 L10.822006,16.142996 C10.609009,16.206015 10.438004,16.435995 10.438004,16.654013 L10.438004,17.434013 C10.438004,17.654015 10.258011,17.833 10.040009,17.833 L8.3540039,17.833 C8.1350098,17.833 7.9550018,17.654015 7.9550018,17.434013 L7.9550018,16.654013 C7.9550018,16.435995 7.7830048,16.206015 7.5740051,16.146017 L5.5310059,15.330006 C5.3339996,15.226002 5.053009,15.267994 4.8980103,15.424 L4.3120117,16.006002 C4.1600037,16.161001 3.9060059,16.161001 3.75,16.006002 L2.5570066,14.814013 C2.4020081,14.659015 2.4020081,14.405993 2.5570066,14.250995 L3.1050112,13.706011 C3.2580109,13.551012 3.2960052,13.267991 3.1840057,13.078996 L2.2060089,10.774 C2.1430054,10.563002 1.9120026,10.392987 1.6910095,10.392987 L0.89601129,10.392987 C0.67800903,10.392987 0.5,10.212995 0.5,9.9929934 L0.5,8.3079929 C0.5,8.0889988 0.67800903,7.9090066 0.89601129,7.9090066 L1.6910095,7.9090066 C1.9120026,7.9090066 2.1410065,7.7389927 2.1990051,7.5250034 L2.996002,5.5229864 C3.0980072,5.3270025 3.0550079,5.043982 2.8970032,4.8880062 L2.326004,4.3140006 C2.1690063,4.1590014 2.1690063,3.9059796 2.326004,3.7500043 L3.5169981,2.5579858 C3.6720123,2.402987 3.9260101,2.402987 4.0800018,2.5579858 L4.6060028,3.0839875 C4.7630005,3.2379797 5.0429993,3.2749975 5.230011,3.1649814 L7.5740051,2.1609824 C7.7830048,2.0959797 7.9550018,1.8649919 7.9550018,1.6469742 L7.9550018,0.89697301 C7.9550018,0.67898583 8.1350098,0.49999997 8.3540039,0.5 z - F1M217.917,403.645C214.327,403.645,211.417,400.734,211.417,397.145C211.417,393.555,214.327,390.645,217.917,390.645C221.507,390.645,224.417,393.555,224.417,397.145C224.417,400.734,221.507,403.645,217.917,403.645 M231.623,395.062L230.411,395.062C230.044,395.062,229.66,394.777,229.559,394.428L227.909,390.577C227.733,390.263,227.791,389.794,228.049,389.536L228.869,388.717C229.126,388.458,229.126,388.037,228.869,387.781L226.896,385.807C226.639,385.549,226.218,385.549,225.956,385.807L225.068,386.699C224.808,386.957,224.332,387.027,224.013,386.858L220.662,385.521C220.313,385.422,220.025,385.041,220.025,384.679L220.025,383.437C220.025,383.074,219.727,382.777,219.365,382.777L216.571,382.777C216.208,382.777,215.909,383.074,215.909,383.437L215.909,384.679C215.909,385.041,215.623,385.425,215.278,385.532L211.393,387.195C211.082,387.378,210.617,387.316,210.357,387.062L209.486,386.189C209.23,385.933,208.81,385.933,208.552,386.189L206.577,388.165C206.317,388.424,206.317,388.845,206.577,389.101L207.524,390.053C207.786,390.311,207.856,390.78,207.688,391.104L206.367,394.425C206.271,394.777,205.892,395.062,205.525,395.062L204.208,395.062C203.846,395.062,203.551,395.358,203.551,395.722L203.551,398.515C203.551,398.881,203.846,399.179,204.208,399.179L205.525,399.179C205.892,399.179,206.273,399.461,206.38,399.811L208.001,403.632C208.187,403.945,208.123,404.413,207.87,404.671L206.961,405.575C206.704,405.831,206.704,406.251,206.961,406.508L208.938,408.483C209.196,408.741,209.617,408.741,209.87,408.483L210.842,407.519C211.099,407.261,211.565,407.191,211.891,407.363L215.278,408.716C215.623,408.815,215.909,409.197,215.909,409.558L215.909,410.852C215.909,411.215,216.208,411.512,216.571,411.512L219.365,411.512C219.727,411.512,220.025,411.215,220.025,410.852L220.025,409.558C220.025,409.197,220.309,408.815,220.662,408.71L224.45,407.102C224.766,406.924,225.229,406.986,225.489,407.24L226.344,408.101C226.601,408.355,227.021,408.355,227.279,408.101L229.256,406.122C229.514,405.866,229.514,405.445,229.256,405.188L228.344,404.279C228.091,404.021,228.02,403.551,228.191,403.229L229.563,399.812C229.66,399.461,230.044,399.179,230.411,399.175L231.623,399.175C231.983,399.175,232.283,398.879,232.283,398.515L232.283,395.722C232.283,395.358,231.983,395.062,231.623,395.062 - M14.365993,11.367979 C16.022976,11.367979 17.365993,12.70999 17.365993,14.367979 C17.365993,16.023985 16.022976,17.367979 14.365993,17.367979 C12.70898,17.367979 11.365993,16.023985 11.365993,14.367979 C11.365993,12.70999 12.70898,11.367979 14.365993,11.367979 z M14.366008,7.8679852 C10.775997,7.8679848 7.8660102,10.77799 7.8660102,14.367988 C7.8660102,17.95701 10.775997,20.867992 14.366008,20.867992 C17.956003,20.867992 20.866005,17.95701 20.866005,14.367988 C20.866005,10.77799 17.956003,7.8679848 14.366008,7.8679852 z M13.02,0 L15.814005,0 C16.174997,0 16.474009,0.29699802 16.474009,0.66000462 L16.474009,1.9019785 C16.474009,2.263979 16.760996,2.6449909 17.111002,2.7439899 L20.461006,4.080996 C20.781013,4.2500024 21.255989,4.1799951 21.517006,3.9219995 L22.405006,3.0300007 C22.667,2.7720051 23.087013,2.7720051 23.344002,3.0300007 L25.318001,5.0040007 C25.574989,5.2599821 25.574989,5.6810026 25.318001,5.9400058 L24.497993,6.7590065 C24.239998,7.0170021 24.181984,7.4859962 24.358009,7.7999921 L26.006996,11.651007 C26.108986,12.000006 26.492989,12.285009 26.859991,12.28501 L28.071995,12.28501 C28.43198,12.285009 28.731998,12.581 28.731998,12.944983 L28.731998,15.738014 C28.731998,16.101997 28.43198,16.397987 28.071995,16.397987 L26.859991,16.397987 C26.492989,16.401985 26.108986,16.683998 26.012001,17.035011 L24.639992,20.452007 C24.467995,20.773998 24.539986,21.243999 24.793007,21.501995 L25.704994,22.410992 C25.962013,22.668011 25.962013,23.089001 25.704994,23.345013 L23.728004,25.324017 C23.470009,25.578014 23.048988,25.578014 22.793007,25.324017 L21.937996,24.462994 C21.67701,24.208996 21.213997,24.147015 20.898994,24.324993 L17.111002,25.932995 C16.756998,26.038006 16.474009,26.419996 16.474009,26.781019 L16.474009,28.074995 C16.474009,28.438002 16.174997,28.734999 15.814005,28.734999 L13.02,28.734999 C12.657009,28.734999 12.357998,28.438002 12.357998,28.074995 L12.357998,26.781019 C12.357998,26.419996 12.072002,26.038006 11.727001,25.939007 L8.3390026,24.58601 C8.0140057,24.414013 7.5470099,24.48399 7.290998,24.742016 L6.3189983,25.706005 C6.0660076,25.964001 5.6450028,25.964001 5.3870072,25.706005 L3.4100027,23.730999 C3.1529989,23.47401 3.1529989,23.053997 3.4100027,22.798016 L4.3189993,21.893993 C4.5720048,21.635998 4.6350083,21.168011 4.4500113,20.854992 L2.8290091,17.034004 C2.7219992,16.683998 2.3400116,16.401985 1.973999,16.401985 L0.65701294,16.401985 C0.29501343,16.401985 0,16.104012 0,15.738014 L0,12.944983 C0,12.581 0.29501343,12.285009 0.65701294,12.28501 L1.973999,12.28501 C2.3400116,12.285009 2.7190084,12.000006 2.8160086,11.647985 L4.1370077,8.3269997 C4.305007,8.0029945 4.2349997,7.5340004 3.9730062,7.2760048 L3.026,6.3240085 C2.7660055,6.0679965 2.7660055,5.647006 3.026,5.3880033 L5.0010056,3.4119892 C5.2580094,3.1560078 5.6789994,3.1560078 5.9350109,3.4119892 L6.8059978,4.285006 C7.0660076,4.5390038 7.5310035,4.6009851 7.8410006,4.4180017 L11.727001,2.7550068 C12.072002,2.6479816 12.357998,2.263979 12.357998,1.9019785 L12.357998,0.66000462 C12.357998,0.29699802 12.657009,0 13.02,0 z - F1M545.412,316.709C545.206,316.781,544.916,316.716,544.764,316.564L537.733,309.534C537.582,309.382,537.518,309.093,537.587,308.89L538.373,306.647C538.441,306.443,538.407,306.127,538.292,305.946L535.774,301.941C535.662,301.757,535.392,301.591,535.177,301.565L531.752,301.18C531.539,301.153,531.361,301.311,531.361,301.526L531.361,303.76C531.361,303.972,531.539,304.167,531.752,304.192L533.565,304.398C533.779,304.422,534.049,304.591,534.162,304.772L535.219,306.452C535.334,306.633,535.369,306.95,535.294,307.151L534.941,308.167C534.87,308.37,534.688,308.66,534.536,308.811L533.931,309.417C533.777,309.569,533.488,309.753,533.286,309.825L532.271,310.179C532.067,310.249,531.753,310.214,531.571,310.099L529.89,309.045C529.708,308.928,529.539,308.66,529.514,308.448L529.295,306.476C529.27,306.262,529.252,306.084,529.253,306.082C529.256,306.08,529.256,306.073,529.252,306.069C529.247,306.062,529.066,306.06,528.853,306.06L526.712,306.06C526.498,306.06,526.343,306.236,526.366,306.448L526.764,309.98C526.787,310.194,526.955,310.463,527.139,310.577L531.146,313.095C531.329,313.209,531.643,313.244,531.844,313.175L534.087,312.392C534.288,312.318,534.58,312.385,534.731,312.538L541.762,319.564C541.913,319.718,541.978,320.01,541.909,320.211L541.124,322.452C541.054,322.655,541.087,322.971,541.204,323.153L543.721,327.157C543.833,327.341,544.104,327.51,544.315,327.534L547.745,327.921C547.959,327.945,548.134,327.79,548.134,327.573L548.134,325.344C548.134,325.127,547.959,324.932,547.745,324.906L545.931,324.703C545.714,324.682,545.447,324.51,545.333,324.328L544.276,322.649C544.165,322.464,544.131,322.151,544.197,321.947L544.853,320.075C544.924,319.872,545.15,319.646,545.351,319.578L547.226,318.922C547.428,318.85,547.742,318.885,547.927,319.001L549.604,320.058C549.786,320.17,549.957,320.439,549.98,320.651L550.2,322.625C550.225,322.837,550.244,323.014,550.243,323.019C550.238,323.021,550.24,323.027,550.244,323.032C550.248,323.036,550.429,323.041,550.643,323.041L552.783,323.041C552.998,323.041,553.153,322.865,553.131,322.651L552.731,319.118C552.708,318.904,552.541,318.635,552.357,318.521L548.35,316.005C548.169,315.892,547.854,315.854,547.649,315.926z - M8.5669994,3.829016 L8.5669994,7.3880053 C5.5090222,8.680027 3.3619928,11.708011 3.3619928,15.238008 C3.3619928,19.942019 7.1769876,23.756012 11.881019,23.756012 C16.584988,23.756012 20.399006,19.942019 20.399006,15.238008 C20.399006,11.708011 18.253016,8.680027 15.192963,7.3880053 L15.192963,3.829016 C20.141989,5.2640128 23.761,9.8269997 23.761,15.238008 C23.761,21.799013 18.441978,27.119019 11.879981,27.119019 C5.3179827,27.119019 0,21.799013 0,15.238008 C0,9.8260231 3.6180348,5.263021 8.5669994,3.829016 z M10.081968,0 L13.678968,0 L13.678968,11.168999 L10.081968,11.168999 z - M620.521,266.264L605.146,266.264L605.146,262.264L620.521,262.264z - M10.29599,10.438995 L4.6690063,16.074982 23.09201,16.074982 17.464996,10.438995 13.878998,14.028992 z M25.872009,2.0249939 L18.972992,8.9339905 25.872009,15.838989 z M1.8880005,2.0249939 L1.8880005,15.838989 8.7919922,8.9339905 z M4.6690063,1.7889709 L10.29599,7.4219971 11.798004,8.9339905 13.878998,11.013 15.959015,8.9339905 17.464996,7.4219971 23.09201,1.7889709 z M0,0 L27.76001,0 27.76001,0.31799316 27.76001,17.544983 27.76001,17.757996 0,17.757996 0,17.544983 0,0.31799316 z - M16.83252,6.9896851 C19.499084,6.9536743 21.187073,8.1134338 22.417999,9.9349976 18.110992,11.561996 18.638,20.309998 23.184998,21.233994 23.184998,21.363998 23.184998,21.493988 23.184998,21.623993 21.740997,24.571991 20.471008,27.695999 17.436005,29.026993 17.054016,29.026993 16.670013,29.026993 16.287018,29.026993 14.082001,27.760986 10.350006,27.434998 8.2400208,29.026993 7.7290039,29.026993 7.2180176,29.026993 6.7070007,29.026993 2.8580017,26.769989 1.007019,22.483994 0,17.337997 0,16.298996 0,15.260986 0,14.220993 0.60601807,10.456985 3.3430176,6.8589935 7.2810059,7.0129852 8.7630005,7.0709991 10.100006,8.3769989 11.688019,8.3769989 13.104004,8.3769989 14.694,7.1259918 16.286011,7.0129852 16.472626,6.9998016 16.654755,6.9920807 16.83252,6.9896851 z M16.477997,0 C16.734009,0 16.990021,0 17.244995,0 17.216003,3.9319916 15.205994,6.8879852 11.496002,6.4289856 11.627991,2.7309875 13.76001,1.0679932 16.477997,0 z - F1M257.414,308.958C255.344,311.027,251.988,311.027,249.92,308.958C247.85,306.889,247.85,303.533,249.92,301.465C251.988,299.395,255.344,299.395,257.414,301.465C259.482,303.533,259.482,306.889,257.414,308.958 M259.1,299.778C256.099,296.778,251.234,296.778,248.233,299.778C245.233,302.779,245.233,307.646,248.233,310.644C250.82,313.234,254.794,313.583,257.763,311.706L261.801,315.745L264.198,313.348L260.161,309.31C262.039,306.341,261.688,302.367,259.1,299.778 - M10.154,2.1339998 C7.402,2.1339998 5.1700001,4.359 5.158,7.1069997 L5.1519995,7.1069997 5.1519995,10.149 15.155,10.149 15.155,7.1069997 15.15,7.1069997 C15.137,4.359 12.906,2.1339998 10.154,2.1339998 z M10.154,0 C14.085,0 17.273,3.1799998 17.285,7.1069997 L17.284,7.1069997 17.284,10.149 18.939,10.149 C19.695,10.149 20.308,10.761 20.308,11.517 L20.308,29.088001 C20.308,29.843999 19.695,30.457 18.939,30.457 L1.3689995,30.457 C0.61199951,30.457 0,29.843999 0,29.088001 L0,11.517 C0,10.761 0.61199951,10.149 1.3689995,10.149 L3.0229998,10.149 3.0229998,7.1069997 3.0240002,7.1069997 C3.0359993,3.1809998 6.2229996,0 10.154,0 z - M11.01001,0 L14.411987,6.8930359 21.470032,7.9179993 21.468079,7.9179993 22.018982,7.9980164 16.514038,13.365021 17.814026,20.94101 11.01001,17.363007 4.2050171,20.94101 5.5050049,13.365021 0,7.9980164 7.6069946,6.8930359 z - M10.139999,2.6919861 L11.859001,2.6919861 11.859001,10.140991 18.792,10.140991 18.792,11.858978 11.859001,11.858978 11.228996,11.858978 10.139999,11.858978 z M11,2.0619812 C6.064003,2.0619812 2.0619965,6.0639954 2.0619965,11 2.0619965,15.935974 6.064003,19.937988 11,19.937988 15.934998,19.937988 19.938004,15.935974 19.938004,11 19.938004,6.0639954 15.935997,2.0619812 11,2.0619812 z M11,0 C17.074997,0 22,4.9249878 22,11 22,17.074982 17.074997,22 11,22 4.9250031,22 0,17.074982 0,11 0,4.9249878 4.9250031,0 11,0 z - M10.271996,6.4309998 L12.013008,6.4309998 12.013008,13.976013 19.036003,13.976013 19.036003,15.71701 12.013008,15.71701 11.375008,15.71701 10.271996,15.71701 z M11.142998,5.7940063 C6.1440048,5.7940063 2.090004,9.8479919 2.090004,14.846985 2.090004,19.846008 6.1440048,23.899994 11.142998,23.899994 16.142998,23.899994 20.196007,19.846008 20.196007,14.846985 20.196007,9.8479919 16.142998,5.7940063 11.142998,5.7940063 z M8.5100021,0 L13.776009,0 13.776009,4.0190125 C18.659004,5.20401 22.284996,9.6000061 22.286003,14.846008 22.286003,21 17.297005,25.989014 11.142998,25.989014 4.9889984,25.989014 0,20.998993 0,14.846008 0,9.6000061 3.6269989,5.20401 8.5100021,4.0190125 z - M10.139999,2.6919861 L10.139999,11.858978 11.229004,11.858978 11.858994,11.858978 18.791992,11.858978 18.791992,10.140991 11.858994,10.140991 11.858994,2.6919861 z M11,0 C17.074997,0 22,4.9249878 22,11 22,17.074982 17.074997,22 11,22 4.9250031,22 0,17.074982 0,11 0,4.9249878 4.9250031,0 11,0 z - M6.8999939,25.976013 C4.9670105,25.976013 3.3999939,27.542999 3.3999939,29.476013 3.3999939,31.408997 4.9670105,32.976013 6.8999939,32.976013 8.8330078,32.976013 10.399994,31.408997 10.399994,29.476013 10.399994,27.542999 8.8330078,25.976013 6.8999939,25.976013 z M6.980011,16.335999 C6.368988,16.335999 5.7690125,16.382996 5.1809998,16.46701 L5.1809998,20.542999 C5.7619934,20.417999 6.3630066,20.347992 6.980011,20.347992 11.679993,20.347992 15.490997,24.158997 15.490997,28.859009 15.490997,30.588013 14.971985,32.195007 14.085999,33.537018 L18.596008,33.537018 C19.178986,32.09201 19.502991,30.514008 19.502991,28.859009 19.502991,21.944 13.895996,16.335999 6.980011,16.335999 z M7.7720032,4.4620056 C6.8970032,4.4620056 6.0320129,4.5100098 5.1809998,4.6000061 L5.1809998,9.9500122 C6.0289917,9.835022 6.8930054,9.7700195 7.7720032,9.7700195 18.355011,9.7700195 26.93399,18.348999 26.93399,28.932007 26.93399,30.52002 26.737,32.063019 26.372986,33.537018 L31.803009,33.537018 C32.087006,32.045013 32.240997,30.506012 32.240997,28.932007 32.242004,15.416992 21.286011,4.4620056 7.7720032,4.4620056 z M3,0 L35,0 C36.649994,0 38,1.3500061 38,3 L38,35 C38,36.649994 36.649994,38 35,38 L3,38 C1.3500061,38 0,36.649994 0,35 L0,3 C0,1.3500061 1.3500061,0 3,0 z - M7.8999939,26.976013 C5.9670105,26.976013 4.3999939,28.542999 4.3999939,30.476013 4.3999939,32.408997 5.9670105,33.976013 7.8999939,33.976013 9.8330078,33.976013 11.399994,32.408997 11.399994,30.476013 11.399994,28.542999 9.8330078,26.976013 7.8999939,26.976013 z M7.980011,17.335999 C7.368988,17.335999 6.7690125,17.382996 6.1809998,17.46701 L6.1809998,21.542999 C6.7619934,21.417999 7.3630066,21.347992 7.980011,21.347992 12.679993,21.347992 16.490997,25.158997 16.490997,29.859009 16.490997,31.588013 15.971985,33.195007 15.085999,34.537018 L19.596008,34.537018 C20.178986,33.09201 20.502991,31.514008 20.502991,29.859009 20.502991,22.944 14.895996,17.335999 7.980011,17.335999 z M8.7720032,5.4620056 C7.8970032,5.4620056 7.0320129,5.5100098 6.1809998,5.6000061 L6.1809998,10.950012 C7.0289917,10.835022 7.8930054,10.77002 8.7720032,10.77002 19.355011,10.77002 27.93399,19.348999 27.93399,29.932007 27.93399,31.52002 27.737,33.063019 27.372986,34.537018 L32.803009,34.537018 C33.087006,33.045013 33.240997,31.506012 33.240997,29.932007 33.242004,16.416992 22.286011,5.4620056 8.7720032,5.4620056 z M4,1 L36,1 C37.649994,1 39,2.3500061 39,4 L39,36 C39,37.649994 37.649994,39 36,39 L4,39 C2.3500061,39 1,37.649994 1,36 L1,4 C1,2.3500061 2.3500061,1 4,1 z - F1M646.525,268.693L655.771,259.449L655.693,259.518C655.813,259.424,658.705,257.204,660.947,259.449C663.103,261.604,661.155,263.847,660.925,264.096L660.947,264.071L649.762,275.257L649.82,275.205C649.651,275.345,645.644,278.626,642.274,275.257C639.018,272.001,641.934,268.854,642.276,268.507C642.274,268.509,654.477,256.305,654.477,256.305L654.428,256.351C654.624,256.184,659.306,252.262,663.353,256.305C667.387,260.341,663.484,264.845,663.315,265.035L663.353,264.996L653.646,274.702L654.94,275.997L664.647,266.291L664.663,266.272L664.682,266.253C666.512,264.207,668.859,259.226,664.647,255.012C660.441,250.806,655.34,253.145,653.23,254.967L653.206,254.987L653.184,255.012L640.979,267.216C639.365,268.83,637.287,272.859,640.979,276.552C644.631,280.203,649.132,278.183,651.001,276.604L651.03,276.578L651.057,276.552L662.242,265.365C663.463,264.067,665.006,260.916,662.242,258.154C659.52,255.432,656.023,256.918,654.555,258.087L654.514,258.119L654.477,258.154L645.231,267.4z - M449.29,381.019L432.707,381.019L432.707,365.644L449.29,365.644z - M9.3330001,0 L13.333,0 13.333,15.375 9.3330001,15.375 z M0,0 L3.9999999,0 3.9999999,15.375 0,15.375 z - M24.455,0.61500008 L28.455,0.61500008 28.455,15.99 24.455,15.99 z M15.121,0.61500008 L19.121,0.61500008 19.121,15.99 15.121,15.99 z M0,0 L14.789,8.5379999 0,17.077 z - M14.787994,0 L14.787994,8.0830688 28.789001,0 28.789001,17.076019 14.787994,8.9929199 14.787994,17.076019 0,8.5379944 z - M18.119995,0 L18.119995,8.0839844 32.119995,0 32.119995,17.076996 18.119995,8.993988 18.119995,17.076996 4,8.9246826 4,16.22702 0,16.22702 0,0.85202026 4,0.85202026 4,8.1532593 z - M0,0 L14.000977,8.0830383 14.000977,0 28.789001,8.5379944 14.000977,17.076996 14.000977,8.992981 0,17.076996 z - M0,0 L14,8.0834351 14,0 28.120972,8.1532898 28.120972,0.85198975 32.120972,0.85198975 32.120972,16.22699 28.120972,16.22699 28.120972,8.9246826 14,17.076996 14,8.9945068 0,17.076996 z - F1M641.074,321.18C637.116,321.18,633.904,317.971,633.904,314.011C633.904,310.054,637.116,306.842,641.074,306.842C645.034,306.842,648.243,310.054,648.243,314.011C648.243,317.971,645.034,321.18,641.074,321.18 M627.878,308.322C627.878,309.192,626.978,309.904,625.878,309.904L622.997,309.904C621.897,309.904,620.997,309.192,620.997,308.322C620.997,307.452,621.897,306.74,622.997,306.74L625.878,306.74C626.978,306.74,627.878,307.452,627.878,308.322 M629.878,303.614C628.778,303.614,627.878,303.233,627.878,302.769C627.878,302.305,626.978,301.924,625.878,301.924L622.997,301.924C621.897,301.924,620.997,302.305,620.997,302.769C620.997,303.233,620.115,303.614,619.037,303.614C617.958,303.614,617.076,304.514,617.076,305.614L617.076,322.791C617.076,323.891,617.977,324.791,619.076,324.791L650.006,324.791C651.105,324.791,652.006,323.891,652.006,322.791L652.006,305.614C652.006,304.514,651.105,303.614,650.006,303.614z M641.236,315.893C640.166,315.893,639.301,315.026,639.301,313.957C639.301,312.887,640.166,312.021,641.236,312.021C642.306,312.021,643.172,312.887,643.172,313.957C643.172,315.026,642.306,315.893,641.236,315.893 M641.074,309.38C638.518,309.38,636.443,311.455,636.443,314.011C636.443,316.567,638.518,318.643,641.074,318.643C643.63,318.643,645.701,316.567,645.701,314.011C645.701,311.455,643.63,309.38,641.074,309.38 - F1M331.313,563.311L317.082,563.311L309.01,571.914L308.797,563.311L302,563.311L302,533.998L331.313,533.998z - M386.647,563.311L372.415,563.311L364.343,571.914L364.131,563.311L357.333,563.311L357.333,533.998L386.647,533.998L386.647,563.311z - F1M447.813,560.311C447.813,561.961,446.463,563.311,444.813,563.311L436.582,563.311C434.932,563.311,432.658,564.295,431.529,565.498L427.563,569.727C426.434,570.93,425.477,570.564,425.436,568.915L425.372,566.31C425.331,564.66,423.947,563.311,422.297,563.311L421.5,563.311C419.85,563.311,418.5,561.961,418.5,560.311L418.5,536.998C418.5,535.348,419.85,533.998,421.5,533.998L444.813,533.998C446.463,533.998,447.813,535.348,447.813,536.998z - M503.98,560.311C503.98,561.961,502.631,563.311,500.98,563.311L492.749,563.311C491.099,563.311,488.825,564.295,487.696,565.498L483.729,569.727C482.601,570.93,481.644,570.564,481.603,568.915L481.539,566.31C481.498,564.66,480.114,563.311,478.464,563.311L477.667,563.311C476.017,563.311,474.667,561.961,474.667,560.311L474.667,536.998C474.667,535.348,476.017,533.998,477.667,533.998L500.98,533.998C502.631,533.998,503.98,535.348,503.98,536.998L503.98,560.311z - F1M331.313,607.395L317.082,607.395L309.01,611.914L308.797,607.395L302,607.395L302,591.998L331.313,591.998z - M386.647,607.395L372.415,607.395L364.343,611.914L364.131,607.395L357.333,607.395L357.333,591.998L386.647,591.998L386.647,607.395z - F1M447.813,604.395C447.813,606.045,446.463,607.395,444.813,607.395L436.582,607.395C434.932,607.395,432.404,608.054,430.964,608.86L428.127,610.448C426.688,611.255,425.462,610.897,425.403,609.654C425.345,608.411,423.947,607.395,422.297,607.395L421.5,607.395C419.85,607.395,418.5,606.045,418.5,604.395L418.5,594.998C418.5,593.348,419.85,591.998,421.5,591.998L444.813,591.998C446.463,591.998,447.813,593.348,447.813,594.998z - M503.98,604.395C503.98,606.045,502.631,607.395,500.98,607.395L492.749,607.395C491.099,607.395,488.571,608.054,487.131,608.86L484.294,610.448C482.854,611.255,481.629,610.897,481.57,609.654C481.512,608.411,480.114,607.395,478.464,607.395L477.667,607.395C476.017,607.395,474.667,606.045,474.667,604.395L474.667,594.998C474.667,593.348,476.017,591.998,477.667,591.998L500.98,591.998C502.631,591.998,503.98,593.348,503.98,594.998L503.98,604.395z - M21.500036,21.032999 L21.421177,21.188484 C20.753605,22.471619 19.925375,23.58799 18.976974,24.482231 L18.843016,24.604626 L19.07498,24.489197 C20.682716,23.664637 22.088428,22.499987 23.196501,21.090906 L23.240929,21.032999 z M17.37859,21.032999 L17.371532,21.064796 C16.960249,22.824295 16.395781,24.33313 15.685818,25.367764 L15.621832,25.457935 L15.707819,25.427235 C17.572409,24.721003 19.195171,23.172724 20.356995,21.090906 L20.388525,21.032999 z M10.486703,21.032999 L10.492313,21.056185 C11.215294,23.972479 12.304368,25.755455 13.337351,25.847277 L13.420955,25.851004 L13.504601,25.847277 C14.53762,25.755455 15.627392,23.972479 16.350945,21.056185 L16.356558,21.032999 z M6.4553499,21.032999 L6.4868636,21.090906 C7.6480737,23.172724 9.2701426,24.721003 11.13439,25.427235 L11.219942,25.457785 L11.156081,25.367764 C10.446338,24.33313 9.882288,22.824295 9.4714088,21.064796 L9.4643593,21.032999 z M3.6029429,21.032999 L3.6473675,21.090906 C4.7553339,22.499987 6.1608753,23.664637 7.7683277,24.489197 L7.99576,24.60239 L7.7772484,24.397747 C6.8658867,23.518053 6.068459,22.43152 5.4217868,21.188484 L5.3429308,21.032999 z M23.211849,14.322016 L23.18936,14.708988 C23.061337,16.543262 22.662342,18.270981 22.047913,19.816189 L21.956335,20.039999 L23.937792,20.039999 L24.048944,19.862143 C24.977785,18.335327 25.58691,16.593672 25.782679,14.73086 L25.818449,14.322016 z M18.171144,14.322016 L18.161224,14.68434 C18.101355,16.50795 17.912403,18.326635 17.599857,19.980806 L17.588043,20.039999 L20.883085,20.039999 L20.961973,19.862143 C21.621185,18.335327 22.053539,16.593672 22.192495,14.73086 L22.217888,14.322016 z M9.6671219,14.322016 L9.6790142,14.748766 C9.7418594,16.625416 9.9360924,18.331793 10.220311,19.81319 L10.265026,20.039999 L16.578415,20.039999 L16.623169,19.81319 C16.907627,18.331793 17.102051,16.625416 17.164959,14.748766 L17.176861,14.322016 z M4.6271124,14.322016 L4.6524854,14.73086 C4.7913408,16.593672 5.2233872,18.335327 5.8822184,19.862143 L5.96106,20.039999 L9.2551231,20.039999 L9.2433224,19.980806 C8.9311247,18.326635 8.7424736,16.50795 8.682704,14.68434 L8.672801,14.322016 z M1.0255805,14.322016 L1.0613518,14.73086 C1.2571157,16.593672 1.866225,18.335327 2.7949955,19.862143 L2.9061403,20.039999 L4.8866549,20.039999 L4.795083,19.816189 C4.1806822,18.270981 3.7816935,16.543262 3.6536727,14.708988 L3.6311836,14.322016 z M22.265423,7.6119909 L22.366602,7.9061384 C22.882729,9.4659939 23.187027,11.183938 23.229004,12.990919 L23.232903,13.327015 L25.850161,13.327015 L25.849005,13.197647 C25.814701,11.279016 25.343273,9.4650049 24.530273,7.8512087 L24.404678,7.6119909 z M17.730499,7.6119909 L17.784622,7.9558067 C18.026783,9.5616112 18.159889,11.281147 18.179455,12.984018 L18.181431,13.327015 L22.240274,13.327015 L22.238949,13.152687 C22.209305,11.206204 21.860308,9.3683567 21.263035,7.7392178 L21.214064,7.6119909 z M10.115915,7.6119909 L10.086958,7.7846079 C9.8462496,9.261405 9.6929512,10.933283 9.662571,12.753417 L9.6578035,13.327015 L17.186192,13.327015 L17.181417,12.753417 C17.151009,10.933283 16.997555,9.261405 16.756636,7.7846079 L16.727654,7.6119909 z M5.6302767,7.6119909 L5.581336,7.7392178 C4.9844236,9.3683567 4.6356893,11.206204 4.6060677,13.152687 L4.6047421,13.327015 L8.6625328,13.327015 L8.6645031,12.984018 C8.6840363,11.281147 8.8169136,9.5616112 9.058774,7.9558067 L9.1128302,7.6119909 z M2.4392874,7.6119909 L2.3137019,7.8512087 C1.5007527,9.4650049 1.0293292,11.279016 0.99502492,13.197647 L0.99386919,13.327015 L3.6101127,13.327015 L3.613874,12.997645 C3.6576834,11.081837 3.9963574,9.2659922 4.5697241,7.6323757 L4.5771465,7.6119909 z M7.9957371,2.2436218 L7.7683277,2.3568039 C5.9140272,3.3079872 4.328413,4.7117357 3.1583335,6.4212008 L3.0290439,6.616991 L4.9663363,6.616991 L4.9700546,6.6081066 C5.6891823,4.9455261 6.6629252,3.5123711 7.8172741,2.4098244 z M18.84478,2.2422523 L18.903784,2.2954235 C20.089306,3.3918667 21.091063,4.8331451 21.831486,6.5131836 L21.875736,6.616991 L23.814878,6.616991 L23.685579,6.4212008 C22.515402,4.7117357 20.929607,3.3079872 19.07498,2.3568039 z M11.221077,1.3866158 L11.219995,1.3869896 C9.1156864,2.1520271 7.313303,3.9874878 6.1236582,6.4548874 L6.0488091,6.616991 L9.2920389,6.616991 L9.3368015,6.3927422 C9.7555103,4.3720818 10.365383,2.6308842 11.156081,1.4782372 z M15.620702,1.3864746 L15.685818,1.4782372 C16.476761,2.6308842 17.087126,4.3720818 17.506277,6.3927422 L17.551086,6.616991 L20.795288,6.616991 L20.720396,6.4548874 C19.530088,3.9874878 17.726879,2.1520271 15.622199,1.3869896 z M13.420945,0.99499512 L13.337351,0.99872208 C12.219168,1.0980778 11.035259,3.1783276 10.321128,6.5333691 L10.303766,6.616991 L16.539642,6.616991 L16.522266,6.5333691 C15.807548,3.1783276 14.622824,1.0980778 13.504601,0.99872208 z M13.420952,0 L13.766978,0.0043926239 C21.010666,0.18849373 26.844,6.1366577 26.844,13.423016 C26.844,16.083103 26.066517,18.564837 24.726765,20.652857 L24.569008,20.892345 L24.569008,21.032999 L24.472509,21.032999 L24.364653,21.188484 C21.992281,24.522438 18.136187,26.730562 13.766978,26.841608 L13.421004,26.846001 L13.075191,26.841608 C8.7082653,26.730562 4.852366,24.522438 2.4797897,21.188484 L2.371922,21.032999 L2.2760088,21.032999 L2.2760088,20.893248 L2.1176414,20.652857 C0.77774429,18.564837 0,16.083103 0,13.423016 C0,6.1366577 5.8352871,0.18849373 13.075191,0.0043926239 z - F1M637.757,504.257L620.243,504.257L620.243,486.743L637.757,486.743z M617,507.5L641,507.5L641,483.5L617,483.5z - F1M517.1304,875.4233L505.7264,886.6153L466.4894,886.5963L466.5094,866.0273L517.1304,866.0273z M462.9474,878.9873L460.7084,878.9873L460.7084,873.7233L462.9474,873.7233z M462.9474,862.5603L462.9474,870.1633L460.7094,870.1633C458.7414,870.1633,457.1474,871.7573,457.1474,873.7243L457.1474,878.9873C457.1474,880.9543,458.7414,882.5483,460.7094,882.5483L462.9474,882.5483L462.9474,890.1713L520.7854,890.1713L520.7854,862.5603z - F1M832.956,783.743L831.01,783.743L831.01,791.155L832.956,791.155z M809.604,746.833L809.604,755.541L818.27,755.541z M788.198,745.697L788.198,784.043L818.876,784.043L818.876,757.487L806.972,757.487L806.972,745.697z M828.263,798.237L828.263,779.121L821.509,779.121L821.509,786.218L785.452,786.218L785.452,779.121L778.697,779.121L778.697,798.237z M830.666,782.053L835.359,782.053L835.359,792.926L830.666,792.926L830.666,799.955L776.408,799.955L776.408,777.29L785.794,777.29L785.794,743.865L809.298,743.865L821.358,755.541L821.358,777.29L830.666,777.29z - M23.110018,10.429998 L23.110018,4.9389992 56.116997,4.9389992 56.116997,45.017993 23.656018,45.017993 23.656018,40.623994 18.155021,40.623994 18.155021,47.760993 18.155021,49.957992 20.90602,49.957992 58.871995,49.957992 61.622993,49.957992 61.622993,47.760993 61.622993,2.7429996 61.622993,1.009742E-28 58.871995,1.009742E-28 20.35702,1.009742E-28 17.606022,1.009742E-28 17.606022,2.7429996 17.606022,10.429998 z M15.40599,35.13598 L22.005985,28.548981 9.4604343E-07,28.548981 9.4604343E-07,23.054982 22.005985,23.054982 15.40599,15.919983 23.109984,15.919983 31.360978,24.704982 23.109984,35.13598 z - F1M505.7651,448.2705L501.2011,445.8175L500.9231,441.0785L491.0051,435.7535L488.4711,439.0385L469.3051,428.8495L469.3051,432.3895L487.6901,442.1405L488.0251,445.4565L494.9881,449.1055L497.1051,447.1225L504.2501,450.6625L504.2501,482.0555L505.7651,482.0555z M466.1051,432.6395L466.1051,463.4445L502.5651,481.6095L502.5651,452.2855L497.3841,449.4405L495.7411,451.1975L486.3251,446.1745L486.0191,443.4395z M469.7131,427.4175C470.0291,427.4175,471.5561,428.1235,474.2981,429.5305C477.0381,430.9395,479.6731,432.3255,482.2001,433.6875C484.7261,435.0495,486.6131,436.0755,487.8571,436.7645L490.4201,433.4805L502.9301,440.1485L503.2121,445.0585L507.7861,447.5695L507.7861,470.1935C509.0471,470.1935,510.0851,470.3995,510.9001,470.8075C511.7161,471.2155,512.8001,471.9115,514.1531,472.8955C514.4871,473.1375,515.0621,473.4995,515.8781,473.9805C516.6941,474.4635,517.2911,474.9325,517.6711,475.3875C518.0501,475.8425,518.2411,476.4305,518.2411,477.1545C518.2411,477.8785,518.0361,478.4585,517.6281,478.8945C517.2201,479.3325,516.5751,479.7815,515.6941,480.2455C514.8121,480.7085,514.1491,481.0895,513.7041,481.3865C512.9061,481.9815,512.0981,482.5655,511.2821,483.1405C510.4671,483.7175,509.5951,484.0035,508.6661,484.0035L503.2121,484.0035L464.3371,464.8155L464.3371,432.6555C464.3371,432.1545,464.5201,431.7325,464.8881,431.3875C465.2561,431.0425,465.6941,430.8715,466.2031,430.8715C466.5051,430.8715,467.0611,431.0385,467.8731,431.3755L467.8731,429.0005C467.8731,427.9455,468.4871,427.4175,469.7131,427.4175 - M17.999985,3.7880009 L15.999987,3.7880009 15.999987,0.78800018 17.999985,0.78800018 z M17.999985,7.7880018 L15.999987,7.7880018 15.999987,4.7880011 17.999985,4.7880011 z M17.999985,11.788003 L15.999987,11.788003 15.999987,8.788002 17.999985,8.788002 z M17.999985,15.788004 L15.999987,15.788004 15.999987,12.788003 17.999985,12.788003 z M17.999985,19.788004 L15.999987,19.788004 15.999987,16.788004 17.999985,16.788004 z M17.999985,23.788005 L15.999987,23.788005 15.999987,20.788005 17.999985,20.788005 z M14.999988,7.7880018 L3.9999968,7.7880018 3.9999968,0.78800018 14.999988,0.78800018 z M14.999988,15.788004 L3.9999968,15.788004 3.9999968,8.788002 14.999988,8.788002 z M14.999988,23.788005 L3.9999968,23.788005 3.9999968,16.788004 14.999988,16.788004 z M2.9999976,3.7880009 L0.99999919,3.7880009 0.99999919,0.78800018 2.9999976,0.78800018 z M2.9999976,7.7880018 L0.99999919,7.7880018 0.99999919,4.7880011 2.9999976,4.7880011 z M2.9999976,11.788003 L0.99999919,11.788003 0.99999919,8.788002 2.9999976,8.788002 z M2.9999976,15.788004 L0.99999919,15.788004 0.99999919,12.788003 2.9999976,12.788003 z M2.9999976,19.788004 L0.99999919,19.788004 0.99999919,16.788004 2.9999976,16.788004 z M2.9999976,23.788005 L0.99999919,23.788005 0.99999919,20.788005 2.9999976,20.788005 z M0,24.788006 L18.777985,24.788006 18.777985,8.5265128E-14 0,8.5265128E-14 z M14,6.7880056 L5,6.7880056 5,1.7880056 14,1.7880056 z M14,14.788006 L5,14.788006 5,9.7880056 14,9.7880056 z M14,22.788006 L5,22.788006 5,17.788006 14,17.788006 z - F1M53.9995,43.4995C53.1705,43.4995,52.4995,44.1705,52.4995,44.9995C52.4995,49.6865,48.6865,53.4995,43.9995,53.4995C39.3125,53.4995,35.4995,49.6865,35.4995,44.9995C35.4995,40.3125,39.3125,36.4995,43.9995,36.4995L44.0005,36.4995L44.0005,38.9995L50.0005,34.9995L44.0005,30.9995L44.0005,33.4995L43.9995,33.4995C37.6585,33.4995,32.4995,38.6585,32.4995,44.9995C32.4995,51.3405,37.6585,56.4995,43.9995,56.4995C50.3405,56.4995,55.4995,51.3405,55.4995,44.9995C55.4995,44.1705,54.8285,43.4995,53.9995,43.4995 - M20.449749,20.277999 C18.796769,21.435999 16.863793,22.016999 14.886817,21.989999 14.625821,21.986999 14.365824,21.973999 14.109827,21.950999 14.004828,21.940999 13.899829,21.923999 13.794831,21.910999 13.592833,21.883999 13.390836,21.856999 13.193838,21.818999 13.07284,21.795999 12.953841,21.764999 12.834843,21.736999 12.641845,21.691999 12.449847,21.645999 12.26185,21.589999 12.170851,21.561999 12.082852,21.529999 11.992853,21.499999 11.775856,21.426999 11.559858,21.351999 11.349861,21.263999 11.301861,21.244999 11.255862,21.221999 11.208862,21.200999 10.962866,21.092999 10.719868,20.978999 10.484871,20.851999 10.473872,20.845999 10.463872,20.840999 10.452872,20.834999 9.6578815,20.397999 8.9298904,19.852999 8.2918983,19.215999 8.2818984,19.205999 8.2718985,19.193999 8.2608987,19.182999 8.0629011,18.983999 7.8739034,18.775999 7.6939056,18.558999 7.6559061,18.512999 7.6199065,18.462999 7.581907,18.415999 6.2829229,16.790999 5.4999325,14.734 5.4999325,12.497 L7.9999019,12.497 3.9999509,6.497 0,12.497 2.4999693,12.497 C2.4999693,15.126999 3.3199593,17.564999 4.7129422,19.580999 4.729942,19.608999 4.7419418,19.638999 4.7609416,19.666999 4.9049398,19.872999 5.0649379,20.062999 5.219936,20.257999 5.2779352,20.331999 5.3319346,20.407999 5.3919338,20.479999 5.6199311,20.756999 5.8619281,21.016999 6.110925,21.270999 6.1349247,21.295999 6.1569245,21.320999 6.1799242,21.343999 7.0159139,22.180999 7.9609023,22.885999 8.9888897,23.449999 9.0158894,23.465999 9.0428891,23.481999 9.0718887,23.496999 9.3678851,23.655999 9.6718813,23.799999 9.9808775,23.935999 10.057877,23.968999 10.132876,24.005999 10.210875,24.038999 10.474871,24.147999 10.745868,24.243999 11.018865,24.334999 11.147863,24.378999 11.275862,24.423999 11.40686,24.463999 11.645857,24.534999 11.889854,24.593999 12.135851,24.651999 12.298849,24.689999 12.460847,24.730999 12.626845,24.762999 12.695844,24.776999 12.760843,24.797999 12.828843,24.808999 13.06084,24.849999 13.293837,24.872999 13.525834,24.900999 13.609833,24.910999 13.691832,24.924999 13.775831,24.933999 14.192826,24.974999 14.608821,25.001999 15.023816,25.001999 17.564785,25.001999 20.043754,24.224999 22.170728,22.734999 22.84872,22.258999 23.013718,21.324999 22.538723,20.645999 22.062729,19.965999 21.126741,19.801999 20.449749,20.277999 M27.501023,12.496999 C27.500023,9.8749991 26.685032,7.4419993 25.299045,5.4299995 25.279046,5.3959995 25.265046,5.3609995 25.242046,5.3289995 25.070048,5.0829996 24.88205,4.8539996 24.695051,4.6239996 24.673052,4.5959996 24.653052,4.5669996 24.630052,4.5389996 23.362065,2.9999997 21.769081,1.8109998 19.964099,1.0339999 19.914099,1.0119999 19.8651,0.98799992 19.8151,0.96699992 19.527103,0.84799993 19.232106,0.74299994 18.935109,0.64399995 18.82811,0.60899995 18.723111,0.56999996 18.614112,0.53799996 18.355115,0.45999997 18.093117,0.39599997 17.82812,0.33499998 17.682122,0.30099998 17.536123,0.26399999 17.388124,0.23499999 17.315125,0.22099999 17.246126,0.19899999 17.174127,0.18599999 16.976129,0.152 16.778131,0.137 16.580133,0.111 16.443134,0.094000001 16.309135,0.073000003 16.171137,0.059000004 15.83914,0.028000007 15.509143,0.015000008 15.179147,0.0090000084 15.119147,0.0090000084 15.061148,9.1552508E-09 15.001148,9.1552508E-09 14.990148,9.1552508E-09 14.980149,0.0030000089 14.969149,0.0040000088 12.431174,0.0060000086 9.9571988,0.77199994 7.83322,2.2599998 7.1542268,2.7349998 6.9892285,3.6699997 7.4642237,4.3489996 7.938219,5.0279996 8.8752096,5.1929995 9.5532028,4.7169996 11.194186,3.5679997 13.108167,2.9859997 15.071148,3.0039997 15.353145,3.0059997 15.631142,3.0199997 15.906139,3.0459997 15.990138,3.0549997 16.074138,3.0679997 16.158137,3.0779997 16.384135,3.1059997 16.608132,3.1379997 16.82813,3.1809997 16.926129,3.1999997 17.022128,3.2249997 17.117127,3.2469997 17.334125,3.2959997 17.550123,3.3479997 17.761121,3.4119997 17.82812,3.4329997 17.894119,3.4569997 17.961119,3.4789997 18.202116,3.5579997 18.440114,3.6429997 18.673112,3.7399997 18.697111,3.7499997 18.721111,3.7619997 18.744111,3.7719997 20.142097,4.3729996 21.368085,5.2989995 22.325075,6.4569994 22.331075,6.4639994 22.337075,6.4729994 22.343075,6.4799994 23.689061,8.1189993 24.500053,10.214999 24.501053,12.496999 L22.000078,12.496999 26.001038,18.496998 29.999998,12.496999 z - M6,0 L9,0 9,5.9999996 15,5.9999996 15,8.9999995 9,8.9999995 9,15 6,15 6,8.9999995 0,8.9999995 0,5.9999996 6,5.9999996 z - M237.083,83.001L235.152,83.001L235.152,94.197C232.15,92.832,228.633,94.66,228.05,97.372C227.86,98.254,228.253,99.209,228.618,99.647C230.673,102.1,235.152,100.956,237.211,98.319C238.125,97.149,238.048,96.128,238.048,93.622L238.048,88.346C239.314,89.288,240.743,88.522,241.254,90.202C241.571,91.246,241.432,91.982,241.096,92.868C240.994,93.134,240.714,93.358,240.843,93.626C241.73,94.284,242.056,92.823,242.422,92.299C242.909,91.602,242.635,91.805,242.813,91.343C244.574,86.777,237.603,87.413,237.083,83.001 - - - F1M6916.2676,6856.5332C6916.2676,6854.1802,6918.1816,6852.2662,6920.5336,6852.2662L6954.6666,6852.2662C6957.0196,6852.2662,6958.9336,6854.1802,6958.9336,6856.5332L6958.9336,6890.6672L6946.5906,6890.6672C6943.9936,6890.6672,6941.8676,6892.7922,6941.8676,6895.3892L6941.8676,6907.7332L6920.5336,6907.7332C6918.1816,6907.7332,6916.2676,6905.8192,6916.2676,6903.4672z M6920.5346,6912.0002L6943.4326,6912.0002L6943.4326,6911.9862C6943.4346,6911.9862,6943.4366,6911.9852,6943.4386,6911.9852C6943.5596,6911.9722,6943.6856,6911.9432,6943.8166,6911.8982C6943.8246,6911.8952,6943.8316,6911.8932,6943.8396,6911.8902C6943.8956,6911.8712,6943.9526,6911.8462,6944.0096,6911.8212C6944.0416,6911.8062,6944.0766,6911.7902,6944.1096,6911.7722C6944.1606,6911.7482,6944.2086,6911.7232,6944.2606,6911.6932C6944.3416,6911.6472,6944.4236,6911.5952,6944.5066,6911.5372C6944.5406,6911.5142,6944.5756,6911.4872,6944.6086,6911.4632C6944.6756,6911.4132,6944.7436,6911.3602,6944.8116,6911.3042C6944.8436,6911.2762,6944.8756,6911.2502,6944.9086,6911.2212C6945.0066,6911.1372,6945.1066,6911.0462,6945.2076,6910.9442L6962.1456,6894.0072C6962.2476,6893.9032,6962.3406,6893.8022,6962.4276,6893.7022C6962.4556,6893.6712,6962.4796,6893.6402,6962.5046,6893.6102C6962.5656,6893.5372,6962.6216,6893.4662,6962.6736,6893.3942C6962.6966,6893.3642,6962.7196,6893.3332,6962.7406,6893.3032C6962.8056,6893.2092,6962.8656,6893.1162,6962.9156,6893.0252C6962.9266,6893.0062,6962.9356,6892.9872,6962.9456,6892.9682C6962.9836,6892.8952,6963.0186,6892.8242,6963.0476,6892.7542C6963.0636,6892.7192,6963.0756,6892.6832,6963.0886,6892.6482C6963.1086,6892.5952,6963.1246,6892.5412,6963.1386,6892.4882C6963.1486,6892.4542,6963.1596,6892.4192,6963.1656,6892.3852C6963.1816,6892.3082,6963.1936,6892.2332,6963.1976,6892.1602L6963.2006,6892.1602L6963.2006,6856.5332C6963.2006,6851.8202,6959.3796,6848.0002,6954.6666,6848.0002L6920.5346,6848.0002C6915.8216,6848.0002,6912.0006,6851.8202,6912.0006,6856.5332L6912.0006,6903.4672C6912.0006,6908.1792,6915.8216,6912.0002,6920.5346,6912.0002 - M62.125186,1.8750017 C64.62519,4.375004 64.62519,8.4330078 62.125186,10.92801 L41.005152,32.04303 C38.510148,34.543032 34.460141,34.543032 31.956137,32.04303 29.456133,29.547027 29.456133,25.499024 31.956137,22.994021 L53.080171,1.8750017 C55.576175,-0.62500056 59.625182,-0.62500056 62.125186,1.8750017 M51.198247,27.887992 L51.198247,44.165081 51.194247,44.165081 C51.194247,44.233081 51.181246,44.310081 51.164246,44.387082 51.159246,44.421082 51.147246,44.455082 51.138246,44.489082 51.125246,44.540083 51.104246,44.592083 51.092246,44.651083 51.074246,44.685083 51.066246,44.720084 51.044246,44.754084 51.014246,44.826084 50.980246,44.894085 50.942245,44.971085 50.933245,44.989085 50.929245,45.010085 50.912245,45.023085 50.869245,45.121086 50.805245,45.206086 50.737244,45.304087 50.720244,45.334087 50.699244,45.368087 50.673244,45.398087 50.618244,45.466088 50.567244,45.534088 50.503243,45.611088 50.477243,45.645089 50.456243,45.675089 50.430243,45.705089 50.341242,45.804089 50.246242,45.90609 50.144242,46.004091 L33.21016,62.946183 C33.10816,63.044183 33.006159,63.138184 32.912159,63.223184 32.878159,63.253184 32.844158,63.275184 32.809158,63.305185 32.745158,63.365185 32.677158,63.415185 32.609157,63.467185 32.574157,63.484185 32.540157,63.518186 32.506157,63.535186 32.425156,63.599186 32.344156,63.646186 32.259156,63.697187 32.208155,63.727187 32.161155,63.744187 32.114155,63.774187 32.080155,63.791187 32.046155,63.808187 32.007154,63.825187 31.952154,63.846187 31.892154,63.872188 31.837154,63.893188 31.837154,63.893188 31.823153,63.893188 31.815153,63.902188 31.687153,63.940188 31.559152,63.974188 31.435152,63.987188 L31.431152,63.987188 31.431152,64.000188 8.5320415,64.000188 C3.8270189,64.000188 4.7497014E-07,60.181168 4.7497014E-07,55.471142 L4.7497014E-07,8.538887 C4.7497014E-07,3.8208614 3.8270189,0.0058406429 8.5320415,0.0058406429 L42.665206,0.0058406429 C44.440214,0.0058406429 46.082222,0.54384357 47.448229,1.4698486 L44.316213,4.6008656 C43.808211,4.3838644 43.249208,4.2688638 42.665206,4.2688638 L8.5320415,4.2688638 C6.1860302,4.2688638 4.266021,6.1798742 4.266021,8.538887 L4.266021,55.471142 C4.266021,57.822155 6.1860302,59.738165 8.5320415,59.738165 L29.869144,59.738165 29.869144,47.390098 C29.869144,44.796084 31.990154,42.667072 34.589167,42.667072 L46.936226,42.667072 46.936226,32.150015 z M34.52828,35.815132 L22.90635,41.093227 28.192318,29.48002 C28.538316,30.968046 29.284312,32.394072 30.449305,33.554092 31.614298,34.719113 33.030289,35.461126 34.52828,35.815132 - M62.748066,1.2510012 C64.421072,2.9150028 64.421072,5.6160054 62.748066,7.284007 L53.699031,16.333016 62.748066,25.383024 C64.421072,27.051026 64.421072,29.751028 62.748066,31.42003 61.084059,33.084032 58.384049,33.084032 56.720043,31.42003 L47.666008,22.366021 38.615973,31.42003 C36.951967,33.084032 34.251957,33.084032 32.57895,31.42003 30.914944,29.751028 30.914944,27.051026 32.57895,25.383024 L41.628985,16.333016 32.57895,7.284007 C30.914944,5.6160054 30.914944,2.9150028 32.57895,1.2510012 34.251957,-0.41700039 36.951967,-0.41700039 38.615973,1.2510012 L47.666008,10.30001 56.720043,1.2510012 C58.384049,-0.41700039 61.084059,-0.41700039 62.748066,1.2510012 M51.202875,31.935988 L51.202875,44.159984 C51.197875,44.231984 51.184875,44.304984 51.168875,44.381984 51.159875,44.415984 51.150875,44.449984 51.138875,44.483984 51.125875,44.539984 51.108875,44.590984 51.087875,44.645984 51.074875,44.679984 51.061876,44.713984 51.053876,44.752984 51.022876,44.820984 50.988876,44.893984 50.946876,44.965984 50.937876,44.982984 50.925876,45.004984 50.920876,45.020984 50.865876,45.115983 50.809876,45.204983 50.737876,45.298983 50.720876,45.332983 50.694876,45.362983 50.677876,45.392983 50.622877,45.464983 50.566877,45.533983 50.502877,45.605983 50.480877,45.639983 50.451877,45.669983 50.426877,45.699983 50.340877,45.797983 50.246878,45.900983 50.143878,46.002983 L33.210919,62.940977 C33.107919,63.043977 33.00592,63.132977 32.90792,63.218977 32.87392,63.248977 32.84792,63.273977 32.80892,63.299977 32.74092,63.358977 32.67292,63.410977 32.608921,63.461977 32.574921,63.482977 32.540921,63.512977 32.506921,63.534977 32.425921,63.593977 32.344921,63.644977 32.263921,63.691977 32.207922,63.721977 32.164922,63.743977 32.109922,63.768977 L32.007922,63.819977 C31.955922,63.845977 31.895922,63.866977 31.840922,63.888977 31.832922,63.892977 31.823922,63.892977 31.814923,63.896977 31.682923,63.939977 31.562923,63.969977 31.434923,63.981977 L31.434923,63.998977 8.5329793,63.998977 C3.8219908,63.998977 1.7069681E-07,60.176978 1.7069681E-07,55.46598 L1.7069681E-07,8.5339969 C1.7069681E-07,3.8189986 3.8219908,5.4160409E-09 8.5329793,5.4160409E-09 L28.218931,5.4160409E-09 C27.458933,1.3149995 27.070934,2.786999 27.070934,4.2669984 L8.5329793,4.2669984 C6.1819851,4.2669984 4.2659898,6.1789977 4.2659898,8.5339969 L4.2659898,55.46598 C4.2659898,57.816979 6.1819851,59.732978 8.5329793,59.732978 L29.869927,59.732978 29.869927,47.389983 C29.869927,44.790984 31.989922,42.665984 34.592916,42.665984 L46.935886,42.665984 46.935886,29.132989 47.665884,28.39899 z - M25.6,17.063006 L25.6,8.5340031 C25.6,6.1740023 23.689,4.2670016 21.333,4.2670016 L17.067,4.2670016 C14.712,4.2670016 12.8,6.1740023 12.8,8.5340031 L12.8,17.063006 C12.8,19.422007 14.712,21.330008 17.067,21.330008 L21.333,21.330008 C23.689,21.330008 25.6,19.422007 25.6,17.063006 M59.734,55.46702 L59.734,8.5340031 C59.734,6.1740023 57.818,4.2670016 55.467,4.2670016 L55.467,17.063006 C55.467,21.782008 51.648,25.596009 46.933,25.596009 L17.067,25.596009 C12.352,25.596009 8.534,21.782008 8.534,17.063006 L8.534,4.2670016 C6.178,4.2670016 4.267,6.1740023 4.267,8.5340031 L4.267,55.46702 C4.267,57.818021 6.178,59.734022 8.534,59.734022 L55.467,59.734022 C57.818,59.734022 59.734,57.818021 59.734,55.46702 M64,8.5340031 L64,55.46702 C64,60.182022 60.182,64.001023 55.467,64.001023 L8.534,64.001023 C3.819,64.001023 2.8272775E-27,60.182022 2.8272775E-27,55.46702 L2.8272775E-27,8.5340031 C2.8272775E-27,3.8150014 3.819,0 8.534,0 L55.467,0 C60.182,0 64,3.8150014 64,8.5340031 M55.466903,38.396206 L55.466903,46.934204 C55.466903,51.644204 51.648912,55.467203 46.933922,55.467203 L17.066989,55.467203 C12.353,55.467203 8.5340086,51.644204 8.5340086,46.934204 L8.5340086,38.396206 C8.5340086,33.686206 12.353,29.863207 17.066989,29.863207 L46.933922,29.863207 C51.648912,29.863207 55.466903,33.686206 55.466903,38.396206 - F1M7564.7988,8136.5312C7564.7988,8134.1762,7562.8878,8132.2602,7560.5318,8132.2602C7558.1768,8132.2602,7556.2658,8134.1762,7556.2658,8136.5312C7556.2658,8138.8862,7558.1768,8140.7942,7560.5318,8140.7942C7562.8878,8140.7942,7564.7988,8138.8862,7564.7988,8136.5312 M7575.4658,8136.5312C7575.4658,8134.1762,7573.5538,8132.2602,7571.1988,8132.2602C7568.8438,8132.2602,7566.9318,8134.1762,7566.9318,8136.5312C7566.9318,8138.8862,7568.8438,8140.7942,7571.1988,8140.7942C7573.5538,8140.7942,7575.4658,8138.8862,7575.4658,8136.5312 M7586.1318,8136.5312C7586.1318,8134.1762,7584.2208,8132.2602,7581.8648,8132.2602C7579.5098,8132.2602,7577.5988,8134.1762,7577.5988,8136.5312C7577.5988,8138.8862,7579.5098,8140.7942,7581.8648,8140.7942C7584.2208,8140.7942,7586.1318,8138.8862,7586.1318,8136.5312 M7611.7328,8183.4652L7611.7328,8149.3272C7611.7328,8146.9762,7609.8198,8145.0602,7607.4658,8145.0602L7560.5318,8145.0602C7558.1768,8145.0602,7556.2658,8146.9762,7556.2658,8149.3272L7556.2658,8183.4652C7556.2658,8185.8112,7558.1808,8187.7312,7560.5318,8187.7312L7607.4658,8187.7312C7609.8168,8187.7312,7611.7328,8185.8112,7611.7328,8183.4652 M7615.9988,8136.5312L7615.9988,8183.4652C7615.9988,8188.1792,7612.1798,8191.9982,7607.4658,8191.9982L7560.5318,8191.9982C7555.8178,8191.9982,7551.9988,8188.1792,7551.9988,8183.4652L7551.9988,8136.5312C7551.9988,8131.8122,7555.8178,8127.9982,7560.5318,8127.9982L7607.4658,8127.9982C7612.1798,8127.9982,7615.9988,8131.8122,7615.9988,8136.5312 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Themes/Metro/WidgetStyles.xaml --- a/Chronosv2/source/Themes/Metro/WidgetStyles.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Themes/Metro/WindowStyles.xaml --- a/Chronosv2/source/Themes/Metro/WindowStyles.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1049 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/ViewModel/AboutViewModel.cs --- a/Chronosv2/source/ViewModel/AboutViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -using System; -using System.Deployment.Application; -using System.Reflection; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.ViewModel; - -namespace Chronos.ViewModel -{ - /// - /// About window viewmodel - /// - public sealed class AboutViewModel - : NavigationViewModel - { - #region · Properties · - - /// - /// Gets the application version. - /// - /// The application version. - public string Version - { - get - { - if (ApplicationDeployment.IsNetworkDeployed) - { - return ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); - } - else - { - return Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } - } - } - - /// - /// Gets the application product id. - /// - /// The application product id. - public string ProductId - { - get { return Guid.NewGuid().ToString(); } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public AboutViewModel() - : base() - { - } - - #endregion - - #region · Overriden Methods · - - public override bool CanClose() - { - return true; - } - - public override void Close() - { - this.GetService().CloseDialog(); - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/ViewModel/LoginViewModel.cs --- a/Chronosv2/source/ViewModel/LoginViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -using System; -using System.Windows; -using Chronos.Authentication; -using Chronos.Model; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.ViewModel; -using nRoute.Components.Messaging; -using nRoute.Services; - -namespace Chronos.ViewModel -{ - /// - /// Login view view model class - /// - public sealed class LoginViewModel - : WindowViewModel - { - #region · Data Properties · - - /// - /// Gets or sets the user name - /// - public string UserId - { - get { return this.Entity.UserId; } - set - { - if (this.Entity.UserId != value) - { - this.Entity.UserId = value; - this.NotifyPropertyChanged(() => UserId); - - this.InquiryCommand.RequeryCanExecute(); - } - } - } - - /// - /// Gets or sets the password - /// - public string Password - { - get { return this.Entity.Password; } - set - { - if (this.Entity.Password != value) - { - this.Entity.Password = value; - this.NotifyPropertyChanged(() => Password); - - this.InquiryCommand.RequeryCanExecute(); - } - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class - /// - public LoginViewModel() - : base() - { - } - - #endregion - - #region · Overriden Methods · - - public override bool CanClose() - { - return (this.ViewMode != ViewModeType.Busy); - } - - public override void Close() - { - this.GetService().CloseDialog(); - Application.Current.Shutdown(); - } - - protected override void InitializePropertyStates() - { - this.PropertyStates.Add(e => e.UserId); - this.PropertyStates.Add(e => e.Password); - } - - protected override void OnViewModeChanged() - { - base.OnViewModeChanged(); - - if (this.PropertyStates.Count > 0) - { - this.PropertyStates[x => x.UserId].IsEditable = (this.ViewMode != ViewModeType.Busy); - this.PropertyStates[x => x.Password].IsEditable = (this.ViewMode != ViewModeType.Busy); - } - } - - #endregion - - #region · Command Actions · - - protected override bool CanInquiryData() - { - return (!String.IsNullOrEmpty(this.UserId) && - !String.IsNullOrEmpty(this.Password) && - this.ViewMode != ViewModeType.Busy); - } - - protected override void OnInquiryAction(InquiryActionResult result) - { - result.Data = this.Entity; - result.Result = InquiryActionResultType.DataFetched; - } - - protected override void OnInquiryActionComplete(InquiryActionResult result) - { - if (result.Result == InquiryActionResultType.DataFetched) - { - Channel.Public.OnNext( - new AuthenticationInfo - { - Action = AuthenticationAction.LoggedIn, - UserId = this.UserId - }, true); - - ServiceLocator.GetService().CloseDialog(); - } - else if (result.Result == InquiryActionResultType.DataNotFound) - { - this.NotificationMessage = "Username and password do not match."; - - this.ViewMode = ViewModeType.Default; - } - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/ViewModel/ShellViewModel.cs --- a/Chronosv2/source/ViewModel/ShellViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,509 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Windows; -using System.Windows.Input; -using System.Windows.Shell; -using System.Windows.Threading; -using Chronos.Authentication; -using Chronos.Modules.Navigation; -using Chronos.Presentation.Core.Navigation; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.ViewModel; -using Chronos.Presentation.Windows; -using Chronos.WidgetLibrary; -using NLog; -using nRoute.Components; -using nRoute.Components.Messaging; -using nRoute.Navigation; - -namespace Chronos.ViewModel -{ - /// - /// Shell Window ViewModel - /// - public sealed class ShellViewModel - : ViewModelBase - { - #region · Logger · - - private static Logger Logger = LogManager.GetCurrentClassLogger(); - - #endregion - - #region · Fields · - - private WindowState windowState; - private string userName; - - #region · Commands · - - private ICommand maximizeCommand; - private ICommand minimizeCommand; - private ICommand showWidgetLibraryCommand; - private ICommand shutdownCommand; - private ICommand closeSessionCommand; - private ICommand switchDesktopCommand; - private ICommand showDesktopCommand; - private ICommand saveCurrentDesktopCommand; - private ICommand saveAllDesktopsCommand; - private ICommand showAboutBoxCommand; - - #endregion - - #region · Observers · - - private ChannelObserver authenticationObserver; - private ChannelObserver activeDesktopObserver; - private ChannelObserver navigatedObserver; - - #endregion - - #endregion - - #region · Commands · - - /// - /// Gets the maximize command. - /// - /// The maximize command. - public ICommand MaximizeCommand - { - get - { - if (this.maximizeCommand == null) - { - this.maximizeCommand = new ActionCommand(() => OnMaximizeWindow()); - } - - return this.maximizeCommand; - } - } - - /// - /// Gets the minimize command. - /// - /// The minimize command. - public ICommand MinimizeCommand - { - get - { - if (this.minimizeCommand == null) - { - this.minimizeCommand = new ActionCommand(() => OnMinimizeWindow()); - } - - return this.minimizeCommand; - } - } - - /// - /// Gets the switch desktop command - /// - public ICommand SwitchDesktopCommand - { - get - { - if (this.switchDesktopCommand == null) - { - this.switchDesktopCommand = new ActionCommand(() => OnSwitchDesktop()); - } - - return this.switchDesktopCommand; - } - } - - /// - /// Gets the show desktop command - /// - public ICommand ShowDesktopCommand - { - get - { - if (this.showDesktopCommand == null) - { - this.showDesktopCommand = new ActionCommand(() => OnShowDesktop()); - } - - return this.showDesktopCommand; - } - } - - /// - /// Gets the save current desktop command. - /// - /// The save desktop command. - public ICommand SaveCurrentDesktopCommand - { - get - { - if (this.saveCurrentDesktopCommand == null) - { - this.saveCurrentDesktopCommand = new ActionCommand(() => OnSaveCurrentDesktop()); - } - - return this.saveCurrentDesktopCommand; - } - } - - /// - /// Gets the save all desktops command. - /// - /// The save desktop command. - public ICommand SaveAllDesktopsCommand - { - get - { - if (this.saveAllDesktopsCommand == null) - { - this.saveAllDesktopsCommand = new ActionCommand(() => OnSaveAllDesktops()); - } - - return this.saveAllDesktopsCommand; - } - } - - /// - /// Gets the show widget library command. - /// - /// The show widget library command. - public ICommand ShowWidgetLibraryCommand - { - get - { - if (this.showWidgetLibraryCommand == null) - { - this.showWidgetLibraryCommand = new ActionCommand(() => OnShowWidgetLibrary()); - } - - return this.showWidgetLibraryCommand; - } - } - - /// - /// Gets the about box command. - /// - /// The about box command. - public ICommand ShowAboutBoxCommand - { - get - { - if (this.showAboutBoxCommand == null) - { - this.showAboutBoxCommand = new ActionCommand(() => OnShowAboutBoxCommand()); - } - - return this.showAboutBoxCommand; - } - } - - /// - /// Gets the shutdown command - /// - public ICommand ShutdownCommand - { - get - { - if (this.shutdownCommand == null) - { - this.shutdownCommand = new ActionCommand(() => OnShutdown()); - } - - return this.shutdownCommand; - } - } - - /// - /// Gets the log off command - /// - public ICommand CloseSessionCommand - { - get - { - if (this.closeSessionCommand == null) - { - this.closeSessionCommand = new ActionCommand(() => OnCloseSession()); - } - - return this.closeSessionCommand; - } - } - - #endregion - - #region · Properties · - - /// - /// Gets or sets the state of the window. - /// - /// The state of the window. - public WindowState WindowState - { - get { return this.windowState; } - set - { - if (this.windowState != value) - { - this.windowState = value; - this.NotifyPropertyChanged(() => WindowState); - } - } - } - - /// - /// Gets the active windows. - /// - /// The active windows. - public IList ActiveWindows - { - get - { - if (this.GetService().HasDesktopActive) - { - return this.GetService().ActiveDesktopWindows; - } - - return null; - } - } - - /// - /// Gets the logged in user name - /// - public string UserName - { - get { return (!String.IsNullOrEmpty(this.userName) ? this.userName : "Not logged in"); } - private set - { - this.userName = value; - this.NotifyPropertyChanged(() => UserName); - } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - public ShellViewModel() - : base() - { - this.InitializeObservers(); - } - - #endregion - - #region · Command Actions · - - /// - /// Handles the show widget library command action - /// - private void OnShowWidgetLibrary() - { - this.GetService().Show(); - } - - /// - /// Handles the switch desktop command action - /// - private void OnSwitchDesktop() - { - this.GetService().SwitchDesktop(); - } - - /// - /// Handles the show desktop command - /// - private void OnShowDesktop() - { - this.GetService().ShowDesktop(); - } - - /// - /// Handles the save current desktop command action - /// - private void OnSaveCurrentDesktop() - { - this.GetService().SaveCurrentDesktop(); - } - - /// - /// Handles the save all desktops command action - /// - private void OnSaveAllDesktops() - { - this.GetService().SaveAllDesktops(); - } - - /// - /// Handles the shutdown command action - /// - private void OnShutdown() - { - Logger.Debug("Ending the session"); - Application.Current.Shutdown(); - } - - /// - /// Closes the session - /// - private void OnCloseSession() - { - Channel.Public.OnNext( - new AuthenticationInfo { Action = AuthenticationAction.LogOut }, true); - } - - /// - /// Maximizes the window. - /// - private void OnMaximizeWindow() - { - if (this.WindowState == WindowState.Maximized) - { - this.WindowState = WindowState.Normal; - } - else - { - this.WindowState = WindowState.Maximized; - } - - Logger.Debug("Changed the status of the main application window ({0})", this.WindowState); - } - - /// - /// Handles the minimize window command action - /// - private void OnMinimizeWindow() - { - this.WindowState = WindowState.Minimized; - } - - private void OnShowAboutBoxCommand() - { - this.GetService() - .Navigate(NavigateMode.Modal, NavigationRoutes.About); - } - - #endregion - - #region · Observer Initialization · - - private void InitializeObservers() - { - Logger.Debug("Starting observers of nRoute"); - - // Authentication Observer - this.authenticationObserver = new ChannelObserver( - (l) => OnAuthenticationAction(l)); - - // Subscribe on the UI Thread - this.authenticationObserver.Subscribe(ThreadOption.BackgroundThread); - - // Active desktop changed observer - this.activeDesktopObserver = new ChannelObserver( - (l) => OnActiveDesktopChanged(l)); - - // Subscribe on the UI Thread - this.activeDesktopObserver.Subscribe(ThreadOption.UIThread); - - // Navigation observers - - // Navigated observer - this.navigatedObserver = new ChannelObserver( - (l) => OnNavigated(l)); - - this.navigatedObserver.Subscribe(ThreadOption.BackgroundThread); - } - - #endregion - - #region · Observer Actions · - - private void OnAuthenticationAction(AuthenticationInfo info) - { - switch (info.Action) - { - case AuthenticationAction.LogOn: - break; - - case AuthenticationAction.LoggedIn: - this.Invoke(() => { this.UserName = info.UserId; }); - break; - - case AuthenticationAction.LogOut: - this.Invoke(() => { this.UserName = info.UserId; }); - break; - } - } - - private void OnActiveDesktopChanged(ActiveDesktopChangedInfo info) - { - Logger.Debug("Changing the Active Desktop"); - - this.NotifyPropertyChanged(() => ActiveWindows); - } - - private void OnNavigated(NavigatedInfo info) - { - Logger.Debug("Navigation completed successfully ({0})", info.Request.RequestUrl); - - this.CreateRecentNavigationEntry(info); - } - - #endregion - - #region · Windows 7 Taskbar · - - private void CreateRecentNavigationEntry(NavigatedInfo value) - { - if (value.Request.NavigationMode == NavigateMode.New) - { - this.Dispatcher.BeginInvoke( - (Action)delegate - { - if (App.RunningOnWin7) - { - JumpList jl = JumpList.GetJumpList(Application.Current); - - if (jl != null) - { - if (jl.JumpItems.Count >= 10) - { - jl.JumpItems.Clear(); - } - - var q = jl.JumpItems.OfType().Where(t => t.Arguments.Equals(value.Request.RequestUrl)); - - if (q.Count() == 0) - { - jl.JumpItems.Add - ( - new JumpTask - { - CustomCategory = "Recent", - Title = value.Title, - Arguments = value.Request.RequestUrl, - IconResourcePath = null, - IconResourceIndex = -1, - Description = null, - WorkingDirectory = - Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) - } - ); - - jl.Apply(); - } - } - } - }, DispatcherPriority.Background); - } - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Views/About.xaml --- a/Chronosv2/source/Views/About.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Views/About.xaml.cs --- a/Chronosv2/source/Views/About.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -using Chronos.Modules.Navigation; -using Chronos.Presentation.Core.ViewModel; -using Chronos.Presentation.Windows.Controls; -using Chronos.ViewModel; -using nRoute.Components.Composition; -using nRoute.Navigation.Mapping; -using nRoute.ViewModels; - -namespace Chronos.Views -{ - /// - /// Interaction logic for About.xaml - /// - [MapNavigationContent(NavigationRoutes.About)] - [DefineViewViewModel(typeof(About), typeof(AboutViewModel))] - public partial class About : WindowElement - { - [ResolveConstructor] - public About([ResolveViewModel(typeof(About))]INavigationViewModel viewModel) - { - InitializeComponent(); - - this.DataContext = viewModel; - } - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Views/Login.xaml --- a/Chronosv2/source/Views/Login.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/Views/Login.xaml.cs --- a/Chronosv2/source/Views/Login.xaml.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -using Chronos.Modules.Navigation; -using Chronos.Presentation.Windows.Controls; -using Chronos.ViewModel; -using nRoute.Components.Composition; -using nRoute.Navigation.Mapping; -using nRoute.ViewModels; - -namespace Chronos.Views -{ - /// - /// Interaction logic for LoginView.xaml - /// - [MapNavigationContent(NavigationRoutes.Login)] - [DefineViewViewModel(typeof(Login), typeof(LoginViewModel))] - public partial class Login : WindowElement - { - #region · Constructors · - - [ResolveConstructor] - public Login([ResolveViewModel(typeof(Login))]LoginViewModel viewModel) - { - InitializeComponent(); - - this.DataContext = viewModel; - } - - #endregion - } -} diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/WidgetLibrary/WidgetItemViewModel.cs --- a/Chronosv2/source/WidgetLibrary/WidgetItemViewModel.cs Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -using System.Windows.Input; -using Chronos.Presentation.Core.VirtualDesktops; -using Chronos.Presentation.Core.Widgets; -using Chronos.Presentation.Core.Windows; -using Chronos.Presentation.ViewModel; -using nRoute.Components; - -namespace Chronos.WidgetLibrary -{ - /// - /// Widget Definition ViewModel - /// - public sealed class WidgetItemViewModel - : ViewModelBase, IWidget - { - #region · Fields · - - private IWidget widgetDefinition; - private ICommand createWidgetCommand; - - #endregion - - #region · Commands · - - /// - /// Gets the create widget command. - /// - /// The create widget command. - public ICommand CreateWidgetCommand - { - get - { - if (this.createWidgetCommand == null) - { - this.createWidgetCommand = new ActionCommand(() => OnCreateWidget()); - } - - return this.createWidgetCommand; - } - } - - #endregion - - #region · Properties · - - /// - /// Gets the widget title - /// - /// - public string Title - { - get { return this.widgetDefinition.Title; } - } - - /// - /// Gets the widget description - /// - /// - public string Description - { - get { return this.widgetDefinition.Description; } - } - - /// - /// Gets the widget group - /// - /// - public string Group - { - get { return this.widgetDefinition.Group; } - } - - /// - /// Gets the widget icon style - /// - /// - public string IconStyle - { - get { return this.widgetDefinition.IconStyle; } - } - - #endregion - - #region · Constructors · - - /// - /// Initializes a new instance of the class. - /// - /// The widget. - public WidgetItemViewModel(IWidget widgetDefinition) - : base() - { - this.widgetDefinition = widgetDefinition; - } - - #endregion - - #region · IWidget Members · - - /// - /// Creates the widget view - /// - /// - System.Windows.FrameworkElement IWidget.CreateView() - { - return this.widgetDefinition.CreateView(); - } - - #endregion - - #region · Command Actions · - - /// - /// Handles the create widget command. - /// - private void OnCreateWidget() - { - this.GetService() - .Show(this.widgetDefinition.CreateView() as IDesktopElement); - } - - #endregion - } -} \ No newline at end of file diff -r 7d9de5746f18 -r 2df455021a91 Chronosv2/source/WidgetLibrary/WidgetLibraryView.xaml --- a/Chronosv2/source/WidgetLibrary/WidgetLibraryView.xaml Thu Mar 22 08:09:41 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -