Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

Context.cs

using System;
using System.Collections;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Xml;

namespace FlickrNet
{
      /// <summary>
      /// The context of the current photo, as returned by
      /// <see cref="Flickr.PhotosGetContext"/>,
      /// <see cref="Flickr.PhotosetsGetContext"/>
      ///  and <see cref="Flickr.GroupPoolGetContext"/> methods.
      /// </summary>
00015       public class Context
      {
            /// <summary>
            /// The number of photos in the current context, e.g. Group, Set or photostream.
            /// </summary>
00020             public long Count;
            /// <summary>
            /// The next photo in the context.
            /// </summary>
00024             public ContextPhoto NextPhoto;
            /// <summary>
            /// The previous photo in the context.
            /// </summary>
00028             public ContextPhoto PreviousPhoto;
      }

      /// <summary>
      /// Temporary class used to excapsulate the context count property.
      /// </summary>
      [System.Serializable]
00035       public class ContextCount
      {
            /// <summary>
            /// Default constructor.
            /// </summary>
00040             public ContextCount()
            {
            }

            /// <summary>
            /// The number of photos in the context.
            /// </summary>
            [XmlText()]
00048             public long Count;
      }

      /// <summary>
      /// The next (or previous) photo in the current context.
      /// </summary>
      [System.Serializable]
00055       public class ContextPhoto
      {
            /// <summary>
            /// The id of the next photo. Will be "0" if this photo is the last.
            /// </summary>
            [XmlAttribute("id", Form=XmlSchemaForm.Unqualified)]
00061             public string PhotoId;

            /// <summary>
            /// The secret for the photo.
            /// </summary>
            [XmlAttribute("secret", Form=XmlSchemaForm.Unqualified)]
00067             public string Secret;

            /// <summary>
            /// The title of the next photo in context.
            /// </summary>
            [XmlAttribute("title", Form=XmlSchemaForm.Unqualified)]
00073             public string Title;

            /// <summary>
            /// The URL, in the given context, for the next or previous photo.
            /// </summary>
            [XmlAttribute("url", Form=XmlSchemaForm.Unqualified)]
00079             public string Url;

            /// <summary>
            /// The URL for the thumbnail of the photo.
            /// </summary>
            [XmlAttribute("thumb", Form=XmlSchemaForm.Unqualified)]
00085             public string Thumbnail;
      }

      /// <summary>
      /// All contexts that a photo is in.
      /// </summary>
00091       public class AllContexts
      {
            private ContextSet[] _sets;
            private ContextGroup[] _groups;

            /// <summary>
            /// An array of <see cref="ContextSet"/> objects for the current photo.
            /// </summary>
            public ContextSet[] Sets
00100             {
                  get { return _sets; }
            }

            /// <summary>
            /// An array of <see cref="ContextGroup"/> objects for the current photo.
            /// </summary>
            public ContextGroup[] Groups
00108             {
                  get { return _groups; }
            }

            internal AllContexts(XmlElement[] elements)
            {
                  ArrayList sets = new ArrayList();
                  ArrayList groups = new ArrayList();

                  foreach(XmlElement element in elements)
                  {
                        if( element.Name == "set" )
                        {
                              ContextSet aset = new ContextSet();
                              aset.PhotosetId = element.Attributes["id"].Value;
                              aset.Title = element.Attributes["title"].Value;
                              sets.Add(aset);
                        }

                        if( element.Name == "pool" )
                        {
                              ContextGroup agroup = new ContextGroup();
                              agroup.GroupId = element.Attributes["id"].Value;
                              agroup.Title = element.Attributes["title"].Value;
                              groups.Add(agroup);
                        }
                  }

                  _sets = new ContextSet[sets.Count];
                  sets.CopyTo(_sets);

                  _groups = new ContextGroup[groups.Count];
                  groups.CopyTo(_groups);
            }
      }

      /// <summary>
      /// A set context for a photo.
      /// </summary>
00147       public class ContextSet
      {
            /// <summary>
            /// The Photoset ID of the set the selected photo is in.
            /// </summary>
00152             public string PhotosetId;
            /// <summary>
            /// The title of the set the selected photo is in.
            /// </summary>
00156             public string Title;
      }

      /// <summary>
      /// A group context got a photo.
      /// </summary>
00162       public class ContextGroup
      {
            /// <summary>
            /// The Group ID for the group that the selected photo is in.
            /// </summary>
00167             public string GroupId;
            /// <summary>
            /// The title of the group that then selected photo is in.
            /// </summary>
00171             public string Title;
      }
}

Generated by  Doxygen 1.6.0   Back to index