private void ButtonAdd_Click(object sender, EventArgs e) { FormAddDocument form = new FormAddDocument(new WarehouseDocumentViewModel(), _documentsService, _articlesService); form.VMChanged += ReloadDataSource; form.Show(); }
private async void ButtonUpdate_Click(object sender, EventArgs e) { await(this).WrapException(async() => { DataGridViewRow row = FindSelectedRow(); if (row != null) { var id = (int)row.Cells["Id"].Value; var vm = await _documentsService.GetWareHouseDocumentById(id); FormAddDocument form = new FormAddDocument(vm, _documentsService, _articlesService); form.VMChanged += ReloadDataSource; form.Show(); } }); }