public void UpdateMedia(Media FinalMedia) { DataTable table = _MCDB.Tables["csv"]; DataRow[] foundRows; foundRows = table.Select("ID = " + FinalMedia.GetID().ToString()); DataRow DR = foundRows[0]; DR["Type"] = FinalMedia.GetType().Name; DR["Name"] = FinalMedia.GetName(); DR["Path"] = FinalMedia.GetPath(); DR["Size"] = FinalMedia.GetSize(); DR["Rating"] = FinalMedia.GetRating(); DR["AudioType"] = ""; DR["IsHD"] = ""; if (FinalMedia.GetType().Name.Equals("Video")) { DR["IsHD"] = ((Video)FinalMedia).IsHD(); } if (FinalMedia.GetType().Name.Equals("Audio")) { DR["AudioType"] = ((Audio)FinalMedia).GetAudioType(); } }
//This is the constructor called in case of a Media Edit, meaning we need to fill the contents public MediaWindow(Media editMedia) { InitializeComponent(); MediaLabel.Content = "Edit Media"; Submit.Content = "Save"; Submit.IsEnabled = true; MediaIDLabel.Visibility = System.Windows.Visibility.Visible; MediaID.Text = editMedia.GetID().ToString(); MediaID.Visibility = System.Windows.Visibility.Visible; MediaName.Text = editMedia.GetName(); MediaPath.Text = editMedia.GetPath(); MediaSize.Text = editMedia.GetSize(); MediaRating.Value = editMedia.GetRating(); if (editMedia.GetType().Name.Equals("Video")) { MediaVideoQualityLabel.IsEnabled = true; MediaVideoQuality.IsEnabled = true; MediaVideoQuality.IsChecked = ((Video)(editMedia)).IsHD(); _mediaType = MediaType.Video; } else if (editMedia.GetType().Name.Equals("Audio")) { MediaAudioType.Text = ((Audio)(editMedia)).GetAudioType().ToString(); _mediaType = MediaType.Audio; } else if (editMedia.GetType().Name.Equals("Image")) { _mediaType = MediaType.Image; } _edit = true; }
public void AddMedia(Media FinalMedia) { DataTable table = _MCDB.Tables["csv"]; DataRow DR = table.NewRow(); DR["ID"] = Int32.Parse(((String)table.Compute("Max(ID)", String.Empty))) + 1; DR["Type"] = FinalMedia.GetType().Name; DR["Name"] = FinalMedia.GetName(); DR["Path"] = FinalMedia.GetPath(); DR["Size"] = FinalMedia.GetSize(); DR["Rating"] = FinalMedia.GetRating(); if (FinalMedia.GetType().Name.Equals("Video")) { DR["IsHD"] = ((Video)FinalMedia).IsHD(); } if (FinalMedia.GetType().Name.Equals("Audio")) { DR["AudioType"] = ((Audio)FinalMedia).GetAudioType(); } table.Rows.Add(DR); }
public void AddMedia(Media FinalMedia) { DataTable table = _MCDB.Tables["csv"]; DataRow DR = table.NewRow(); DR["ID"] = Int32.Parse(((String) table.Compute("Max(ID)", String.Empty))) + 1; DR["Type"] = FinalMedia.GetType().Name; DR["Name"] = FinalMedia.GetName(); DR["Path"] = FinalMedia.GetPath(); DR["Size"] = FinalMedia.GetSize(); DR["Rating"] = FinalMedia.GetRating(); if (FinalMedia.GetType().Name.Equals("Video")) { DR["IsHD"] = ((Video) FinalMedia).IsHD(); } if (FinalMedia.GetType().Name.Equals("Audio")) { DR["AudioType"] = ((Audio) FinalMedia).GetAudioType(); } table.Rows.Add(DR); }