Пример #1
0
        private void newCategoryMenuItem_Click(object sender, EventArgs e)
        {
            var toolStripItem = sender as ToolStripItem;

            if (toolStripItem == null)
                return;

            var repository = toolStripItem.Tag as Repository;

            if (repository == null)
                return;

            var formDashboardCategoryTitle = new FormDashboardCategoryTitle();
            formDashboardCategoryTitle.ShowDialog(this);

            if (string.IsNullOrEmpty(formDashboardCategoryTitle.GetTitle()))
                return;

            var newRepositoryCategory = new RepositoryCategory(formDashboardCategoryTitle.GetTitle());

            RepositoryCategory.RemoveRepository(repository);
            repository.RepositoryType = RepositoryType.Repository;
            newRepositoryCategory.AddRepository(repository);

            Repositories.RepositoryCategories.Add(newRepositoryCategory);

            dashboardCategoryChanged(this, null);
        }
        private void newCategoryMenuItem_Click(object sender, EventArgs e)
        {
            if (repository == null)
                return;

            RepositoryCategory newRepositoryCategory;

            using (var formDashboardCategoryTitle = new FormDashboardCategoryTitle())
            {
                formDashboardCategoryTitle.ShowDialog(this);

                if (string.IsNullOrEmpty(formDashboardCategoryTitle.GetTitle()))
                    return;

                newRepositoryCategory = new RepositoryCategory(formDashboardCategoryTitle.GetTitle());
            }

            RepositoryCategory.RemoveRepository(repository);
            repository.RepositoryType = RepositoryType.Repository;
            newRepositoryCategory.AddRepository(repository);

            Repositories.RepositoryCategories.Add(newRepositoryCategory);

            dashboardCategoryChanged(this, null);
        }