Permalink
Browse files

Complete rework off the demos

  • Loading branch information...
1 parent df08108 commit 5eb07db5fb7b48f6d72c2356920f0f115f5a709b @kmees committed Jan 26, 2012
Showing with 1,385 additions and 718 deletions.
  1. BIN Tools/NotifyPropertyWeaverMsBuildTask.dll
  2. +18 −0 demos/CMContrib.SL.Demo/AppBootstrapper.cs
  3. +88 −27 demos/CMContrib.SL.Demo/CMContrib.SL.Demo.csproj
  4. +0 −8 demos/CMContrib.SL.Demo/IShell.cs
  5. +58 −0 demos/CMContrib.SL.Demo/Resources/Source/ComplexBindingViewModel.cs
  6. BIN demos/CMContrib.SL.Demo/ShellView.xaml
  7. +3 −3 demos/CMContrib.SL.Demo/ShellView.xaml.cs
  8. +214 −0 demos/CMContrib.SL.Demo/TypeLoader.cs
  9. +0 −60 demos/CMContrib.SL.Demo/ViewModels/DialogsDemoViewModel.cs
  10. +0 −35 demos/CMContrib.SL.Demo/ViewModels/DynamicDemoViewModel.cs
  11. +0 −50 demos/CMContrib.SL.Demo/Views/CoreDemoView.xaml
  12. +0 −15 demos/CMContrib.SL.Demo/Views/CoreDemoView.xaml.cs
  13. +0 −31 demos/CMContrib.SL.Demo/Views/DialogsDemoView.xaml
  14. +0 −16 demos/CMContrib.SL.Demo/Views/DialogsDemoView.xaml.cs
  15. +0 −19 demos/CMContrib.SL.Demo/Views/DynamicDemoView.xaml
  16. +0 −15 demos/CMContrib.SL.Demo/Views/DynamicDemoView.xaml.cs
  17. +42 −0 demos/CMContrib.SL.Demo/Views/Samples/GenericSampleView.xaml
  18. +13 −0 demos/CMContrib.SL.Demo/Views/Samples/GenericSampleView.xaml.cs
  19. +13 −0 demos/CMContrib.WPF.Demo/AppBootstrapper.cs
  20. +63 −23 demos/CMContrib.WPF.Demo/CMContrib.WPF.Demo.csproj
  21. +40 −0 demos/CMContrib.WPF.Demo/Converters/CodeToDocumentConverter.cs
  22. +0 −4 demos/CMContrib.WPF.Demo/IDemo.cs
  23. +14 −0 demos/CMContrib.WPF.Demo/ISample.cs
  24. BIN demos/CMContrib.WPF.Demo/IShell.cs
  25. +10 −1 demos/CMContrib.WPF.Demo/Properties/Demo.Designer.cs
  26. +3 −0 demos/CMContrib.WPF.Demo/Properties/Demo.resx
  27. +11 −0 demos/CMContrib.WPF.Demo/Resources/config_sample.txt
  28. +2 −2 demos/CMContrib.WPF.Demo/Results/{ErrorResult.cs → CompleteWithErrorResult.cs}
  29. +14 −4 demos/CMContrib.WPF.Demo/Results/LogResult.cs
  30. +10 −0 demos/CMContrib.WPF.Demo/SampleCategory.cs
  31. BIN demos/CMContrib.WPF.Demo/ShellView.xaml
  32. +3 −3 demos/CMContrib.WPF.Demo/ShellView.xaml.cs
  33. BIN demos/CMContrib.WPF.Demo/ShellViewModel.cs
  34. +0 −96 demos/CMContrib.WPF.Demo/ViewModels/CoreDemoViewModel.cs
  35. +19 −0 demos/CMContrib.WPF.Demo/ViewModels/Design/GenericSampleDesign.cs
  36. +46 −0 demos/CMContrib.WPF.Demo/ViewModels/Design/ShellDesign.cs
  37. +0 −132 demos/CMContrib.WPF.Demo/ViewModels/DialogsDemoViewModel.cs
  38. +0 −37 demos/CMContrib.WPF.Demo/ViewModels/DynamicDemoViewModel.cs
  39. +63 −0 demos/CMContrib.WPF.Demo/ViewModels/SampleScreen.cs
  40. +46 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/BrowseFolderViewModel.cs
  41. +58 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/ComplexBindingViewModel.cs
  42. +28 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/ConfigurationViewModel.cs
  43. +18 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/DialogSampleScreen.cs
  44. +24 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/ErrorDialogViewModel.cs
  45. +26 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/InformationDialogViewModel.cs
  46. +51 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/OpenFileViewModel.cs
  47. +30 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/QuestionDialogViewModel.cs
  48. +34 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/RescueAttributeViewModel.cs
  49. +57 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/RescueExtensionViewModel.cs
  50. +37 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/SaveFileViewModel.cs
  51. +38 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/WarningDialogViewModel.cs
  52. +28 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/WhenCancelledExtension.cs
  53. +31 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/WorkerThreadAttributeViewModel.cs
  54. +33 −0 demos/CMContrib.WPF.Demo/ViewModels/Samples/WorkerThreadExtensionViewModel.cs
  55. +0 −29 demos/CMContrib.WPF.Demo/Views/CoreDemoView.xaml
  56. +0 −15 demos/CMContrib.WPF.Demo/Views/CoreDemoView.xaml.cs
  57. +20 −18 demos/CMContrib.WPF.Demo/Views/DialogView.xaml
  58. +0 −22 demos/CMContrib.WPF.Demo/Views/DialogsDemoView.xaml
  59. +0 −22 demos/CMContrib.WPF.Demo/Views/DialogsDemoView.xaml.cs
  60. +0 −16 demos/CMContrib.WPF.Demo/Views/DynamicDemoView.xaml
  61. +0 −15 demos/CMContrib.WPF.Demo/Views/DynamicDemoView.xaml.cs
  62. +46 −0 demos/CMContrib.WPF.Demo/Views/Samples/GenericSampleView.xaml
  63. +26 −0 demos/CMContrib.WPF.Demo/Views/Samples/GenericSampleView.xaml.cs
  64. +1 −0 demos/CMContrib.WPF.Demo/packages.config
  65. BIN lib/ColorCode.SL.dll
  66. +6 −0 src/CMContrib.SL/CMContrib.SL.csproj
Binary file not shown.
@@ -5,6 +5,8 @@
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition.Primitives;
using System.Linq;
+using Caliburn.Micro.Contrib.Demo.Views;
+using Caliburn.Micro.Contrib.Demo.Views.Samples;
namespace Caliburn.Micro.Contrib.Demo
{
@@ -21,6 +23,22 @@ protected override void Configure()
FrameworkExtensions.ActionMessage.EnableFilters();
Localizer.CustomResourceManager = Properties.Demo.ResourceManager;
+ // Return a generic sample view if the sample doesn't provide a custom view
+ var baseLocate = ViewLocator.LocateTypeForModelType;
+ ViewLocator.LocateTypeForModelType = (type, dependencyObject, context) =>
+ {
+ var baseView = baseLocate(type, dependencyObject, context);
+ if (baseView == null && type.GetInterfaces().Contains(typeof(ISample)))
+ {
+ return typeof(GenericSampleView);
+ }
+ return baseView;
+ };
+ // Namespace mapping for custom dialog view
+ ViewLocator.AddSubNamespaceMapping("Dialogs", "Demo.Views");
+ // or alternatively
+ // ViewLocator.AddNamespaceMapping("Caliburn.Micro.Contrib.Dialogs", "Caliburn.Micro.Contrib.Demo.Views");
+
var catalog = new AggregateCatalog(
AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>()
);
@@ -64,6 +64,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Caliburn.Micro.1.3.0\lib\sl4\Caliburn.Micro.dll</HintPath>
</Reference>
+ <Reference Include="ColorCode.SL">
+ <HintPath>..\..\lib\ColorCode.SL.dll</HintPath>
+ </Reference>
<Reference Include="mscorlib" />
<Reference Include="System.ComponentModel.Composition, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.ComponentModel.Composition.Initialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
@@ -94,43 +97,107 @@
<Reference Include="System.Windows.Browser" />
</ItemGroup>
<ItemGroup>
- <Compile Include="..\CMContrib.WPF.Demo\IDemo.cs">
- <Link>IDemo.cs</Link>
+ <Compile Include="..\CMContrib.WPF.Demo\ISample.cs">
+ <Link>ISample.cs</Link>
+ </Compile>
+ <Compile Include="..\CMContrib.WPF.Demo\IShell.cs">
+ <Link>IShell.cs</Link>
</Compile>
<Compile Include="..\CMContrib.WPF.Demo\Results\CancelResult.cs">
<Link>Results\CancelResult.cs</Link>
</Compile>
- <Compile Include="..\CMContrib.WPF.Demo\Results\ErrorResult.cs">
- <Link>Results\ErrorResult.cs</Link>
+ <Compile Include="..\CMContrib.WPF.Demo\Results\CompleteWithErrorResult.cs">
+ <Link>Results\CompleteWithErrorResult.cs</Link>
</Compile>
<Compile Include="..\CMContrib.WPF.Demo\Results\LogResult.cs">
<Link>Results\LogResult.cs</Link>
</Compile>
+ <Compile Include="..\CMContrib.WPF.Demo\SampleCategory.cs">
+ <Link>SampleCategory.cs</Link>
+ </Compile>
<Compile Include="..\CMContrib.WPF.Demo\ShellViewModel.cs">
<Link>ShellViewModel.cs</Link>
</Compile>
- <Compile Include="..\CMContrib.WPF.Demo\ViewModels\CoreDemoViewModel.cs">
- <Link>ViewModels\CoreDemoViewModel.cs</Link>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\SampleScreen.cs">
+ <Link>ViewModels\SampleScreen.cs</Link>
+ </Compile>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\ComplexBindingViewModel.cs">
+ <Link>ViewModels\Samples\ComplexBindingViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\ComplexBindingViewModel.cs">
+ <Link>Resources\Source\ComplexBindingViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\DialogSampleScreen.cs">
+ <Link>ViewModels\Samples\DialogSampleScreen.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\DialogSampleScreen.cs">
+ <Link>Resources\Source\DialogSampleScreen.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\ErrorDialogViewModel.cs">
+ <Link>ViewModels\Samples\ErrorDialogViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\ErrorDialogViewModel.cs">
+ <Link>Resources\Source\ErrorDialogViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\InformationDialogViewModel.cs">
+ <Link>ViewModels\Samples\InformationDialogViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\InformationDialogViewModel.cs">
+ <Link>Resources\Source\InformationDialogViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\QuestionDialogViewModel.cs">
+ <Link>ViewModels\Samples\QuestionDialogViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\QuestionDialogViewModel.cs">
+ <Link>Resources\Source\QuestionDialogViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\RescueAttributeViewModel.cs">
+ <Link>ViewModels\Samples\RescueAttributeViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\RescueAttributeViewModel.cs">
+ <Link>Resources\Source\RescueAttributeViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\RescueExtensionViewModel.cs">
+ <Link>ViewModels\Samples\RescueExtensionViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\RescueExtensionViewModel.cs">
+ <Link>Resources\Source\RescueExtensionViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WarningDialogViewModel.cs">
+ <Link>ViewModels\Samples\WarningDialogViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WarningDialogViewModel.cs">
+ <Link>Resources\Source\WarningDialogViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WhenCancelledExtension.cs">
+ <Link>ViewModels\Samples\WhenCancelledExtension.cs</Link>
</Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WhenCancelledExtension.cs">
+ <Link>Resources\Source\WhenCancelledExtension.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WorkerThreadAttributeViewModel.cs">
+ <Link>ViewModels\Samples\WorkerThreadAttributeViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WorkerThreadAttributeViewModel.cs">
+ <Link>Resources\Source\WorkerThreadAttributeViewModel.cs</Link>
+ </Resource>
+ <Compile Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WorkerThreadExtensionViewModel.cs">
+ <Link>ViewModels\Samples\WorkerThreadExtensionViewModel.cs</Link>
+ </Compile>
+ <Resource Include="..\CMContrib.WPF.Demo\ViewModels\Samples\WorkerThreadExtensionViewModel.cs">
+ <Link>Resources\Source\WorkerThreadExtensionViewModel.cs</Link>
+ </Resource>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="AppBootstrapper.cs" />
- <Compile Include="IShell.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ShellView.xaml.cs">
<DependentUpon>ShellView.xaml</DependentUpon>
</Compile>
- <Compile Include="ViewModels\DialogsDemoViewModel.cs" />
- <Compile Include="ViewModels\DynamicDemoViewModel.cs" />
- <Compile Include="Views\CoreDemoView.xaml.cs">
- <DependentUpon>CoreDemoView.xaml</DependentUpon>
- </Compile>
- <Compile Include="Views\DialogsDemoView.xaml.cs">
- <DependentUpon>DialogsDemoView.xaml</DependentUpon>
- </Compile>
- <Compile Include="Views\DynamicDemoView.xaml.cs">
- <DependentUpon>DynamicDemoView.xaml</DependentUpon>
+ <Compile Include="TypeLoader.cs" />
+ <Compile Include="Views\Samples\GenericSampleView.xaml.cs">
+ <DependentUpon>GenericSampleView.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="..\CMContrib.WPF.Demo\Properties\Demo.resx">
<Link>Properties\Demo.resx</Link>
@@ -158,17 +225,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
- <Page Include="Views\CoreDemoView.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="Views\DialogsDemoView.xaml">
- <Generator>MSBuild:Compile</Generator>
+ <Page Include="Views\Samples\GenericSampleView.xaml">
<SubType>Designer</SubType>
- </Page>
- <Page Include="Views\DynamicDemoView.xaml">
<Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
@@ -184,7 +243,9 @@
<Name>CMContrib.SL</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup />
+ <ItemGroup>
+ <Folder Include="Resources\Source\" />
+ </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -1,8 +0,0 @@
-namespace Caliburn.Micro.Contrib.Demo
-{
- public interface IShell
- {
- void Log(string message);
- }
-}
-
@@ -0,0 +1,58 @@
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.Windows.Input;
+using System.Windows.Media;
+using Caliburn.Micro.Contrib.Demo.Results;
+using Caliburn.Micro.Contrib.Dialogs;
+
+namespace Caliburn.Micro.Contrib.Demo.ViewModels.Samples
+{
+ [Export(typeof(ISample))]
+ public class ComplexBindingViewModel : SampleScreen
+ {
+ public ComplexBindingViewModel()
+ {
+ Category = SampleCategory.Dynamic;
+ Description =
+ "CMContrib offers additional syntax for ActionMessages to support complex binding scenarios. " +
+ "The additional syntax supports Xaml bindings in the Message as well as properties of special values. " +
+ "The additional syntax must be enabled manually and is shown in the Configure() method of the AppBootstrapper";
+
+ ExecuteMessage = "[Event Click] = [Action Execute($dataContext," +
+ "$dataContext.DisplayName," +
+ "$eventArgs," +
+ "{Binding Path=Foreground, ElementName=DisplayName}," +
+ "DisplayName.Text," +
+ "'true')]";
+ }
+
+ public override IEnumerable<IResult> Execute()
+ {
+ return Execute(null, null, null, null, null, false);
+ }
+
+ public IEnumerable<IResult> Execute(
+ object dataContext,
+ string title,
+ object eventArgs,
+ Brush binding,
+ string content,
+ bool b)
+ {
+ yield return new LogResult(
+ "Parameter Values:\n" +
+ "DataContext: {0}\n" +
+ "Title: {1}\n" +
+ "Args: {2}\n" +
+ "Title Foreground: {3}\n" +
+ "Title: {4}\n" +
+ "BoolValue: {5}",
+ dataContext,
+ title,
+ eventArgs,
+ binding,
+ content,
+ b);
+ }
+ }
+}
Binary file not shown.
@@ -14,13 +14,13 @@ public ShellView()
public void Busy(string message)
{
- Indicator.BusyContent = message;
- Indicator.IsBusy = true;
+ BusyIndicator.BusyContent = message;
+ BusyIndicator.IsBusy = true;
}
public void Idle()
{
- Indicator.IsBusy = false;
+ BusyIndicator.IsBusy = false;
}
}
}
Oops, something went wrong.

0 comments on commit 5eb07db

Please sign in to comment.