Beispiel #1
0
        private void btnRenameCategory_Click(object sender, EventArgs e)
        {
            if (listCategories.SelectedIndex < 0)
            {
                return;
            }

            var newCategory = new NewCategory(DialogAction.Rename, GetCategoryNames());

            newCategory.CategoryName = _categories[listCategories.SelectedIndex].CategoryName;

            newCategory.ShowDialog();
            if (newCategory.DialogResult == DialogResult.OK)
            {
                _categories[listCategories.SelectedIndex].CategoryName = newCategory.CategoryName;

                for (int i = 0; i < _categories[listCategories.SelectedIndex].SaveStates.Count; i++)
                {
                    _categories[listCategories.SelectedIndex].SaveStates[i] = Helper.RenameSave(_categories[listCategories.SelectedIndex].SaveStates[i], newCategory.CategoryName, _categories[listCategories.SelectedIndex].SaveStates[i].SaveStateName);
                }

                BindCategories();
            }
            Helper.WriteSaveInfo(_categories);
        }
Beispiel #2
0
        private void BtnNewCategory_Click(object sender, EventArgs e)
        {
            var newCategory = new NewCategory(DialogAction.New, GetCategoryNames());

            newCategory.ShowDialog();
            if (newCategory.DialogResult == DialogResult.OK)
            {
                var cat = new Category()
                {
                    CategoryName   = newCategory.CategoryName,
                    PositionNumber = _categories.Count,
                    SaveStates     = new List <SaveState>()
                };
                _categories.Add(cat);
                BindCategories();
            }
            Helper.WriteSaveInfo(_categories);
        }