Exemple #1
0
        /// <summary>
        /// Saves the picture and adds it to the picture explorer
        /// </summary>
        private void save()
        {
            string _pathname = DateTime.Now.ToString("yyyyMMdd_hhmmss");

            _bitmap.Save("./" + _pathname + ".png", ImageFormat.Png);
            _changed      = false;
            _editedImg[0] = System.IO.Path.GetFullPath("./" + _pathname + ".png");
            PictureControl.AddImages(_editedImg);
        }
Exemple #2
0
        /// <summary>
        /// Parses a loadable Datastore xml-schemed file. And sets its value to the current Datastore
        /// </summary>
        /// <param name="fileName">The path of the xml-schmed file</param>
        public void LoadFrom(string fileName)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.AppStarting;
                DataContractSerializer serializer = new DataContractSerializer(typeof(DataStore));
                DataStore ds;
                using (Stream s = File.OpenRead(fileName))
                {
                    ds = (DataStore)serializer.ReadObject(s);
                }

                if (ds.ExportData != null)
                {
                    ExportData            = new ExportData(_timeline, _statusBar, ds.ExportData.Resolution, ds.ExportData.FPS);
                    ExportData.Bitrate    = ds.ExportData.Bitrate;
                    ExportData.ExportPath = ds.ExportData.ExportPath;
                }

                _pictureExplorer.Reset();
                _musicExplorer.Reset();
                _timeline.PictureElements.Clear();
                _timeline.MusicElements.Clear();

                //Remove Music End Elements
                List <UIElement> toRemove = new List <UIElement>();
                foreach (UIElement child in _timeline.MainCanvas.Children)
                {
                    if (child.GetType() == typeof(TlMusikElementEnde))
                    {
                        toRemove.Add(child);
                    }
                }
                foreach (UIElement element in toRemove)
                {
                    _timeline.MainCanvas.Children.Remove(element);
                }
                _timeline.EndElements.Clear();

                _timeline.MainScrollbar.ScrollToRightEnd();

                foreach (string musicPath in ds._musicPaths)
                {
                    _musicExplorer.AddMusic(musicPath);
                }

                foreach (TimelinePictureElementData elData in ds._timelinePictureData)
                {
                    _timeline.AddPictureElement(elData.StartTime, elData.EndTime, elData.Thumbnail, elData.TransitionID, elData.TransitionExecutionTime, -1);
                }

                foreach (TimelineMusicElementData elData in ds._timelineMusicData)
                {
                    _timeline.AddMusicElement(elData.MusicPath);
                }

                Canvas.SetLeft(_timeline.tlMarker, ds._tlMarkerPos);

                _pictureExplorer.AddImages(ds._picturePaths.ToArray());
            } catch (Exception)
            {
                MessageBox.Show("Error while loading file " + fileName + ". File could not be loaded!", "Error opening project", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Mouse.OverrideCursor = null;
        }