public ChangesetControl(ChangesetViewModel model, Func<string, UserViewModel> userFactory)
        {
            this.DataContext = this;

            this.Model = model;
            this.User = userFactory(model.Author);

            this.InitializeComponent();
        }
 public SelectableChangesetViewModel(ChangesetViewModel baseModel)
 {
     this.Changeset = baseModel;
     this.Changeset.PropertyChanged += (s, e) => this.TriggerChanged("Changeset");
 }
예제 #3
0
        private async void ChangesetsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            var model = this.gridChangesets.SelectedItem as ChangesetViewModel;

            if (model == null || model == this.currentChangeset)
                return;

            this.currentChangeset = model;

            var userModel = await this.GetUserModelAsync(model.Author);
            this.lblUser.Content = model.Author;
            this.txtComment.Text = model.Comment;
            this.imgUser.Source = userModel.Image;
            this.txtChangeDate.Text = model.Datum.ToString();

            this.lblChangesStatus.Content = "Processing...";
            this.lblChangesStatus.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xD7, 0xE4, 0xF2));

            this.Changes.Clear();

            foreach (var item in model.Changeset.Changes)
            {
                this.Changes.Add(new ChangeViewModel(item, null));
            }

            foreach (var item in this.Changes.ToArray())
            {
                item.Info = await this.RefreshStats(model.Changeset, item.Change, false);
            }

            if (this.currentChangeset == model)
            {
                this.lblChangesStatus.Content = "Done.";
                this.lblChangesStatus.Background = new SolidColorBrush(Color.FromArgb(255, 160, 245, 76));
            }
        }