private void filesListView_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Delete) { if (filesListView.SelectedItems.Count > 0) { var image = filesListView.SelectedItems[0].ImageList.Images[filesListView.SelectedItems[0].ImageKey]; string text = filesListView.SelectedItems.Count == 1 ? "Are you sure you want to delete " + filesListView.SelectedItems[0].Tag : "Are you sure you want to delete " + filesListView.SelectedItems.Count + " files"; List <string> paths = new List <string>(); foreach (var item in filesListView.SelectedItems) { paths.Add((string)((ListViewItem)item).Tag); } ModelessMessageBox.Show(this, text, "Delete Resource", image, "Yes", "No", () => { foreach (var path in paths) { Client.CopyResource(path, "/DeletedResources/" + Path.GetFileName(path)); Client.DeleteResource(path); } }); } } } catch { } }
private void filesListView_AfterLabelEdit(object sender, LabelEditEventArgs e) { try { var oldPath = (string)filesListView.Items[e.Item].Tag; var folderPath = oldPath.Substring(0, oldPath.LastIndexOf('/')); Client.MoveResource(oldPath, folderPath + "/" + e.Label); } catch (Exception ex) { ModelessMessageBox.Show(this, "Failed to rename file" + ex.Message, "EOROROR", () => { }); } }
public static ModelessMessageBox Show(Form parent, string text, string caption, Action ok, Action cancel = null) { var messageBox = new ModelessMessageBox(); //messageBox.Parent = parent; messageBox.Message = text; messageBox.Text = caption; messageBox.Image = messageBox.defaultImageList.Images[0]; messageBox.Ok = ok; messageBox.Cancel = cancel; messageBox.CenterIn(parent); messageBox.Show(); return(messageBox); }
public static ModelessMessageBox Show(Form parent, string text, string caption, Image image, string okText, string cancelText, Action ok, Action cancel = null) { var messageBox = new ModelessMessageBox(); //messageBox.Parent = parent; messageBox.Message = text; messageBox.Text = caption; messageBox.Image = image; messageBox.okButton.Text = okText; messageBox.cancelButton.Text = cancelText; messageBox.Ok = ok; messageBox.Cancel = cancel; messageBox.CenterIn(parent); messageBox.Show(); return(messageBox); }
public static ModelessMessageBox Show(Form parent, string text, string caption, Action ok, Action cancel = null) { var messageBox = new ModelessMessageBox(); //messageBox.Parent = parent; messageBox.Message = text; messageBox.Text = caption; messageBox.Image = messageBox.defaultImageList.Images[0]; messageBox.Ok = ok; messageBox.Cancel = cancel; messageBox.CenterIn(parent); messageBox.Show(); return messageBox; }
public static ModelessMessageBox Show(Form parent, string text, string caption, Image image, string okText, string cancelText, Action ok, Action cancel = null) { var messageBox = new ModelessMessageBox(); //messageBox.Parent = parent; messageBox.Message = text; messageBox.Text = caption; messageBox.Image = image; messageBox.okButton.Text = okText; messageBox.cancelButton.Text = cancelText; messageBox.Ok = ok; messageBox.Cancel = cancel; messageBox.CenterIn(parent); messageBox.Show(); return messageBox; }