private void EditMedia_Click(object sender, RoutedEventArgs e) { DataRow selectedRow = ((DataRowView)GetSelectedRow().DataContext).Row; Boolean valid = false; if (((String)selectedRow["Type"]).Equals("Video")) { _SelectedMedia = new Video((String)selectedRow["Name"], (String)selectedRow["Path"], (String)selectedRow["Size"], Int32.Parse((String)selectedRow["Rating"]), (((String)selectedRow["IsHD"]).Equals("true"))); valid = true; } else if (((String)selectedRow["Type"]).Equals("Audio")) { _SelectedMedia = new Audio((String)selectedRow["Name"], (String)selectedRow["Path"], (String)selectedRow["Size"], Int32.Parse((String)selectedRow["Rating"]), (String)selectedRow["AudioType"]); valid = true; } else if (((String)selectedRow["Type"]).Equals("Image")) { _SelectedMedia = new Image((String)selectedRow["Name"], (String)selectedRow["Path"], (String)selectedRow["Size"], Int32.Parse((String)selectedRow["Rating"])); valid = true; } if (valid) { _SelectedMedia.SetID(Int32.Parse((String)selectedRow["ID"])); Debug debug = new Debug(); debug.Show("APPEL EDITMEDIA AVEC ID " + _SelectedMedia.GetID()); MediaWindow mediaWindow = new MediaWindow(_SelectedMedia); mediaWindow.ShowDialog(); } }
private void AddMedia_Click(object sender, RoutedEventArgs e) { MediaWindow mediaWindow = new MediaWindow(); mediaWindow.ShowDialog(); }