private void keyFromFolder_Click(object sender, EventArgs e) { using (var fbd = new CommonOpenFileDialog()) { fbd.Title = "設定するルートフォルダーを選択してください。"; fbd.IsFolderPicker = true; if (fbd.ShowDialog() == CommonFileDialogResult.Ok) { try { using (var map = new Dialogs.KeySetup(fbd.FileName)) { if (map.ShowDialog() == DialogResult.OK) { pathText.Text = String.Empty; destinations.Clear(); destinations = map.MappingTable; keyListTargetUpdated(sender, e); } } } catch (UnauthorizedAccessException) { } } } }
private void keyFromFolder_Click(object sender, EventArgs e) { using (var fbd = new FolderBrowserDialog()) { fbd.Description = "設定するルートフォルダーを選択してください。"; fbd.RootFolder = Environment.SpecialFolder.Desktop; if (fbd.ShowDialog() == DialogResult.OK) { try { using (var map = new Dialogs.KeySetup(fbd.SelectedPath)) { if (map.ShowDialog() == DialogResult.OK) { pathText.Text = String.Empty; destinations.Clear(); destinations = map.MappingTable; keyListTargetUpdated(sender, e); } } } catch (UnauthorizedAccessException) { } } } }
private void setWithFolder_Click(object sender, EventArgs e) { if (Core.CurrentOperation == null) { return; } using (var fbd = new CommonOpenFileDialog()) { fbd.Title = "追加するフォルダーを選択してください。"; fbd.IsFolderPicker = true; if (fbd.ShowDialog() == CommonFileDialogResult.Ok) { try { using (var ksetup = new Dialogs.KeySetup(fbd.FileName)) { ksetup.SetMapping(Core.CurrentOperation.Data.GetDestinationsKeys().ToArray <Keys>()); if (ksetup.ShowDialog() == DialogResult.OK) { var map = ksetup.MappingTable; foreach (var kmp in map.Keys) { if (String.IsNullOrEmpty(map[kmp])) { continue; } if (Core.CurrentOperation.Data.IsDestinationExists(kmp)) { Core.CurrentOperation.Data.GetDestination(kmp).SetDestPathWithOverwriteConfirm(map[kmp]); } else { Core.CurrentOperation.Data.AddDestination(kmp, new Bright.Data.Destination(kmp, map[kmp])); } } UpdateKeysList(); } } } catch (UnauthorizedAccessException) { } } } }
private void setWithFolder_Click(object sender, EventArgs e) { if (Core.CurrentOperation == null) { return; } using (var fbd = new FolderBrowserDialog()) { fbd.RootFolder = Environment.SpecialFolder.Desktop; fbd.Description = "追加するフォルダーを選択してください。"; if (fbd.ShowDialog() == DialogResult.OK) { try { using (var ksetup = new Dialogs.KeySetup(fbd.SelectedPath)) { ksetup.SetMapping(Core.CurrentOperation.Data.GetDestinationsKeys().ToArray <Keys>()); if (ksetup.ShowDialog() == DialogResult.OK) { var map = ksetup.MappingTable; foreach (var kmp in map.Keys) { if (String.IsNullOrEmpty(map[kmp])) { continue; } if (Core.CurrentOperation.Data.IsDestinationExists(kmp)) { Core.CurrentOperation.Data.GetDestination(kmp).SetDestPathWithOverwriteConfirm(map[kmp]); } else { Core.CurrentOperation.Data.AddDestination(kmp, new Bright.Data.Destination(kmp, map[kmp])); } } UpdateKeysList(); } } } catch (UnauthorizedAccessException) { } } } }