void CopyToClipboard()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format("List of Workspaces & Shelvesets older than {0}", DateTime.Now.AddDays(-this.MaxDays)));

            if (Workspaces.Count > 0)
            {
                sb.AppendLine("Workspaces:");
                TableBuilder table = new TableBuilder();
                table.AddHeaders(new Header("Name"), new Header("Computer"), new Header("Last Access Date"), new Header("Comment", 35));
                foreach (var ws in Workspaces.OrderBy(o => o.OwnerName))
                {
                    table.AddValues(ws.DisplayName, ws.Computer, ws.LastAccessDate.ToString(), ws.Comment);
                }

                sb.Append(table.ToString());
            }

            if (Shelvesets.Count > 0)
            {
                sb.AppendLine("Shelvesets:");
                TableBuilder table = new TableBuilder();
                table.AddHeaders(new Header("Name"), new Header("Creation Date"), new Header("Comment", 35));
                foreach (var ws in Shelvesets.OrderBy(o => o.OwnerName))
                {
                    table.AddValues(ws.DisplayName, ws.CreationDate.ToString(), ws.Comment);
                }
                sb.Append(table.ToString());
            }

            Clipboard.SetText(sb.ToString());
        }
Exemplo n.º 2
0
        void CopyDetails()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format("Item: {0}", SelectedSourceControlItem.ServerItem));
            TableBuilder table = new TableBuilder();

            table.AddHeaders(new Header("ID"), new Header("Change"), new Header("Committer"), new Header("Date", 10), new Header("Comment", 35));

            foreach (Changeset change in SelectedItemHistory)
            {
                string changesStr = string.Empty;
                table.AddValues(change.ChangesetId.ToString(), change.Changes.Aggregate(changesStr,
                                                                                        (current, changeStr) => current + (changeStr.ChangeType.ToString() + ", ")), change.Committer, change.CreationDate.ToString(), change.Comment);
            }

            Clipboard.SetText(table.ToString());
        }