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))); }
protected override void Execute_Definition(RoomieCommandContext context) { var scope = context.Scope; DateTime dateTime = context.ReadParameter("DateTime").ToDateTime(); TimeSpan timeSpan = context.ReadParameter("TimeSpan").ToTimeSpan(); string resultName = context.ReadParameter("ResultName").Value; DateTime result = dateTime.Add(timeSpan); scope.Parent.Local.SetVariable(resultName, TimeUtils.DateTimeToString(result)); }
internal RevisionBrowserItem(string name, DateTime timestamp, string sha, RevisionBrowserBaseItem parent, RevisionBrowserModel owner, string description, bool isReviewed, int invertedDisplayIndex) : base(parent, owner) { Name = name; InvertedDisplayIndex = invertedDisplayIndex; _timestamp = timestamp; Timestamp = TimeUtils.DateTimeToString(timestamp); FullSHA = sha; Description = description; IsReviewed = isReviewed; }
private void onLostConnectionIndicatorTimer(object sender, EventArgs e) { if (!isConnectionLost()) { return; } double elapsedSecondsDouble = (DateTime.Now - _lostConnectionInfo.Value.TimeStamp).TotalMilliseconds; int elapsedSeconds = Convert.ToInt32(elapsedSecondsDouble / LostConnectionIndicationTimerInterval); string text = elapsedSeconds % 2 == 0 ? ConnectionLostText.ToLower() : ConnectionLostText.ToUpper(); string tooltipText = String.Format("Connection was lost at {0}", TimeUtils.DateTimeToString(_lostConnectionInfo.Value.TimeStamp)); applyConnectionStatus(text, Color.Red, tooltipText); }
private void addOperationRecord(string text) { string textWithTimestamp = String.Format("{0} {1}", TimeUtils.DateTimeToString(DateTime.Now), text); _operationRecordHistory.Add(textWithTimestamp); if (_operationRecordHistory.Count() > OperationRecordHistoryDepth) { _operationRecordHistory.RemoveAt(0); } labelOperationStatus.Text = text; Trace.TraceInformation("[MainForm] {0}", text); if (!_exiting) { StringBuilder builder = new StringBuilder(OperationRecordHistoryDepth); foreach (string record in _operationRecordHistory) { builder.AppendLine(record); } toolTip.SetToolTip(labelOperationStatus, builder.ToString()); } }
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(); }