Example #1
0
        public void LoadShow(string aWorkingFolder, string aXmlFile)
        {
            // Load a new slide show, discarding any previous one
            this.Text      = aXmlFile;
            iSlideShow     = new SlideShow();
            iWorkingFolder = aWorkingFolder;
            string fullPath = Path.Combine(iWorkingFolder, aXmlFile);

            iSlideShow.Load(fullPath);
            InitialiseShow();
        }
Example #2
0
        public void LoadShow(string aWorkingFolder, string aXmlFile)
        {
            // Load a new slide show, discarding any previous one
            this.Text      = aXmlFile;
            iSlideShow     = new SlideShow();
            iWorkingFolder = aWorkingFolder;
            string fullPath = Path.Combine(iWorkingFolder, aXmlFile);

            iSlideShow.Load(fullPath);

            // Transition slides on timer tick: artificial tick to display the first slide
            iEndOfShow = false;
            transitionTimer.Enabled = true;
            timer1_Tick(null, null);
        }
Example #3
0
        private void addExistingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int currentItem = eventsListBox.SelectedIndex;

            if ((currentItem < 0) || (currentItem >= eventsListBox.Items.Count))
            {
                // Not a valid selection, but cater for the special case in which there
                // is an empty EventList, hence nothing to select, but we do want to allow
                // an event to be added.
                if (iEventList.Count == 0)
                {
                    currentItem = 0;
                }
                else
                {
                    // Not a valid selection - don't allow event to be added
                    return;
                }
            }

            openSlideShowDialog.InitialDirectory = Path.GetDirectoryName(iEventList.Path);
            DialogResult res = openSlideShowDialog.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                string    slideShowPath = openSlideShowDialog.FileName;
                SlideShow newShow       = new SlideShow();
                newShow.Load(slideShowPath);

                // Let the user title the slide show: but recall the existing full title
                SlideShowTitleForm titleForm = new SlideShowTitleForm(newShow.Title);
                DialogResult       result    = titleForm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    // Save titled slide show to XML file
                    newShow.Title = titleForm.FullTitle;

                    iEventList.Insert(currentItem, titleForm.BriefTitle, newShow);
                    iEventListChanged = true;       // Remember that an edit has taken place

                    // Repopulate the listbox with the new longer event list
                    PopulateEventsListBox(true);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Apply properties to a single slide show in the specified folder
        /// </summary>
        void ApplyPropertiesToSlideshow(string aSlideShowPath)
        {
            //MessageBox.Show( "Applying album data to image properties for a slide show: " + filename );
            SlideShow slideShow = new SlideShow();

            slideShow.Load(aSlideShowPath);
            foreach (Slide slide in slideShow.Slides)
            {
                string directory       = Path.GetDirectoryName(aSlideShowPath);
                string fullPathToSlide = Path.Combine(directory, slide.Path);
                string baseFileName    = Path.GetFileNameWithoutExtension(slide.Path);
                //string operation = "Set Date/Time to: " + baseFileName;
                //operation += Environment.NewLine;
                //operation += "Set title/caption to: " + slideShow.Title;
                //operation += Environment.NewLine;
                //operation += "Set comments to: " + string.Join( Environment.NewLine, slide.Comments() );

                //// USE THE METADATA CLASS TO APPLY THESE CHANGES TO THE IMAGE
                //MessageBox.Show( operation, "Apply properties to: " + slide.Path );

                // Some files are not date-named. Ideally we would like at least a year.
                DateTime actualDateTime = new DateTime();
                bool     isDateNamed    = IsDateNamed(new FileInfo(baseFileName));
                MetaData metaData       = new MetaData(fullPathToSlide);
                if (isDateNamed)
                {
                    actualDateTime = MakeDateTimeFromName(baseFileName);
                    metaData.ApplyPropertyItem("DateTime", actualDateTime.ToString());
                }
                metaData.ApplyPropertyItem("ImageTitle", slideShow.Title);
                metaData.ApplyPropertyItem("ImageDescription", string.Join(Environment.NewLine, slide.Comments()));
                metaData.ApplyPropertyItem("ExifUserComment", string.Join(Environment.NewLine, slide.Comments()));

                metaData.Save();

                if (isDateNamed)
                {
                    // Want one or both of these
                    File.SetCreationTime(fullPathToSlide, actualDateTime);
                    File.SetLastWriteTime(fullPathToSlide, actualDateTime);
                }
            }
        }
Example #5
0
        // Load the events from an XML document
        public bool Load()
        {
            // Start with empty EventsList
            iEventList = new List <Event>();

            if (!File.Exists(iFilePath))
            {
                MessageBox.Show("Cannot load " + iFilePath + " - no such file", "EventList");
                return(false);
            }

            XmlSerializer s = new XmlSerializer(typeof(EventList));
            TextReader    r = new StreamReader(iFilePath);

            // Wanted to say "this = s.Deserialize(r)", but it is illegal.
            // Instead load EventList into "loaded" and transcribe to "this".
            EventList loaded = s.Deserialize(r) as EventList;

            iTitle     = loaded.Title;
            iEventList = loaded.Events;
            iCurrent   = -1;
            r.Close();

            // Loaded the event list. Recurse to load each slide show.
            foreach (Event happening in iEventList)
            {
                if (happening.Path != null)
                {
                    SlideShow slideShow = new SlideShow();
                    slideShow.Load(happening.Path);
                }
            }

            iLoaded = true;
            return(true);
        }