Exemplo n.º 1
0
 /// <summary>
 /// Displays a message box.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="text">The text.</param>
 /// <param name="caption">The caption.</param>
 /// <param name="cbText">The cb text.</param>
 /// <param name="buttons">The buttons.</param>
 /// <param name="icon">The icon.</param>
 /// <returns></returns>
 public static DialogResult Show(IWin32Window owner, string text, string caption, string cbText,
                                 MessageBoxButtons buttons = MessageBoxButtons.OK,
                                 MessageBoxIcon icon       = MessageBoxIcon.None)
 {
     using (MessageBoxCustom form = new MessageBoxCustom())
     {
         return(form.ShowDialog(owner, text, caption, cbText, buttons, icon));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Displays a message box.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="text">The text.</param>
 /// <param name="caption">The caption.</param>
 /// <param name="cbText">The cb text.</param>
 /// <param name="buttons">The buttons.</param>
 /// <param name="icon">The icon.</param>
 /// <returns></returns>
 public static DialogResult Show(IWin32Window owner, string text, string caption, string cbText,
     MessageBoxButtons buttons = MessageBoxButtons.OK,
     MessageBoxIcon icon = MessageBoxIcon.None)
 {
     using (MessageBoxCustom form = new MessageBoxCustom())
     {
         return form.ShowDialog(owner, text, caption, cbText, buttons, icon);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Context menu > Change priority.
        /// Opens a dialog box to edit the priorities. Check for concflicts and asks the user when needed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miChangePriority_Click(object sender, EventArgs e)
        {
            // TODO: Unscramble

            var entries = SelectedEntries;

            using (PlanPrioritiesEditorForm form = new PlanPrioritiesEditorForm())
            {
                // Gets the entry's priority (or default if more than one item selected)
                form.Priority = PlanEntry.DefaultPriority;
                if (lvSkills.SelectedItems.Count == 1)
                {
                    PlanEntry pe = GetPlanEntry(lvSkills.SelectedItems[0]);
                    if (pe != null) form.Priority = pe.Priority;
                }

                // User canceled ?
                DialogResult dr = form.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                // Update priorities, while performing backup for subsequent check
                if (!m_plan.TrySetPriority(m_displayPlan, entries, form.Priority))
                {
                    bool showDialog = Settings.UI.PlanWindow.PrioritiesMsgBox.ShowDialogBox;

                    // User wishes the dialog to be displayed
                    if (showDialog)
                    {
                        string text = String.Concat("This would result in a priority conflict.",
                               " (Either pre-requisites with a lower priority or dependant skills with a higher priority).\r\n\r\n",
                               "Click Yes if you wish to do this and adjust the other skills\r\nor No if you do not wish to change the priority."),
                        captionText = "Priority Conflict",
                        cbOptionText = "Do not show this dialog again";

                        // Shows the custom dialog box
                        MessageBoxCustom MsgBoxCustom = new MessageBoxCustom();
                        DialogResult drb = MsgBoxCustom.Show(this, text, captionText, cbOptionText, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                        Settings.UI.PlanWindow.PrioritiesMsgBox.ShowDialogBox = MsgBoxCustom.cbUnchecked;

                        // When the checkbox is checked we store the dialog result
                        if (!MsgBoxCustom.cbUnchecked)
                            Settings.UI.PlanWindow.PrioritiesMsgBox.DialogResult = drb;

                        if (drb == DialogResult.Yes)
                            m_plan.SetPriority(m_displayPlan, entries, form.Priority);

                    }
                    // User wishes the dialog not to be displayed and has set the dialog result to "Yes"
                    else if (Settings.UI.PlanWindow.PrioritiesMsgBox.DialogResult == DialogResult.Yes)
                    {
                        m_plan.SetPriority(m_displayPlan, entries, form.Priority);
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Selects the action.
        /// </summary>
        /// <returns></returns>
        internal static Action SelectAction()
        {
            s_msgBox = new MessageBoxCustom();
            s_msgBox.Button1.Click += OnButtonClick;
            s_msgBox.Button2.Click += OnButtonClick;
            s_msgBox.Button3.Click += OnButtonClick;
            s_msgBox.Text = $"{Caption} - Action Selector";
            s_msgBox.Message.Text = @"Select an action for patch file creation.";
            s_msgBox.Button1.Text = @"Datafiles Only";
            s_msgBox.Button2.Text = @"Release Only";
            s_msgBox.Button3.Text = @"Release && Datafiles";
            s_msgBox.Button1.AutoSize = true;
            s_msgBox.Button2.AutoSize = true;
            s_msgBox.Button3.AutoSize = true;
            s_msgBox.PictureBox.Image = SystemIcons.Question.ToBitmap();
            s_msgBox.CheckBox.Visible = false;

            s_msgBox.ShowDialog();

            if (s_action == Action.None)
                ExitRequested = true;

            return s_action;
        }