private void RemoveButtonHandler(object parameter) { AddElectricalRevisionHistoryDialog popupDialog = new AddElectricalRevisionHistoryDialog(Equipment.Id, Equipment.Name); popupDialog.Show(); popupDialog.Closed += (s2, e2) => { if (popupDialog.DialogResult.HasValue && popupDialog.DialogResult.Value) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.SaveIsActiveEquipmentStateCompleted += (s1, e1) => { //Calls MainPage.CloseTab() EventAggregator.GetEvent<PrismEvents.CloseTabPrismEvent>().Publish(new QuickElectrical {Id = Equipment.Id}); EventAggregator.GetEvent<PrismEvents.RefreshNavigationEvent>().Publish(new QuickElectrical()); }; cmsWebServiceClient.SaveIsActiveEquipmentStateAsync(CommonUtils.ModelType.ElectricalEquipment, Equipment.Id, false, CMS.User.Id); } }; }
public bool Save(Action<bool> saved) { var validationErrors = GetErrors(); if (validationErrors.Any()) { ValidationPopup.Show(validationErrors); return false; } CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); EquipmentControl.saveButton.IsEnabled = false; AddElectricalRevisionHistoryDialog dialog = new AddElectricalRevisionHistoryDialog(mEquipmentId, mElectricalEquipment.Name); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { ElectricalEquipmentComponentsControl componentsControl = ComponentsTab.Content as ElectricalEquipmentComponentsControl; //SAVE COMP cmsWebServiceClient.SaveElectricalEquipmentComponentCompleted += (s2, e2) => { if (e2.Result.HasErrors) { //val popup.. ValidationPopup vp = new ValidationPopup(); vp.Show(Utils.BuildValidationResultFromServerErrors("Move Component Failed", e2.Result.ServerErrorMessages)); } else { BuildMoveComponentRevisionHistory(componentsControl); //save actual equipment 2nd SaveEquipment(saved, cmsWebServiceClient); } }; //save any component moves 1st cmsWebServiceClient.SaveElectricalEquipmentComponentAsync(componentsControl.Model.MovedComponent); } EquipmentControl.saveButton.IsEnabled = true; }; return true; }