X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=win%2FC%23%2FHandBrakeWPF%2FViewModels%2FViewModelBase.cs;h=c07593b7b413a321cab2ace057880cb47335ca9d;hb=e83c570f4856660bbb120998546333aa4308a43f;hp=829524606989a58328e322751e07e5d0ceedc626;hpb=827c69558da16cabd3ff0ff03425d655e6db0d68;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/win/C#/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/C#/HandBrakeWPF/ViewModels/ViewModelBase.cs index 82952460..c07593b7 100644 --- a/win/C#/HandBrakeWPF/ViewModels/ViewModelBase.cs +++ b/win/C#/HandBrakeWPF/ViewModels/ViewModelBase.cs @@ -1,12 +1,35 @@ namespace HandBrakeWPF.ViewModels { - using Caliburn.Core; using Caliburn.PresentationFramework.ApplicationModel; + using Microsoft.Practices.ServiceLocation; + /// /// A Base Class for the View Models which contains reusable code. /// public class ViewModelBase : MultiPresenterManager { + protected IServiceLocator Locator { get; private set; } + + public ViewModelBase(IServiceLocator locator) + { + this.Locator = locator; + } + + public void Show() where T : IPresenter + { + this.ShutdownCurrent(); + this.Open(Locator.GetInstance()); + } + + public void ShowDialog() where T : IPresenter + { + Locator.GetInstance().ShowDialog(Locator.GetInstance()); + } + + public void Popup() where T : IPresenter + { + Locator.GetInstance().Show(Locator.GetInstance()); + } } }