Esempio n. 1
0
        private void mnuPositionAdd_Click(object sender, EventArgs e)
        {
            string name = FrmInput.GetInput("Geben Sie eine Bezeichnung ein:", "Bezeichnung eingeben", null, this);

            if (name != null)
            {
                foreach (ToolStripItem itemOther in mnuPositions.DropDownItems)
                {
                    if (itemOther is ToolStripMenuItem)
                    {
                        if ((itemOther as ToolStripMenuItem).Checked)
                        {
                            (itemOther as ToolStripMenuItem).Checked = false;
                            break;
                        }
                    }
                }

                ConfigPosition loc = new ConfigPosition(name, Left, Top);
                CurrentConfig.Positions.Add(loc);
                CurrentConfig.Save();

                ToolStripMenuItem item = new ToolStripMenuItem(name);
                item.Click  += mnuPositions_Click;
                item.Tag     = loc;
                item.Checked = true;
                mnuPositions.DropDownItems.Add(item);

                mnuPositionSave.Tag = item;
            }
        }
Esempio n. 2
0
        public static string GetInput(string text, string title, string defaultValue = null, Form parent = null)
        {
            FrmInput frm = new FrmInput(text, title, defaultValue);

            if (frm.ShowDialog(parent) == DialogResult.OK)
            {
                return(frm.Value);
            }

            return(null);
        }