示例#1
0
            void entry_DialogEntryChanged(object sender, EntryEventArgs e)
            {
                if (callback != null && e != null && e.Entry != null)
                {
                    try
                    {
                        DialogEntryStatus status = e.Entry.Status;
                        if (status != lastStatus)
                        {
                            if (status.HasFlag(DialogEntryStatus.Disabled))
                            {
                                return;
                            }

                            // activation
                            if (status.HasFlag(DialogEntryStatus.Activated) && !lastStatus.HasFlag(DialogEntryStatus.Activated))
                            {
                                callback(e.Entry);
                            }
                            // checked
                            else if (status.HasFlag(DialogEntryStatus.Checked) && !lastStatus.HasFlag(DialogEntryStatus.Checked))
                            {
                                callback(e.Entry);
                            }
                        }
                    }
                    catch (Exception) { }
                }
            }
 /// <summary>
 /// Handles the minimization. Depending on new and current status.
 /// </summary>
 /// <param name="oldStatus">The old status.</param>
 /// <param name="newStatus">The new status.</param>
 internal void handleMinimization(DialogEntryStatus oldStatus, DialogEntryStatus newStatus)
 {
     if (oldStatus != null && newStatus != null && MinimizeType != null && IsMinimized != null)
     {
         if (MinimizeType == MinimizeTypes.AutoSelectionMinimize)
         {
             //Not selected, will be selected
             if (!oldStatus.HasFlag(DialogEntryStatus.Selected) && newStatus.HasFlag(DialogEntryStatus.Selected))
             {
                 if (MinimizeType == MinimizeTypes.AutoSelectionMinimize && IsMinimized)
                 {
                     IsMinimized = false;
                 }
             }
             //Selected, will be unselected
             else if (oldStatus.HasFlag(DialogEntryStatus.Selected) && !newStatus.HasFlag(DialogEntryStatus.Selected))
             {
                 if (MinimizeType != MinimizeTypes.NeverMinimize && !IsMinimized)
                 {
                     IsMinimized = true;
                 }
             }
         }
         else if (MinimizeType == MinimizeTypes.AutoActivationMinimize)
         {
             //Not editing, will be editing
             if (!oldStatus.HasFlag(DialogEntryStatus.Editing) && newStatus.HasFlag(DialogEntryStatus.Editing))
             {
                 if (MinimizeType == MinimizeTypes.AutoActivationMinimize && IsMinimized)
                 {
                     IsMinimized = false;
                 }
             }
             //Editing, will be not editing
             else if (oldStatus.HasFlag(DialogEntryStatus.Editing) && !newStatus.HasFlag(DialogEntryStatus.Editing))
             {
                 if (MinimizeType == MinimizeTypes.AutoActivationMinimize && !IsMinimized)
                 {
                     IsMinimized = true;
                 }
             }
         }
     }
 }
 /*Seperate function to handle mode changes depending on prior and current status: Abort, Start, Finish*/
 private void handleModeChanges(DialogEntryStatus status)
 {
     if (Status != null && status != null && InputBox != null && InputBox.BoxHeightType != null && InputBox.BoxHeightType != BoxHeightTypes.Unknown)
     {
         if (!Status.HasFlag(DialogEntryStatus.Editing) && status.HasFlag(DialogEntryStatus.Selected) && status.HasFlag(DialogEntryStatus.Editing))
         {
             modeInput(ModeTypes.Start);
         }
         else if (status.HasFlag(DialogEntryStatus.Aborting))
         {
             modeInput(ModeTypes.Abort);
         }
         else if (Status.HasFlag(DialogEntryStatus.Editing) && Status.HasFlag(DialogEntryStatus.Selected) && !status.HasFlag(DialogEntryStatus.Selected) && !status.HasFlag(DialogEntryStatus.Editing))
         {
             modeInput(ModeTypes.Abort);
         }
         else if (Status.HasFlag(DialogEntryStatus.Editing) && Status.HasFlag(DialogEntryStatus.Selected) && status.HasFlag(DialogEntryStatus.Selected) && !status.HasFlag(DialogEntryStatus.Editing))
         {
             modeInput(ModeTypes.Finish);
         }
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DialogEntry_ToolStripMenuItem"/> class.
        /// </summary>
        /// <param name="dlgEntry">The dialog entry.</param>
        public DialogEntry_ToolStripMenuItem(DialogEntry dlgEntry) : base(dlgEntry)
        {
            Type = dlgEntry.Type;
            this.CheckOnClick = true;

            //Check for Types & Status, some coloring to differentiate between types for now

            switch (Type)
            {
            case DialogEntryType.Activation:
                break;

            case DialogEntryType.Button:
                this.Text         = "btn:: " + this.Text;
                this.CheckOnClick = false;
                break;

            case DialogEntryType.Checkbox:
                this.Text = "[] " + this.Text;
                break;

            case DialogEntryType.EditField:

                EditField_DialogEntry efield = (EditField_DialogEntry)dlgEntry;
                if (efield.HasLabel)
                {
                    if (efield.InputBox != null && !efield.InputBox.IsGraphical)
                    {
                        this.Text = efield.Label + this.Text;
                    }
                    else
                    {
                        this.Text = "ef:: " + efield.Label + this.Text;
                    }
                }
                else
                {
                    this.Text = "ef:: " + this.Text;
                }
                this.CheckOnClick = false;
                this.Enabled      = false;

                break;

            case DialogEntryType.Group:
                this.CheckOnClick = false;
                this.Font         = new System.Drawing.Font(this.Font, System.Drawing.FontStyle.Bold);
                break;

            case DialogEntryType.EditField_Label:
                this.CheckOnClick = false;
                this.Enabled      = false;
                this.Font         = new System.Drawing.Font(this.Font, System.Drawing.FontStyle.Italic);
                break;

            case DialogEntryType.Label:
                this.CheckOnClick = false;
                this.Enabled      = false;
                break;

            case DialogEntryType.RadioButton:
                this.Text = "() " + this.Text;
                break;

            case DialogEntryType.Unknown:
                break;

            default: break;
            }

            DialogEntryStatus itemStatus = dlgEntry.Status;

            if (itemStatus.HasFlag(DialogEntryStatus.Checked))
            {
                this.Checked = true;
            }

            if (itemStatus.HasFlag(DialogEntryStatus.Disabled))
            {
                this.Enabled = false;
                this.Text    = "xx" + this.Text;
            }

            dlgEntry.DialogEntryChanged += d_EntryChanged;
        }