private void btnAdd_Click(object sender, EventArgs e) { int idx = 0; foreach (var p in PaletteManager.GetPaletteNames()) { if (p.ToLower().StartsWith("palette")) { string ns = p.Substring(7); int n; if (int.TryParse(ns, out n)) { idx = Math.Max(n, idx); } } } if (InputWindow.Show("팔레트이름을 입력해주세요", $"Palette{idx + 1}") == DialogResult.OK) { string name = InputWindow.Result.Trim(); if (name.Length > 0) { if (!CheckPalette(name)) { return; } AddPalette(name); } } }
public static DialogResult Show(string msg = "", string input = "") { InputWindow iw = new InputWindow(msg, input); DialogResult r = iw.ShowDialog(); if (r == DialogResult.OK) { Result = iw.Input; } return(r); }
private void MRename_Click(object sender, EventArgs e) { if (InputWindow.Show("변경할 이름을 설정해주세요", selectedPaletteName) == DialogResult.OK) { string name = InputWindow.Result.Trim(); if (!CheckPalette(name)) { return; } PaletteManager.RenamePalette(selectedPaletteName, name); lvPalette.Items[selectedPalette].Text = name; SavePaletteList(); selectedPaletteName = name; } }