Esempio n. 1
0
        private void NewLayerButton_Click(object sender, System.EventArgs e)
        {
            string name = string.Empty;

            using (LayerEdit edit = new LayerEdit(name))
            {
                DialogResult res = edit.ShowDialog(this);
                if (res == DialogResult.OK)
                {
                    name = edit.LayerName;
                }
                else
                {
                    return;
                }
            }
            GraphLayer newlayer = new GraphLayer(name);

            LayerListItem item = CreateItem(ref newlayer);

            item.Floating = true;             //uncommitted to the graphcontrol until clicked OK or Apply
            listView.Items.Add(item);
            listView.SelectedItems.Clear();
            listView.Items[item.Index].Selected = true;
        }
Esempio n. 2
0
        private void RenameButton_Click(object sender, System.EventArgs e)
        {
            string name;

            if (listView.SelectedItems.Count > 0)
            {
                name = listView.SelectedItems[0].SubItems[0].Text;
                using (LayerEdit edit = new LayerEdit(name))
                {
                    DialogResult res = edit.ShowDialog(this);
                    if (res == DialogResult.OK)
                    {
                        name = edit.LayerName;
                    }
                    else
                    {
                        return;
                    }
                }
                (listView.SelectedItems[0] as LayerListItem).Name = name;
            }
        }