예제 #1
0
파일: MainForm.cs 프로젝트: gitfunk/7thSea
        private void renameCategoryButton_Click(object sender, EventArgs e)
        {
            ListItemWithId category = (ListItemWithId)categorySelector.Items[categorySelector.SelectedIndex];

            UserInputDialog dialog = new UserInputDialog();
            dialog.Text = "Rename " + category.Text;
            dialog.CaptionText = "Enter new name for " + category.Text;
            dialog.InputText = category.Text;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string newCategoryName = dialog.InputText;

                database.RenameCategory(category.Id, newCategoryName);
                categorySelector.Items[categorySelector.SelectedIndex] = new ListItemWithId(newCategoryName, category.Id);
            }
        }
예제 #2
0
파일: MainForm.cs 프로젝트: gitfunk/7thSea
        private void newCategoryButton_Click(object sender, EventArgs e)
        {
            UserInputDialog dialog = new UserInputDialog();
            dialog.Text = "New Category";
            dialog.CaptionText = "Enter name for new category";

            if (dialog.ShowDialog() == DialogResult.OK)
                CreateNewCategory(dialog.InputText);
        }