private MergeRequest getMergeRequest(MergeRequestListView proposedListView)
        {
            MergeRequestListView listView = proposedListView ?? getListView(getCurrentTabDataCacheType());
            FullMergeRequestKey? fmk      = listView.GetSelectedMergeRequest();

            return(fmk.HasValue ? fmk.Value.MergeRequest : null);
        }
        private MergeRequestKey?getMergeRequestKey(MergeRequestListView proposedListView)
        {
            MergeRequestListView listView = proposedListView ?? getListView(getCurrentTabDataCacheType());
            FullMergeRequestKey? fmk      = listView.GetSelectedMergeRequest();

            return(fmk.HasValue && fmk.Value.MergeRequest != null
            ? new MergeRequestKey(fmk.Value.ProjectKey, fmk.Value.MergeRequest.IId)
            : new Nullable <MergeRequestKey>());
        }
        private EDataCacheType getListViewType(MergeRequestListView listView)
        {
            if (listView == listViewLiveMergeRequests)
            {
                return(EDataCacheType.Live);
            }
            else if (listView == listViewFoundMergeRequests)
            {
                return(EDataCacheType.Search);
            }
            else if (listView == listViewRecentMergeRequests)
            {
                return(EDataCacheType.Recent);
            }

            Debug.Assert(false);
            return(EDataCacheType.Live);
        }
        private string getDefaultProjectName()
        {
            MergeRequestListView listView = getListView(EDataCacheType.Live);
            MergeRequestKey?     currentMergeRequestKey = getMergeRequestKey(listView);

            if (currentMergeRequestKey.HasValue)
            {
                return(currentMergeRequestKey.Value.ProjectKey.ProjectName);
            }

            if (listView.Groups.Count > 0)
            {
                return(listView.Groups[0].Name);
            }

            ProjectKey?project = getDataCache(EDataCacheType.Live)?.MergeRequestCache?.GetProjects()?.FirstOrDefault();

            if (project.HasValue)
            {
                return(project.Value.ProjectName);
            }

            return(String.Empty);
        }