using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AjaxControlToolkit;
using System.IO;
using System.Collections.Generic;


public partial class _Default : System.Web.UI.Page 
{
    protected AccordionPane pane;
    protected SlideShowExtender sse;
    protected Button Btn_Next2;
    protected Button Btn_Play2;
    protected Button Btn_Previous2;
    protected Label lblImageDescription2;
    protected Image Image12;
    protected int i;

    protected void Page_Load(object sender, EventArgs e)
    {
        i = -1;

        DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory.ToString() + "picGallery/images/");
        DirectoryInfo[] tempdi = di.GetDirectories();
        foreach (DirectoryInfo dirinfo in tempdi)
        {


            i++;
         




        pane = new AccordionPane();
        pane.HeaderContainer.Controls.Add(new LiteralControl("server: " + dirinfo.ToString()));


        sse = new SlideShowExtender();


        Btn_Next2 = new Button();
        Btn_Next2.Width = 64;
        Btn_Next2.Height = 26;
        Btn_Next2.Text = "Next";
        Btn_Next2.ID = UniqueID + "11481";

        Btn_Previous2 = new Button();
        Btn_Previous2.ID = UniqueID + "11851";
        Btn_Previous2.Width = 62;
        Btn_Previous2.Height = 25;
        Btn_Previous2.Text = "Previous";



        Btn_Play2 = new Button();
        Btn_Play2.ID = UniqueID + "11521";

        sse.AutoPlay = true;
        lblImageDescription2 = new Label();
        lblImageDescription2.ID = UniqueID + "11191";
        sse.ImageDescriptionLabelID = UniqueID + "11191";
        sse.Loop = true;
        sse.AutoPlay = false;

        sse.NextButtonID = UniqueID + "11481";
        sse.PreviousButtonID = UniqueID + "11851";

        sse.PlayButtonID = UniqueID + "11521";
        sse.PlayButtonText = "Play";

        //sse.SlideShowServicePath = "webs.asmx";
        sse.SlideShowServiceMethod = "GetSlides1";
        sse.ContextKey = i.ToString();

        sse.StopButtonText = "Stop";
        Image12 = new Image();
        Image12.Height = 316;
        Image12.Width = 388;
        Image12.ID = UniqueID + "11641";
        Image12.ImageAlign = ImageAlign.Left;
        sse.TargetControlID = UniqueID + "11641";

        pane.ContentContainer.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
        pane.ContentContainer.Controls.Add(lblImageDescription2);
        pane.ContentContainer.Controls.Add(new LiteralControl("</br>"));
        pane.ContentContainer.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
        pane.ContentContainer.Controls.Add(Btn_Previous2);
        pane.ContentContainer.Controls.Add(Btn_Play2);
        pane.ContentContainer.Controls.Add(Btn_Next2);
        pane.ContentContainer.Controls.Add(Image12);

        PlaceHolder ph = new PlaceHolder();            
            
            Label l = new Label();
        
            l.Text = "";
        List<string> result = new List<string>();
        StreamReader re;
        using (re = new StreamReader(AppDomain.CurrentDomain.BaseDirectory.ToString() + dirinfo.Parent.Parent + "/" + dirinfo.Parent + "/" + dirinfo.Name + "/" + dirinfo.Name + ".txt", new System.Text.UTF7Encoding()))
        {
            string input = null;
            while ((input = re.ReadLine()) != null)
            {
                result.Add(input);
            }
            re.Close();
        }

        foreach (string s in result)
            l.Text += s;

        ph.Controls.Add(l);



        pane.ContentContainer.Controls.Add(ph);
        //pane.ContentContainer.Controls.Add(new LiteralControl("</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>"));
        //pane.ContentContainer.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));



        
        pane.ContentContainer.Controls.Add(sse);

        MyAccordion1.Controls.Add(pane);


        



        }  


        //AccordionPane pane = new AccordionPane();
       // pane.HeaderContainer.Controls.Add(new LiteralControl("server side"));
       //// pane.ContentContainer.Controls.Add(new LiteralControl("test"));
       // MyAccordion1.Controls.Add(pane);



       // pane.HeaderContainer.Controls.Add(new LiteralControl("work server"));

       //// SlideShowExtender sse = new SlideShowExtender();



       // Button Btn_Next = new Button();
       // Btn_Next.ID = "Btn_Previous1";
       // Button Btn_Play = new Button();
       // Btn_Play.ID = "Btn_Play10";
       // Button Btn_Previous = new Button();
       // Btn_Previous.ID = "Btn_Previous1";
       // sse.AutoPlay = true;
       // Label lblImageDescription = new Label();
       // lblImageDescription.ID = "lblImageDescription1";
        
       // sse.ImageDescriptionLabelID = "lblImageDescription1";
       // sse.Loop = true;
                       // sse.EnableViewState = true;
                       // sse.UseContextKey = true;
       // sse.NextButtonID = "Btn_Next1";
       // sse.PlayButtonID = "Btn_Play10";
       // sse.PlayButtonText = "Play1";
       // sse.PreviousButtonID = "Btn_Previous1";
       // sse.SlideShowServiceMethod = "GetSlides";

       // sse.StopButtonText = "Stop";
        
       // Image10.ID = "Image10";

                               // Image10.ImageUrl = "images/Winter.jpg";
                                // Image10.Height = 316;
                           // Image10.Width = 388;
                              // Image10.Visible = true;
                            // Image10.EnableViewState = true;
                               // Image10.BorderColor = System.Drawing.Color.Black;
                             // Image10.BorderStyle = BorderStyle.Ridge;
       // sse.TargetControlID = Image10.ID;

       // pane.ContentContainer.Controls.Add(sse);
       // MyAccordion1.Controls.Add(pane);

        
        //Response.Write(
        //      "<asp:Image ID=" + '"' + "Image11" + '"' + "runat=" + '"' + "server" + '"' + "Height=" + '"' + "316px" + '"' + "Width=" + '"' + "388px" + '"' +
        //        "BorderColor=" + '"' + "Black" + '"' + "BorderStyle=" + '"' + "Ridge" + '"' + " /><br />" +

        //    "<asp:Button ID=" + '"' + "Btn_Play10" + '"' + "runat=" + '"' + "server" + '"' + "Text=" + '"' + "Button" + '"' + " />");
      





        
        //new LiteralControl(
            //"<h2 style=" + '"' + "text-align: center" + '"' + ">Slide Gallery</h2>" +
            
           // "<asp:ScriptManager ID=" + '"' + "ScriptManager2" + '"' + "runat=" + '"' + "server" + '"' + " />" +
        
            //"<asp:Image ID=" + '"' + "Image1" + '"' + "runat=" + '"' + "server" + '"' + "Height=" + '"' + "316px" + '"' + "Width=" + '"' + "388px" + '"' + 
            //    "BorderColor=" + '"' + "Black" + '"' + "BorderStyle=" + '"' + "Ridge" + '"' + "/><br />" +
            //    "<br />" +             
            //    "<asp:Label ID=" + '"' + "lblImageDescription" + '"' + "runat=" + '"' + "server" + '"' + "/><br />" +
            //    "<br />" +   
            //"<asp:Button ID=" + '"' + "Btn_Previous" + '"' + "runat=" + '"' + "server" + '"' + "Text=" + '"' + "Previous" + '"' + "/>" +
            //"<asp:Button ID=" + '"' + "Btn_Next" + '"' + "runat=" + '"' + "server" + '"' + "Text=" + '"' + "Next" + '"' + "Width=" + '"' + "64px" + '"' + "/><br />" + 
            //"<br />" +
            //"<asp:Button ID=" + '"' + "Btn_Play" + '"' + "runat=" + '"' + "server" + '"' + "Text=" + '"' + "Play" + '"' + " /><br />" +
            
            
            //"<cc1:SlideShowExtender ID=" + '"' + "SlideShowExtender1" + '"' + "AutoPlay=" + '"' + "true" + '"' + "ImageDescriptionLabelID=" + '"' + "lblImageDescription" + '"' + "Loop=" + '"' + "true" + '"' + "NextButtonID=" + '"' + "Btn_Next" + '"' + "PlayButtonID=" + '"' +"Btn_Play" + '"' + "PlayButtonText=" + '"' + "Play" + '"' + "PreviousButtonID=" + '"' + "Btn_Previous" + '"' + "SlideShowServiceMethod=" + '"' + "GetSlides" + '"' + "StopButtonText=" + '"' + "Stop" + '"' + "TargetControlID=" + '"' + "Image1" + '"' + "runat=" + '"' + "server" + '"' + "></cc1:SlideShowExtender>"));
       
           // MyAccordion.Controls.Add(pane);
    }
}