private async void delete_Click(object sender, RoutedEventArgs e) { if (enableComponent) { if (helper.checkInternetConnection()) { accessKeys temp = (accessKeys)list.SelectedItem; if (temp != null) { foreach (accessKeys key in accesskeyList) { if (key.getKeys() == temp.getKeys()) { await users.deleteKey(key); } } await users.deleteFileSecurity(await users.fetchFileSecurity(helper.getUsername() + temp.getKeys())); helper.popup(temp.getKeys() + " has been deleted", "Success"); navigationHelper.GoBack(); } } else { helper.popup("Check your internet connection", "NO INTERNET"); } } }
public static async Task <bool> deleteKey(accessKeys key) { try { TableOperation deleteOperation = TableOperation.Delete(key); TableResult finalResult = await accessKeysTable.ExecuteAsync(deleteOperation); return(true); } catch { return(false); } }
public static async Task <bool> addAccessKey(string key, string filename) { try { accessKeys temp = new accessKeys(key, filename); TableOperation insertOperation = TableOperation.Insert(temp); await accessKeysTable.ExecuteAsync(insertOperation); return(true); } catch { } return(false); }
private void view_Click(object sender, RoutedEventArgs e) { if (enableComponent) { accessKeys temp = (accessKeys)list.SelectedItem; if (temp != null) { List <string> parameter = new List <string>(); parameter.Add(temp.getKeys()); foreach (accessKeys key in accesskeyList) { if (key.getKeys() == temp.getKeys()) { parameter.Add(key.getFilename()); } } helper.setKey(""); Frame.Navigate(typeof(AccessKeyItems), parameter); } } }
private void changeSecurity_Click(object sender, RoutedEventArgs e) { if (enableComponent) { if (helper.checkInternetConnection()) { accessKeys temp = (accessKeys)list.SelectedItem; if (temp != null) { List <string> parameter = new List <string>(); parameter.Add("profile"); parameter.Add(temp.getKeys()); Frame.Navigate(typeof(plotSecuritySettings), parameter); } } else { helper.popup("Check your internet connection", "NO INTERNET"); } } }
public static async Task <bool> deleteFile(files file, linking link, accessKeys key) { try { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connection.getConnectionString()); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference(helper.getUsername()); await container.CreateIfNotExistsAsync(); CloudBlockBlob blockBlob = container.GetBlockBlobReference(file.getFilename()); await blockBlob.DeleteIfExistsAsync(); files temp = await fetchFile(helper.getUsername(), file.getFilename()); if (temp != null) { await updateFileCount(Convert.ToDouble(temp.size), 1); await deleteFileOnline(temp); await helper.deleteFileDataLocal(temp.getFilename()); if (link != null) { await removerLink(link); } if (key != null) { await deleteKey(key); } } return(true); } catch { } return(false); }
private async void deleteFileBtn_Click(object sender, RoutedEventArgs e) { if (enableComponent) { if (helper.checkInternetConnection()) { object[] listSelected = list.SelectedItems.ToArray <object>(); bool userCheck = await helper.dialogPopup("Do you want to delete these files", "Delete"); if (userCheck) { displayLoading("Deleting..."); int current = 0, total = listSelected.Count <object>(); List <linking> linkingList = await users.getLink(helper.getUsername()); List <accessKeys> keys = await users.fetchAccessKeys(); foreach (files temp in listSelected) { linking parameterLink = null; accessKeys parameterKey = null; if (linkingList != null) { foreach (linking link in linkingList) { if (link.getFilename() == temp.getFilename()) { parameterLink = link; } } } if (keys != null) { foreach (accessKeys key in keys) { if (key.getFilename() == temp.getFilename()) { parameterKey = key; } } } displayLoading("Deleting files ...\nFile: " + current.ToString() + "/" + total); if (!await users.deleteFile(temp, parameterLink, parameterKey)) { helper.popup("The file couldn't be deleted. Please try again", "DELETION FAILED"); } current++; } await setListView(); disableLoading(); } else { foreach (files file in listSelected) { list.SelectedItems.Remove(file); } } } else { helper.popup("Check your internet connection", "NO INTERNET"); } } }