Exemple #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string slug = "";
            string buildid = "";
            NavigationContext.QueryString.TryGetValue("slug", out slug);
            NavigationContext.QueryString.TryGetValue("id", out buildid);
            long id = Int64.Parse(buildid);

            TravisAPI.GetBuildDetails(slug, id, (build) =>
            {
                this.build = (Build)build;
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                   this.DataContext = new BuildViewModel((Build)build);
                });
            },
            (ex) =>
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("Error retrieving build " + buildid + " in " + slug + "\n" +
                                    "The error was: " + ex.Message);
                });
                NavigationService.GoBack();
            });
        }
Exemple #2
0
 public BuildViewModel(Build b)
 {
     Jobs = new ObservableCollection<JobViewModel>();
     UpdateFrom(b);
 }
Exemple #3
0
        internal void UpdateFrom(Build b)
        {
            this.build = b;
            this.Message = b.Message;
            this.ShortMessage = b.Message.Split('\n')[0];
            this.EventType = b.EventType;
            this.ResultColor = GetResultColor(b.Result);
            if (b.Repository != null)
            {
                this.Slug = b.Repository.Slug;
            }
            this.BuildId = b.BuildId;
            this.Number = b.Number;

            if (b.Committer != null && b.Author != null)
            {
                if (b.Committer.Name == b.Author.Name && b.Committer.EMail == b.Author.EMail)
                {
                    this.Author = String.Format("{0} ({1})", b.Committer.Name, b.Committer.EMail);
                }
                else
                {
                    this.Author = String.Format("{0} ({1}) (Authored by: {2} {3})", b.Committer.Name, b.Committer.EMail, b.Author.Name, b.Author.EMail);
                }
            }
            if (b.StartedAt != null && b.FinishedAt != null)
            {
                this.BuildDuration = b.StartedAt - b.FinishedAt;
            }
            this.Date = b.CommittedAt;
            this.Commit = b.Commit;
            this.Url = b.CompareUrl;
            b.LoadJobs(
                (job) => Dispatch(() => Jobs.Add(new JobViewModel(job))),
                (ex) => Dispatch(() => MessageBox.Show("There was an error getting the job matrix:\n" + ex.Message))
            );
        }