public static int ProcessMessage(int messageType, int recordHandle) { if (EmbeddedUIProxy.uiInstance != null) { try { int msgType = messageType & 0x7F000000; int buttons = messageType & 0x0000000F; int icon = messageType & 0x000000F0; int defButton = messageType & 0x00000F00; Record msgRec = (recordHandle != 0 ? Record.FromHandle((IntPtr)recordHandle, false) : null); using (msgRec) { if (EmbeddedUIProxy.DebugBreakEnabled("ProcessMessage")) { System.Diagnostics.Debugger.Launch(); } return((int)EmbeddedUIProxy.uiInstance.ProcessMessage( (InstallMessage)msgType, msgRec, (MessageButtons)buttons, (MessageIcon)icon, (MessageDefaultButton)defButton)); } } catch (Exception) { // Ignore it... just hope future messages will not throw exceptions. } } return(0); }
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; } }
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); } }