Ejemplo n.º 1
0
        public ucPlayer()
        {
            InitializeComponent();
            musicEngine = new MusicEngine();
            IsRepeating = Properties.Settings.Default.IsRepeating;
            IsRandom = Properties.Settings.Default.IsRandom;
            //musicEngine.PlaybackTimerEvent += HandlePlaybackTimerEvent;
            musicEngine.SongFinishedEvent += HandleSongFinishedEvent;
            playbackTimer = new System.Windows.Forms.Timer {Interval = 50};
            playbackTimer.Tick += HandleLocalPlaybackTimerEvent;
            if (Properties.Settings.Default.IsVolumeEnabled)
            {
                isVolumeEnabled = true;
                double volume = Properties.Settings.Default.CurrentVolume;
                sldrVolume.Value = volume;

                if (Properties.Settings.Default.IsAcourateVolumeEnabled)
                {
                    isAcourateVolumeEnabled = true;
                    musicEngine.IsVolumeEnabled = false;
                    sldrVolume.Focusable = false;
                    sldrVolume.LargeChange = 0;
                }
                else
                    musicEngine.IsVolumeEnabled = true;

                float dbVolume;
                double dB = (volume - 601) / 10;
                if (dB < -60)
                    dbVolume = 0;
                else
                    dbVolume = (float)Math.Pow(10, dB / 20);


                musicEngine.Volume = dbVolume;
                if (sldrVolume.Value == 0)
                    lblVolumeContent.Content = "Muted";
            }
            else
            {
                isVolumeEnabled = false;
                isAcourateVolumeEnabled = false;
                sldrVolume.Value = 601;
                sldrVolume.IsEnabled = false;
                musicEngine.IsVolumeEnabled = false;
            }

            if (Properties.Settings.Default.IsMemoryPlayEnabled)
                musicEngine.MemoryPlay = true;
            else
                musicEngine.MemoryPlay = false;

            if (Properties.Settings.Default.IsNetworkControlEnabled)
                isNetworkControlEnabled = true;
            else
                isNetworkControlEnabled = false;
           

            /* 
             * Pulling the following out of the constructor and into a separate
             * method that is called from the main window after all children
             * have loaded.  This is because the various (Image)template.FindName("imageShuffle", btnShuffle);
             * calls return null at this point in the initialization workflow.

             *** IsRepeating = Properties.Settings.Default.IsRepeating;
             *** IsRandom = Properties.Settings.Default.IsRandom;
             * */
        }
Ejemplo n.º 2
0
 public PlaybackStatusEventArgs(MusicEngine.PlaybackStatus status)
 {
     this.status = status;
 }