public void LoadData(Guid key) { BasicDatasUpdated = false; db.DatabasePath = PfadClass.Instance().DatabasePfad; var data = db.GetByID(key); piclist = new PictureListClass(); var SFiles = new List <DBFiles>(); actData = data[0]; DataToEdit(); EditToData(); axWMP.Hide(); /* * btnPause.Enabled = false; * btnStopPlay.Enabled = false; * btnPlay.Enabled = false; * btnContinue.Enabled = false; */ foreach (var actFl in actData.SongFiles) { if (GlobalFunctionsClass.Instance().SongType(actFl.FilesName) == eDBSongFileType.songimage) { SFiles.Add(actFl); } else if (GlobalFunctionsClass.Instance().SongType(actFl.FilesName) == eDBSongFileType.mp3file) { AudioFile = actFl; if (AudioFile != null) { /* * btnPause.Enabled = true; * btnStopPlay.Enabled = true; * btnPlay.Enabled = true; * btnContinue.Enabled = true; */ axWMP.Show(); PlaySongWP(); } } } SFiles.Sort(); actData.SongFiles = SFiles.ToArray(); int n = 0; foreach (var fls in actData.SongFiles) { string guid = fls.FilesID.ToString(); var files = db.GetImage(guid); piclist.AddNewPicture(pnlSheets, db.ActMemoryStream); n++; } pbShownPages.Minimum = 0; pbShownPages.Maximum = (n <= 1) ? 1 : n - 1; pbShownPages.Value = (ActPicStart + ShowCount > pbShownPages.Maximum) ? pbShownPages.Maximum : ActPicStart + ShowCount; }
private void PlaySong() { if (wplayer != null) { wplayer.controls.stop(); wplayer.URL = null; wplayer = null; } wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange); wplayer.PositionChange += Wplayer_PositionChange; wplayer.DurationUnitChange += Wplayer_DurationUnitChange; FileInfo fi = null; if (AudioFile != null) { GlobalFunctionsClass.Instance().GetWriteTemp(db, actData.Id, AudioFile.FilesID, GlobalFunctionsClass.Instance().GetTempFile(AudioFile.FileType), AudioFile.FileType); fi = new FileInfo(GlobalFunctionsClass.Instance().GetTempFile(AudioFile.FileType)); } if (fi == null) { return; } if (fi.Exists) { wplayer.URL = fi.FullName; wplayer.controls.play(); pbPlayMedia.Minimum = 0; pbPlayMedia.Value = 0; pbPlayMedia.Maximum = (int)(wplayer.currentMedia.duration * 10); tmSoundPlayer.Start(); hsPlaySong.Enabled = false; hsStopSong.Enabled = true; hsPauseSong.Enabled = true; //ShowPosition(); //th = new Thread(ShowPosition); //th.Start(); } }
private void PlaySongWP() { FileInfo fi = null; if (AudioFile != null) { GlobalFunctionsClass.Instance().GetWriteTemp(db, actData.Id, AudioFile.FilesID, GlobalFunctionsClass.Instance().GetTempFile(AudioFile.FileType), AudioFile.FileType); fi = new FileInfo(GlobalFunctionsClass.Instance().GetTempFile(AudioFile.FileType)); } if (fi == null) { return; } if (fi.Exists) { axWMP.URL = fi.FullName; axWMP.close(); } }