Exemplo n.º 1
0
 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) { }
         }
     }
 }
Exemplo n.º 2
0
 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) { }
         }
     }
 }
Exemplo n.º 3
0
 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) { }
         }
     }
 }
Exemplo n.º 4
0
 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) { }
         }
     }
 }