public CollabHistoryItem(RevisionData data)
        {
            m_RevisionId  = data.id;
            m_TimeStamp   = data.timeStamp;
            name          = "HistoryItem";
            m_ActionsTray = new VisualElement {
                name = "HistoryItemActionsTray"
            };
            m_ProgressSpinner = new HistoryProgressSpinner();
            m_Details         = new VisualElement {
                name = "HistoryDetail"
            };
            var author = new Label(data.authorName)
            {
                name = "Author"
            };

            m_TimeAgo         = new Label(TimeAgo.GetString(m_TimeStamp));
            m_FullDescription = data.comment;
            var shouldTruncate = ShouldTruncateDescription(m_FullDescription);

            if (shouldTruncate)
            {
                m_Description = new Label(GetTruncatedDescription(m_FullDescription));
            }
            else
            {
                m_Description = new Label(m_FullDescription);
            }
            m_Description.name = "RevisionDescription";
            var dropdown = new CollabHistoryDropDown(data.changes, data.changesTotal, data.changesTruncated, data.id);

            if (data.current)
            {
                m_Button = new Button(Restore)
                {
                    name = "ActionButton", text = "Restore"
                };
            }
            else if (data.obtained)
            {
                m_Button = new Button(GoBackTo)
                {
                    name = "ActionButton", text = "Go back to..."
                };
            }
            else
            {
                m_Button = new Button(UpdateTo)
                {
                    name = "ActionButton", text = "Update"
                };
            }
            m_Button.SetEnabled(data.enabled);
            m_ProgressSpinner.ProgressEnabled = data.inProgress;

            m_ActionsTray.Add(m_ProgressSpinner);
            m_ActionsTray.Add(m_Button);

            m_Details.Add(author);
            m_Details.Add(m_TimeAgo);
            m_Details.Add(m_Description);

            if (shouldTruncate)
            {
                m_ExpandCollapseButton = new Button(ToggleDescription)
                {
                    name = "ToggleDescription", text = "Show More"
                };
                m_Details.Add(m_ExpandCollapseButton);
            }

            if (data.buildState != BuildState.None)
            {
                BuildStatusButton buildButton;
                if (data.buildState == BuildState.Configure)
                {
                    buildButton = new BuildStatusButton(ShowServicePage);
                }
                else
                {
                    buildButton = new BuildStatusButton(ShowBuildForCommit, data.buildState, data.buildFailures);
                }

                m_Details.Add(buildButton);
            }

            m_Details.Add(m_ActionsTray);
            m_Details.Add(dropdown);

            Add(m_Details);

            this.schedule.Execute(UpdateTimeAgo).Every(1000 * 20);
        }
示例#2
0
        public CollabHistoryItem(RevisionData data)
        {
            this.m_RevisionId  = data.id;
            this.m_TimeStamp   = data.timeStamp;
            base.name          = "HistoryItem";
            this.m_ActionsTray = new VisualContainer
            {
                name = "HistoryItemActionsTray"
            };
            this.m_ProgressSpinner = new HistoryProgressSpinner();
            this.m_Details         = new VisualElement
            {
                name = "HistoryDetail"
            };
            Label child = new Label(data.authorName)
            {
                name = "Author"
            };

            this.m_TimeAgo         = new Label(TimeAgo.GetString(this.m_TimeStamp));
            this.m_FullDescription = data.comment;
            bool flag = this.ShouldTruncateDescription(this.m_FullDescription);

            if (flag)
            {
                this.m_Description = new Label(this.GetTruncatedDescription(this.m_FullDescription));
            }
            else
            {
                this.m_Description = new Label(this.m_FullDescription);
            }
            this.m_Description.name = "RevisionDescription";
            CollabHistoryDropDown child2 = new CollabHistoryDropDown(data.changes, data.changesTotal, data.changesTruncated);

            if (data.current)
            {
                this.m_Button = new Button(new Action(this.Restore))
                {
                    name = "ActionButton",
                    text = "Restore"
                };
            }
            else if (data.obtained)
            {
                this.m_Button = new Button(new Action(this.GoBackTo))
                {
                    name = "ActionButton",
                    text = "Go back to..."
                };
            }
            else
            {
                this.m_Button = new Button(new Action(this.UpdateTo))
                {
                    name = "ActionButton",
                    text = "Update"
                };
            }
            this.m_Button.SetEnabled(data.enabled);
            this.m_ProgressSpinner.ProgressEnabled = data.inProgress;
            this.m_ActionsTray.Add(this.m_ProgressSpinner);
            this.m_ActionsTray.Add(this.m_Button);
            this.m_Details.Add(child);
            this.m_Details.Add(this.m_TimeAgo);
            this.m_Details.Add(this.m_Description);
            if (flag)
            {
                this.m_ExpandCollapseButton = new Button(new Action(this.ToggleDescription))
                {
                    name = "ToggleDescription",
                    text = "Show More"
                };
                this.m_Details.Add(this.m_ExpandCollapseButton);
            }
            if (data.buildState != BuildState.None)
            {
                BuildStatusButton child3;
                if (data.buildState == BuildState.Configure)
                {
                    child3 = new BuildStatusButton(new Action(this.ShowServicePage));
                }
                else
                {
                    child3 = new BuildStatusButton(new Action(this.ShowBuildForCommit), data.buildState, data.buildFailures);
                }
                this.m_Details.Add(child3);
            }
            this.m_Details.Add(this.m_ActionsTray);
            this.m_Details.Add(child2);
            base.Add(this.m_Details);
            base.schedule.Execute(new Action(this.UpdateTimeAgo)).Every(20000L);
        }