/// <summary> /// Called when an updated source has been submitted for saving /// Only update the existing source if it has been changed. /// </summary> /// <param name="originalSource"></param> /// <param name="newSource"></param> private void SourceChanged(Source originalSource, Source newSource, SourceEditDialogFragment sourceEditDialog) { // If nothing has changed then tell the user, otherwise carry out the save operation if ((newSource.Name != originalSource.Name) || (newSource.FolderName != originalSource.FolderName) || (newSource.PortNo != originalSource.PortNo) || (newSource.IPAddress != originalSource.IPAddress) || (newSource.AccessMethod != originalSource.AccessMethod)) { // Something has changed so update the source originalSource.UpdateSource(newSource); // Need to tell the SourceSelectionDialogFragment that it needs to redisplay its data sourceSelectionDialog?.OnSourceChanged(); // Dismiss the dialogue sourceEditDialog.Dismiss(); } else { // Nothing has changed NotificationDialogFragment.ShowFragment(CommandRouter.Manager, "No changes made to source"); } }
/// <summary> /// Called when a source has been selected to edit. /// Display the SoureEditDialogFragment /// </summary> /// <param name="selectedSource"></param> private void SourceSelected(Source selectedSource) => SourceEditDialogFragment.ShowFragment(CommandRouter.Manager, selectedSource, SourceChanged);