コード例 #1
0
ファイル: SingleFileCtrl.cs プロジェクト: kanbang/Colt
 private void btnBrowseAliasDir_Click(object sender, EventArgs e)
 {
     using (var picker = new UnmanagedFileBrowser(_fs.CurrentConnection.ResourceService))
     {
         picker.SelectFoldersOnly = true;
         if (picker.ShowDialog() == DialogResult.OK)
         {
             txtPath.Text = picker.SelectedItem;
         }
     }
 }
コード例 #2
0
        public override void Run()
        {
            var wb = Workbench.Instance;
            var exp = wb.ActiveSiteExplorer;
            var mgr = ServiceRegistry.GetService<ServerConnectionManager>();
            var conn = mgr.GetConnection(exp.ConnectionName);

            var picker = new UnmanagedFileBrowser(conn.ResourceService);
            if (picker.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK)
            {
                MessageService.ShowMessage(picker.SelectedItem);
            }
            else
            {
                MessageService.ShowMessage(Strings.Cancelled);
            }
        }
コード例 #3
0
ファイル: CompositeFileCtrl.cs プロジェクト: kanbang/Colt
 private void browseAliasedFolderToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var picker = new UnmanagedFileBrowser(_service.ResourceService))
     {
         picker.AllowMultipleSelection = false;
         picker.SelectFoldersOnly = true;
         if (picker.ShowDialog() == DialogResult.OK)
         {
             List<string> files = new List<string>();
             var folder = picker.SelectedItem;
             if (!string.IsNullOrEmpty(folder))
             {
                 folder = folder.Replace("%MG_DATA_PATH_ALIAS[", "[") //NOXLATE
                                .Replace("]%", "]"); //NOXLATE
             }
             var list = _service.ResourceService.EnumerateUnmanagedData(folder, string.Empty, false, UnmanagedDataTypes.Files);
             var extensions = new List<string>(new string[] {
                 ".png", //NOXLATE
                 ".jpg", //NOXLATE
                 ".jpeg", //NOXLATE
                 ".tif", //NOXLATE
                 ".tiff", //NOXLATE
                 ".ecw", //NOXLATE
                 ".sid", //NOXLATE
                 ".dem", //NOXLATE
                 ".gif", //NOXLATE
                 ".bmp" //NOXLATE
             });
             foreach (var f in list.Items)
             {
                 var file = f as OSGeo.MapGuide.ObjectModels.Common.UnmanagedDataListUnmanagedDataFile;
                 if (file != null)
                 {
                     foreach (var ext in extensions)
                     {
                         if (file.FileName.ToLower().EndsWith(ext))
                         {
                             var leftpart = file.UnmanagedDataId.Substring(0, file.UnmanagedDataId.IndexOf("]")); //NOXLATE
                             var rightpart = file.UnmanagedDataId.Substring(file.UnmanagedDataId.IndexOf("]") + 1); //NOXLATE
                             var item = "%MG_DATA_PATH_ALIAS" + leftpart + "]%" + rightpart; //NOXLATE
                             files.Add(item);
                             break;
                         }
                     }
                 }
             }
             DoUpdateConfiguration(files.ToArray(), new string[0], true);
         }
     }
 }
コード例 #4
0
ファイル: CompositeFileCtrl.cs プロジェクト: kanbang/Colt
 private void browseAliasedFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var picker = new UnmanagedFileBrowser(_service.ResourceService))
     {
         picker.AllowMultipleSelection = true;
         if (picker.ShowDialog() == DialogResult.OK)
         {
             DoUpdateConfiguration(picker.SelectedItems, new string[0], true);
         }
     }
 }
コード例 #5
0
ファイル: FileBasedCtrl.cs プロジェクト: kanbang/Colt
 private void btnBrowseAlias_Click(object sender, EventArgs e)
 {
     using (var picker = new UnmanagedFileBrowser(_service.ResourceService))
     {
         picker.Extensions = GetUnmanagedFileExtensions();
         picker.SelectFoldersOnly = false;
         if (picker.ShowDialog() == DialogResult.OK)
         {
             txtAlias.Text = picker.SelectedItem;
         }
     }
 }
コード例 #6
0
ファイル: GenericCtrl.cs プロジェクト: kanbang/Colt
        private void pickAnAliasedFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (grdConnectionParameters.SelectedCells.Count != 1)
                return;

            var cell = grdConnectionParameters.SelectedCells[0];

            using (var dlg = new UnmanagedFileBrowser(_service.ResourceService))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    cell.Value = dlg.SelectedItem;
                }
            }
        }
コード例 #7
0
ファイル: UnmanagedCtrl.cs プロジェクト: kanbang/Colt
 private void btnBrowseAlias_Click(object sender, EventArgs e)
 {
     using (var picker = new UnmanagedFileBrowser(_resSvc))
     {
         if (picker.ShowDialog() == DialogResult.OK)
         {
             txtFilePath.Text = picker.SelectedItem;
         }
     }
 }