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);
        }
示例#2
0
        private bool PromptCategoryName(List <string> categories, string originalName, out string name)
        {
            using (var dialog = new FormDashboardCategoryTitle(categories, originalName))
            {
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    name = dialog.Category;
                    return(true);
                }

                name = null;
                return(false);
            }
        }
示例#3
0
        private void tsmiCategoryAdd_Click(object sender, EventArgs e)
        {
            RepositoryContextAction((sender as ToolStripMenuItem)?.OwnerItem, repository =>
            {
                using (var dialog = new FormDashboardCategoryTitle(GetCategories()))
                {
                    if (dialog.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }

                    ThreadHelper.JoinableTaskFactory.Run(() => _controller.AssignCategoryAsync(repository, dialog.Category));
                    ShowRecentRepositories();
                }
            });
        }
        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);
        }