Exemplo n.º 1
0
        public VtdConfig(bool bConstruct)
        {
            Debug.Assert(bConstruct);

            cbSize     = (uint)Marshal.SizeOf(typeof(VtdConfig));
            hwndParent = IntPtr.Zero;
            hInstance  = IntPtr.Zero;

            dwFlags = VtdFlags.None;
            if (Program.Translation.Properties.RightToLeft)
            {
                dwFlags |= VtdFlags.RtlLayout;
            }

            dwCommonButtons         = VtdCommonButtonFlags.None;
            pszWindowTitle          = null;
            hMainIcon               = IntPtr.Zero;
            pszMainInstruction      = string.Empty;
            pszContent              = string.Empty;
            cButtons                = 0;
            pButtons                = IntPtr.Zero;
            nDefaultButton          = 0;
            cRadioButtons           = 0;
            pRadioButtons           = IntPtr.Zero;
            nDefaultRadioButton     = 0;
            pszVerificationText     = null;
            pszExpandedInformation  = null;
            pszExpandedControlText  = null;
            pszCollapsedControlText = null;
            hFooterIcon             = IntPtr.Zero;
            pszFooter               = null;
            pfCallback              = null;
            lpCallbackData          = IntPtr.Zero;
            cxWidth = 0;
        }
Exemplo n.º 2
0
        public VtdConfig(bool bConstruct)
        {
            Debug.Assert(bConstruct);

            cbSize = (uint)Marshal.SizeOf(typeof(VtdConfig));
            hwndParent = IntPtr.Zero;
            hInstance = IntPtr.Zero;

            dwFlags = VtdFlags.None;
            if(Program.Translation.Properties.RightToLeft) dwFlags |= VtdFlags.RtlLayout;

            dwCommonButtons = VtdCommonButtonFlags.None;
            pszWindowTitle = null;
            hMainIcon = IntPtr.Zero;
            pszMainInstruction = string.Empty;
            pszContent = string.Empty;
            cButtons = 0;
            pButtons = IntPtr.Zero;
            nDefaultButton = 0;
            cRadioButtons = 0;
            pRadioButtons = IntPtr.Zero;
            nDefaultRadioButton = 0;
            pszVerificationText = null;
            pszExpandedInformation = null;
            pszExpandedControlText = null;
            pszCollapsedControlText = null;
            hFooterIcon = IntPtr.Zero;
            pszFooter = null;
            pfCallback = null;
            lpCallbackData = IntPtr.Zero;
            cxWidth = 0;
        }
Exemplo n.º 3
0
        private TaskDialogResult Show(IntPtr hWnd, out int button, out int radioButton, out bool verificationFlagChecked)
        {
            if (OsVersionInfo.dwMajorVersion < 6 /* OSがVista以上であること */)
            {
                throw new InvalidOperationException(Resource.OSVersionError);
            }

            if (DllVersionInfo.dwMajorVersion < 6)
            {
                throw new InvalidOperationException(Resource.ComCtl32VersionError);
            }

            OwnerHandle = hWnd;

            button                  = 0;
            radioButton             = 0;
            verificationFlagChecked = false;

            var callback       = new TaskDialogCallbackProc(TaskDialogCallback);
            var callbackHandle = GCHandle.Alloc(callback);

            try
            {
                TaskDialog.CurrentPage.nativeTaskDialog.pfCallback = callback;

                TaskDialog.CurrentPage.PrepareShow(this);

                CurrentProgressBarType = TaskDialog.CurrentPage.ProgressBar;

                int hResult = TaskDialogIndirect(ref TaskDialog.CurrentPage.nativeTaskDialog, out button, out radioButton, out verificationFlagChecked);

                if (hResult < 0)
                {
                    Marshal.ThrowExceptionForHR(hResult);
                }

                if (internalExceptions != null)
                {
                    throw new AggregateException(internalExceptions).Flatten();
                }
            }
            finally
            {
                if (TaskDialog.PreviousPage != null)
                {
                    TaskDialog.PreviousPage.activeTaskDialog = null;
                }

                TaskDialog.CurrentPage.activeTaskDialog            = null;
                TaskDialog.CurrentPage.nativeTaskDialog.pfCallback = null;
                if (callbackHandle.IsAllocated)
                {
                    callbackHandle.Free();
                }
            }

            switch ((TASKDIALOG_COMMAND_ID)button)
            {
            case TASKDIALOG_COMMAND_ID.IDOK:
                return(TaskDialogResult.Ok);

            case TASKDIALOG_COMMAND_ID.IDYES:
                return(TaskDialogResult.Yes);

            case TASKDIALOG_COMMAND_ID.IDNO:
                return(TaskDialogResult.No);

            case TASKDIALOG_COMMAND_ID.IDCANCEL:
                return(TaskDialogResult.Cancel);

            case TASKDIALOG_COMMAND_ID.IDRETRY:
                return(TaskDialogResult.Retry);

            case TASKDIALOG_COMMAND_ID.IDCLOSE:
                return(TaskDialogResult.Close);

            default:
                return(TaskDialogResult.UserButtun);
            }
        }