Пример #1
0
        private Boolean LoadDirectory(String directory)
        {
            if (!directory.StartsWith("/"))
            {
                System.Windows.Forms.MessageBox.Show("您输入的路径无效!", "VFS", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                return(false);
            }
            if (!directory.EndsWith("/"))
            {
                directory += "/";
            }
            currentDirectory = directory;
            textboxPath.Text = directory;

            try
            {
                var dir  = vfs.NewDirectory(directory);
                var list = dir.List();
                listView.Items.Clear();
                foreach (var info in list)
                {
                    listView.Items.Add(new DirectoryItem(info));
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message, "VFS", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                return(false);
            }

            return(true);
        }