Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code and slides from my June 4, 2011 "Intro to Caliburn.Micro" talk a…
…t CodeStock.
- Loading branch information
1 parent
a3bf2e4
commit 18913c7
Showing
410 changed files
with
17,471 additions
and
2,118 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
public void DoStuff() | ||
{ | ||
.... | ||
|
||
if (someQuestion) | ||
{ | ||
return; | ||
} | ||
|
||
if (someOtherQuestion) | ||
{ | ||
return; | ||
} | ||
|
||
Action<Result> whenCompleted = (result) => | ||
{ | ||
(blah, blah, ...) | ||
}; | ||
|
||
Async(doXyz(), whenCompleted ); | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The Caliburn.Micro source code is from November 17, 2010. | ||
The Caliburn.Micro source code is from June 1, 2011. | ||
|
||
The changeset is: b41ec4270d71 | ||
The changeset is: 5764a107cea0 and is sssociated with Release: Caliburn.Micro v1.1 RTW. | ||
|
||
The url is: http://caliburnmicro.codeplex.com/SourceControl/changeset/changes/b41ec4270d71 | ||
The url is: http://caliburnmicro.codeplex.com/SourceControl/changeset/changes/5764a107cea0 | ||
|
20 changes: 20 additions & 0 deletions
20
code/Caliburn.Micro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Caliburn.Micro.BubblingAction", "Caliburn.Micro.BubblingAction\Caliburn.Micro.BubblingAction.csproj", "{3777F0C7-CD1D-4964-AF3F-FFCBF61AA9B1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{3777F0C7-CD1D-4964-AF3F-FFCBF61AA9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3777F0C7-CD1D-4964-AF3F-FFCBF61AA9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3777F0C7-CD1D-4964-AF3F-FFCBF61AA9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3777F0C7-CD1D-4964-AF3F-FFCBF61AA9B1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
8 changes: 8 additions & 0 deletions
8
...liburn.Micro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:Caliburn.Micro.BubblingAction" | ||
x:Class="Caliburn.Micro.BubblingAction.App"> | ||
<Application.Resources> | ||
<local:MefBootstrapper x:Key="bootstrapper" /> | ||
</Application.Resources> | ||
</Application> |
12 changes: 12 additions & 0 deletions
12
...urn.Micro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/App.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Caliburn.Micro.BubblingAction | ||
{ | ||
using System.Windows; | ||
|
||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
...n.Micro.BubblingAction/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.50727</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{3777F0C7-CD1D-4964-AF3F-FFCBF61AA9B1}</ProjectGuid> | ||
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Caliburn.Micro.BubblingAction</RootNamespace> | ||
<AssemblyName>Caliburn.Micro.BubblingAction</AssemblyName> | ||
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> | ||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion> | ||
<SilverlightApplication>true</SilverlightApplication> | ||
<SupportedCultures> | ||
</SupportedCultures> | ||
<XapOutputs>true</XapOutputs> | ||
<GenerateSilverlightManifest>true</GenerateSilverlightManifest> | ||
<XapFilename>Caliburn.Micro.HelloWorld.xap</XapFilename> | ||
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate> | ||
<SilverlightAppEntry>Caliburn.Micro.BubblingAction.App</SilverlightAppEntry> | ||
<TestPageFileName>Caliburn.Micro.HelloWorldTestPage.html</TestPageFileName> | ||
<CreateTestPage>true</CreateTestPage> | ||
<ValidateXaml>true</ValidateXaml> | ||
<EnableOutOfBrowser>false</EnableOutOfBrowser> | ||
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile> | ||
<UsePlatformExtensions>false</UsePlatformExtensions> | ||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation> | ||
<LinkedServerProject> | ||
</LinkedServerProject> | ||
</PropertyGroup> | ||
<!-- This property group is only here to support building this project using the | ||
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs | ||
to set the TargetFrameworkVersion to v3.5 --> | ||
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'"> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants> | ||
<NoStdLib>true</NoStdLib> | ||
<NoConfig>true</NoConfig> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>Bin\Release</OutputPath> | ||
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants> | ||
<NoStdLib>true</NoStdLib> | ||
<NoConfig>true</NoConfig> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Caliburn.Micro"> | ||
<HintPath>..\..\..\bin\Silverlight\Debug\Caliburn.Micro.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" /> | ||
<Reference Include="System.Windows" /> | ||
<Reference Include="system" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net" /> | ||
<Reference Include="System.Windows.Interactivity, Version=4.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Windows.Browser" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="App.xaml.cs"> | ||
<DependentUpon>App.xaml</DependentUpon> | ||
</Compile> | ||
<Compile Include="Model.cs" /> | ||
<Compile Include="IShell.cs" /> | ||
<Compile Include="MefBootstrapper.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="ShellViewModel.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ApplicationDefinition Include="App.xaml"> | ||
<SubType>Designer</SubType> | ||
<Generator>MSBuild:Compile</Generator> | ||
</ApplicationDefinition> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Properties\AppManifest.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Page Include="ShellView.xaml"> | ||
<SubType>Designer</SubType> | ||
<Generator>MSBuild:Compile</Generator> | ||
</Page> | ||
</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. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
<ProjectExtensions> | ||
<VisualStudio> | ||
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> | ||
<SilverlightProjectProperties /> | ||
</FlavorProperties> | ||
</VisualStudio> | ||
</ProjectExtensions> | ||
</Project> |
7 changes: 7 additions & 0 deletions
7
...iburn.Micro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/IShell.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Caliburn.Micro.BubblingAction | ||
{ | ||
public interface IShell | ||
{ | ||
|
||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...ro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/MefBootstrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
namespace Caliburn.Micro.BubblingAction | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.Composition; | ||
using System.ComponentModel.Composition.Hosting; | ||
using System.ComponentModel.Composition.Primitives; | ||
using System.Linq; | ||
|
||
public class MefBootstrapper : Bootstrapper<IShell> | ||
{ | ||
private CompositionContainer container; | ||
|
||
protected override void Configure() | ||
{ | ||
container = CompositionHost.Initialize( | ||
new AggregateCatalog( | ||
AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>() | ||
) | ||
); | ||
|
||
var batch = new CompositionBatch(); | ||
|
||
batch.AddExportedValue<IWindowManager>(new WindowManager()); | ||
batch.AddExportedValue<IEventAggregator>(new EventAggregator()); | ||
batch.AddExportedValue(container); | ||
|
||
container.Compose(batch); | ||
} | ||
|
||
protected override object GetInstance(Type serviceType, string key) | ||
{ | ||
string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key; | ||
var exports = container.GetExportedValues<object>(contract); | ||
|
||
if (exports.Count() > 0) | ||
return exports.First(); | ||
|
||
throw new Exception(string.Format("Could not locate any instances of contract {0}.", contract)); | ||
} | ||
|
||
protected override IEnumerable<object> GetAllInstances(Type serviceType) | ||
{ | ||
return container.GetExportedValues<object>(AttributedModelServices.GetContractName(serviceType)); | ||
} | ||
|
||
protected override void BuildUp(object instance) | ||
{ | ||
container.SatisfyImportsOnce(instance); | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...liburn.Micro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/Model.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Caliburn.Micro.BubblingAction | ||
{ | ||
using System; | ||
|
||
public class Model | ||
{ | ||
public Guid Id { get; set; } | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...es/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/Properties/AppManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
> | ||
<Deployment.Parts> | ||
</Deployment.Parts> | ||
</Deployment> |
38 changes: 38 additions & 0 deletions
38
...es/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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("Caliburn.Micro.BubblingAction")] | ||
[assembly:AssemblyDescription("")] | ||
[assembly:AssemblyConfiguration("")] | ||
[assembly:AssemblyCompany("Microsoft")] | ||
[assembly: AssemblyProduct("Caliburn.Micro.BubblingAction")] | ||
[assembly:AssemblyCopyright("Copyright © Microsoft 2010")] | ||
[assembly:AssemblyTrademark("")] | ||
[assembly:AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
|
||
[assembly:ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
|
||
[assembly:Guid("12bf83be-62fe-43d7-8d46-b4e7dd69b06e")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Revision and Build Numbers | ||
// by using the '*' as shown below: | ||
|
||
[assembly:AssemblyVersion("1.0.0.0")] | ||
[assembly:AssemblyFileVersion("1.0.0.0")] |
20 changes: 20 additions & 0 deletions
20
....Micro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/ShellView.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<UserControl x:Class="Caliburn.Micro.BubblingAction.ShellView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:cal="http://www.caliburnproject.org"> | ||
<StackPanel> | ||
<ItemsControl x:Name="Items"> | ||
<ItemsControl.ItemTemplate> | ||
<DataTemplate> | ||
<StackPanel Orientation="Horizontal"> | ||
<Button Content="Remove" | ||
cal:Message.Attach="Remove($dataContext)" /> | ||
<TextBlock Text="{Binding Id}" /> | ||
</StackPanel> | ||
</DataTemplate> | ||
</ItemsControl.ItemTemplate> | ||
</ItemsControl> | ||
<Button Content="Add" | ||
cal:Message.Attach="Add" /> | ||
</StackPanel> | ||
</UserControl> |
31 changes: 31 additions & 0 deletions
31
...cro/samples/Caliburn.Micro.BubblingAction/Caliburn.Micro.BubblingAction/ShellViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace Caliburn.Micro.BubblingAction | ||
{ | ||
using System; | ||
using System.ComponentModel.Composition; | ||
|
||
[Export(typeof(IShell))] | ||
public class ShellViewModel : IShell | ||
{ | ||
public BindableCollection<Model> Items { get; private set; } | ||
|
||
public ShellViewModel() | ||
{ | ||
Items = new BindableCollection<Model>{ | ||
new Model { Id = Guid.NewGuid() }, | ||
new Model { Id = Guid.NewGuid() }, | ||
new Model { Id = Guid.NewGuid() }, | ||
new Model { Id = Guid.NewGuid() } | ||
}; | ||
} | ||
|
||
public void Add() | ||
{ | ||
Items.Add(new Model { Id = Guid.NewGuid() }); | ||
} | ||
|
||
public void Remove(Model child) | ||
{ | ||
Items.Remove(child); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...iburn.Micro/samples/Caliburn.Micro.Coroutines/Caliburn.Micro.Coroutines.External/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="Caliburn.Micro.Coroutines.External.App" /> |
12 changes: 12 additions & 0 deletions
12
...rn.Micro/samples/Caliburn.Micro.Coroutines/Caliburn.Micro.Coroutines.External/App.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Caliburn.Micro.Coroutines.External | ||
{ | ||
using System.Windows; | ||
|
||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
Oops, something went wrong.