コード例 #1
0
        private void CreateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem item = sender as ToolStripMenuItem;
                if (item == null)
                {
                    return;
                }
                switch (item.Text)
                {
                case "Description":
                    try
                    {
                        var Subform = new NewDescriptionForm();
                        if (Subform.ShowDialog(this) != DialogResult.OK)
                        {
                            return;
                        }
                        Description.Create(Subform.Root, Subform.Name);
                        OpenDescription(Path.Combine(Subform.Root, Subform.Name, Subform.Name + "." + Description.Extension));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.ToString(), "Can not create description.",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;

                default: ResourceExplorer.CreateResource(Resource.StringToType(item.Text)); break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Error: Can not create resource.",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }