示例#1
0
        private void CleanUp()
        {
            if (bgPlayWorker != null)
            {
                this.bgPlayWorker.DoWork             -= new System.ComponentModel.DoWorkEventHandler(this.bgPlayWorker_DoWork);
                this.bgPlayWorker.RunWorkerCompleted -= new System.ComponentModel.RunWorkerCompletedEventHandler(this.bgPlayWorker_RunWorkerCompleted);
                bgPlayWorker.Dispose();
                bgPlayWorker = null;
            }
            if (waitHandle != null)
            {
                waitHandle.Close();
                //waitHandle.Dispose();
                waitHandle = null;
            }

            if (audioPlayer != null)
            {
                audioPlayer.StopPlayback();
                audioPlayer.Dispose();
                audioPlayer = null;
            }
            if (aTimer != null)
            {
                aTimer.Elapsed -= OnTimedEvent;
                aTimer.Dispose();
                aTimer = null;
            }
            if (marqueeLbl != null)
            {
                marqueeLbl.Dispose();
            }
            plWnd.CloseButtonClicked        -= plWnd_CloseButtonClicked;
            plWnd.PlaylistItemDoubleClicked -= plWnd_PlaylistItemDoubleClicked;
            plWnd.PlaylistLoaded            -= plWnd_PlaylistLoaded;
            plWnd.PlaylistCleared           -= plWnd_PlaylistCleared;
            plWnd.Close();
            plWnd.Dispose();

            if (pnTrackInfo != null)
            {
                pnTrackInfo.Dispose();
            }

            if (gkHook != null)
            {
                gkHook.KeyPressed -= OnKeyPressed;
                gkHook.Dispose();
            }
        }