Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Login screen prior to Shell

$
0
0
You have been really helpful so far, currently I have the following - the configure container will resolve and DI and I am using ViewModelLocator to hook everything up, I am just not sure about how and where to launch the login in form and add a new handler prior to InitialiseShell

public class Bootstrapper : UnityBootstrapper
{
    public Bootstrapper()
    {
        ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver((viewType) =>
        {
            var viewName = viewType.FullName;
            var viewAssemblyName = viewType.GetTypeInfo().Assembly.FullName;
            var viewModelName = String.Format(CultureInfo.InvariantCulture, "{0}ViewModel, {1}", viewName, viewAssemblyName);
            return Type.GetType(viewModelName);
        });
  }

    protected override void ConfigureContainer()
    {
        base.ConfigureContainer();

        //Container.RegisterType<IMyObject, MyObject>();

        ViewModelLocationProvider.SetDefaultViewModelFactory((type) =>
        {
            return Container.Resolve(type);
        });

    }

    protected override DependencyObject CreateShell()
    {
        return Container.Resolve<Shell>();
}
    protected override void InitializeShell()
    {
        base.InitializeShell();

        Application.Current.MainWindow = (Window)Shell;
        Application.Current.MainWindow.Show();
    }

    protected override void ConfigureModuleCatalog()
    {
        base.ConfigureModuleCatalog();

        ModuleCatalog moduleCatalog = (ModuleCatalog)this.ModuleCatalog;
        //moduleCatalog.AddModule(typeof(ModuleA.ModuleA));
    }
}
}

Viewing all articles
Browse latest Browse all 1878

Trending Articles