public CreditTransactionPageViewModel() { _FillListCreditTransaction(); _openListItem = new Command(x => { try { if (CurrentItem != null) { CreditTransactionViewModel vm; using (var service = ServiceClientProvider.GetCreditTransaction()) { var transaction = service.GetCreditTransaction(CurrentItem.Id); using (var printeService = ServiceClientProvider.GetPrintedDocument()) { var response = printeService.GetPrintedList(DocumentType.CreditTransaction); var lst = response.Select(p => new PrintItem() { Name = p.Name, Type = DocumentType.CreditTransaction, Document = transaction }); var responseInfo = service.GetCreditTransactionInfo(); vm = new CreditTransactionViewModel(transaction, lst, responseInfo.Creditors, responseInfo.Requisits); } CreditTransactionView CreditTransactionView = new CreditTransactionView(vm); CreditTransactionView.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Не удалось открыть сделку"); } }); }
public CreditTransactionView(CreditTransactionViewModel model) { InitializeComponent(); DataContext = model; }