private void AddNewKey_Click(object sender, EventArgs e) { using (var fbd = new CommonOpenFileDialog()) { fbd.Title = "追加するフォルダーを選択してください。"; fbd.IsFolderPicker = true; if (fbd.ShowDialog() == CommonFileDialogResult.Ok) { List <Keys> cand = new List <Keys>(); var dks = Core.CurrentOperation.Data.GetDestinationsKeys(); for (int initPoint = (int)Keys.D0; initPoint <= (int)Keys.D9; initPoint++) { if (!dks.Contains <Keys>((Keys)initPoint)) { cand.Add((Keys)initPoint); } if (!dks.Contains <Keys>((Keys)initPoint | Keys.Shift)) { cand.Add((Keys)initPoint | Keys.Shift); } } for (int initPoint = (int)Keys.A; initPoint <= (int)Keys.Z; initPoint++) { if (!dks.Contains <Keys>((Keys)initPoint)) { cand.Add((Keys)initPoint); } if (!dks.Contains <Keys>((Keys)initPoint | Keys.Shift)) { cand.Add((Keys)initPoint | Keys.Shift); } } using (var ak = new Dialogs.AddKey(cand.ToArray())) { if (ak.ShowDialog() == DialogResult.OK) { Core.CurrentOperation.Data.AddDestination(ak.Selected, new Bright.Data.Destination(ak.Selected, fbd.FileName)); } } } } }
private void AddNewKey_Click(object sender, EventArgs e) { using (var fbd = new FolderBrowserDialog()) { fbd.RootFolder = Environment.SpecialFolder.Desktop; if (fbd.ShowDialog() == DialogResult.OK) { fbd.Description = "追加するフォルダーを選択してください。"; List <Keys> cand = new List <Keys>(); var dks = Core.CurrentOperation.Data.GetDestinationsKeys(); for (int initPoint = (int)Keys.D0; initPoint <= (int)Keys.D9; initPoint++) { if (!dks.Contains <Keys>((Keys)initPoint)) { cand.Add((Keys)initPoint); } if (!dks.Contains <Keys>((Keys)initPoint | Keys.Shift)) { cand.Add((Keys)initPoint | Keys.Shift); } } for (int initPoint = (int)Keys.A; initPoint <= (int)Keys.Z; initPoint++) { if (!dks.Contains <Keys>((Keys)initPoint)) { cand.Add((Keys)initPoint); } if (!dks.Contains <Keys>((Keys)initPoint | Keys.Shift)) { cand.Add((Keys)initPoint | Keys.Shift); } } using (var ak = new Dialogs.AddKey(cand.ToArray())) { if (ak.ShowDialog() == DialogResult.OK) { Core.CurrentOperation.Data.AddDestination(ak.Selected, new Bright.Data.Destination(ak.Selected, fbd.SelectedPath)); } } } } }