protected override void OnStartup(object sender, StartupEventArgs e) { ViewLocator.LocateTypeForModelType = (modelType, dependencyObject, arg3) => ViewModelConventions.GetViewForModel(modelType); lifetimeScope.Resolve <AutoSubscriber>().Subscribe(); lifetimeScope.Resolve <IWindowManager>().ShowDialog(lifetimeScope.Resolve <ShellViewModel>()); base.OnStartup(sender, e); }
static Window GetWindow <T>(T model) where T : INotifyPropertyChanged { var viewType = ViewModelConventions.GetViewForModel(typeof(T)); var view = (ContentControl)Activator.CreateInstance(viewType); var window = new Window { Content = view, Height = 400, Width = 400, }; ViewModelBinder.Bind(model, view, null); return(window); }
public AppBootstrapper(ILifetimeScope lifetimeScope) : base(useApplication: false) { this.lifetimeScope = lifetimeScope; ViewLocator.LocateTypeForModelType = (modelType, dependencyObject, arg3) => ViewModelConventions.GetViewForModel(modelType); }