Пример #1
0
 public void UpdateAll()
 {
   // Rebuild the thumbails.     
   string path = m_imageTools.GetPath(m_path);
   DirectoryWrapper directory = new DirectoryWrapper(path, m_imageTools);
   UpdateDirectory(directory);
 }
Пример #2
0
    private void UpdateDirectory(DirectoryWrapper directory)
    {
      foreach(ImageWrapper image in directory.Images)
        image.UpdateCache();

      foreach(SubDirectoryWrapper subDir in directory.Directories)
      {
        subDir.UpdateCache();
        DirectoryWrapper SubDir = new DirectoryWrapper(m_imageTools.GetPath(directory.VirtualPath) + "\\" + 
          subDir.Caption, m_imageTools);
        UpdateDirectory(SubDir);
      }
    }
Пример #3
0
		/// <summary>
		///  This creates a Table object with all the subdirectories in it
		/// </summary>
		/// <param name="x">Subdirectories wide</param>
		/// <param name="data">The directory to render</param>
		/// <param name="url">The URL to use in the links</param>
		/// <returns></returns>
		public static Table RenderDirectoryTable(int x, DirectoryWrapper data/*, string url*/, System.Web.UI.Control ctrl)
		{
			Table table = new Table();
			table.CellPadding = 10;
			table.CellSpacing = 10;
			table.Width = Unit.Percentage(100);

			TableRow tr = null;

			foreach ( SubDirectoryWrapper dir in data.Directories )
			{
				if ( tr == null ) tr = new TableRow();

				TableCell td = new TableCell();
				td.Attributes["align"] = "center";

				HyperLink h = new HyperLink();

				h.ImageUrl = dir.Src;
				h.CssClass = "LinkButton";
				h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + dir.HREF + ";0");
				h.Text = dir.Tooltip;

				td.Controls.Add(h);
				
				td.Controls.Add(BR);

				h = new HyperLink();
				h.CssClass = "LinkButton";
				h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "directory;" + dir.HREF + ";0");
				h.Text = dir.Caption;
				

				td.Controls.Add(h);

				tr.Cells.Add(td);

				if ( tr.Cells.Count == x )
				{
					table.Rows.Add(tr);
					tr = null;
				}
			}

			if ( tr != null ) table.Rows.Add(tr);

			return table;
		}
Пример #4
0
		/// <summary>
		/// This creates a Table object with all the thumbnails in it
		/// </summary>
		/// <param name="nofCols">Picture Columns</param>
		/// <param name="nofRows">Picture Rows</param>
		/// <param name="startIndex">index of the first displayed picture</param>
		/// <param name="data">The directory to render</param>
		/// <param name="url">The URL to use in the links</param>
		/// <returns></returns>
		public static Table RenderImageTable(int nofCols, int nofRows, int startIndex, DirectoryWrapper data, 
                                         System.Web.UI.Control ctrl)
		{
			Table table = new Table();
			table.Width = Unit.Percentage(100);

			TableRow tr = null;
      if(((data.Images.Count - 1) - startIndex) <= 0) // Are some pictures in this range?
        startIndex = 0;   // No.
      int lastIndex = System.Math.Min((data.Images.Count - 1), startIndex + nofCols * nofRows - 1);

      for(int index = startIndex; index <= lastIndex; index++)
			{
				if ( tr == null ) 
          tr = new TableRow();
        ImageWrapper image = data.Images[index] as ImageWrapper;
				HyperLink h = new HyperLink();
				h.ImageUrl = image.ThumbHref;
				h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "picture;" + data.VirtualPath + ";" + index);
				h.Text = image.Tooltip;
				h.CssClass = "LinkButton";

				Label lbText = new Label();
				lbText.Text = image.Caption;


				TableCell td = new TableCell();
				td.Attributes.Add("align", "center");
				td.Controls.Add(h);
				if(lbText.Text != "")
				{
					lbText.Text = @"<div align=""center"" width=""100%"">" + lbText.Text + @"</div>";
					td.Controls.Add(lbText);
				}
				tr.Cells.Add(td);

				if ( tr.Cells.Count == nofCols )
				{
					table.Rows.Add(tr);
					tr = null;
				}
			}

			if ( tr != null ) table.Rows.Add(tr);

			return table;
		}
        /// <summary>
        /// This creates a Table object with all the thumbnails in it
        /// </summary>
        /// <param name="x">Pictures wide</param>
        /// <param name="y">Puctures down (not used)</param>
        /// <param name="data">The directory to render</param>
        /// <param name="url">The URL to use in the links</param>
        /// <returns></returns>
        public static Table RenderImageTable(int x, int y, DirectoryWrapper data, /*string url*/System.Web.UI.Control ctrl)
        {
            Table table = new Table();
            table.Width = Unit.Percentage(100);

            TableRow tr = null;

            foreach ( ImageWrapper image in data.Images )
            {
                if ( tr == null ) tr = new TableRow();

                HyperLink h = new HyperLink();
                h.ImageUrl = image.ThumbHref;
                h.NavigateUrl = ctrl.Page.GetPostBackClientHyperlink(ctrl, "picture;" + image.FullImageHref);
                h.Text = image.Name;
                h.CssClass = "LinkButton";

                Label lbText = new Label();
                lbText.Text = image.Blurb;

                TableCell td = new TableCell();
                td.Attributes.Add("align", "center");
                td.Controls.Add(h);
                if(lbText.Text != "")
                {
                    lbText.Text = @"<div align=""center"" width=""100%"">" + lbText.Text + @"</div>";
                    td.Controls.Add(lbText);
                }
                tr.Cells.Add(td);

                if ( tr.Cells.Count == x )
                {
                    table.Rows.Add(tr);
                    tr = null;
                }
            }

            if ( tr != null ) table.Rows.Add(tr);

            return table;
        }