public CompanyUC(EventHandler onRemove, EventHandler onEdit, CompanyResumeViewModel companyResumeViewModel, UserBasicInformationViewModel userBasicInformation) { InitializeComponent(); _companyResumeViewModel = companyResumeViewModel; _onRemove = onRemove; _onEditHandler = onEdit; _userBasicInformation = userBasicInformation; SetCompanyValues(); }
private void OnRemove(object sender, EventArgs e) { CompanyResumeViewModel companyViewModel = sender as CompanyResumeViewModel; if (MessageBox.Show($"Deseja realmente remover a empresa: {companyViewModel.Company}?", "Atenção", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { _companyService.Delete(companyViewModel.Id).ContinueWith(task => { if (task.Result.IsSuccess) { MessageBox.Show($"Removido com sucesso", "Sucesso", MessageBoxButton.OK, MessageBoxImage.Information); _indexes.Remove(companyViewModel.Id); PopulateByDictionary(); } else { MessageBox.Show($"Falha na tentativa de remoção.", "Falha", MessageBoxButton.OK, MessageBoxImage.Warning); } }, TaskScheduler.FromCurrentSynchronizationContext()); } }