private string getActivities(DateTime createdAt, MergeRequestKey key, bool tooltipText) { DateTime?latestCommitTime = getLatestCommitTime(key); return(String.Format("Created: {0}\r\nLatest commit: {1}", tooltipText ? TimeUtils.DateTimeToString(createdAt) : TimeUtils.DateTimeToStringAgo(createdAt), tooltipText ? TimeUtils.DateTimeOptToString(latestCommitTime) : TimeUtils.DateTimeOptToStringAgo(latestCommitTime))); }
private void updateRefreshButtonToolTip() { DataCache dataCache = getDataCache(EDataCacheType.Live); DateTime? refreshTimestamp = dataCache?.MergeRequestCache?.GetListRefreshTime(); string refreshedAgo = refreshTimestamp.HasValue ? String.Format("Refreshed {0}", TimeUtils.DateTimeToStringAgo(refreshTimestamp.Value)) : String.Empty; toolTip.SetToolTip(this.buttonReloadList, String.Format("{0}{1}{2}", RefreshButtonTooltip, refreshedAgo == String.Empty ? String.Empty : "\r\n", refreshedAgo)); }
private void updateRelatedDiscussionControlState() { bool areRelatedDisussionsAvailable = _relatedDiscussions.Any(); if (areRelatedDisussionsAvailable) { if (!_relatedDiscussionIndex.HasValue) { _relatedDiscussionIndex = 0; } else { _relatedDiscussionIndex = Math.Min(_relatedDiscussionIndex.Value, _relatedDiscussions.Count() - 1); } checkBoxShowRelated.Enabled = true; } else { _relatedDiscussionIndex = null; checkBoxShowRelated.Enabled = false; } checkBoxShowRelated.Text = String.Format("Show related threads ({0})", _relatedDiscussions.Count()); int currentRelatedIndex = areRelatedDisussionsAvailable ? _relatedDiscussionIndex.Value : 0; int currentRelatedIndexOneBased = areRelatedDisussionsAvailable ? _relatedDiscussionIndex.Value + 1 : 0; int totalRelatedIndex = areRelatedDisussionsAvailable ? _relatedDiscussions.Count() : 0; labelRelatedDiscussionCounter.Text = String.Format("{0} / {1}", currentRelatedIndexOneBased, totalRelatedIndex); labelRelatedDiscussionCounter.Visible = areRelatedDisussionsAvailable; bool allowScrollForward = areRelatedDisussionsAvailable && currentRelatedIndex < totalRelatedIndex - 1; bool allowScrollBackward = areRelatedDisussionsAvailable && currentRelatedIndex > 0; buttonPrevRelatedDiscussion.Enabled = allowScrollBackward; buttonNextRelatedDiscussion.Enabled = allowScrollForward; htmlPanelPreview.Enabled = areRelatedDisussionsAvailable; labelRelatedDiscussionAuthor.Visible = areRelatedDisussionsAvailable; updateRelatedThreadsGroupBoxVisibility(); if (needShowRelatedDiscussions()) { ReportedDiscussionNote note = _relatedDiscussions[_relatedDiscussionIndex.Value]; bool areRefsEqual = note.Position.DiffPosition.Refs.Equals(NewDiscussionPosition.Refs); labelDifferentContextHint.Visible = !areRefsEqual; labelRelatedDiscussionAuthor.Text = String.Format("{0} -- {1}", note.Details.AuthorName, TimeUtils.DateTimeToStringAgo(note.Details.CreatedAt)); toolTip.SetToolTip(labelRelatedDiscussionAuthor, TimeUtils.DateTimeToString(note.Details.CreatedAt)); updatePreview(htmlPanelPreviewRelatedDiscussion, note.Content.Body); showDiscussionContext(note.Position.DiffPosition, htmlPanelRelatedDiscussionContext); } else { labelRelatedDiscussionAuthor.Text = String.Empty; toolTip.SetToolTip(labelRelatedDiscussionAuthor, String.Empty); htmlPanelPreviewRelatedDiscussion.Text = String.Empty; htmlPanelRelatedDiscussionContext.Text = String.Empty; } // We want to hide "Show related" check box when related discussions don't make sense or unwanted checkBoxShowRelated.Visible = needShowDiffContext(); }