public DashboardCategory(string title, RepositoryCategory repositoryCategory) { InitializeComponent(); SetUpFonts(); Translate(); Title = title; RepositoryCategory = repositoryCategory; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
public void ShowRecentRepositories() { if (!Visible) { return; } // Make sure the dashboard is only initialized once if (!initialized) { // Remove favorites var categories = (from DashboardCategory i in this.groupLayoutPanel.Controls select i).ToList(); this.groupLayoutPanel.Controls.Clear(); foreach (var category in categories) { category.DashboardCategoryChanged -= dashboardCategory_DashboardCategoryChanged; category.DashboardItemClick -= dashboardItem_Click; category.Clear(); } // Show favorites foreach (var category in Repositories.RepositoryCategories) { AddDashboardEntry(category); } initialized = true; } splitContainer7.Panel1MinSize = 1; splitContainer7.Panel2MinSize = 1; splitContainer7.SplitterDistance = Math.Max(2, splitContainer7.Height - (DonateCategory.Height + 25)); RecentRepositories.Clear(); RepositoryCategory filteredRecentRepositoryHistory = new RepositoryCategory(); filteredRecentRepositoryHistory.Description = Repositories.RepositoryHistory.Description; filteredRecentRepositoryHistory.CategoryType = Repositories.RepositoryHistory.CategoryType; foreach (Repository repository in Repositories.RepositoryHistory.Repositories) { if (!Repositories.RepositoryCategories.Any(c => c.Repositories.Any(r => r.Path != null && r.Path.Equals(repository.Path, StringComparison.CurrentCultureIgnoreCase)))) { repository.RepositoryType = RepositoryType.History; filteredRecentRepositoryHistory.Repositories.Add(repository); } } RecentRepositories.RepositoryCategory = filteredRecentRepositoryHistory; pictureBox1.BringToFront(); }
private void AddDashboardEntry(RepositoryCategory entry) { var dashboardCategory = new DashboardCategory(entry.Description, entry); this.groupLayoutPanel.Controls.Add(dashboardCategory); dashboardCategory.DashboardItemClick += dashboardItem_Click; dashboardCategory.DashboardCategoryChanged += dashboardCategory_DashboardCategoryChanged; }
public void ShowRecentRepositories() { if (!Visible) { return; } //Make sure the dashboard is only initialized once if (!initialized) { //Remove favourites for (int i = splitContainer5.Panel2.Controls.Count; i > 0; i--) { DashboardCategory dashboarCategory = splitContainer5.Panel2.Controls[i - 1] as DashboardCategory; if (dashboarCategory != null) { dashboarCategory.DashboardCategoryChanged -= dashboardCategory_DashboardCategoryChanged; dashboarCategory.DashboardItemClick -= dashboardItem_Click; dashboarCategory.Clear(); splitContainer5.Panel2.Controls.RemoveAt(i - 1); } } //Show favourites Repositories.RepositoryCategories.Aggregate(0, AddDashboardEntry); initialized = true; } splitContainer7.Panel1MinSize = 1; splitContainer7.Panel2MinSize = 1; splitContainer7.SplitterDistance = Math.Max(2, splitContainer7.Height - (DonateCategory.Height + 25)); //Resize favourites for (int i = splitContainer5.Panel2.Controls.Count; i > 0; i--) { DashboardCategory dashboarCategory = splitContainer5.Panel2.Controls[i - 1] as DashboardCategory; if (dashboarCategory != null) { dashboarCategory.Width = splitContainer5.Panel2.Width; } } RecentRepositories.Clear(); RepositoryCategory filteredRecentRepositoryHistory = new RepositoryCategory(); filteredRecentRepositoryHistory.Description = Repositories.RepositoryHistory.Description; filteredRecentRepositoryHistory.CategoryType = Repositories.RepositoryHistory.CategoryType; foreach (Repository repository in Repositories.RepositoryHistory.Repositories) { if (!Repositories.RepositoryCategories.Any(c => c.Repositories.Any(r => r.Path != null && r.Path.Equals(repository.Path, StringComparison.CurrentCultureIgnoreCase)))) { repository.RepositoryType = RepositoryType.History; filteredRecentRepositoryHistory.Repositories.Add(repository); } } RecentRepositories.RepositoryCategory = filteredRecentRepositoryHistory; pictureBox1.BringToFront(); }
private int AddDashboardEntry(int y, RepositoryCategory entry) { var dashboardCategory = new DashboardCategory(entry.Description, entry) { Location = new Point(0, y), Width = splitContainer5.Panel2.Width }; splitContainer5.Panel2.Controls.Add(dashboardCategory); dashboardCategory.BringToFront(); y += dashboardCategory.Height; dashboardCategory.DashboardItemClick += dashboardItem_Click; dashboardCategory.DashboardCategoryChanged += dashboardCategory_DashboardCategoryChanged; return y; }
private void Add_Click(object sender, EventArgs e) { var category = new RepositoryCategory("new"); Repositories.RepositoryCategories.Add(category); Categories_SelectedIndexChanged(null, null); }
public DashboardCategory(string title, RepositoryCategory repositoryCategory) : this() { Title = title; RepositoryCategory = repositoryCategory; }
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); }