private void RefreshFileList() { lstDirectory.Items.Clear(); if (!(_CurrentPath == "" || _CurrentPath == "/")) { lstDirectory.Items.Add(LBracket + ".." + RBracket); } CloseComm(); Cursor.Current = Cursors.WaitCursor; List <string> dir = _ESP.GetDir(_CurrentPath, LBracket, RBracket); if (dir.Count == 1 && dir[0].Length > 15) { dir = _ESP.GetDir(_CurrentPath, LBracket, RBracket); Cursor.Current = Cursors.Default; } foreach (string entry in dir) { lstDirectory.Items.Add(entry); } lblCurrentDirectory.Text = (_CurrentPath == "") ? "/" : _CurrentPath; AllowEditing(); }
private void RefreshFileList() { lstDirectory.Items.Clear(); if (!(_CurrentPath == "" || _CurrentPath == "/")) { lstDirectory.Items.Add(LBracket + ".." + RBracket); } Cursor.Current = Cursors.WaitCursor; List <string> dir = null; bool passed = false; try { dir = _ESP.GetDir(_CurrentPath, LBracket, RBracket); passed = true; } catch (Exception ex) { Debug.WriteLine("RefreshFileList() Exception: " + ex.Message); } if (!passed) { Application.DoEvents(); dir = _ESP.GetDir(_CurrentPath, LBracket, RBracket); } Cursor.Current = Cursors.Default; int folderCount = 0; int fileCount = 0; foreach (string entry in dir) { lstDirectory.Items.Add(entry); if (entry.StartsWith(LBracket) && entry.EndsWith(RBracket)) { folderCount++; } else { fileCount++; } } lblFolderCount.Text = folderCount.ToString(); lblFileCount.Text = fileCount.ToString(); lblCurrentDirectory.Text = (_CurrentPath == "") ? "/" : _CurrentPath; }
private void RefreshFileList() { lstDirectory.Items.Clear(); if (!(_CurrentPath == "" || _CurrentPath == "/")) { lstDirectory.Items.Add(LBracket + ".." + RBracket); } CloseComm(); Cursor.Current = Cursors.WaitCursor; List <string> dir = null; bool passed = false; try { dir = _ESP.GetDir(_CurrentPath, LBracket, RBracket); passed = true; } catch (Exception ex) { Debug.WriteLine("RefreshFileList() Exception: " + ex.Message); } if (!passed) { Application.DoEvents(); dir = _ESP.GetDir(_CurrentPath, LBracket, RBracket); } Cursor.Current = Cursors.Default; foreach (string entry in dir) { lstDirectory.Items.Add(entry); } lblCurrentDirectory.Text = (_CurrentPath == "") ? "/" : _CurrentPath; AllowEditing(); }