示例#1
0
        private void buttonModify_Click(object sender, System.EventArgs e)
        {
            string str = (string)listBox1.SelectedItem;

            if (str == null)
            {
                return;
            }
            SwitchManager swm    = ((LevelDoc)DocManager.GetActiveDocument(typeof(LevelDoc))).SwitchManager;
            Switch        sw     = swm[str];
            string        strNew = EditStringForm.DoModal("Modify Switch", "New switch name:", str);

            if (strNew == null)
            {
                return;
            }
            if (strNew != str)
            {
                sw.Name = strNew;
                listBox1.Items.Remove(str);
                int i = listBox1.Items.Add(strNew);
                listBox1.SelectedIndex = i;
                // UNDONE: doc is modified
            }
        }
 public static string DoModal(string strTitle, string strPrompt, string strCurrent)
 {
     EditStringForm frm = new EditStringForm(strTitle, strPrompt, strCurrent);
     DialogResult res = frm.ShowDialog();
     if (res == DialogResult.Cancel)
         return null;
     return frm.textBox1.Text;
 }
        static public string DoModal(string strTitle, string strPrompt, string strCurrent)
        {
            EditStringForm frm = new EditStringForm(strTitle, strPrompt, strCurrent);
            DialogResult   res = frm.ShowDialog();

            if (res == DialogResult.Cancel)
            {
                return(null);
            }
            return(frm.textBox1.Text);
        }
示例#4
0
        private void buttonNew_Click(object sender, System.EventArgs e)
        {
            string str = EditStringForm.DoModal("New Switch", "New switch name:", null);

            if (str != null)
            {
                SwitchManager swm = ((LevelDoc)DocManager.GetActiveDocument(typeof(LevelDoc))).SwitchManager;
                if (swm[str] == null)
                {
                    swm.AddSwitch(new Switch(str));
                    int i = listBox1.Items.Add(str);
                    listBox1.SelectedIndex = i;
                    // UNDONE: doc is modified
                }
            }
        }
示例#5
0
        private void buttonNew_Click(object sender, System.EventArgs e)
        {
            string str = EditStringForm.DoModal("New Counter", "New Counter name:", null);

            if (str != null)
            {
                CounterManager ctrm = ((LevelDoc)DocManager.GetActiveDocument(typeof(LevelDoc))).CounterManager;
                if (ctrm[str] == null)
                {
                    ctrm.AddCounter(new Counter(str));
                    int i = listBox1.Items.Add(str);
                    listBox1.SelectedIndex = i;
                    // UNDONE: doc is modified
                }
            }
        }