Exemplo n.º 1
0
        /// <summary>
        /// A media player that is controlled from a notify icon
        /// using the mouse. Takes control of the notifyicon icon,
        /// tooltip and balloon to display status.
        /// </summary>
        /// <param name="icon">
        /// The notify icon that controls playback.
        /// </param>
        public Player(NotifyIcon icon)
        {
            notifyIcon = icon;
            notifyIcon.MouseClick += OnMouseClick;

            player = new MediaPlayer();
            player.BufferingStarted += OnBufferingStarted;
            player.BufferingEnded += OnBufferingEnded;
            player.MediaEnded += OnMediaEnded;
            player.MediaFailed += OnMediaFailed;

            source = null;
            isIdle = true;

            idleIcon = Utils.ResourceAsIcon("GaGa.Resources.idle.ico");
            playingIcon = Utils.ResourceAsIcon("GaGa.Resources.playing.ico");
            playingMutedIcon = Utils.ResourceAsIcon("GaGa.Resources.playing-muted.ico");

            bufferingIcons = new Icon[] {
                Utils.ResourceAsIcon("GaGa.Resources.buffering1.ico"),
                Utils.ResourceAsIcon("GaGa.Resources.buffering2.ico"),
                Utils.ResourceAsIcon("GaGa.Resources.buffering3.ico"),
                Utils.ResourceAsIcon("GaGa.Resources.buffering4.ico"),
            };

            bufferingIconTimer = new DispatcherTimer();
            bufferingIconTimer.Interval = TimeSpan.FromMilliseconds(300);
            bufferingIconTimer.Tick += bufferingIconTimer_Tick;

            currentBufferingIcon = 0;

            UpdateIcon();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Stores program settings.
 /// </summary>
 public GaGaSettings()
 {
     LastBalanceTrackBarValue = 0;
     LastVolumeTrackBarValue = 10;
     LastPlayerStream = null;
     OptionsEnableAutoPlayChecked = false;
     OptionsEnableMultimediaKeysChecked = true;
 }
Exemplo n.º 3
0
 ///
 /// Safe external interface/mouse control.
 ///
 /// <summary>
 /// Open a stream and start playing it.
 /// </summary>
 /// <param name="target">Stream to play.</param>
 public void Play(PlayerStream stream)
 {
     source = stream;
     StartPlaying();
 }
Exemplo n.º 4
0
 ///
 /// Clicking on menu items.
 ///
 /// <summary>
 /// Stream clicked, play it.
 /// </summary>
 private void OnStreamItemClick(Object sender, EventArgs e)
 {
     MenuItem item = (MenuItem) sender;
     PlayerStream stream = new PlayerStream(item.Text, (Uri) item.Tag);
     player.Play(stream);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Set a given stream as current and play it.
 /// Unmutes the player.
 /// </summary>
 /// <param name="stream">Source stream to play.</param>
 public void Play(PlayerStream stream)
 {
     Source = stream;
     Play();
 }