Exemplo n.º 1
0
        //If you want your own splash window - inherit from the bootstrapper and register type ISplashView
        protected override void InitializeModules()
        {
            IContainerExtension container = CreateContainerExtension();

            ModuleCatalog.Initialize();

            // Check for existance, make sure we init first.
            // load from disk in case of it not showing up in module catalog.
            // resolving seems to init properly.
            if (System.IO.File.Exists("Wider.Splash.dll"))
            {
                // Assume exits
                Assembly assembly = Assembly.LoadFrom("Wider.Splash.dll");
                Type     type     = assembly.GetType("Wider.Splash.SplashModule");
                IModule  splash   = (IModule)Container.Resolve(type);
                splash.OnInitialized(container);
            }

            // Load core module, this is internal so call manually
            CoreModule coreModule = Container.Resolve <CoreModule>();

            coreModule.OnInitialized(container);

            base.InitializeModules();

            // now we should have a shell, load settings and show if we can.
            IShell shell = Container.Resolve <IShell>();

            coreModule.LoadSettings();

            // Assign main window object and show window.
            Application.Current.MainWindow             = shell as Window;
            Application.Current.MainWindow.DataContext = Container.Resolve <IWorkspace>();
            Application.Current.MainWindow.Show();
        }
Exemplo n.º 2
0
        protected override Window CreateShell()
        {
            coreModule.OnInitialized(Container);
            base.InitializeModules();

            // now we should have a shell, load settings and show if we can.
            IShell shell = Container.Resolve <IShell>();

            coreModule.LoadSettings();

            // Assign main window object and show window.
            Window main = shell as Window;

            main.DataContext = Container.Resolve <IWorkspace>();

            // make sure we are the only one.
            WindowCollection windows = Application.Current.Windows;

            foreach (Object item in windows)
            {
                Window window = item as Window;
                if (window != main)
                {
                    window.Close();
                }
            }
            return(main);
        }