/// <summary> /// Delete selected record(s) /// </summary> /// <returns></returns> public async System.Threading.Tasks.Task DeleteRecords() { // Display confirm message with Yes/No option MessageDialog dialog = new MessageDialog(loader.GetString("ConfirmDelete")); dialog.Commands.Add(new UICommand(loader.GetString("Yes"))); dialog.Commands.Add(new UICommand(loader.GetString("No"))); dialog.DefaultCommandIndex = 1; dialog.CancelCommandIndex = 1; var result = await dialog.ShowAsync(); // If user clicks No, then do nothing. if (result.Label == loader.GetString("No")) { return; } // Otherwise delete recrod(s). Show progress ring first. progressRing.IsActive = true; // Then delete record(s) foreach (ViewData item in lvList.SelectedItems) { Entity record = new Entity(); record.LogicalName = (string.IsNullOrEmpty(item.ActivityTypeName)) ? (cbLookFor.SelectedItem as EntityMetadataEx).EntityMetadata.LogicalName : item.ActivityTypeName; record.Id = item.Id; await CRMHelper.DeleteRecord(record); } // Finally Refresh data await RefreshList(); }
/// <summary> /// This method deletes a note record /// </summary> /// <returns></returns> public async System.Threading.Tasks.Task DeleteRecords() { // Show download message. var result = await Util.ShowConfirmMessage(loader.GetString("ConfirmDeleteNote"), loader.GetString("Yes"), loader.GetString("No"), 1); if (!result) { return; } progressRing.IsActive = true; // Delete selected notes. foreach (Annotation note in lvList.SelectedItems) { await CRMHelper.DeleteRecord(note); } progressRing.IsActive = false; }
/// <summary> /// Delete current record /// </summary> /// <returns></returns> public async System.Threading.Tasks.Task <bool> DeleteRecord() { // Display confirm message with Yes/No option var result = await Util.ShowConfirmMessage(loader.GetString("ConfirmDelete"), loader.GetString("Yes"), loader.GetString("No"), 1); // If user click no, then do nothing. if (!result) { return(false); } // Otherwise delete recrod(s). Show progress ring first. progressRing.IsActive = true; // Then delete await CRMHelper.DeleteRecord(Record); progressRing.IsActive = false; // Let page handle navigation return(true); }