/// <summary>
 /// Sets important text properties.
 /// </summary>
 /// <param name="dialogConfig">An instance of a <see cref="SafeNativeMethods.TASKDIALOGCONFIG"/> object.</param>
 private void ApplyTextConfiguration(SafeNativeMethods.TASKDIALOGCONFIG dialogConfig)
 {
     // note that nulls or empty strings are fine here.
     dialogConfig.pszContent              = content;
     dialogConfig.pszWindowTitle          = caption;
     dialogConfig.pszMainInstruction      = instruction;
     dialogConfig.pszExpandedInformation  = expandedText;
     dialogConfig.pszExpandedControlText  = expandedControlText;
     dialogConfig.pszCollapsedControlText = collapsedControlText;
     dialogConfig.pszFooter           = footerText;
     dialogConfig.pszVerificationText = checkBoxText;
 }
Esempio n. 2
0
 private void ApplyTextConfiguration(SafeNativeMethods.TASKDIALOGCONFIG dialogConfig)
 {
     // Set important text properties -
     // note that nulls or empty strings are fine here.
     // TODO: Rationalize default handling -
     // do we even need to set defaults first?
     dialogConfig.pszContent              = content;
     dialogConfig.pszWindowTitle          = caption;
     dialogConfig.pszMainInstruction      = instruction;
     dialogConfig.pszExpandedInformation  = expandedText;
     dialogConfig.pszExpandedControlText  = expandedControlText;
     dialogConfig.pszCollapsedControlText = collapsedControlText;
     dialogConfig.pszFooter           = footerText;
     dialogConfig.pszVerificationText = checkBoxText;
 }
Esempio n. 3
0
        private void ApplyOptionConfiguration(SafeNativeMethods.TASKDIALOGCONFIG dialogConfig)
        {
            // Handle options - start with no options set.
            SafeNativeMethods.TASKDIALOG_FLAGS options = SafeNativeMethods.TASKDIALOG_FLAGS.NONE;
            if (cancelable)
            {
                options |= SafeNativeMethods.TASKDIALOG_FLAGS.TDF_ALLOW_DIALOG_CANCELLATION;
            }
            if (checkBoxChecked.HasValue && checkBoxChecked.Value)
            {
                options |= SafeNativeMethods.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED;
            }
            if (hyperlinksEnabled)
            {
                options |= SafeNativeMethods.TASKDIALOG_FLAGS.TDF_ENABLE_HYPERLINKS;
            }
            if (expanded)
            {
                options |= SafeNativeMethods.TASKDIALOG_FLAGS.TDF_EXPANDED_BY_DEFAULT;
            }
            if (Tick != null)
            {
                options |= SafeNativeMethods.TASKDIALOG_FLAGS.TDF_CALLBACK_TIMER;
            }
            if (startupLocation == TaskDialogStartupLocation.CenterOwner)
            {
                options |= SafeNativeMethods.TASKDIALOG_FLAGS.TDF_POSITION_RELATIVE_TO_WINDOW;
            }

            // Note: no validation required, as we allow this to
            // be set even if there is no expanded information
            // text because that could be added later.
            // Default for Win32 API is to expand into (and after)
            // the content area.
            if (expansionMode == TaskDialogExpandedInformationLocation.ExpandFooter)
            {
                options |= SafeNativeMethods.TASKDIALOG_FLAGS.TDF_EXPAND_FOOTER_AREA;
            }

            // Finally, apply options to config.
            dialogConfig.dwFlags = options;
        }
Esempio n. 4
0
        private void ApplyGeneralNativeConfiguration(SafeNativeMethods.TASKDIALOGCONFIG dialogConfig)
        {
            // If an owner wasn't specifically specified,
            // we'll use the app's main window.
            Window currentOwner = ownerWindow;

            if (currentOwner == null)
            {
                currentOwner = Helpers.GetDefaultOwnerWindow();
            }

            if (currentOwner != null)
            {
                dialogConfig.hwndParent = (new WindowInteropHelper(currentOwner)).Handle;
            }

            // Other miscellaneous sets.
            dialogConfig.MainIcon =
                new SafeNativeMethods.TASKDIALOGCONFIG_ICON_UNION((int)mainIcon);
            dialogConfig.FooterIcon =
                new SafeNativeMethods.TASKDIALOGCONFIG_ICON_UNION((int)footerIcon);
            dialogConfig.dwCommonButtons =
                (SafeNativeMethods.TASKDIALOG_COMMON_BUTTON_FLAGS)standardButtons;
        }