|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using System.Windows.Controls;
using System.Windows.Media;
using System.ComponentModel;
using System.Windows;
namespace CustomerInfoObserver
{
/// <summary>
/// This class injects the Presenter into the View using Unity
/// </summary>
/// <typeparam name="TView">Any View</typeparam>
/// <typeparam name="TPresenter">Any Presenter</typeparam>
public class BaseView<TView, TPresenter> : System.Windows.Window
where TPresenter : BasePresenter<TView>
where TView : class
{
public TPresenter Presenter { get; set; }
public BaseView()
{
ContainerAccessor containerAccessor = new ContainerAccessor();
UnityContainer container = containerAccessor.GetContainer();
if (container == null) throw new InvalidOperationException("Cannot find UnityContainer");
Presenter = container.Resolve<TPresenter>();
Presenter.View = this as TView;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.