public PostListPage(PostListViewModel vm) { BindingContext = vm; InitializeComponent(); if (vm.IsLogined) { this.ToolbarItems.Add(new ToolbarItem("Edit", "", async() => { var editPage = new AlbumEditPage(new AlbumViewModel(vm.CurrentAlnum)); await Navigation.PushAsync(editPage); })); } MessagingCenter.Subscribe <Album>(this, "delete", async album => { await Navigation.PopAsync(); }); }
async void AddButtonClickedAsync(object sender, EventArgs e) { var editPage = new AlbumEditPage(new AlbumViewModel(null)); await Navigation.PushAsync(editPage); }
async void EditButtonClickedAsync(object sender, EventArgs e) { var editPage = new AlbumEditPage(BindingContext as AlbumViewModel); await Navigation.PushAsync(editPage); }