private async void RemovePassword_FromCollection(object sender) { if (sender != null) { var id = sender as string; //Add Notes to Server Animate = true; Instructions = "Deleting"; //Diagnostics string Message = string.Empty; string StackTrace = string.Empty; bool _HasError = false; //Remove note await Task.Run(() => { try { this.Passwords.RemoveAt(this.Passwords.IndexOf(this.Passwords.SingleOrDefault(w => w.ID == id))); passwordManager.Delete_PasswordById(id); DataVaultWebServiceClient dataService = new DataVaultWebServiceClient(ConfigurationManager.InSecurePublicBinding(), new System.ServiceModel.EndpointAddress(Constants.Data_InSecureUrl)); var response = dataService._DeletePassword_ByID(id, Constants.InMemory_ContactID); if (response.Errors.Count != 0) { response.Errors.ForEach(w => { //Add to log table for diagnostics if (this.logging != null) { var log = LocalMapper.Map_LogWithMessage(w, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); this.logging.AddLog(log); } }); _HasError = true; } } catch (Exception ex) { if (ex.InnerException != null) { Message = ex.InnerException.Message; StackTrace = ex.InnerException.StackTrace; } else { Message = ex.Message; StackTrace = ex.StackTrace; } _HasError = true; var mEx = new Exceptions(logging, Message, StackTrace); if (mEx != null) { mEx.HandleException(mEx, logging); } } }).ContinueWith((e) => { Device.BeginInvokeOnMainThread(() => { Animate = false; //if (_HasError) // dialogue.ShowAlert("mmm...Something went wrong", Message); }); }); } }