コード例 #1
0
        private async void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var confirm = MessageBox.Show("Are you sure you want to delete the selected item?", "Confirm deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (confirm != DialogResult.Yes)
            {
                return;
            }
            if (CloudLocationPicker.SelectedItems.Count == 0)
            {
                return;
            }
            if (CloudLocationPicker.SelectedItems[0].Tag == null)
            {
                return;
            }

            try
            {
                var itemToDelete = await _oneDriveApi.GetItemById(CloudLocationPicker.SelectedItems[0].Tag.ToString());

                await _oneDriveApi.Delete(itemToDelete);

                MessageBox.Show("Item has been deleted", "Delete item", MessageBoxButtons.OK, MessageBoxIcon.Information);
                await LoadFolderItems(CurrentMyOneDriveItem.Id);
            }
            catch (Exception)
            {
                MessageBox.Show("Item could not be deleted", "Delete item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #2
0
        private async void DeleteButton_Click(object sender, EventArgs e)
        {
            var data = await OneDriveApi.Delete("Test.txt");

            JsonResultTextBox.Text = data.ToString();
        }