Commit 089aead

Jason Lepp <jlepp@arcresources.com>
2010-10-14 22:44:20
Begin adding repos, domain and StructureMap
1 parent 6ee5411
lib/StructureMap/StructureMap.dll
Binary file
src/MVPtoMVVM/domain/TodoItem.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace MVPtoMVVM.domain
+{
+    public class TodoItem
+    {
+        public string Description { get; set; }
+        public DateTime DueDate  { get; set; }
+    }
+}
\ No newline at end of file
src/MVPtoMVVM/repositories/IRepository.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+using MVPtoMVVM.domain;
+
+namespace MVPtoMVVM.repositories
+{
+    public interface ITodoItemRepository
+    {
+        void Add(TodoItem item);
+        TodoItem Get(string description);
+        IEnumerable<TodoItem> GetAll();
+    }
+}
\ No newline at end of file
src/MVPtoMVVM/repositories/TodoItemRepository.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+using MVPtoMVVM.domain;
+using System.Linq;
+
+namespace MVPtoMVVM.repositories
+{
+    class TodoItemRepository : ITodoItemRepository
+    {
+        private List<TodoItem> items = new List<TodoItem>();
+
+        public void Add(TodoItem item)
+        {
+            items.Add(item);
+        }
+
+        public TodoItem Get(string description)
+        {
+            return items.FirstOrDefault(x => x.Description == description);
+        }
+
+        public IEnumerable<TodoItem> GetAll()
+        {
+            return items.AsEnumerable();
+        }
+    }
+}
\ No newline at end of file
src/MVPtoMVVM/MVPtoMVVM.csproj
@@ -40,8 +40,10 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Class1.cs" />
+    <Compile Include="domain\TodoItem.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="repositories\IRepository.cs" />
+    <Compile Include="repositories\TodoItemRepository.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
src/MVPtoMVVM.mvp/App.xaml
@@ -1,7 +1,7 @@
 <Application x:Class="MVPtoMVVM.mvp.App"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             StartupUri="MainWindow.xaml">
+             StartupUri="MvpWindow.xaml">
     <Application.Resources>
          
     </Application.Resources>
src/MVPtoMVVM.mvp/Bootstrap.cs
@@ -0,0 +1,21 @@
+using MVPtoMVVM.domain;
+using StructureMap;
+
+namespace MVPtoMVVM.mvp
+{
+    public class Bootstrap
+    {
+        public void Execute()
+        {
+            ObjectFactory.Initialize(x =>
+            {
+                x.Scan(scanner =>
+                {
+                    scanner.AssemblyContainingType(typeof(TodoItem));
+
+                });
+            });
+
+        }
+    }
+}
\ No newline at end of file
src/MVPtoMVVM.mvp/MVPtoMVVM.mvp.csproj
@@ -36,6 +36,9 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="StructureMap">
+      <HintPath>..\..\lib\StructureMap\StructureMap.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
@@ -55,7 +58,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
-    <Page Include="MainWindow.xaml">
+    <Page Include="MvpWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
@@ -63,8 +66,9 @@
       <DependentUpon>App.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="MainWindow.xaml.cs">
-      <DependentUpon>MainWindow.xaml</DependentUpon>
+    <Compile Include="Bootstrap.cs" />
+    <Compile Include="MvpWindow.xaml.cs">
+      <DependentUpon>MvpWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
   </ItemGroup>
@@ -92,6 +96,12 @@
     </None>
     <AppDesigner Include="Properties\" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\MVPtoMVVM\MVPtoMVVM.csproj">
+      <Project>{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}</Project>
+      <Name>MVPtoMVVM</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.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.
src/MVPtoMVVM.mvp/MvpWindow.xaml
@@ -0,0 +1,9 @@
+<Window x:Class="MVPtoMVVM.mvp.MvpWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        Title="MainWindow" Height="350" Width="525">
+    <StackPanel>
+        <DataGrid AutoGenerateColumns="True" Name="todoItemsGrid">
+        </DataGrid>
+    </StackPanel>
+</Window>
src/MVPtoMVVM.mvp/MvpWindow.xaml.cs
@@ -0,0 +1,10 @@
+namespace MVPtoMVVM.mvp
+{
+    public partial class MvpWindow
+    {
+        public MvpWindow()
+        {
+            InitializeComponent();
+        }
+    }
+}
MVPtoMVVM.mvp.sln
@@ -3,16 +3,38 @@ Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVPtoMVVM.mvp", "src\MVPtoMVVM.mvp\MVPtoMVVM.mvp.csproj", "{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVPtoMVVM", "src\MVPtoMVVM\MVPtoMVVM.csproj", "{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		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
+		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Debug|Mixed Platforms.Build.0 = Debug|x86
 		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Debug|x86.ActiveCfg = Debug|x86
 		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Debug|x86.Build.0 = Debug|x86
+		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Release|Any CPU.ActiveCfg = Release|x86
+		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Release|Mixed Platforms.ActiveCfg = Release|x86
+		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Release|Mixed Platforms.Build.0 = Release|x86
 		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Release|x86.ActiveCfg = Release|x86
 		{01F8F0EA-64F3-4A1C-B5BF-C0CD4BD3CA8B}.Release|x86.Build.0 = Release|x86
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Release|Any CPU.Build.0 = Release|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{FFF299F6-DB6A-4858-B7A9-B5BE3F7C6325}.Release|x86.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE