public static void PromptText(string title, string message, Action <string> callback) { var inf = new Infobox(); inf.ShowYesNo = false; inf.ShowText = true; inf.Text = title; inf.MessageText = message; inf.TextCallback = callback; inf.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { Infobox.PromptText("Create filesystem", "Please name your file system.", (result) => { if (string.IsNullOrWhiteSpace(result)) { MessageBox.Show(text: "ShiftFS does not allow blank volume names.", caption: "Volume name can't be blank", icon: MessageBoxIcon.Error, buttons: MessageBoxButtons.OK); } else { var dir = new Directory(); dir.Name = result; dir.permissions = Objects.UserPermissions.Guest; Mounts.Add(dir); SetupTree(); } }); }
private void newDirectoryToolStripMenuItem_Click(object sender, EventArgs e) { if (DirectoryExists(tvfiles.SelectedNode.Tag.ToString())) { Infobox.PromptText("New directory", "Please name your directory.", (result) => { if (string.IsNullOrWhiteSpace(result)) { MessageBox.Show(text: "ShiftFS does not allow blank directory names.", caption: "Directory name can't be blank", icon: MessageBoxIcon.Error, buttons: MessageBoxButtons.OK); } else { var dinf = GetDirectoryInfo(tvfiles.SelectedNode.Tag.ToString()); dinf.AddDirectory(new Directory { Name = result, permissions = Objects.UserPermissions.Guest }); SetupTree(); } }); } }