Ejemplo n.º 1
0
 static private void WritePhoto(StreamWriter sw, Photograph p)
 {
     sw.WriteLine(p.FileName);
     sw.WriteLine(p.Caption != null
     ? p.Caption : "");
     sw.WriteLine(p.DateTaken.ToString());
     sw.WriteLine(p.Photographer != null
     ? p.Photographer : "");
     sw.WriteLine(p.Notes != null
     ? p.Notes : "");
 }
Ejemplo n.º 2
0
        public void MoveItemForward(int index)
        {
            if (index < 0 || index > Album.Count - 1)
            {
                throw new IndexOutOfRangeException();
            }
            // Remove photo and reinsert at subsequent pos
            Photograph photo = Album[index];

            Album.RemoveAt(index);
            Album.Insert(index + 1, photo);
        }
Ejemplo n.º 3
0
        public void MoveItemBackward(int index)
        {
            if (index <= 0 || index >= Album.Count)
            {
                throw new IndexOutOfRangeException();
            }
            // Remove photo and reinsert at prior position
            Photograph photo = Album[index];

            Album.RemoveAt(index);
            Album.Insert(index - 1, photo);
        }
Ejemplo n.º 4
0
        public override bool Equals(object obj)
        {
            if (obj is Photograph)
            {
                Photograph p = (Photograph)obj;
                return(FileName.Equals(p.FileName,
                                       StringComparison.
                                       InvariantCultureIgnoreCase));
            }

            return(false);
        }
Ejemplo n.º 5
0
        static private Photograph ReadPhotoV63(StreamReader sr)
        {
            // Presume atthe start of photo
            string file = sr.ReadLine();

            if (file == null || file.Length == 0)
            {
                return(null);
            }
            // File not null, should find photo
            Photograph p = new Photograph(file);

            p.Caption = sr.ReadLine();
            p.DateTaken
                           = DateTime.Parse(sr.ReadLine());
            p.Photographer = sr.ReadLine();
            p.Notes        = sr.ReadLine();
            return(p);
        }