private void SetComboWidth() { if (comboMinWidthEdit.Value == 0) { MostRecentLB.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); LessRecentLB.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); } else { int width = Math.Max(30, (int)comboMinWidthEdit.Value); MostRecentLB.Columns[0].Width = width; LessRecentLB.Columns[0].Width = width; } }
private void comboMinWidthEdit_ValueChanged(object sender, EventArgs e) { try { MostRecentLB.BeginUpdate(); LessRecentLB.BeginUpdate(); SetComboWidth(); RefreshRepos(); } finally { MostRecentLB.EndUpdate(); LessRecentLB.EndUpdate(); } }
private void RefreshRepos() { Validates.NotNull(_repositoryHistory); MostRecentLB.Items.Clear(); LessRecentLB.Items.Clear(); List <RecentRepoInfo> mostRecentRepos = new(); List <RecentRepoInfo> lessRecentRepos = new(); RecentRepoSplitter splitter = new() { MaxRecentRepositories = (int)_NO_TRANSLATE_maxRecentRepositories.Value, ShorteningStrategy = GetShorteningStrategy(), SortLessRecentRepos = sortLessRecentRepos.Checked, SortMostRecentRepos = sortMostRecentRepos.Checked, RecentReposComboMinWidth = (int)comboMinWidthEdit.Value, MeasureFont = MostRecentLB.Font, Graphics = MostRecentLB.CreateGraphics() }; try { splitter.SplitRecentRepos(_repositoryHistory, mostRecentRepos, lessRecentRepos); } finally { splitter.Graphics.Dispose(); } foreach (var repo in mostRecentRepos) { MostRecentLB.Items.Add(new ListViewItem(repo.Caption) { Tag = repo, ToolTipText = repo.Caption }); } foreach (var repo in lessRecentRepos) { LessRecentLB.Items.Add(new ListViewItem(repo.Caption) { Tag = repo, ToolTipText = repo.Caption }); } }
private void RefreshRepos() { MostRecentLB.Items.Clear(); LessRecentLB.Items.Clear(); List <RecentRepoInfo> mostRecentRepos = new List <RecentRepoInfo>(); List <RecentRepoInfo> lessRecentRepos = new List <RecentRepoInfo>(); RecentRepoSplitter splitter = new RecentRepoSplitter(); splitter.MaxRecentRepositories = (int)_NO_TRANSLATE_maxRecentRepositories.Value; splitter.ShorteningStrategy = GetShorteningStrategy(); splitter.SortLessRecentRepos = sortLessRecentRepos.Checked; splitter.SortMostRecentRepos = sortMostRecentRepos.Checked; splitter.RecentReposComboMinWidth = (int)comboMinWidthEdit.Value; splitter.measureFont = MostRecentLB.Font; splitter.graphics = MostRecentLB.CreateGraphics(); try { splitter.SplitRecentRepos(Repositories.RepositoryHistory.Repositories, mostRecentRepos, lessRecentRepos); } finally { splitter.graphics.Dispose(); } foreach (RecentRepoInfo repo in mostRecentRepos) { MostRecentLB.Items.Add(repo); } foreach (RecentRepoInfo repo in lessRecentRepos) { LessRecentLB.Items.Add(repo); } }