Example #1
0
 void UpdateFilter(PullRequestState state, [AllowNull] IAccount ass, [AllowNull] IAccount aut)
 {
     if (PullRequests == null)
     {
         return;
     }
     pullRequests.Filter = (pr, i, l) =>
                           (!state.IsOpen.HasValue || state.IsOpen == pr.IsOpen) &&
                           (ass == null || ass.Equals(pr.Assignee)) &&
                           (aut == null || aut.Equals(pr.Author));
 }
        void UpdateFilter(PullRequestState state, IAccount ass, IAccount aut, string filText)
        {
            if (PullRequests == null)
            {
                return;
            }

            var filterTextIsNumber      = false;
            var filterTextIsString      = false;
            var filterPullRequestNumber = 0;

            if (filText != null)
            {
                filText = filText.Trim();

                var hasText = !string.IsNullOrEmpty(filText);

                if (hasText && filText.StartsWith("#", StringComparison.CurrentCultureIgnoreCase))
                {
                    filterTextIsNumber = int.TryParse(filText.Substring(1), out filterPullRequestNumber);
                }
                else
                {
                    filterTextIsNumber = int.TryParse(filText, out filterPullRequestNumber);
                }

                filterTextIsString = hasText && !filterTextIsNumber;
            }

            pullRequests.Filter = (pullRequest, index, list) =>
                                  (!state.IsOpen.HasValue || state.IsOpen == pullRequest.IsOpen) &&
                                  (ass == null || ass.Equals(pullRequest.Assignee)) &&
                                  (aut == null || aut.Equals(pullRequest.Author)) &&
                                  (filterTextIsNumber == false || pullRequest.Number == filterPullRequestNumber) &&
                                  (filterTextIsString == false || pullRequest.Title.ToUpperInvariant().Contains(filText.ToUpperInvariant()));
        }
 void UpdateFilter(PullRequestState state, [AllowNull]IAccount ass, [AllowNull]IAccount aut)
 {
     if (PullRequests == null)
         return;
     pullRequests.Filter = (pr, i, l) =>
         (!state.IsOpen.HasValue || state.IsOpen == pr.IsOpen) &&
              (ass == null || ass.Equals(pr.Assignee)) &&
              (aut == null || aut.Equals(pr.Author));
 }