private void EditComponentHandler(object parameter) { if (SelectedComponent != null) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetCalibrationComponentsCompleted += (s, e) => { CalibrationComponent clone = new CalibrationComponent(); CommonUtils.CloneObject(clone, SelectedComponent, ""); clone.CalibrationComponentType = SelectedComponent.CalibrationComponentType;//not done by CloneObject method. IList<string> existingComponentNames = (from x in Components select x.Name).ToList(); AddEditCalibrationComponentDialog dialog = new AddEditCalibrationComponentDialog(mSelectedComponent, existingComponentNames); dialog.Show(); //Select the component as user might have changed the component type //and this needs to reload the component type properties dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { SelectedComponent = dialog.Component; } else { SelectedComponent.Name = clone.Name; SelectedComponent.CalibrationComponentType = clone.CalibrationComponentType; SelectedComponent.Description = clone.Description; SelectedComponent.Notes = clone.Notes; } RaisePropertyChanged("Components"); }; }; cmsWebServiceClient.GetCalibrationComponentsAsync(); } }
private void AddButtonHandler(object parameter) { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetCalibrationComponentsCompleted += (s, e) => { DisplayAddComponentDialog(); }; cmsWebServiceClient.GetCalibrationComponentsAsync(); }