/[AnywhereTS-MSSQL]/trunk/TSAdminTool/frmAddTFTP.cs
ViewVC logotype

Diff of /trunk/TSAdminTool/frmAddTFTP.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/TSAdminTool/frmAddTFTP.cs	2012/07/12 14:17:14	46
+++ trunk/TSAdminTool/frmAddTFTP.cs	2012/07/16 12:58:43	180
@@ -6,6 +6,7 @@
 using System.Text;
 using System.Windows.Forms;
 using System.IO;
+using System.Threading;
 
 namespace AnywhereTS
 {
@@ -56,38 +57,29 @@
                 textInput.Focus();
                 return;
             }
-            
+
             DialogResult = DialogResult.OK;
         }
 
+
+        string tftp_path = string.Empty;
         private void btnBrowse_Click(object sender, EventArgs e)
         {
-        // Show the FolderBrowserDialog.
-
-        Rebrowse:
+            var t = new Thread(new ThreadStart(CreateFolderBrowser));
+            t.IsBackground = true;
+            t.SetApartmentState(ApartmentState.STA);
+            t.Start();
+            while (t.IsAlive) { Application.DoEvents(); }
+            textInput.Text = tftp_path;
+            textInput.Select();
+        }
+        private void CreateFolderBrowser()
+        {
+            folderBrowserDialog = new FolderBrowserDialog();
+            folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer;
             DialogResult result = folderBrowserDialog.ShowDialog();
-            if (result == DialogResult.OK)
-            {
-                string strPath = string.Empty; // The path provided by the user 
-
-                // Browse to a folder by displaying the folder browse Dialog
-                try
-                {
-                    strPath = folderBrowserDialog.SelectedPath.Trim();
-                }
-                catch (NotSupportedException)
-                {   // User has browsed to a non folder
-                    MessageBox.Show("Object is not a file folder.");
-                    using (log4net.NDC.Push(string.Format("path={0}", strPath)))
-                    {
-                        Logging.ATSAdminLog.Warn("Object is not a file folder.");
-                    }
-                    goto Rebrowse;
-                }
-                textInput.Text = strPath;
-                textInput.Select();
-            }
-
+            if (result != DialogResult.OK) return;
+            tftp_path = folderBrowserDialog.SelectedPath.Trim();
         }
 
         private void frmAddTFTP_Load(object sender, EventArgs e)

 

  ViewVC Help
Powered by ViewVC 1.1.22