void UpdateIssueList() { // Get the time at midnight DateTime Now = DateTime.Now; DateTime Midnight = (Now - Now.TimeOfDay).ToUniversalTime(); // Fetch the new issues IssueListView.BeginUpdate(); IssueListView.Items.Clear(); foreach (IssueData Issue in Issues) { if (FilterProjectName == null || Issue.Project == FilterProjectName) { ListViewItem Item = new ListViewItem(""); Item.SubItems.Add(Issue.Id.ToString()); Item.SubItems.Add(Issue.Project); Item.SubItems.Add(FormatIssueDateTime(Issue.CreatedAt.ToLocalTime(), Midnight)); Item.SubItems.Add(Issue.ResolvedAt.HasValue? FormatIssueDateTime(Issue.ResolvedAt.Value.ToLocalTime(), Midnight) : "Unresolved"); Item.SubItems.Add((Issue.Owner == null)? "-" : Utility.FormatUserName(Issue.Owner)); Item.SubItems.Add(Issue.Summary); Item.Tag = Issue; IssueListView.Items.Add(Item); } } IssueListView.EndUpdate(); // Update the maximum number of results StatusLabel.Text = (IssueListView.Items.Count == Issues.Count)? String.Format("Showing {0} results.", Issues.Count) : String.Format("Showing {0}/{1} results.", IssueListView.Items.Count, Issues.Count); }
void UpdateIssueList() { // Get the time at midnight DateTime Now = DateTime.Now; DateTime Midnight = (Now - Now.TimeOfDay).ToUniversalTime(); // Update the table int ItemIdx = 0; IssueListView.BeginUpdate(); foreach (IssueData Issue in Issues) { if (FilterProjectName == null || Issue.Project == FilterProjectName) { for (;;) { if (ItemIdx == IssueListView.Items.Count) { IssueList_InsertItem(ItemIdx, Issue, Midnight); break; } ListViewItem ExistingItem = IssueListView.Items[ItemIdx]; IssueData ExistingIssue = (IssueData)ExistingItem.Tag; if (ExistingIssue == null || ExistingIssue.Id < Issue.Id) { IssueList_InsertItem(ItemIdx, Issue, Midnight); break; } else if (ExistingIssue.Id == Issue.Id) { IssueList_UpdateItem(ExistingItem, Issue, Midnight); break; } else { IssueListView.Items.RemoveAt(ItemIdx); continue; } } ItemIdx++; } } while (ItemIdx < IssueListView.Items.Count) { IssueListView.Items.RemoveAt(ItemIdx); } IssueListView.EndUpdate(); // Update the maximum number of results StatusLabel.Text = (IssueListView.Items.Count == Issues.Count)? String.Format("Showing {0} results matching project '{1}'.", Issues.Count, FilterProjectName) : String.Format("Showing {0}/{1} results matching project '{2}'.", IssueListView.Items.Count, Issues.Count, FilterProjectName); }
void UpdateIssueList() { // Get the time at midnight DateTime Now = DateTime.Now; DateTime Midnight = (Now - Now.TimeOfDay).ToUniversalTime(); // Get the regex for the selected filter Func <IssueData, bool> Filter; if (String.IsNullOrEmpty(FilterName)) { Filter = x => true; } else if (!CustomFilters.TryGetValue(FilterName, out Filter)) { Filter = x => x.Streams == null || x.Streams.Any(y => String.Equals(y, FilterName, StringComparison.OrdinalIgnoreCase)); } // Update the table int ItemIdx = 0; IssueListView.BeginUpdate(); foreach (IssueData Issue in Issues) { if (Filter(Issue)) { for (;;) { if (ItemIdx == IssueListView.Items.Count) { IssueList_InsertItem(ItemIdx, Issue, Midnight); break; } ListViewItem ExistingItem = IssueListView.Items[ItemIdx]; IssueData ExistingIssue = (IssueData)ExistingItem.Tag; if (ExistingIssue == null || ExistingIssue.Id < Issue.Id) { IssueList_InsertItem(ItemIdx, Issue, Midnight); break; } else if (ExistingIssue.Id == Issue.Id) { IssueList_UpdateItem(ExistingItem, Issue, Midnight); break; } else { IssueListView.Items.RemoveAt(ItemIdx); continue; } } ItemIdx++; } } while (ItemIdx < IssueListView.Items.Count) { IssueListView.Items.RemoveAt(ItemIdx); } IssueListView.EndUpdate(); // Update the maximum number of results string FilterText = ""; if (!String.IsNullOrEmpty(FilterName)) { FilterText = String.Format(" matching filter '{0}'", FilterName); } StatusLabel.Text = (IssueListView.Items.Count == Issues.Count)? String.Format("Showing {0} results{1}.", Issues.Count, FilterText) : String.Format("Showing {0}/{1} results{2}.", IssueListView.Items.Count, Issues.Count, FilterText); }