private void ViewInApp_Click(object sender, EventArgs e) { var item = (MediaItemDTO)this.ItemsTable.CurrentRow.DataBoundItem; if (item != null) { if (service.IsVideo(item.Path)) { VideoWindow video = new VideoWindow(item.Path); video.ShowDialog(); } else if (service.IsPhoto(item.Path)) { PhotoWindow photo = new PhotoWindow(item.Path); photo.ShowDialog(); } } }