Exemple #1
0
        internal static void Shutdown()
        {
            if (EmbeddedUIProxy.uiInstance != null)
            {
                try
                {
                    if (EmbeddedUIProxy.DebugBreakEnabled("Shutdown"))
                    {
                        System.Diagnostics.Debugger.Launch();
                    }

                    EmbeddedUIProxy.uiInstance.Shutdown();
                }
                catch (Exception)
                {
                    // Nothing to do at this point... the installation is done anyway.
                }

                EmbeddedUIProxy.uiInstance = null;
            }
        }
        public static int Initialize(int sessionHandle, string uiClass, int internalUILevel)
        {
            Session session = null;

            try
            {
                session = new Session((IntPtr) sessionHandle, false);
                
                if (String.IsNullOrEmpty(uiClass))
                {
                    throw new ArgumentNullException("uiClass");
                }

                EmbeddedUIProxy.uiInstance = EmbeddedUIProxy.InstantiateUI(session, uiClass);
            }
            catch (Exception ex)
            {
                if (session != null)
                {
                    try
                    {
                        session.Log("Exception while loading embedded UI:");
                        session.Log(ex.ToString());
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            if (EmbeddedUIProxy.uiInstance == null)
            {
                return (int) ActionResult.Failure;
            }

            try
            {
                string resourcePath = Path.GetDirectoryName(EmbeddedUIProxy.uiInstance.GetType().Assembly.Location);
                InstallUIOptions uiOptions = (InstallUIOptions) internalUILevel;
                if (EmbeddedUIProxy.DebugBreakEnabled("Initialize"))
                {
                    System.Diagnostics.Debugger.Launch();
                }

                if (EmbeddedUIProxy.uiInstance.Initialize(session, resourcePath, ref uiOptions))
                {
                    // The embedded UI initialized and the installation should continue
                    // with internal UI reset according to options.
                    return ((int) uiOptions) << 16;
                }
                else
                {
                    // The embedded UI did not initialize but the installation should still continue
                    // with internal UI reset according to options.
                    return (int) uiOptions;
                }
            }
            catch (InstallCanceledException)
            {
                // The installation was canceled by the user.
                return (int) ActionResult.UserExit;
            }
            catch (Exception ex)
            {
                // An unhandled exception causes the installation to fail immediately.
                session.Log("Exception thrown by embedded UI initialization:");
                session.Log(ex.ToString());
                return (int) ActionResult.Failure;
            }
        }
        public static void Shutdown()
        {
            if (EmbeddedUIProxy.uiInstance != null)
            {
                try
                {
                    if (EmbeddedUIProxy.DebugBreakEnabled("Shutdown"))
                    {
                        System.Diagnostics.Debugger.Launch();
                    }

                    EmbeddedUIProxy.uiInstance.Shutdown();
                }
                catch (Exception)
                {
                    // Nothing to do at this point... the installation is done anyway.
                }

                EmbeddedUIProxy.uiInstance = null;
            }
        }
Exemple #4
0
        internal static int Initialize(int sessionHandle, string uiClass, int internalUILevel)
        {
            Session session = null;

            try
            {
                session = new Session((IntPtr)sessionHandle, false);

                if (String.IsNullOrEmpty(uiClass))
                {
                    throw new ArgumentNullException("uiClass");
                }

                EmbeddedUIProxy.uiInstance = EmbeddedUIProxy.InstantiateUI(session, uiClass);
            }
            catch (Exception ex)
            {
                if (session != null)
                {
                    try
                    {
                        session.Log("Exception while loading embedded UI:");
                        session.Log(ex.ToString());
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            if (EmbeddedUIProxy.uiInstance == null)
            {
                return((int)ActionResult.Failure);
            }

            try
            {
                string           resourcePath = Path.GetDirectoryName(EmbeddedUIProxy.uiInstance.GetType().Assembly.Location);
                InstallUIOptions uiOptions    = (InstallUIOptions)internalUILevel;
                if (EmbeddedUIProxy.DebugBreakEnabled("Initialize"))
                {
                    System.Diagnostics.Debugger.Launch();
                }

                if (EmbeddedUIProxy.uiInstance.Initialize(session, resourcePath, ref uiOptions))
                {
                    // The embedded UI initialized and the installation should continue
                    // with internal UI reset according to options.
                    return(((int)uiOptions) << 16);
                }
                else
                {
                    // The embedded UI did not initialize but the installation should still continue
                    // with internal UI reset according to options.
                    return((int)uiOptions);
                }
            }
            catch (InstallCanceledException)
            {
                // The installation was canceled by the user.
                return((int)ActionResult.UserExit);
            }
            catch (Exception ex)
            {
                // An unhandled exception causes the installation to fail immediately.
                session.Log("Exception thrown by embedded UI initialization:");
                session.Log(ex.ToString());
                return((int)ActionResult.Failure);
            }
        }