Пример #1
0
        public static Album LoadFromFile(string filename)
        {
            Album album = new Album();

            album.Filename = filename;

            string jsonString;

            jsonString = File.ReadAllText(filename);
            JsonConvert.PopulateObject(jsonString, album);
            if (Convert.ToDouble(album.version) > CONFIG_VERSION)
            {
                throw new InvalidOperationException("Album File version is newer than this version of the program");
            }
            Slides slides = album.slides;

            slides.SetBasePath(album.basePath);

            for (int i = slides.Count - 1; i >= 0; i--)
            {
                if (!File.Exists(slides[i].fileName))
                {
                    MessageBox.Show("File Not Found: " + slides[i].fileName, "File Not Found");
                    slides.RemoveAt(i);
                }
            }
            return(album);
        }
Пример #2
0
 private void playSlideClick(object sender, RoutedEventArgs e)
 {
     if (album.Valid())
     {
         Slides oneSlide = new Slides();
         oneSlide.Add(currentSlide);
         AnimationWindow animationWindow = new AnimationWindow();
         animationWindow.Show();
         animationWindow.animate(oneSlide);
     }
 }
Пример #3
0
        public Album(Slides _slides, string _soundtrack, string _filename)
        {
            Filename   = _filename;
            slides     = _slides;
            Soundtrack = _soundtrack;
            if (!string.IsNullOrEmpty(Filename) && Filename != "untitled")
            {
                basePath = Path.GetDirectoryName(Filename);
            }

            version = CONFIG_VERSION;
        }
Пример #4
0
        private bool loadIt(string filename)
        {
            Album old_album = album;  // just in case

            try {
                album = Album.LoadFromFile(filename);
            } catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
            slides = album.slides;

            lastSavedAlbum = album.ToJson();
            this.Title     = "KB30 - " + album.Filename;
            return(true);
        }
Пример #5
0
 public void animate(Slides _slides, int _start = 0, String _soundtrack = "")
 {
     slides.Clear();
     foreach (Slide slide in _slides)
     {
         if (slide.keys.Count == 1 && slide.keys[0].duration == 0)
         {
             slide.keys[0].duration = 0.1;
         }
         slides.Add(slide);
     }
     if (slides.Count == 0)
     {
         MessageBox.Show("At least one slide must have non-zero duration.");
         exitOnClose = true;
         this.Close();
         return;
     }
     soundtrack = _soundtrack;
     startAnimation(_start);
 }