private async void cmdCopy_Click(object sender, EventArgs e) { if (!ZUIDs(out var lUIDs)) { return; } cMailbox lMailbox; using (frmMailboxDialog lMailboxDialog = new frmMailboxDialog(mClient, false)) { if (lMailboxDialog.ShowDialog(this) != DialogResult.OK) { return; } lMailbox = lMailboxDialog.Mailbox; } cCopyFeedback lFeedback; try { lFeedback = await mClient.SelectedMailbox.UIDCopyAsync(lUIDs, lMailbox); } catch (Exception ex) { if (!IsDisposed) { MessageBox.Show(this, $"copy error\n{ex}"); } return; } if (!IsDisposed && lFeedback != null) { MessageBox.Show(this, $"copied as {lFeedback}"); } }
private async void cmdRenameTo_Click(object sender, EventArgs e) { var lNode = tvw.SelectedNode; if (lNode == null) { return; } var lTag = tvw.SelectedNode.Tag as cNodeTag; if (lTag?.Mailbox == null) { return; } iMailboxContainer lContainer; using (frmMailboxDialog lMailboxDialog = new frmMailboxDialog(mClient, true)) { if (lMailboxDialog.ShowDialog(this) != DialogResult.OK) { return; } lContainer = lMailboxDialog.MailboxContainer; } string lName; if (string.IsNullOrWhiteSpace(txtRename.Text)) { lName = null; } else { lName = txtRename.Text.Trim(); } try { var lMailbox = await lTag.Mailbox.RenameAsync(lContainer, lName); if (IsDisposed) { return; } ZAddMailbox(lContainer, lMailbox); } catch (Exception ex) { if (!IsDisposed) { MessageBox.Show(this, $"an error occurred while renaming: {ex}"); } } }
private async void cmdCopyTo_Click(object sender, EventArgs e) { var lBindingSource = dgvMessages.DataSource as BindingSource; if (lBindingSource == null) { return; } if (lBindingSource.Count == 0) { MessageBox.Show("there have to be some messages to copy"); } // get them now: some could be delivered while the dialog is up (TODO: test that theory) var lMessages = new List <cMessage>(from cGridRowData lItem in lBindingSource select lItem.Message); cMailbox lMailbox; using (frmMailboxDialog lMailboxDialog = new frmMailboxDialog(mClient, false)) { if (lMailboxDialog.ShowDialog(this) != DialogResult.OK) { return; } lMailbox = lMailboxDialog.Mailbox; } cCopyFeedback lFeedback; try { lFeedback = await lMailbox.CopyAsync(lMessages); } catch (Exception ex) { if (!IsDisposed) { MessageBox.Show(this, $"copy error\n{ex}"); } return; } if (!IsDisposed && lFeedback != null) { MessageBox.Show(this, $"copied {lFeedback}"); } }