Exemple #1
0
        private async void removeCmd_Click(object sender, EventArgs e)
        {
            if (CurSel?.Location == null)
            {
                MessageBox.Show(this, "Error getting disk information", null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var approveText = $"Are you sure you want to remove the disk image file:\n\r{CurSel.Location}?";

            if (!string.IsNullOrEmpty(CurSel.AttachedTo))
            {
                approveText += $"\n\r\n\rThis will detach it from the following virtual machines:\n\r{CurSel.AttachedTo}";
            }
            if (MessageBox.Show(this, approveText, Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            await RunAsyncAction("Removing", async (t, p) => await Medium.RemoveAsync(CurSel.Location, t, p));
            await RefreshList();
        }