private bool InternalShowDialog(Form fParent) { if (IntPtr.Size == 4) { Debug.Assert(Marshal.SizeOf(typeof(VtdConfig)) == VtdConfigSize32); } else if (IntPtr.Size == 8) { Debug.Assert(Marshal.SizeOf(typeof(VtdConfig)) == VtdConfigSize64); } else { Debug.Assert(false); } m_cfg.cbSize = (uint)Marshal.SizeOf(typeof(VtdConfig)); if (fParent == null) { m_cfg.hwndParent = IntPtr.Zero; } else { try { m_cfg.hwndParent = fParent.Handle; } catch (Exception) { Debug.Assert(false); m_cfg.hwndParent = IntPtr.Zero; } } bool bExp = (m_cfg.pszExpandedInformation != null); m_cfg.pszExpandedControlText = (bExp ? KPRes.Details : null); m_cfg.pszCollapsedControlText = (bExp ? KPRes.Details : null); int pnButton = 0, pnRadioButton = 0; bool bVerification = false; try { ButtonsToPtr(); } catch (Exception) { Debug.Assert(false); return(false); } m_cfg.pfCallback = this.OnTaskDialogCallback; try { using (EnableThemingInScope etis = new EnableThemingInScope(true)) { if (NativeMethods.TaskDialogIndirect(ref m_cfg, out pnButton, out pnRadioButton, out bVerification) != 0) { throw new NotSupportedException(); } } } catch (Exception) { return(false); } finally { try { m_cfg.pfCallback = null; FreeButtonsPtr(); } catch (Exception) { Debug.Assert(false); } } m_iResult = pnButton; m_bVerification = bVerification; return(true); }
private bool InternalShowDialog(Form fParent) { if(IntPtr.Size == 4) { Debug.Assert(Marshal.SizeOf(typeof(VtdConfig)) == VtdConfigSize32); } else if(IntPtr.Size == 8) { Debug.Assert(Marshal.SizeOf(typeof(VtdConfig)) == VtdConfigSize64); } else { Debug.Assert(false); } m_cfg.cbSize = (uint)Marshal.SizeOf(typeof(VtdConfig)); if(fParent == null) m_cfg.hwndParent = IntPtr.Zero; else { try { m_cfg.hwndParent = fParent.Handle; } catch(Exception) { Debug.Assert(false); m_cfg.hwndParent = IntPtr.Zero; } } bool bExp = (m_cfg.pszExpandedInformation != null); m_cfg.pszExpandedControlText = (bExp ? KPRes.Details : null); m_cfg.pszCollapsedControlText = (bExp ? KPRes.Details : null); int pnButton = 0, pnRadioButton = 0; bool bVerification = false; try { ButtonsToPtr(); } catch(Exception) { Debug.Assert(false); return false; } // m_cfg.pfCallback = this.OnTaskDialogCallback; try { using(EnableThemingInScope etis = new EnableThemingInScope(true)) { if(NativeMethods.TaskDialogIndirect(ref m_cfg, out pnButton, out pnRadioButton, out bVerification) != 0) throw new NotSupportedException(); } } catch(Exception) { return false; } finally { try { // m_cfg.pfCallback = null; FreeButtonsPtr(); } catch(Exception) { Debug.Assert(false); } } m_iResult = pnButton; m_bVerification = bVerification; return true; }