Beispiel #1
0
        private async void deleteFilesButton_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            DisableAll();
            var statusLabel = new ToolStripStatusLabel("Deleting files");

            statusBar.Items.Add(statusLabel);
            try
            {
                var selectedFiles = filesListBox.SelectedItems;
                foreach (CloudFile file in selectedFiles)
                {
                    statusLabel.Text = string.Format("Deleting {0}", file.Name);
                    await _cloud.DeleteFileAsync(_currentUser, file.Name);
                }
                statusLabel.Text        = "Refreshing files";
                filesListBox.DataSource = await _cloud.GetFilesListAsync(_currentUser);
            }
            catch (CloudException cloud)
            {
                MessageBox.Show(cloud.Message, "Cloud problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (Exception)
            {
                MessageBox.Show("Unexcepted error occured. Click OK to contiune", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            EnableAll();
            statusBar.Items.Remove(statusLabel);
            Cursor = Cursors.Arrow;
        }