コード例 #1
0
ファイル: TaskDialog.cs プロジェクト: yk35/WPF-Task-Dialog
        internal static VistaTaskDialogCommonButtons ConvertCommonButtons(TaskDialogCommonButtons commonButtons)
        {
            VistaTaskDialogCommonButtons vtdCommonButtons = VistaTaskDialogCommonButtons.None;

            switch (commonButtons)
            {
            default:
            case TaskDialogCommonButtons.None:
                vtdCommonButtons = VistaTaskDialogCommonButtons.None;
                break;

            case TaskDialogCommonButtons.Close:
                vtdCommonButtons = VistaTaskDialogCommonButtons.Close;
                break;

            case TaskDialogCommonButtons.OKCancel:
                vtdCommonButtons = VistaTaskDialogCommonButtons.OK | VistaTaskDialogCommonButtons.Cancel;
                break;

            case TaskDialogCommonButtons.RetryCancel:
                vtdCommonButtons = VistaTaskDialogCommonButtons.Retry | VistaTaskDialogCommonButtons.Cancel;
                break;

            case TaskDialogCommonButtons.YesNo:
                vtdCommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No;
                break;

            case TaskDialogCommonButtons.YesNoCancel:
                vtdCommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No | VistaTaskDialogCommonButtons.Cancel;
                break;
            }

            return(vtdCommonButtons);
        }
コード例 #2
0
            public static NiTaskDialogCommonButtons DecodeCommonButtons(TaskDialogCommonButtons value)
            {
                NiTaskDialogCommonButtons result = 0;

                if (value.HasFlag(TaskDialogCommonButtons.OK))
                {
                    result |= NiTaskDialogCommonButtons.OK;
                }
                if (value.HasFlag(TaskDialogCommonButtons.Yes))
                {
                    result |= NiTaskDialogCommonButtons.Yes;
                }
                if (value.HasFlag(TaskDialogCommonButtons.No))
                {
                    result |= NiTaskDialogCommonButtons.No;
                }
                if (value.HasFlag(TaskDialogCommonButtons.Cancel))
                {
                    result |= NiTaskDialogCommonButtons.Cancel;
                }
                if (value.HasFlag(TaskDialogCommonButtons.Retry))
                {
                    result |= NiTaskDialogCommonButtons.Retry;
                }
                if (value.HasFlag(TaskDialogCommonButtons.Close))
                {
                    result |= NiTaskDialogCommonButtons.Close;
                }

                return(result);
            }
コード例 #3
0
        /// <summary>
        ///     手動でダイアログを閉じます。
        /// </summary>
        /// <param name="commonButtonId">押されたと仮定するボタンのID。</param>
        public void CloseDialog(TaskDialogCommonButtons commonButtonId)
        {
            this.DialogShowStates = DialogShowStates.Closing;

            this.Commands.ClickButtonCommand((int)TaskDialogCommonButtons.Cancel);
            this.Dialog.RaiseClosingEvent((int)commonButtonId);
        }
コード例 #4
0
ファイル: TaskDialogHelpers.cs プロジェクト: nitz/luminous
        public static string ButtonsToText(IList <TaskDialogButton> Buttons, TaskDialogCommonButtons CommonButtons)
        {
            string s = string.Empty;

            if (Buttons != null)
            {
                foreach (TaskDialogButton b in Buttons)
                {
                    if (!string.IsNullOrEmpty(s))
                    {
                        s += "   ";
                    }
                    s += b.Result.ToLocalizedString();
                }
            }
            foreach (TaskDialogCommonButtons b in CommonButtonsOrder)
            {
                if ((b & CommonButtons) != TaskDialogCommonButtons.None)
                {
                    if (!string.IsNullOrEmpty(s))
                    {
                        s += "   ";
                    }
                    s += b.ToLocalizedString();
                }
            }
            return(s);
        }
コード例 #5
0
        void AppDialogShowing(object sender, RevitDialogEvents.DialogBoxShowingEventArgs args)
        {
            int dialogId = args.HelpId;

            String promptInfo = "A Revit dialog will be opened.\n";

            promptInfo += "The help id of this dialog is " + dialogId.ToString() + "\n";
            promptInfo += "If you don't want the dialog to open, please press cancel button";

            TaskDialog taskDialog = new TaskDialog("Revit");

            taskDialog.MainContent = promptInfo;
            TaskDialogCommonButtons buttons = TaskDialogCommonButtons.Ok |
                                              TaskDialogCommonButtons.Cancel;

            taskDialog.CommonButtons = buttons;
            TaskDialogResult result = taskDialog.Show();

            if (TaskDialogResult.Cancel == result)
            {
                args.OverrideResult(1);
            }
            else
            {
                args.OverrideResult(0);
            }
        }
コード例 #6
0
        private static TaskDialogSelectedButton CommonButtonIdToDialogResult(TaskDialogCommonButtons commonButtonId)
        {
            switch (commonButtonId)
            {
            case TaskDialogCommonButtons.Ok:
                return(TaskDialogSelectedButton.Ok);

            case TaskDialogCommonButtons.Cancel:
                return(TaskDialogSelectedButton.Cancel);

            case TaskDialogCommonButtons.Retry:
                return(TaskDialogSelectedButton.Retry);

            case TaskDialogCommonButtons.Yes:
                return(TaskDialogSelectedButton.Yes);

            case TaskDialogCommonButtons.No:
                return(TaskDialogSelectedButton.No);

            case TaskDialogCommonButtons.Close:
                return(TaskDialogSelectedButton.Close);

            default:
                return(TaskDialogSelectedButton.None);
            }
        }
コード例 #7
0
ファイル: TaskDialogHelpers.cs プロジェクト: nitz/luminous
        public static string ToLocalizedString(this TaskDialogCommonButtons @this)
        {
            switch (@this)
            {
            case TaskDialogCommonButtons.OK:
                return(Properties.Resources.OKText);

            case TaskDialogCommonButtons.Yes:
                return(Properties.Resources.YesText);

            case TaskDialogCommonButtons.No:
                return(Properties.Resources.NoText);

            case TaskDialogCommonButtons.Abort:
                return(Properties.Resources.AbortText);

            case TaskDialogCommonButtons.Retry:
                return(Properties.Resources.RetryText);

            case TaskDialogCommonButtons.Ignore:
                return(Properties.Resources.IgnoreText);

            case TaskDialogCommonButtons.Cancel:
                return(Properties.Resources.CancelText);

            case TaskDialogCommonButtons.Close:
                return(Properties.Resources.CloseText);

            default:
                return(Properties.Resources.NoneText);
            }
        }
コード例 #8
0
        public void AppDialogShowing(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs arg)
        {
            //get the help id of the showing dialog
            int dialogId = arg.HelpId;

            //Format the prompt information string
            string promptInfo = "lalala";

            promptInfo += "HelpId : " + dialogId.ToString();

            //Show the prompt information and allow the user close the dialog directly
            TaskDialog td = new TaskDialog("taskDialog1");

            td.MainContent = promptInfo;
            TaskDialogCommonButtons buttons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel;

            td.CommonButtons = buttons;
            //??liuzbkuv mjhglku
            TaskDialogResult tdr = td.Show();

            if (TaskDialogResult.Cancel == tdr)
            {
                //Do not show the Revit dialog
                arg.OverrideResult(1);
            }
            else
            {
                //Continue to show the Revit dialog
                arg.OverrideResult(0);
            }
        }
コード例 #9
0
        /// <summary>
        /// Displays a task dialog with the given configuration options.
        /// </summary>
        /// <param name="allowDialogCancellation">Indicates that the dialog should be able to be closed using Alt-F4,
        /// Escape, and the title bar's close button even if no cancel button
        /// is specified the CommonButtons.</param>
        /// <param name="callback">A callback that receives messages from the Task Dialog when
        /// various events occur.</param>
        /// <param name="callbackData">Reference object that is passed to the callback.</param>
        /// <param name="commandLinks">Command links.</param>
        /// <param name="commonButtons">Standard push buttons.</param>
        /// <param name="content">Supplemental text that expands on the principal text.</param>
        /// <param name="customButtons">Buttons that are not from the set of standard buttons. Use an
        /// ampersand to denote an access key.</param>
        /// <param name="customFooterIcon">A small 16x16 icon that signifies the purpose of the footer text,
        /// using a custom Icon resource. If defined <paramref name="footerIcon"/>
        /// will be ignored.</param>
        /// <param name="customMainIcon">A large 32x32 icon that signifies the purpose of the dialog, using
        /// a custom Icon resource. If defined <paramref name="mainIcon"/> will be
        /// ignored.</param>
        /// <param name="defaultButtonIndex">Zero-based index of the button to have focus by default.</param>
        /// <param name="enableCallbackTimer">Indicates that the task dialog's callback is to be called
        /// approximately every 200 milliseconds.</param>
        /// <param name="expandedByDefault">Indicates that the expanded info should be displayed when the
        /// dialog is initially displayed.</param>
        /// <param name="expandedInfo">Extra text that will be hidden by default.</param>
        /// <param name="expandToFooter">Indicates that the expanded info should be displayed at the bottom
        /// of the dialog's footer area instead of immediately after the
        /// dialog's content.</param>
        /// <param name="footerIcon">A small 16x16 icon that signifies the purpose of the footer text,
        /// using one of the built-in system icons.</param>
        /// <param name="footerText">Additional footer text.</param>
        /// <param name="mainIcon">A large 32x32 icon that signifies the purpose of the dialog, using
        /// one of the built-in system icons.</param>
        /// <param name="mainInstruction">Principal text.</param>
        /// <param name="owner">The owner window of the task dialog box.</param>
        /// <param name="radioButtons">Application-defined options for the user.</param>
        /// <param name="showMarqueeProgressBar">Indicates that an Marquee Progress Bar is to be displayed.</param>
        /// <param name="showProgressBar">Indicates that a Progress Bar is to be displayed.</param>
        /// <param name="title">Caption of the window.</param>
        /// <param name="verificationByDefault">Indicates that the verification checkbox in the dialog is checked
        /// when the dialog is initially displayed.</param>
        /// <param name="verificationText">Text accompanied by a checkbox, typically for user feedback such as
        /// Do-not-show-this-dialog-again options.</param>
        /// <returns>
        /// A <see cref="T:TaskDialogInterop.TaskDialogResult"/> value that specifies
        /// which button is clicked by the user.
        /// </returns>
        /// <remarks>
        /// Use of this method will ignore any TaskDialogOptions.Default settings.
        /// If you want to make use of defaults, create your own TaskDialogOptions starting with TaskDialogOptions.Default
        /// and pass it into the Show method.
        /// </remarks>
        public static TaskDialogResult Show(
            bool allowDialogCancellation          = false,
            TaskDialogCallback callback           = null,
            object callbackData                   = null,
            string[] commandLinks                 = null,
            TaskDialogCommonButtons commonButtons = TaskDialogCommonButtons.None,
            string content         = null,
            string[] customButtons = null,
            System.Drawing.Icon customFooterIcon = null,
            System.Drawing.Icon customMainIcon   = null,
            int?defaultButtonIndex    = null,
            bool enableCallbackTimer  = false,
            bool expandedByDefault    = false,
            string expandedInfo       = null,
            bool expandToFooter       = false,
            TaskDialogIcon footerIcon = TaskDialogIcon.None,
            string footerText         = null,
            TaskDialogIcon mainIcon   = TaskDialogIcon.None,
            string mainInstruction    = null,
            IntPtr owner                = default(IntPtr),
            string[] radioButtons       = null,
            bool showMarqueeProgressBar = false,
            bool showProgressBar        = false,
            string title                = null,
            bool verificationByDefault  = false,
            string verificationText     = null)
        {
            TaskDialogOptions options = new TaskDialogOptions()
            {
                AllowDialogCancellation = allowDialogCancellation,
                Callback            = callback,
                CallbackData        = callbackData,
                CommandLinks        = commandLinks,
                CommonButtons       = commonButtons,
                Content             = content,
                CustomButtons       = customButtons,
                CustomFooterIcon    = customFooterIcon,
                CustomMainIcon      = customMainIcon,
                DefaultButtonIndex  = defaultButtonIndex,
                EnableCallbackTimer = enableCallbackTimer,
                ExpandedByDefault   = expandedByDefault,
                ExpandedInfo        = expandedInfo,
                ExpandToFooter      = expandToFooter,
                FooterIcon          = footerIcon,
                FooterText          = footerText,
                MainIcon            = mainIcon,
                MainInstruction     = mainInstruction,
                Owner                  = owner,
                RadioButtons           = radioButtons,
                ShowMarqueeProgressBar = showMarqueeProgressBar,
                ShowProgressBar        = showProgressBar,
                Title                  = title,
                VerificationByDefault  = verificationByDefault,
                VerificationText       = verificationText
            };

            return(TaskDialog.Show(options));
        }
コード例 #10
0
 public static TaskDialogResult popupWarning(string instruction, TaskDialogCommonButtons commonButton, TaskDialogResult defButton)
 {
     TaskDialog tdlg = new TaskDialog(ReportResource.plrSettings);
      tdlg.MainInstruction = instruction;
      tdlg.AllowCancellation = true;
      tdlg.CommonButtons = commonButton;
      tdlg.DefaultButton = defButton;
      tdlg.TitleAutoPrefix = false;
      return tdlg.Show();
 }
コード例 #11
0
        public static TaskDialogResult popupWarning(string instruction, TaskDialogCommonButtons commonButton, TaskDialogResult defButton)
        {
            TaskDialog tdlg = new TaskDialog(ReportResource.plrSettings);

            tdlg.MainInstruction   = instruction;
            tdlg.AllowCancellation = true;
            tdlg.CommonButtons     = commonButton;
            tdlg.DefaultButton     = defButton;
            tdlg.TitleAutoPrefix   = false;
            return(tdlg.Show());
        }
コード例 #12
0
        /// <summary>
        /// Gets the buttonId for a common button. If the common button set includes more than
        /// one button, the index number specifies which.
        /// </summary>
        /// <param name="commonButtons">The common button set to use.</param>
        /// <param name="index">The zero-based index into the button set.</param>
        /// <returns>An integer representing the button, used for example with callbacks and the ClickButton method.</returns>
        public static int GetButtonIdForCommonButton(TaskDialogCommonButtons commonButtons, int index)
        {
            int buttonId = 0;

            switch (commonButtons)
            {
                default:
                case TaskDialogCommonButtons.None:
                case TaskDialogCommonButtons.Close:
                    // We'll set to 0 even for Close, as it doesn't matter that we
                    //get the value right since there is only one button anyway
                    buttonId = 0;
                    break;
                case TaskDialogCommonButtons.OKCancel:
                    if (index == 0)
                        buttonId = (int)VistaTaskDialogCommonButtons.OK;
                    else if (index == 1)
                        buttonId = (int)VistaTaskDialogCommonButtons.Cancel;
                    else
                        buttonId = 0;
                    break;
                case TaskDialogCommonButtons.RetryCancel:
                    if (index == 0)
                        buttonId = (int)VistaTaskDialogCommonButtons.Retry;
                    else if (index == 1)
                        buttonId = (int)VistaTaskDialogCommonButtons.Cancel;
                    else
                        buttonId = 0;
                    break;
                case TaskDialogCommonButtons.YesNo:
                    if (index == 0)
                        buttonId = (int)VistaTaskDialogCommonButtons.Yes;
                    else if (index == 1)
                        buttonId = (int)VistaTaskDialogCommonButtons.No;
                    else
                        buttonId = 0;
                    break;
                case TaskDialogCommonButtons.YesNoCancel:
                    if (index == 0)
                        buttonId = (int)VistaTaskDialogCommonButtons.Yes;
                    else if (index == 1)
                        buttonId = (int)VistaTaskDialogCommonButtons.No;
                    else if (index == 2)
                        buttonId = (int)VistaTaskDialogCommonButtons.Cancel;
                    else
                        buttonId = 0;
                    break;
            }

            return buttonId;
        }
コード例 #13
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog in front of the specified window and with specified text, title, buttons, icon, and default button.
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <param name="defaultButton">TaskDialogResult value that specifies the default button for the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string text, string title, TaskDialogCommonButtons buttons, TaskDialogIcon icon, TaskDialogResult defaultButton)
 {
     TaskDialogWindow td = new TaskDialogWindow(null, false)
     {
         Owner = owner,
         WindowTitle = title,
         MainIcon = icon,
         ContentText = text,
         CommonButtons = buttons,
         DefaultButton = defaultButton,
     };
     td.ShowDialog();
     return (TaskDialogResult)td.Tag;
 }
コード例 #14
0
ファイル: TaskDialogHelpers.cs プロジェクト: nitz/luminous
        public static TaskDialogResult TaskDialogCommonButtonsToTaskDialogResult(TaskDialogCommonButtons taskDialogCommonButton)
        {
            int i   = 1;
            int btn = (int)taskDialogCommonButton;

            if (btn == 0)
            {
                return(TaskDialogResult.None);
            }
            while ((btn >>= 1) > 0)
            {
                i++;
            }
            return((TaskDialogResult)i);
        }
コード例 #15
0
ファイル: TaskDialogHelpers.cs プロジェクト: nitz/luminous
        public static TaskDialogResult GetFirstButton(TaskDialogCommonButtons buttons)
        {
            int i   = 1;
            int btn = (int)buttons;

            if (btn == 0)
            {
                return(TaskDialogResult.None);
            }
            do
            {
                if ((btn & 1) != 0)
                {
                    break;
                }
                i++;
            }while ((btn >>= 1) > 0);
            return((TaskDialogResult)i);
        }
コード例 #16
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog with the specified title, intruction, content, title, buttons and icon.
 /// </summary>
 /// <param name="windowTitle">The text to display in the title bar of the task dialog.</param>
 /// <param name="mainInstruction">The instruction to display in the task dialog.</param>
 /// <param name="content">The text to display in the task dialog.</param>
 /// <param name="commonButtons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(string windowTitle, string mainInstruction, string content, TaskDialogCommonButtons commonButtons, TaskDialogIcon icon)
 {
     return Show(DefaultOwnerWindow, windowTitle, mainInstruction, content, commonButtons, icon);
 }
コード例 #17
0
ファイル: TaskDialog.cs プロジェクト: yk35/WPF-Task-Dialog
        /// <summary>
        /// Gets the buttonId for a common button. If the common button set includes more than
        /// one button, the index number specifies which.
        /// </summary>
        /// <param name="commonButtons">The common button set to use.</param>
        /// <param name="index">The zero-based index into the button set.</param>
        /// <returns>An integer representing the button, used for example with callbacks and the ClickButton method.</returns>
        public static int GetButtonIdForCommonButton(TaskDialogCommonButtons commonButtons, int index)
        {
            int buttonId = 0;

            switch (commonButtons)
            {
            default:
            case TaskDialogCommonButtons.None:
            case TaskDialogCommonButtons.Close:
                // We'll set to 0 even for Close, as it doesn't matter that we
                //get the value right since there is only one button anyway
                buttonId = 0;
                break;

            case TaskDialogCommonButtons.OKCancel:
                if (index == 0)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.OK;
                }
                else if (index == 1)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.Cancel;
                }
                else
                {
                    buttonId = 0;
                }
                break;

            case TaskDialogCommonButtons.RetryCancel:
                if (index == 0)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.Retry;
                }
                else if (index == 1)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.Cancel;
                }
                else
                {
                    buttonId = 0;
                }
                break;

            case TaskDialogCommonButtons.YesNo:
                if (index == 0)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.Yes;
                }
                else if (index == 1)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.No;
                }
                else
                {
                    buttonId = 0;
                }
                break;

            case TaskDialogCommonButtons.YesNoCancel:
                if (index == 0)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.Yes;
                }
                else if (index == 1)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.No;
                }
                else if (index == 2)
                {
                    buttonId = (int)VistaTaskDialogCommonButtons.Cancel;
                }
                else
                {
                    buttonId = 0;
                }
                break;
            }

            return(buttonId);
        }
コード例 #18
0
        public static TaskDialogClosingEventArgs Create(TaskDialogCommonButtons commonButtonId)
        {
            var dialogResult = CommonButtonIdToDialogResult(commonButtonId);

            return(new TaskDialogClosingEventArgs(dialogResult, (int)commonButtonId, String.Empty));
        }
コード例 #19
0
ファイル: TaskDialog.cs プロジェクト: twpol/msts-tools
        static int Show(Form owner, string title, TaskDialogCommonIcon icon, string mainInstruction, string content, TaskDialogCommonButtons commonButtons, TaskDialogButton[] buttons)
        {
            if (buttons.Length > 10)
            {
                throw new ArgumentOutOfRangeException("buttons", "Maximum number of buttons is 10.");
            }

            var tdConfig = new TaskDialogConfig();

            tdConfig.Size = (uint)Marshal.SizeOf(tdConfig);
            Debug.Assert(tdConfig.Size == 160);

            tdConfig.Parent          = owner.Handle;
            tdConfig.Instance        = NativeMethods.GetModuleHandle(null);
            tdConfig.Flags           = TaskDialogFlags.PositionRelativeToWindow | (owner.RightToLeft == RightToLeft.Yes ? TaskDialogFlags.RTLLayout : TaskDialogFlags.None);
            tdConfig.CommonButtons   = commonButtons;
            tdConfig.WindowTitle     = title;
            tdConfig.MainIcon        = new IntPtr((int)icon);
            tdConfig.MainInstruction = mainInstruction;
            tdConfig.Content         = content;

            if (buttons.Length > 0)
            {
                var buttonStructSize = Marshal.SizeOf(typeof(TaskDialogButton));
                tdConfig.Buttons = Marshal.AllocHGlobal(buttonStructSize * buttons.Length);
                for (var i = 0; i < buttons.Length; i++)
                {
                    Marshal.StructureToPtr(buttons[i], new IntPtr(tdConfig.Buttons.ToInt64() + i * buttonStructSize), false);
                }
                tdConfig.ButtonCount = (uint)buttons.Length;
            }

            try {
                var button           = 0;
                var radioButton      = 0;
                var verificationFlag = false;
                var rv = NativeMethods.TaskDialogIndirect(ref tdConfig, out button, out radioButton, out verificationFlag);
                if (rv != 0)
                {
                    throw new InvalidOperationException("TaskDialogIndirect failed: " + rv.ToString("X8", CultureInfo.CurrentCulture));
                }
                return(button);
            } finally {
                if (buttons.Length > 0)
                {
                    Marshal.FreeHGlobal(tdConfig.Buttons);
                }
            }
        }
コード例 #20
0
 /// <summary>
 ///     手動でダイアログを閉じます。
 /// </summary>
 protected void CloseDialog(TaskDialogCommonButtons commonButton)
 {
     this.TaskDialogInternal.CloseDialog(commonButton);
 }
コード例 #21
0
        internal static VistaTaskDialogCommonButtons ConvertCommonButtons(TaskDialogCommonButtons commonButtons)
        {
            VistaTaskDialogCommonButtons vtdCommonButtons = VistaTaskDialogCommonButtons.None;

            switch (commonButtons)
            {
                default:
                case TaskDialogCommonButtons.None:
                    vtdCommonButtons = VistaTaskDialogCommonButtons.None;
                    break;
                case TaskDialogCommonButtons.Close:
                    vtdCommonButtons = VistaTaskDialogCommonButtons.Close;
                    break;
                case TaskDialogCommonButtons.OKCancel:
                    vtdCommonButtons = VistaTaskDialogCommonButtons.OK | VistaTaskDialogCommonButtons.Cancel;
                    break;
                case TaskDialogCommonButtons.RetryCancel:
                    vtdCommonButtons = VistaTaskDialogCommonButtons.Retry | VistaTaskDialogCommonButtons.Cancel;
                    break;
                case TaskDialogCommonButtons.YesNo:
                    vtdCommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No;
                    break;
                case TaskDialogCommonButtons.YesNoCancel:
                    vtdCommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No | VistaTaskDialogCommonButtons.Cancel;
                    break;
            }

            return vtdCommonButtons;
        }
コード例 #22
0
        //shows a message box using the given parameters
        public void ShowMessageBox(string dialogName, string id, string message, TaskDialogIcon icon, TaskDialogCommonButtons buttons)
        {
            //give an error message if we do not
            TaskDialog td = new TaskDialog(dialogName);

            td.Id            = id;
            td.MainIcon      = icon;
            td.CommonButtons = buttons;
            td.MainContent   = message;
            td.Show();
        }
コード例 #23
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            // Format the prompt information string
            String promptInfo = "A .json file will be downloaded from SAP AIN and put on your Desktop with FGC equipments information.\n";

            // Show the prompt message, and allow the user to close the dialog directly.
            TaskDialog taskDialog = new TaskDialog("Update Parameters");

            taskDialog.Id          = "Customer DialogId";
            taskDialog.MainContent = promptInfo;
            TaskDialogCommonButtons buttons = TaskDialogCommonButtons.Ok |
                                              TaskDialogCommonButtons.Cancel;

            taskDialog.CommonButtons = buttons;
            TaskDialogResult result = taskDialog.Show();

            //Debajo se utiliza WriteAllText para sobreescribir desde 0 el fichero en caso de que exista y sino para crearlo
            System.IO.File.WriteAllText(@"C:\Users\" + Environment.UserName.ToString() + "\\Desktop\\Extract_AIN_Events.txt", "Initialization of JSON extraction process on " +
                                        DateTime.Now.ToString("MM/dd/yyyy h:mm tt") + Environment.NewLine);

            UIApplication uiapp     = commandData.Application;
            UIDocument    uidoc     = uiapp.ActiveUIDocument;
            Selection     selection = uidoc.Selection;
            Document      doc       = uidoc.Document;
            string        name      = doc.Title;
            string        path      = doc.PathName;

            //store element id's, aunque sólo queremos uno en principio

            //INICIO LLAMADA A TODOS LOS EQUIPOS
            //Esta llamada se hace para tener en una variable todos los equipments que están en AIN.
            JsonDeserializer deserial = new JsonDeserializer();
            var client = new RestClient("https://servicesiot.authentication.eu10.hana.ondemand.com/oauth/token");

            client.Timeout = -1;
            var request = new RestRequest(Method.POST);

            request.AddParameter("grant_type", "client_credentials");
            request.AddHeader("Authorization", "Basic YOUR TOKEN");
            string access_token = "";

            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
            var response = client.Execute(request);

            access_token = JObject.Parse(response.Content).SelectToken("access_token").ToString();
            //TaskDialog.Show("Access Token to AIN is", access_token);
            var clientEquipments  = new RestClient("https://ain-live.cfapps.eu10.hana.ondemand.com/services/api/v1/equipment");
            var requestEquipments = new RestRequest(Method.GET);

            requestEquipments.AddParameter("Accept", "application/json");
            requestEquipments.AddParameter("Content-Type", "application/x-www-form-urlencoded");
            requestEquipments.AddHeader("authorization", "Bearer " + access_token);

            var responseEquipments  = clientEquipments.Execute(requestEquipments);
            var respuestaFormateada = String.Concat("{'equipos':", responseEquipments.Content.ToString(), "}");
            //var respuestaFormateada = responseEquipments.Content.ToString().TrimStart('[').TrimEnd(']');
            JObject json = JObject.Parse(respuestaFormateada);
            //FIN LLAMADA A TODOS LOS EQUIPOS

            var totalEquipos = json["equipos"].LongCount();

            //Se hace un for para ir recorriendo los resultados que vienen de AIN.
            //Dentro del for hay que comprobar el parámetro ShortDescription en cada elemento para ver si contiene el string FGC_
            //En caso de que  tenga el string se hace la llamada a AIN con el equipmentId correspondiente y se pisan todos los parámetros.
            int     e = 0;
            int     a = 0;
            Boolean esFGC;
            Boolean notEnded = true;

            //Creación del fichero json que se requiere en la prueba

            /*var serializer = new JavaScriptSerializer();
             * var serializedResult = serializer.Serialize(responseEquipment.Content);
             * string json_pretty = JSON_PrettyPrinter.Process(serializedResult);*/
            while (notEnded)
            {
                var equimentId = json["equipos"][e]["equipmentId"].ToString().TrimStart('{').TrimEnd('}');
                esFGC = json["equipos"][e]["shortDescription"].ToString().TrimStart('{').TrimEnd('}').Contains("FGC_");
                var internalId = json["equipos"][e]["internalId"].ToString().TrimStart('{').TrimEnd('}');
                if (esFGC)
                {
                    //TaskDialog.Show("Detección de equipos", "Equipment " + json["equipos"][e]["shortDescription"] + "is FGC.");
                    //Una vez sabemos que un equipo es FGC hacemos la llamada correspondiente para recoger los valores de atributos del equipo
                    var clientEquipment  = new RestClient("https://ain-live.cfapps.eu10.hana.ondemand.com/services/api/v1/equipment(" + equimentId + ")/values");
                    var requestEquipment = new RestRequest(Method.GET);
                    requestEquipment.AddHeader("authorization", "Bearer " + access_token);
                    var responseEquipment = clientEquipment.Execute(requestEquipment);
                    var jsonEquipment     = JObject.Parse(responseEquipment.Content);
                    ///Escribir el parámetro en Revit
                    //Aqui hay que meter un for en funcion del número de atributos que devuelve /values.
                    //Depués, por cada parámetro hay que comprobar que existe y escribirlo en Revit.

                    int       idInt   = Convert.ToInt32(internalId);
                    ElementId id      = new ElementId(idInt);
                    Element   element = doc.GetElement(id);
                    if (!(element is null))
                    {
                        using (StreamWriter sw = File.AppendText(@"C:\Users\" + Environment.UserName.ToString() + "\\Desktop\\Extract_AIN_Events.txt"))
                        {
                            sw.WriteLine(json["equipos"][e]["shortDescription"] + " equipment's parameters were" +
                                         "   downloaded and updated on the Revit model.");
                        }

                        //System.IO.File.WriteAllText(@"C:\Users\" + Environment.UserName.ToString() + "\\Desktop\\Extract_AIN_Events.json",   json["equipos"][e]["shortDescription"] + " equipment's parameters were" +
                        //    "   downloaded and updated on the Revit model.");
                    }

                    var atributosElemento = jsonEquipment["templates"][0]["attributeGroups"][0]["attributes"];
                    json["equipos"][e]["attributes"] = atributosElemento;
                    e++;
                    a++;
                }
                else
                {
                    a++;
                    //Se borra el nodo de la variable JSON en la posición actual
                    (json["equipos"] as JArray).RemoveAt(e);
                }
                if (a == totalEquipos)
                {
                    notEnded = false;
                }
            }
            //Escritura en fichero
            string jsonPaint = json.ToString();

            System.IO.File.WriteAllText(@"C:\Users\" + Environment.UserName.ToString() + "\\Desktop\\FGC_Equipments.json", jsonPaint);

            TaskDialog.Show("Download correct", "JSON File is on your desktop with name FGC_Equipments.json");

            using (StreamWriter sw = File.AppendText(@"C:\Users\" + Environment.UserName.ToString() + "\\Desktop\\Extract_AIN_Events.txt"))
            {
                sw.WriteLine("A total of " + e + " equipments information has been updated correctly");
                sw.WriteLine("JSON file correctly generated and saved on Desktop on " +
                             DateTime.Now.ToString("MM/dd/yyyy h:mm tt"));
            }

            //System.IO.File.WriteAllText(@"C:\Users\" + Environment.UserName.ToString() + "\\Desktop\\Extract_AIN_Events.json", "A total of " + e + " equipments information has been updated correctly");

            //System.IO.File.WriteAllText(@"C:\Users\" + Environment.UserName.ToString() + "\\Desktop\\Extract_AIN_Events.json", "JSON file correctly generated and saved on Desktop on " +
            //    DateTime.Now.ToString("MM/dd/yyyy h:mm tt"));

            return(Result.Succeeded);
        }
コード例 #24
0
        /// <summary>
        /// Displays a task dialog that has a message and that returns a result.
        /// </summary>
        /// <param name="owner">
        /// The <see cref="T:System.Windows.Window"/> that owns this dialog.
        /// </param>
        /// <param name="messageText">
        /// A <see cref="T:System.String"/> that specifies the text to display.
        /// </param>
        /// <param name="caption">
        /// A <see cref="T:System.String"/> that specifies the title bar
        /// caption to display.
        /// </param>
        /// <param name="buttons">
        /// A <see cref="T:TaskDialogInterop.TaskDialogCommonButtons"/> value that
        /// specifies which button or buttons to display.
        /// </param>
        /// <param name="icon">
        /// A <see cref="T:TaskDialogInterop.VistaTaskDialogIcon"/> that specifies the
        /// icon to display.
        /// </param>
        /// <returns>
        /// A <see cref="T:TaskDialogInterop.TaskDialogSimpleResult"/> value that
        /// specifies which button is clicked by the user.
        /// </returns>
        public static TaskDialogSimpleResult ShowMessage(Window owner, string messageText, string caption, TaskDialogCommonButtons buttons, VistaTaskDialogIcon icon)
        {
            TaskDialogOptions options = TaskDialogOptions.Default;

            options.Owner = owner;
            options.Title = caption;
            options.Content = messageText;
            options.CommonButtons = buttons;
            options.MainIcon = icon;

            return Show(options).Result;
        }
コード例 #25
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog in front of the specified window and with the specified text, title, buttons, and icon.
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string text, string title, TaskDialogCommonButtons buttons, TaskDialogIcon icon)
 {
     return Show(owner, text, title, buttons, icon, TaskDialogHelpers.GetFirstButton(buttons));
 }
コード例 #26
0
 public static TaskDialogResult GetFirstButton(TaskDialogCommonButtons buttons)
 {
     int i = 1;
     int btn = (int)buttons;
     if (btn == 0)
     {
         return TaskDialogResult.None;
     }
     do
     {
         if ((btn & 1) != 0)
         {
             break;
         }
         i++;
     }
     while ((btn >>= 1) > 0);
     return (TaskDialogResult)i;
 }
コード例 #27
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog with specified text, title, buttons, icon, and default button.
 /// </summary>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <param name="defaultButton">TaskDialogResult value that specifies the default button for the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(string text, string title, TaskDialogCommonButtons buttons, TaskDialogIcon icon, TaskDialogResult defaultButton)
 {
     return Show(DefaultOwnerWindow, text, title, buttons, icon, defaultButton);
 }
コード例 #28
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog in front of the specified window and with the specified text, title, and buttons.
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string text, string title, TaskDialogCommonButtons buttons)
 {
     return Show(owner, text, title, buttons, TaskDialogIcon.None);
 }
コード例 #29
0
 /// <summary>
 ///     標準ボタンを設定します。
 /// </summary>
 /// <param name="commonButtons">標準ボタンフラグ。</param>
 public void SetCommonButtons(TaskDialogCommonButtons commonButtons)
 {
     this.CommonButtons = (TASKDIALOG_COMMON_BUTTON_FLAGS)commonButtons;
 }
コード例 #30
0
 public static string ButtonsToText(IList<TaskDialogButton> Buttons, TaskDialogCommonButtons CommonButtons)
 {
     string s = string.Empty;
     if (Buttons != null)
     {
         foreach (TaskDialogButton b in Buttons)
         {
             if (!string.IsNullOrEmpty(s))
             {
                 s += "   ";
             }
             s += b.Result.ToLocalizedString();
         }
     }
     foreach (TaskDialogCommonButtons b in CommonButtonsOrder)
     {
         if ((b & CommonButtons) != TaskDialogCommonButtons.None)
         {
             if (!string.IsNullOrEmpty(s))
             {
                 s += "   ";
             }
             s += b.ToLocalizedString();
         }
     }
     return s;
 }
コード例 #31
0
 private static string ButtonsToText(TaskDialogCommonButtons CommonButtons)
 {
     return ButtonsToText(null, CommonButtons);
 }
コード例 #32
0
 /// <summary>
 /// Displays a task dialog that has a message and that returns a result.
 /// </summary>
 /// <param name="owner">
 /// The <see cref="T:System.Windows.Window"/> that owns this dialog.
 /// </param>
 /// <param name="messageText">
 /// A <see cref="T:System.String"/> that specifies the text to display.
 /// </param>
 /// <param name="caption">
 /// A <see cref="T:System.String"/> that specifies the title bar
 /// caption to display.
 /// </param>
 /// <param name="buttons">
 /// A <see cref="T:TaskDialogInterop.TaskDialogCommonButtons"/> value that
 /// specifies which button or buttons to display.
 /// </param>
 /// <returns>
 /// A <see cref="T:TaskDialogInterop.TaskDialogSimpleResult"/> value that
 /// specifies which button is clicked by the user.
 /// </returns>
 public static TaskDialogSimpleResult ShowMessage(Window owner, string messageText, string caption, TaskDialogCommonButtons buttons)
 {
     return ShowMessage(owner, messageText, caption, buttons, VistaTaskDialogIcon.None);
 }
コード例 #33
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog in front of the specified window and with the specified title, intruction, content, title, buttons and icon..
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="windowTitle">The text to display in the title bar of the task dialog.</param>
 /// <param name="mainInstruction">The instruction to display in the task dialog.</param>
 /// <param name="content">The text to display in the task dialog.</param>
 /// <param name="commonButtons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string windowTitle, string mainInstruction, string content, TaskDialogCommonButtons commonButtons, TaskDialogIcon icon)
 {
     TaskDialogWindow td = new TaskDialogWindow(null, true) { Owner = owner, WindowTitle = windowTitle, MainIcon = icon, MainInstruction = mainInstruction, ContentText = content, CommonButtons = commonButtons };
     td.DefaultButton = TaskDialogHelpers.GetFirstButton(commonButtons);
     td.UseCommandLinks = true;
     td.ShowDialog();
     return (TaskDialogResult)td.Tag;
 }
コード例 #34
0
        /// <summary>
        /// Displays a task dialog that has a message and that returns a result.
        /// </summary>
        /// <param name="owner">
        /// The <see cref="T:System.Windows.Window"/> that owns this dialog.
        /// </param>
        /// <param name="title">
        /// A <see cref="T:System.String"/> that specifies the title bar
        /// caption to display.
        /// </param>
        /// <param name="mainInstruction">
        /// A <see cref="T:System.String"/> that specifies the main text to display.
        /// </param>
        /// <param name="content">
        /// A <see cref="T:System.String"/> that specifies the body text to display.
        /// </param>
        /// <param name="expandedInfo">
        /// A <see cref="T:System.String"/> that specifies the expanded text to display when toggled.
        /// </param>
        /// <param name="verificationText">
        /// A <see cref="T:System.String"/> that specifies the text to display next to a checkbox.
        /// </param>
        /// <param name="footerText">
        /// A <see cref="T:System.String"/> that specifies the footer text to display.
        /// </param>
        /// <param name="buttons">
        /// A <see cref="T:TaskDialogInterop.TaskDialogCommonButtons"/> value that
        /// specifies which button or buttons to display.
        /// </param>
        /// <param name="mainIcon">
        /// A <see cref="T:TaskDialogInterop.VistaTaskDialogIcon"/> that specifies the
        /// main icon to display.
        /// </param>
        /// <param name="footerIcon">
        /// A <see cref="T:TaskDialogInterop.VistaTaskDialogIcon"/> that specifies the
        /// footer icon to display.
        /// </param>
        /// <returns></returns>
        public static TaskDialogSimpleResult ShowMessage(Window owner, string title, string mainInstruction, string content, string expandedInfo, string verificationText, string footerText, TaskDialogCommonButtons buttons, VistaTaskDialogIcon mainIcon, VistaTaskDialogIcon footerIcon)
        {
            TaskDialogOptions options = TaskDialogOptions.Default;

            if (owner != null)
                options.Owner = owner;
            if (!String.IsNullOrEmpty(title))
                options.Title = title;
            if (!String.IsNullOrEmpty(mainInstruction))
                options.MainInstruction = mainInstruction;
            if (!String.IsNullOrEmpty(content))
                options.Content = content;
            if (!String.IsNullOrEmpty(expandedInfo))
                options.ExpandedInfo = expandedInfo;
            if (!String.IsNullOrEmpty(verificationText))
                options.VerificationText = verificationText;
            if (!String.IsNullOrEmpty(footerText))
                options.FooterText = footerText;
            options.CommonButtons = buttons;
            options.MainIcon = mainIcon;
            options.FooterIcon = footerIcon;

            return Show(options).Result;
        }
コード例 #35
0
ファイル: TaskDialog.cs プロジェクト: angelstam/Luminous
 /// <summary>
 /// Displays a task dialog with specified text, title, and buttons.
 /// </summary>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(string text, string title, TaskDialogCommonButtons buttons)
 {
     return Show(DefaultOwnerWindow, text, title, buttons);
 }
コード例 #36
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication            uiapp     = commandData.Application;
            UIDocument               uidoc     = uiapp.ActiveUIDocument;
            Application              app       = uiapp.Application;
            Document                 doc       = uidoc.Document;
            View                     view      = doc.ActiveView;
            FamilySymbol             fs        = null;
            FilteredElementCollector collector = new FilteredElementCollector(doc);

            collector.OfClass(typeof(FamilySymbol));
            collector.OfCategory(BuiltInCategory.OST_TitleBlocks);

            IEnumerable <Element> titleblock = from element in collector where element.Name.Equals("A0h") select element;

            foreach (Element element in titleblock)
            {
                if (element.Name.Equals("A0h"))
                {
                    fs = element as FamilySymbol;
                }
            }
            if (fs == null)
            {
                TaskDialog.Show("Sheet", "no titleblocks");
            }


            //FamilySymbol fs = collector.FirstElement() as FamilySymbol;
            if (fs != null)
            {
                using (Transaction t = new Transaction(doc, "Create a new ViewSheet"))
                {
                    t.Start();
                    try
                    {
                        // Create a sheet view
                        ViewSheet viewSheet = ViewSheet.Create(doc, fs.Id);
                        if (null == viewSheet)
                        {
                            throw new Exception("Failed to create new ViewSheet.");
                        }

                        // Add passed in view onto the center of the sheet
                        UV location = new UV((viewSheet.Outline.Max.U - viewSheet.Outline.Min.U) / 2,
                                             (viewSheet.Outline.Max.V - viewSheet.Outline.Min.V) / 2);

                        //viewSheet.AddView(view3D, location);
                        Viewport.Create(doc, viewSheet.Id, view.Id, new XYZ(location.U, location.V, 0));

                        // Print the sheet out
                        if (viewSheet.CanBePrinted)
                        {
                            TaskDialog taskDialog = new TaskDialog("Revit");
                            taskDialog.MainContent = "Print the sheet?";
                            TaskDialogCommonButtons buttons = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No;
                            taskDialog.CommonButtons = buttons;
                            TaskDialogResult result = taskDialog.Show();

                            if (result == TaskDialogResult.Yes)
                            {
                                viewSheet.Print();
                            }
                        }

                        t.Commit();
                    }
                    catch
                    {
                        t.RollBack();
                    }
                }
            }

            return(Result.Succeeded);
        }
コード例 #37
0
        /// <summary>
        /// Gets the zero-based index for a common button.
        /// </summary>
        /// <param name="commonButtons">The common button set to use.</param>
        /// <param name="buttonId">The button's id.</param>
        /// <returns>An integer representing the button index, or -1 if not found.</returns>
        /// <remarks>
        /// When Alt+F4, Esc, and other non-button close commands are issued, the dialog
        /// will simulate a Cancel button click. In this case, -1 for index and a buttonid
        /// of Cancel will let you know how the user closed the dialog.
        /// </remarks>
        public static int GetButtonIndexForCommonButton(TaskDialogCommonButtons commonButtons, int buttonId)
        {
            int index = -1;

            switch (commonButtons)
            {
                default:
                case TaskDialogCommonButtons.None:
                    index = -1;
                    break;
                case TaskDialogCommonButtons.Close:
                    index = 0;
                    break;
                case TaskDialogCommonButtons.OKCancel:
                    if (buttonId == (int)TaskDialogSimpleResult.Ok
                        || buttonId == (int)VistaTaskDialogCommonButtons.OK)
                        index = 0;
                    else if (buttonId == (int)TaskDialogSimpleResult.Cancel
                        || buttonId == (int)VistaTaskDialogCommonButtons.Cancel)
                        index = 1;
                    break;
                case TaskDialogCommonButtons.RetryCancel:
                    if (buttonId == (int)TaskDialogSimpleResult.Retry
                        || buttonId == (int)VistaTaskDialogCommonButtons.Retry)
                        index = 0;
                    else if (buttonId == (int)TaskDialogSimpleResult.Cancel
                        || buttonId == (int)VistaTaskDialogCommonButtons.Cancel)
                        index = 1;
                    break;
                case TaskDialogCommonButtons.YesNo:
                    if (buttonId == (int)TaskDialogSimpleResult.Yes
                        || buttonId == (int)VistaTaskDialogCommonButtons.Yes)
                        index = 0;
                    else if (buttonId == (int)TaskDialogSimpleResult.No
                        || buttonId == (int)VistaTaskDialogCommonButtons.No)
                        index = 1;
                    break;
                case TaskDialogCommonButtons.YesNoCancel:
                    if (buttonId == (int)TaskDialogSimpleResult.Yes
                        || buttonId == (int)VistaTaskDialogCommonButtons.Yes)
                        index = 0;
                    else if (buttonId == (int)TaskDialogSimpleResult.No
                        || buttonId == (int)VistaTaskDialogCommonButtons.No)
                        index = 1;
                    else if (buttonId == (int)TaskDialogSimpleResult.Cancel
                        || buttonId == (int)VistaTaskDialogCommonButtons.Cancel)
                        index = 2;
                    break;
            }

            return index;
        }
コード例 #38
0
 public TaskDialogResult MessageBox(string title, string message, string content, TaskDialogCommonButtons buttons,
                                    TaskDialogIcon icons)
 {
     return(TaskDialogResult.Empty);
 }
コード例 #39
0
 public static TaskDialogResult TaskDialogCommonButtonsToTaskDialogResult(TaskDialogCommonButtons taskDialogCommonButton)
 {
     int i = 1;
     int btn = (int)taskDialogCommonButton;
     if (btn == 0)
     {
         return TaskDialogResult.None;
     }
     while ((btn >>= 1) > 0)
     {
         i++;
     }
     return (TaskDialogResult)i;
 }
コード例 #40
0
ファイル: TaskDialog.cs プロジェクト: pvginkel/SystemEx
 /// <summary>
 /// Resets the Task Dialog to the state when first constructed, all properties set to their default value.
 /// </summary>
 public void Reset( )
 {
     this.windowTitle = null;
     this.mainInstruction = null;
     this.content = null;
     this.commonButtons = 0;
     this.mainIcon = TaskDialogIcon.None;
     this.customMainIcon = null;
     this.footerIcon = TaskDialogIcon.None;
     this.customFooterIcon = null;
     this.buttons = new TaskDialogButton[0];
     this.radioButtons = new TaskDialogButton[0];
     this.flags = 0;
     this.defaultButton = 0;
     this.defaultRadioButton = 0;
     this.verificationText = null;
     this.expandedInformation = null;
     this.expandedControlText = null;
     this.collapsedControlText = null;
     this.footer = null;
     this.callback = null;
     this.callbackData = null;
     this.width = 0;
 }
コード例 #41
0
ファイル: BaseForm.cs プロジェクト: zhuomingliang/cyberduck
 public virtual TaskDialogResult MessageBox(string title, string message, string content,
                                            TaskDialogCommonButtons buttons, TaskDialogIcon icon)
 {
     return(TaskDialog.Show(title: title, mainInstruction: message, content: content, commonButtons: buttons,
                            mainIcon: icon));
 }
コード例 #42
0
 protected void SetCommonButtons(TaskDialogCommonButtons commonButtons)
 {
     this.TaskDialogInternal.SetCommonButtons(commonButtons);
 }
コード例 #43
0
ファイル: NiShell.TaskDialog.cs プロジェクト: netide/netide
            public static NiTaskDialogCommonButtons DecodeCommonButtons(TaskDialogCommonButtons value)
            {
                NiTaskDialogCommonButtons result = 0;

                if (value.HasFlag(TaskDialogCommonButtons.OK))
                    result |= NiTaskDialogCommonButtons.OK;
                if (value.HasFlag(TaskDialogCommonButtons.Yes))
                    result |= NiTaskDialogCommonButtons.Yes;
                if (value.HasFlag(TaskDialogCommonButtons.No))
                    result |= NiTaskDialogCommonButtons.No;
                if (value.HasFlag(TaskDialogCommonButtons.Cancel))
                    result |= NiTaskDialogCommonButtons.Cancel;
                if (value.HasFlag(TaskDialogCommonButtons.Retry))
                    result |= NiTaskDialogCommonButtons.Retry;
                if (value.HasFlag(TaskDialogCommonButtons.Close))
                    result |= NiTaskDialogCommonButtons.Close;

                return result;
            }