示例#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
            }
        }
示例#2
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
                }
            }
        }
示例#3
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
                }
            }
        }