1 namespace HandBrakeWPF.ViewModels
\r
3 using Caliburn.PresentationFramework.ApplicationModel;
\r
5 using Microsoft.Practices.ServiceLocation;
\r
8 /// A Base Class for the View Models which contains reusable code.
\r
10 public class ViewModelBase : MultiPresenterManager
\r
12 protected IServiceLocator Locator { get; private set; }
\r
14 public ViewModelBase(IServiceLocator locator)
\r
16 this.Locator = locator;
\r
19 public void Show<T>() where T : IPresenter
\r
21 this.ShutdownCurrent();
\r
22 this.Open(Locator.GetInstance<T>());
\r
25 public void ShowDialog<T>() where T : IPresenter
\r
27 Locator.GetInstance<IWindowManager>().ShowDialog(Locator.GetInstance<T>());
\r
30 public void Popup<T>() where T : IPresenter
\r
32 Locator.GetInstance<IWindowManager>().Show(Locator.GetInstance<T>());
\r