Ejemplo n.º 1
0
        private void terrainOfProjectTreeView_ContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.ToString())
            {
            case "更改":
                //单击右键菜单的更改后,右键菜单便消失
                terrainOfProjectTreeView_ContextMenuStrip.Hide();
                //执行更改操作
                AddTerrainWindow w = new AddTerrainWindow();
                w.Show();
                break;

            case "删除":
                terrainOfProjectTreeView_ContextMenuStrip.Hide();
                //执行删除操作
                DialogResult result = MessageBox.Show("您确定要删除原来添加的地形吗?删除将不可恢复!", "提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (result == DialogResult.OK)
                {
                    string nodeNamesStr = FileOperation.ReadFile(MainWindow.nodeInfoFullPath);
                    if (!TerrainOperation.DeleteTerrain(nodeNamesStr))
                    {
                        MessageBox.Show("对不起,发生错误,删除失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 private void NewTerrain_ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     f8 = OpenNewForm <AddTerrainWindow>(f8);
 }