public CreateSongWindow(User user) { InitializeComponent(); ResizeMode = ResizeMode.NoResize; this.user = user; song = new Song(); validation = new SongValidation(); mediaPlayer = new MediaPlayer(); controller = new Controller(); OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "MP3 files (*.mp3)|*.mp3"; if (openFileDialog.ShowDialog() == true) { mediaPlayer.Open(new Uri(openFileDialog.FileName)); FilePath = openFileDialog.FileName; Thread.Sleep(2000); song.Name = parseName(openFileDialog.FileName); song.Duraction = parseDuraction(mediaPlayer.NaturalDuration.TimeSpan.ToString(@"mm\:ss")); song.NumberOfPlays = 0; mediaPlayer.Close(); } UpdateButton.IsEnabled = false; }
public CreateSongWindow(User user, Song song) { this.user = user; this.song = song; validation = new SongValidation(); controller = new Controller(); InitializeComponent(); CreateButton.IsEnabled = false; }