Beispiel #1
0
        /// <summary>Called when the bootstrap application is run.</summary>
        protected override void Run()
        {
            _mainWindow  = GetApplicationUI();
            UIDispatcher = Threading.Dispatcher.CurrentDispatcher;

            if (_mainWindow != null)
            {
                try
                {
                    if (Command.Display == Wix.Display.Full ||
                        Command.Display == Wix.Display.Passive)
                    {
                        UIDispatcher        = _mainWindow.Dispatcher;
                        _mainWindow.Closed += OnWindowClosed;
                        _mainWindow.Show();
                    }

                    Engine.Detect();

                    Threading.Dispatcher.Run();

                    Engine.Quit(_mainWindow.Result);
                }
                catch (Exception ex)
                {
                    LogError(ex);
                    Engine.Quit(400);
                }
            }
            else
            {
                LogError("Failed to get an UI implementation.");
                Engine.Quit(404);
            }
        }
Beispiel #2
0
        /// <summary>Gets the <see cref="BaseBAWindow" /> derivation from the configured UI implementation assembly.</summary>
        /// <returns>A BaseBAWindow instance or null.</returns>
        private BaseBAWindow GetApplicationUI()
        {
            BaseBAWindow retVal   = null;
            string       implType = GetAppSetting("BootstrapperUI");
            Type         type     = null;

            if (!string.IsNullOrEmpty(implType))
            {
                LogVerbose("configured implementation = " + implType);
                try { type = GetUITypeFromAssembly(implType); }
                catch (Exception e) { LogError(e); }
            }

            if (type != null)
            {
                LogVerbose("full type name = " + type.AssemblyQualifiedName);
                try { retVal = Activator.CreateInstance(type) as BaseBAWindow; }
                catch (Exception e) { LogError(e); }
            }

            if (retVal != null)
            {
                retVal.Bootstrapper = this;
            }

            return(retVal);
        }
Beispiel #3
0
 /// <summary>Sets the main window to the specified <paramref name="window"/>.</summary>
 /// <param name="window">The new main window.</param>
 public void SetMainWindow(BaseBAWindow window)
 {
     if (window == null)
     {
         Exception error = new ArgumentNullException("window");
         LogError(error);
         throw error;
     }
     _mainWindow.Closed -= OnWindowClosed;
     _mainWindow         = window;
     _mainWindow.Closed += OnWindowClosed;
     UIDispatcher        = _mainWindow.Dispatcher;
 }
Beispiel #4
0
        /// <summary>Called when the bootstrap application is run.</summary>
        protected override void Run()
        {
            _mainWindow = GetApplicationUI();

            if (_mainWindow != null)
            {
                if (Threading.Dispatcher.CurrentDispatcher != null)
                {
                    try
                    {
                        UIDispatcher        = _mainWindow.Dispatcher;
                        _mainWindow.Closed += OnWindowClosed;
                        _mainWindow.Show();

                        Engine.Detect();

                        Threading.Dispatcher.Run();
                    }
                    catch (Exception ex)
                    {
                        LogError(ex);
                        Engine.Quit(400);
                    }
                }
                else
                {
                    LogError("No current dispatcher.");
                    Engine.Quit(400);
                }
            }
            else
            {
                LogError("Failed to get an UI implementation.");
                Engine.Quit(404);
            }
        }