Ejemplo n.º 1
0
        protected void GetChanges_Click(object sender, EventArgs e)
        {
            string absolutePath = HttpContext.Current.Server.MapPath(PathTextBox.Text);

            if (System.IO.Directory.Exists(absolutePath))
            {
                DirectoryManager.Directory currentDirectory = directoryStructure?.GetDirectory(PathTextBox.Text);
                if (currentDirectory != null)
                {
                    currentDirectory.SetCurrentFilesList();
                    List <DirectoryManager.File> filesAWithAction = currentDirectory.GetFilesWithAction();
                    FilesGridView.DataSource = filesAWithAction;
                    FilesGridView.DataBind();
                    FilesGridView.Visible = true;
                }
                else
                {
                    currentDirectory = new DirectoryManager.Directory(PathTextBox.Text);
                    directoryStructure.AddDirectory(currentDirectory);

                    InfoLabel.Visible     = true;
                    InfoLabel.Text        = $"Byl namapován nový adresář: {absolutePath}";
                    FilesGridView.Visible = false;
                }
                currentDirectory.SetFileHistory();
                ViewState["Data"] = directoryStructure;
            }
            else
            {
                InfoLabel.Visible = true;
                InfoLabel.Text    = $"Tento adresář nebyl nalezen: {absolutePath}";
            }
        }