private void ExecuteOpenImageFile() { System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Filter = "PNG Files (.png)|*.png|JPG Files (.jpg)|*.jpg|JPEG Files (.jpeg)|*.jpeg|All Files (*.*)|*.*"; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.Image NewImage = new Model.Image(openFileDialog.FileName); ImageList.Add(NewImage); XMLMedia XMLImage = new XMLMedia(); XMLImage.LoadXML("Image.xml"); XMLImage.AddMedia(NewImage); XMLImage.WriteXML("Image.xml"); } }
private void ExecuteOpenMusicFile() { System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Filter = "MP3 Files (.mp3)|*.mp3|All Files (*.*)|*.*"; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.Music NewMusic = new Model.Music(openFileDialog.FileName); MusicList.Add(NewMusic); XMLMedia XMLMusic = new XMLMedia(); XMLMusic.LoadXML("Music.xml"); XMLMusic.AddMedia(NewMusic); XMLMusic.WriteXML("Music.xml"); } }
private void ExecuteOpenVideoFile() { System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Filter = "MP4 Files (.mp4)|*.mp4|WMV Files (.wmv)|*.wmv"; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.Video NewVideo = new Model.Video(openFileDialog.FileName); VideoList.Add(NewVideo); XMLMedia XMLVideo = new XMLMedia(); XMLVideo.LoadXML("Video.xml"); XMLVideo.AddMedia(NewVideo); XMLVideo.WriteXML("Video.xml"); } }
/* LOAD VIDEO FROM XML */ private void LoadVideosFromXML() { XMLMedia XMLVideo = new XMLMedia(); XMLVideo.LoadXML("Video.XML"); List<String> videoList = XMLVideo.ExtractMedias(); foreach (var video in videoList) { var DirectoriesVideos = from DirectoryVideo in VideoList where DirectoryVideo.Path == video select DirectoryVideo; if (DirectoriesVideos.Count() == 0) { VideoList.Add(new Model.Video(video)); } } }
/* LOAD IMAGES FROM XML */ private void LoadImagesFromXML() { XMLMedia XMLImage = new XMLMedia(); XMLImage.LoadXML("Image.XML"); List<String> imagesList = XMLImage.ExtractMedias(); foreach (var image in imagesList) { var DirectoriesImages = from DirectoryImage in ImageList where DirectoryImage.Path == image select DirectoryImage; if (DirectoriesImages.Count() == 0) { ImageList.Add(new Model.Image(image)); } } }
/* LOAD IMAGE FROM XML */ private void LoadMusicsFromXML() { XMLMedia XMLMusic = new XMLMedia(); XMLMusic.LoadXML("Music.XML"); List<String> musicList = XMLMusic.ExtractMedias(); foreach (var music in musicList) { var DirectoriesMusics = from DirectoryMusic in MusicList where DirectoryMusic.Path == music select DirectoryMusic; if (DirectoriesMusics.Count() == 0) { MusicList.Add(new Model.Music(music)); } } }