예제 #1
0
파일: Channel.cs 프로젝트: jaypatrick/dica
 /// <summary>
 /// </summary>
 /// <param name="sender"> </param>
 /// <param name="e"> </param>
 protected internal virtual void OnChannelChanged(object sender, ChannelChangedEventArgs <IChannel> e)
 {
     if (_channelChanged != null)
     {
         _channelChanged(sender, e);
     }
 }
예제 #2
0
        private void ChannelSection_TrackChanged(object sender, ChannelChangedEventArgs <IChannel> e)
        {
            Channel = e.RefreshedContent;

            try
            {
                _player.Play(e.RefreshedContent, PlayerType);

                // save settings
                Settings.Default.SelectedChannelName = e.RefreshedContent.ChannelName;
                Settings.Default.SelectedChannelUri  = e.RefreshedContent.CurrentTrack.TrackUrl;
            }
            catch (COMException exc)
            {
                int    hr      = exc.ErrorCode;
                string message = String.Format("There was an error.\nHRESULT = {0}\n{1}",
                                               hr.ToString(CultureInfo.InvariantCulture), exc.Message);

                throw new COMException(message, exc);
            }
            catch (PlayerNotInstalledException exc)
            {
                OnPlayerNotInstalledException(this, new PlayerNotInstalledExceptionEventArgs <IPlayer>(exc));
            }
        }
예제 #3
0
 public void OnChannelChanged(ChannelChangedEventArgs e)
 {
     _tvState.FromChannel = e.From;
     _tvState.ToChannel   = e.To;
     _tvState.Version     = e.Version;
     dataContext.Update(_tvState, x => x.FromChannel, x => x.ToChannel, x => x.Version);
     dataContext.Commit();
     Console.WriteLine("ChannelChangedEventArgs");
 }
예제 #4
0
        /// <summary>Changes the channel to the previous channel.</summary>
        /// <exception cref="InvalidOperationException">The television is not powerd on.</exception>
        public void RecallChannel()
        {
            if (!IsOn)
            {
                throw new InvalidOperationException("The television must be turned on in order to change the channel.");
            }
            ChannelChangedEventArgs e = new ChannelChangedEventArgs(CurrentChannel, PreviousChannel);

            EntityState.Apply(e);
        }
예제 #5
0
        /// <summary>Changes the television channel to the specified value.</summary>
        /// <param name="channel">A positive number representing the desired channel.</param>
        /// <exception cref="InvalidOperationException">The television is not powerd on.</exception>
        /// <exception cref="ArgumentException">The channel value is less than one.</exception>
        public void ChangeChannel(int channel)
        {
            if (!IsOn)
            {
                throw new InvalidOperationException("The television must be turned on in order to change the channel.");
            }
            if (channel < 1)
            {
                throw new ArgumentException("The channel cannot be set to less than one.");
            }
            ChannelChangedEventArgs e = new ChannelChangedEventArgs(CurrentChannel, channel);

            EntityState.Apply(e);
        }
예제 #6
0
 private void OnUserChangedChannel(object sender, ChannelChangedEventArgs e)
 {
     if (e.User.Equals(client.CurrentUser))
     {
         Notify(NotificationType.SwitchedChannel, "Switched to channel " + e.TargetChannel.Name + ".");
     }
     else if (e.TargetChannel.Equals(client.CurrentChannel))
     {
         Notify(NotificationType.UserJoinedChannel, "{0} joined the channel.", e.User.Nickname, e.User.Phonetic);
     }
     else if (e.PreviousChannel.Equals(client.CurrentChannel))
     {
         Notify(NotificationType.UserLeftChannel, "{0} left the channel.", e.User.Nickname, e.User.Phonetic);
     }
 }
예제 #7
0
        private void ChannelChanged(object sender, ChannelChangedEventArgs <IChannel> e)
        {
            SetTrackText(e.RefreshedContent.CurrentTrack);

            foreach (var control in PlaylistPanel.Controls.OfType <TChannel>())
            {
                if (control.Equals(e.RefreshedContent))
                {
                    _channel = e.RefreshedContent as TChannel;
                    UpdateVisualCues();
                }
                else
                {
                    (control).IsSelected = false;
                }
            }
        }
예제 #8
0
파일: MainForm.cs 프로젝트: ermau/Gablarski
        private void UsersUserChangedChannel(object sender, ChannelChangedEventArgs e)
        {
            if (e.User.Equals(gablarski.CurrentUser))
            {
                if (musicSource != null)
                {
                    gablarski.Audio.EndCapture(musicSource);
                    gablarski.Audio.BeginCapture(musicSource, e.TargetChannel);
                }
                else if (voiceSource != null && !Settings.UsePushToTalk)
                {
                    gablarski.Audio.EndCapture(voiceSource);
                    gablarski.Audio.BeginCapture(voiceSource, e.TargetChannel);
                }
            }

            this.users.RemoveUser(e.User);
            this.users.AddUser(e.User, gablarski.Sources[e.User]);
        }
예제 #9
0
        //if anything changes in the channel the gui can update the right property
        private void Channel_PropertyChanged(object sender, ChannelChangedEventArgs e)
        {
            switch (e.ChannelProperties)
            {
            case ChannelProperties.ChannelName:
                SetUsername();
                break;

            case ChannelProperties.Title:
                SetTitle();
                break;

            case ChannelProperties.Game:
                SetGame();
                break;

            case ChannelProperties.Viewer:
                SetViewer();
                break;

            case ChannelProperties.Status:
                StatusChanged(this, new EventArgs());
                Utility.LogTrace(Channel.Username + " went: " + Channel.Status.ToString());
                break;

            case ChannelProperties.Logo:
                SetLogo();
                break;

            case ChannelProperties.Url:
                break;

            default:
                throw new ArgumentException("Unknown ChannelPropertie");
            }
        }
예제 #10
0
 private void OnChannelChanged(ChannelChangedEventArgs e)
 {
     PreviousChannel = e.From;
     CurrentChannel  = e.To;
 }