/// <summary>
        /// Initializes a new instance of the <see cref="EditField_DialogEntry"/> class.
        /// </summary>
        /// <param name="ID">The identifier.</param>
        /// <param name="text">The text.</param>
        /// <param name="inputM">The input m.</param>
        /// <param name="eventM">The event m.</param>
        /// <param name="validator">The validator.</param>
        /// <param name="help">The help.</param>
        /// <param name="parentEntry">The parent entry.</param>
        /// <param name="parentDialog">The parent dialog.</param>
        /// <param name="status">The status.</param>
        /// <param name="minimizeType">Type of the minimize.</param>
        /// <param name="boxHeightType">Type of the box height.</param>
        public EditField_DialogEntry(
            string ID,
            string text,
            IEditField_InputManager inputM,
            IEditField_EventManager eventM,
            IEditField_Validator validator,
            string help                  = "...",
            DialogEntry parentEntry      = null,
            Dialog parentDialog          = null,
            DialogEntryStatus status     = DialogEntryStatus.Unknown,
            MinimizeTypes minimizeType   = MinimizeTypes.Unknown,
            BoxHeightTypes boxHeightType = BoxHeightTypes.Unknown,
            Boolean isGraphical          = true
            )
            : base(ID, text, help, DialogEntryType.EditField, status, parentEntry, parentDialog)
        {
            InputManager = inputM;

            InputBox = new EditField_InputBox(minimizeType, boxHeightType, isGraphical);

            EventManager = eventM;

            if (!validateForSpaces(Title))
            {
                Title = "";
            }

            Validator = validator;
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a new child to the list of children.
        /// </summary>
        /// <param name="entry">The new child entry.</param>
        /// <returns><c>true</c> if the entry was added successfully; otherwise <c>false</c>.</returns>
        public bool AddToGroupList(DialogEntry entry)
        {
            if (entry != null)
            {
                var entryStat = entry.Status;

                lock (SyncLock)
                {
                    try
                    {
                        if (ChildEntries.Contains(entry))
                        {
                            return(false);
                        }

                        ChildEntries.Add(entry);
                        registerToEvents(entry);
                        entry.ParentEntry  = this;
                        entry.ParentDialog = ParentDialog;
                    }
                    catch { }
                }

                // reset and set again to use the (entry)internal logic for the status.
                entry.Status = DialogEntryStatus.Normal;
                entry.Status = entryStat;
                fire_DialogEntryChanged("ChildEntries");
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EditField_DialogEntry" /> class.
        /// </summary>
        /// <param name="ID">The identifier.</param>
        /// <param name="text">The text.</param>
        /// <param name="help">The help.</param>
        /// <param name="parentEntry">The parent entry.</param>
        /// <param name="parentDialog">The parent dialog.</param>
        /// <param name="status">The status.</param>
        /// <param name="minimizeType">Type of the minimize.</param>
        /// <param name="boxHeightType">Type of the box height.</param>
        /// <param name="maxTextLength">Maximum length of the text.</param>
        /// <param name="characterRestriction">The character restriction.</param>
        /// <param name="directValidation">if set to <c>true</c> field will be validated directly. if <c>false</c> only when saved. Manual validation is needed!.</param>
        public EditField_DialogEntry(
            string ID,
            string text,
            string help                  = "...",
            DialogEntry parentEntry      = null,
            Dialog parentDialog          = null,
            DialogEntryStatus status     = DialogEntryStatus.Unknown,
            MinimizeTypes minimizeType   = MinimizeTypes.Unknown,
            BoxHeightTypes boxHeightType = BoxHeightTypes.Unknown,
            Boolean isGraphical          = true,
            int maxTextLength            = 20,
            InputRestrictionTypes characterRestriction = InputRestrictionTypes.Unrestricted,
            Boolean directValidation = true
            )
            : base(ID, text, help, DialogEntryType.EditField, status, parentEntry, parentDialog)
        {
            InputBox = new EditField_InputBox(minimizeType, boxHeightType, isGraphical);

            EventManager = new EditField_EventManager();

            if (!validateForSpaces(Title))
            {
                Title = "";
            }
            InputManager = new EditField_InputManager(Title);

            Validator = new EditField_Validator(maxTextLength, characterRestriction, directValidation);
        }
Esempio n. 4
0
 /// <summary>
 /// Registers to events of an child entry.
 /// </summary>
 /// <param name="entry">The entry.</param>
 protected virtual void registerToEvents(DialogEntry entry)
 {
     if (entry != null)
     {
         unregisterFromEvents(entry);
         entry.DialogEntryChanged += entry_DialogEntryChanged;
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DialogEntry"/> class.
        /// </summary>
        /// <param name="dialogEntry">The dialog entry.</param>
        public SelfRenderingDialogEntry(DialogEntry dialogEntry) : base(dialogEntry)
        {
            Renderer.Entry = this;

            if (dialogEntry.Type == DialogEntryType.EditField)
            {
                Renderer = new EditFieldRenderer();
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Unregisters from events of an child entry.
 /// </summary>
 /// <param name="entry">The entry.</param>
 protected virtual void unregisterFromEvents(DialogEntry entry)
 {
     if (entry != null)
     {
         try
         {
             entry.DialogEntryChanged -= entry_DialogEntryChanged;
         }
         catch { }
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Registers the activation callback function to a specific entry.
        /// </summary>
        /// <param name="entry">The entry to observe for activation.</param>
        /// <param name="callback">The callback function to call after activation.</param>
        /// <returns><c>true</c> if the callback could be registered; otherwise, <c>false</c>.</returns>
        public static bool RegisterActivationCallbackToEntry(DialogEntry entry, EntryActivation callback)
        {
            bool success = false;

            if (entry != null && callback != null)
            {
                _callbackForwarderList.Add(new EntryCallbackSender(entry, callback));
                return(true);
            }
            return(success);
        }
Esempio n. 8
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing,
 /// releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     // clean up references
     entry    = null;
     callback = null;
     unregisterToEvents();
     try
     {
         _callbackForwarderList.Remove(this);
     }
     catch { }
 }
Esempio n. 9
0
 protected virtual void handleChildChildEntrieEvent(DialogEntry dialogEntry)
 {
     if (dialogEntry != null)
     {
         var children = dialogEntry.GetChildEntryList();
         if (children != null && children.Count > 0)
         {
             foreach (var item in children)
             {
                 registerToEvents(item as DialogEntry);
             }
         }
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RadioButton_DialogEntry" /> class.
 /// </summary>
 /// <param name="ID">The unique identifier.</param>
 /// <param name="text">The text that is displayed.</param>
 /// <param name="help">The help text explaining the functionality behind this entry.</param>
 /// <param name="parentEntry">The parent entry (must be some kind of group type).</param>
 /// <param name="parentDialog">The parent dialog this entry is related to. Can be <c>null</c> - when added to a Dialog this Field will be set automatically.</param>
 /// <param name="children">The children to add to the group.</param>
 public Group_DialogEntry(
     string ID,
     string text,
     string help                      = "...",
     DialogEntry parentEntry          = null,
     Dialog parentDialog              = null,
     List <IDialogComponent> children = null
     )
     : base(ID, text, help, DialogEntryType.Group, DialogEntryStatus.Normal, parentEntry, parentDialog)
 {
     if (children != null)
     {
         ChildEntries.AddRange(children);
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DialogEntry"/> class.
        /// </summary>
        /// <param name="dialogEntry">The dialog entry.</param>
        public DialogEntry(DialogEntry dialogEntry)
        {
            this._id          = dialogEntry.ID;
            this._title       = dialogEntry.Title;
            this._help        = dialogEntry.Help;
            this._type        = dialogEntry.Type;
            this.ParentEntry  = dialogEntry.ParentEntry;
            this.ParentDialog = dialogEntry.ParentDialog;

            this.Status = dialogEntry.Status;

            if (Type == DialogEntryType.Group)
            {
                childEntries = dialogEntry.GetChildEntryList();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DialogEntry" /> class.
        /// </summary>
        /// <param name="ID">The unique identifier.</param>
        /// <param name="text">The text that is displayed.</param>
        /// <param name="help">The help text explaining the functionality behind this entry.</param>
        /// <param name="type">The type defining its behavior.</param>
        /// <param name="status">The initial status.</param>
        /// <param name="parentEntry">The parent entry (must be some kind of group type).</param>
        /// <param name="parentDialog">The parent dialog this entry is related to. Can be <c>null</c> - when added to a Dialog this Field will be set automatically.</param>
        public SelfRenderingDialogEntry(
            string ID,
            string text,
            string help              = "...",
            DialogEntryType type     = DialogEntryType.Activation,
            DialogEntryStatus status = DialogEntryStatus.Normal,
            DialogEntry parentEntry  = null,
            Dialog parentDialog      = null)
            : base(ID, text, help, type, status, parentEntry, parentDialog)
        {
            Renderer.Entry = this;

            if (type == DialogEntryType.EditField)
            {
                Renderer = new EditFieldRenderer();
            }
        }
Esempio n. 13
0
        public Question_Dialog(
            string title,
            string id,
            DialogType type          = DialogType.Question,
            string question          = "",
            QuestionDialogType qType = QuestionDialogType.Unknown,
            bool isActivated         = false,
            Dialog parentDialog      = null)
            : base(title, id, type, isActivated, parentDialog)
        {
            Question = new SelfRenderingDialogEntry(id + "_Question", ll.GetTrans("question.qType." + qType.ToString()) + ": " + question, ll.GetTrans("question.question.help.question"), DialogEntryType.Label);

            QuestionType = qType;

            setQuestionDialogEntryTypes(qType);
            addQuestionDialogEntries(id);
        }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogEntry" /> class.
 /// </summary>
 /// <param name="ID">The unique identifier.</param>
 /// <param name="text">The text that is displayed.</param>
 /// <param name="help">The help text explaining the functionality behind this entry.</param>
 /// <param name="type">The type defining its behavior.</param>
 /// <param name="status">The initial status.</param>
 /// <param name="parentEntry">The parent entry (must be some kind of group type).</param>
 /// <param name="parentDialog">The parent dialog this entry is related to. Can be <c>null</c> - when added to a Dialog this Field will be set automatically.</param>
 public DialogEntry(
     string ID,
     string text,
     string help              = "...",
     DialogEntryType type     = DialogEntryType.Activation,
     DialogEntryStatus status = DialogEntryStatus.Normal,
     DialogEntry parentEntry  = null,
     Dialog parentDialog      = null)
 {
     this._id          = ID;
     this._title       = text;
     this._help        = help;
     this.ParentEntry  = parentEntry;
     this.ParentDialog = parentDialog;
     this.Type         = type;
     this.Status       = status;
 }
        /// <summary>
        /// Löst das <see cref="E:System.Windows.Forms.ToolStripItem.Click" />-Ereignis aus.
        /// </summary>
        /// <param name="e">Ein <see cref="T:System.EventArgs" />, das die Ereignisdaten enthält.</param>
        protected override void OnClick(EventArgs e)
        {
            if (e != null)
            {
                base.OnClick(e);
                if (this.ClassType == DialogClassType.DialogEntry)
                {
                    if (dialogEntryItem != null && dialogEntryItem.ParentDialog != null)
                    {
                        Dialog parent = dialogEntryItem.ParentDialog;

                        if (parent.GetActiveDialog() != null)
                        {
                            Dialog      ActiveDialog  = parent.GetActiveDialog();
                            DialogEntry SelectedEntry = ActiveDialog.SelectedEntry;

                            parent.FocusOn();
                            parent.SelectEntry(dialogEntryItem);
                            parent.ActivateSelectedEntry();

                            /*If the Dialog is not following, the prior selected entry and active dialog will be restored*/
                            if (!AutoFollow)
                            {
                                //causes activateActivation to get wrong ActiveDialog && wrong switch case is chosen
                                // ActiveDialog.FocusOn();
                                // if(SelectedEntry != null)
                                //   ActiveDialog.SelectEntry(SelectedEntry);
                            }
                        }
                    }
                }
                else if (this.ClassType == DialogClassType.Dialog)
                {
                    if (dialogItem != null && AutoFollow)
                    {
                        if (this.DropDownItems != null && this.DropDownItems.Count != null && this.DropDownItems.Count > 0)
                        {
                            /*Dialog position should follow the navigation through the D2F structure*/
                            dialogItem.FocusOn();
                        }
                    }
                }
                fire_OnClickEvent();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DialogToolStripMenuItem"/> class.
        /// </summary>
        /// <param name="dlgEntry">The dialog entry.</param>
        public DialogToolStripMenuItem(DialogEntry dlgEntry)
            : base(dlgEntry.Title)
        {
            dialogEntryItem = dlgEntry;
            ID               = dlgEntry.ID;
            ClassType        = DialogClassType.DialogEntry;
            this.ToolTipText = dlgEntry.Help;
            AutoFollow       = false;
            ToolTipText      = dlgEntry.Help;

            if (dlgEntry.HasSubmenu())
            {
                Hierarchy = DialogToolStripHierarchy.Node;
            }
            else
            {
                Hierarchy = DialogToolStripHierarchy.Leaf;
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Removes an child from the list.
 /// </summary>
 /// <param name="entry">The entry to remove.</param>
 /// <returns><c>true</c> if the child entry could be removed; otherwise <c>false</c>.</returns>
 public bool RemoveFromGroupList(DialogEntry entry)
 {
     if (entry != null)
     {
         bool success;
         lock (SyncLock)
         {
             success = ChildEntries.Remove(entry);
             if (success)
             {
                 entry.ParentEntry = null;
                 fire_DialogEntryChanged("ChildEntries");
             }
         }
         return(success);
     }
     else
     {
         return(false);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="EditField_DialogEntry"/> class.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <param name="minimizeType">Type of the minimize.</param>
        /// <param name="boxHeightType">Type of the box height.</param>
        /// <param name="maxTextLength">Maximum length of the text.</param>
        /// <param name="characterRestriction">The character restriction.</param>
        /// <param name="directValidation">if set to <c>true</c> field will be validated directly. if <c>false</c> only when saved. Manual validation is needed!.</param>
        public EditField_DialogEntry(
            DialogEntry entry,
            MinimizeTypes minimizeType   = MinimizeTypes.Unknown,
            BoxHeightTypes boxHeightType = BoxHeightTypes.Unknown,
            Boolean isGraphical          = true,
            int maxTextLength            = 20,
            InputRestrictionTypes characterRestriction = InputRestrictionTypes.Unrestricted,
            Boolean directValidation = true)
            : base(entry.ID, entry.Title, entry.Help, DialogEntryType.EditField, entry.Status, entry.ParentEntry, entry.ParentDialog)
        {
            InputBox = new EditField_InputBox(minimizeType, boxHeightType, isGraphical);

            EventManager = new EditField_EventManager();

            if (!validateForSpaces(Title))
            {
                Title = "";
            }
            InputManager = new EditField_InputManager(Title);

            Validator = new EditField_Validator(maxTextLength, characterRestriction, directValidation);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EditField_DialogEntry" /> class.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <param name="inputM">The input m.</param>
        /// <param name="eventM">The event m.</param>
        /// <param name="validator">The validator.</param>
        /// <param name="minimizeType">Type of the minimize.</param>
        /// <param name="boxHeightType">Type of the box height.</param>
        public EditField_DialogEntry(
            DialogEntry entry,
            IEditField_InputManager inputM,
            IEditField_EventManager eventM,
            IEditField_Validator validator,
            MinimizeTypes minimizeType   = MinimizeTypes.Unknown,
            BoxHeightTypes boxHeightType = BoxHeightTypes.Unknown,
            Boolean isGraphical          = true)
            : base(entry.ID, entry.Title, entry.Help, DialogEntryType.EditField, entry.Status, entry.ParentEntry, entry.ParentDialog)
        {
            InputManager = inputM;

            InputBox = new EditField_InputBox(minimizeType, boxHeightType, isGraphical);

            EventManager = eventM;

            if (!validateForSpaces(Title))
            {
                Title = "";
            }

            Validator = validator;
        }
Esempio n. 20
0
 /// <summary>
 /// Check recursively if the identifier is unique inside the dialog and the parent group if set.
 /// The id will be extended with '*'.
 /// </summary>
 /// <param name="id">The original identifier.</param>
 /// <param name="parent">The parent group.</param>
 /// <param name="dialog">The dialog.</param>
 /// <returns>An more unique identifier.</returns>
 private static string check4uniqueID(String id, DialogEntry parent, Dialog dialog)
 {
     if (dialog != null)
     {
         while (!dialog.IsUniqueID(id))
         {
             id += "*";
         }
     }
     if (parent != null && parent.HasChildren())
     {
         foreach (var item in parent.GetChildEntryList())
         {
             if (item != null && item.ID.Equals(id))
             {
                 id += "*";
                 id  = check4uniqueID(id, parent, dialog);
                 return(id);
             }
         }
     }
     return(id);
 }
Esempio n. 21
0
        /// <summary>
        /// Builds a specialized dialog entry, based on the given <see cref="DialogEntryType"/>.
        /// </summary>
        /// <param name="type">The type of the entry.</param>
        /// <param name="id">The unique identifier.
        /// If an <see cref="Dialog"/> was set, the id is checked and adapted
        /// to be unique. So check after returning the element if you are
        /// not 100% sure that the id is unique.</param>
        /// <param name="title">The title of the entry (text that is displayed).</param>
        /// <param name="help">The help text for the entry. Giving details about the function or the behavior of the entry.</param>
        /// <param name="status">The initial status of the entry.</param>
        /// <param name="parent">The parent group if exist.</param>
        /// <param name="dialog">The dialog this entry should bee added.</param>
        /// <param name="callback">The callback function to call after activation.</param>
        /// <returns>An specialized <see cref="DialogEntryType"/>.</returns>
        public static DialogEntry BuildDialogEntry(
            DialogEntryType type,
            String id,
            String title,
            String help = "...",
            DialogEntryStatus status = DialogEntryStatus.Normal,
            DialogEntry parent       = null,
            Dialog dialog            = null,
            EntryActivation callback = null
            )
        {
            DialogEntry entry = null;

            if (dialog == null && parent != null && parent.ParentDialog != null)
            {
                dialog = parent.ParentDialog;
            }

            id = check4uniqueID(id, parent, dialog);

            switch (type)
            {
            //case DialogEntryType.Unknown:
            //    break;
            //case DialogEntryType.Activation:
            //    break;
            //case DialogEntryType.Submenu:
            //    break;
            case DialogEntryType.Group:
                entry = new Group_DialogEntry(id, title, help, parent, dialog);
                break;

            //case DialogEntryType.Checkbox:
            //    break;
            case DialogEntryType.RadioButton:
                entry = new RadioButton_DialogEntry(id, title, help, status, parent, dialog);
                break;

            //case DialogEntryType.Button:
            //    break;
            //case DialogEntryType.EditField:
            //    break;
            default:
                entry = new SelfRenderingDialogEntry(id, title, help, type, status, parent, dialog);
                break;
            }

            if (entry == null)
            {
                return(null);
            }

            RegisterActivationCallbackToEntry(entry, callback);

            // parent handling
            if (parent != null)
            {
                parent.AddChild(entry);
            }

            return(entry);
        }
Esempio n. 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EntryCallbackSender"/> class.
 /// </summary>
 /// <param name="_entry">The entry to observe for activation.</param>
 /// <param name="_callback">The callback function to call after activation.</param>
 public EntryCallbackSender(DialogEntry _entry, EntryActivation _callback)
 {
     entry    = _entry;
     callback = _callback;
     registerToEvents();
 }
        /// <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;
        }
Esempio n. 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogEntyEventArgs" /> class.
 /// </summary>
 /// <param name="entry">The related entry.</param>
 /// <param name="propertyName">Name of the property that was changed.</param>
 public DetailedEntryChangedEventArgs(DialogEntry entry, string propertyName = "")
     : base(entry)
 {
     ChangedProperty = propertyName;
 }