Skip to content

Commit

Permalink
continuing work on app controller
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Apr 15, 2009
1 parent 954dea3 commit d9ab083
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 10 deletions.
11 changes: 11 additions & 0 deletions ApplicationControllerExample/App/MainPresenter.cs
@@ -1,4 +1,5 @@
using ApplicationControllerExample.AppController;
using ApplicationControllerExample.Model;

namespace ApplicationControllerExample.App
{
Expand All @@ -21,6 +22,16 @@ public void Run()
View.Run();
}

public void DoSomething()
{
AppController.Execute(new SomeCommandData());
}

public void SomethingElseIsHappening()
{
AppController.Raise<SomeEventData>(new SomeEventData());
}

}

}
Expand Up @@ -7,13 +7,13 @@
namespace ApplicationControllerExample
{

public class ExampleContext : ApplicationContext
public class AppContext : ApplicationContext
{

private IApplicationController AppController { get; set; }
private IContainer Container { get; set; }

public ExampleContext(IApplicationController appController, IContainer container)
public AppContext(IApplicationController appController, IContainer container)
{
AppController = appController;
Container = container;
Expand Down
@@ -1,4 +1,3 @@
using ApplicationControllerExample.App;
using StructureMap;

namespace ApplicationControllerExample.AppController
Expand All @@ -14,6 +13,14 @@ public ApplicationController(IContainer container)
Container = container;
}

public void Execute<T>(T commandData)
{
}

public void Raise<T>(T eventData)
{
}

}

}
Expand Up @@ -2,6 +2,7 @@ namespace ApplicationControllerExample.AppController
{
public interface IApplicationController
{

void Execute<T>(T commandData);
void Raise<T>(T eventData);
}
}
Expand Up @@ -53,9 +53,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AppController\ApplicationController.cs" />
<Compile Include="Model\SomeEventData.cs" />
<Compile Include="Model\SomeCommandData.cs" />
<Compile Include="BootStrapper.cs" />
<Compile Include="DefaultRegistry.cs" />
<Compile Include="ExampleContext.cs" />
<Compile Include="AppContext.cs" />
<Compile Include="AppController\IApplicationController.cs" />
<Compile Include="App\IMainView.cs" />
<Compile Include="App\MainPresenter.cs" />
Expand Down Expand Up @@ -95,9 +97,6 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Model\" />
</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.
Expand Down
2 changes: 1 addition & 1 deletion ApplicationControllerExample/DefaultRegistry.cs
Expand Up @@ -13,7 +13,7 @@ public class DefaultRegistry : Registry
public DefaultRegistry()
{
ForRequestedType<ApplicationContext>()
.TheDefault.Is.OfConcreteType<ExampleContext>();
.TheDefault.Is.OfConcreteType<AppContext>();

ForRequestedType<IApplicationController>()
.TheDefault.Is.OfConcreteType<ApplicationController>();
Expand Down
6 changes: 6 additions & 0 deletions ApplicationControllerExample/Model/SomeCommandData.cs
@@ -0,0 +1,6 @@
namespace ApplicationControllerExample.Model
{
public class SomeCommandData
{
}
}
6 changes: 6 additions & 0 deletions ApplicationControllerExample/Model/SomeEventData.cs
@@ -0,0 +1,6 @@
namespace ApplicationControllerExample.Model
{
public class SomeEventData
{
}
}
3 changes: 2 additions & 1 deletion ApplicationControllerExample/View/Form1.cs
Expand Up @@ -17,11 +17,12 @@ public Form1()

private void button1_Click(object sender, EventArgs e)
{

Presenter.DoSomething();
}

private void button2_Click(object sender, EventArgs e)
{
Presenter.SomethingElseIsHappening();
}

public void Run()
Expand Down

0 comments on commit d9ab083

Please sign in to comment.