public Media add_Media(Media m) { XElement newEl = new XElement("Media", new XElement("Title", m.Title), new XElement("Duration", m.Duration), new XElement("Type", m.Type), new XElement("Path", m.Path)); core.Add(newEl); list_media.Add(m); return m; }
//SI ADD MEDIA tu creer un MEDIA et tu fais un ADD MEDIA public Media create_Media(String Title, String Duration, String Type, String Path) { media = new Media(); media.Title = Title; media.Duration = Duration; media.Type = Type; media.Path = Path; // add_Media(); return media; }
private void add_To_Lib(Media m) { if (m.Type == "video") VideoCollection.Add(m); else if (m.Type == "music") MusicCollection.Add(m); else if (m.Type == "image") ImageCollection.Add(m); }
private Media set_File_Info(String filename, String type) { Console.WriteLine("Filename = "+ filename); Media m = new Media(); m.Path = filename; m.Type = type; Console.WriteLine("Path = "+ m.Path); tagFile = TagLib.File.Create(filename); m.Title = tagFile.Tag.Title; if (tagFile.Tag.Title == null) { m.Title = System.IO.Path.GetFileNameWithoutExtension(filename); } m.media = new MediaElement(); m.media.LoadedBehavior = MediaState.Manual; m.media.UnloadedBehavior = MediaState.Manual; m.media.Source = new Uri(filename); if (type == "music" || type == "video" || type == "image") m.media.MediaOpened += new RoutedEventHandler(MediaOpened); m.media.Pause(); //TimeSpan ts = s.media.NaturalDuration.TimeSpan; //if (ts.Seconds < 10 && ts.Minutes < 10) // m.Duration = ts.Hours + ":0" + ts.Minutes + ":0" + ts.Seconds; //else if (ts.Seconds < 10 && ts.Minutes >= 10) // m.Duration = ts.Hours + ":" + ts.Minutes + ":0" + ts.Seconds; //else if (ts.Seconds >= 10 && ts.Minutes < 10) // m.Duration = ts.Hours + ":0" + ts.Minutes + ":" + ts.Seconds; //else if (ts.Seconds >= 10 && ts.Minutes >= 10) // m.Duration = ts.Hours + ":" + ts.Minutes + ":" + ts.Seconds; Console.WriteLine("HELLO"); Console.WriteLine("Title = " + m.Title); Console.WriteLine("Duration = "+ m.Duration); return m; }