/// <summary> /// Shows as specified managed dialog. /// <para>It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog /// at the same desktop location and with the same size as the parent.</para> /// <para>It also ensures that after the managed dialog is closed the proper ActionResult is returned.</para> /// </summary> /// <param name="dialog">The dialog.</param> /// <returns>ActionResult value</returns> public static ActionResult ShowAsMsiDialog(WixCLRDialog dialog) { ActionResult retval = ActionResult.Success; try { using (dialog) { DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { dialog.session["Custom_UI_Command"] = "next"; retval = ActionResult.Success; } else if (result == DialogResult.Cancel) { dialog.session["Custom_UI_Command"] = "abort"; retval = ActionResult.UserExit; } if (result == DialogResult.Retry) { dialog.session["Custom_UI_Command"] = "back"; retval = ActionResult.Success; } } } catch (Exception e) { dialog.session.Log("Error: " + e.ToString()); retval = ActionResult.Failure; } #if DEBUG //System.Diagnostics.Debugger.Launch(); #endif return(retval); }
/// <summary> /// Shows as specified managed dialog. /// <para>It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog /// at the same desktop location and with the same size as the parent.</para> /// <para>It also ensures that after the managed dialog is closed the proper ActionResult is returned.</para> /// </summary> /// <param name="dialog">The dialog.</param> /// <returns>ActionResult value</returns> public static ActionResult ShowAsMsiDialog(WixCLRDialog dialog) { ActionResult retval = ActionResult.Success; try { using (dialog) { DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { dialog.session["Custom_UI_Command"] = "next"; retval = ActionResult.Success; } else if (result == DialogResult.Cancel) { dialog.session["Custom_UI_Command"] = "abort"; retval = ActionResult.UserExit; } if (result == DialogResult.Retry) { dialog.session["Custom_UI_Command"] = "back"; retval = ActionResult.Success; } } } catch (Exception e) { dialog.session.Log("Error: " + e.ToString()); retval = ActionResult.Failure; } #if DEBUG //System.Diagnostics.Debugger.Launch(); #endif return retval; }