Пример #1
0
 public void UpdateMusicStatus(int roomId, MusicStatus status)
 {
     if (UpdateMusicStatusEvent != null)
     {
         UpdateMusicStatusEvent(roomId, status);
     }
 }
Пример #2
0
        public void UpadateMusicStatus(int roomId, int userId, MusicStatus status,  int targetUserId)
        {
            if (musicCache.ContainsKey(roomId))
            { 
                if(musicCache[roomId].PlayerId == userId)
                {
                    musicCache[roomId] = status;

                }
                UserNCallback callBack = userCache[roomId][targetUserId];
                if (callBack != null)
                {
                    callBack.Callback.UpdateMusicStatus(roomId, status);
                }
            }
        }
 void RoomCallback_ReportMusicStatusEvent(int arg1, int arg2)
 {
     Dispatcher.BeginInvoke((Action)(() =>
         {
             PlayMusicWindowViewModel vm = DataContext as PlayMusicWindowViewModel;
             string[] result = flex.CallFlash(FlexCommand.GetPlayStatus);
             if (result != null)
             {
                 var playStatus = flex.CallFlash(FlexCommand.GetPlayStatus).ToList();
                 if (playStatus.Count == 2)
                 {
                     MusicStatus status = new MusicStatus();
                     status.PlayerId = vm.RoomWindowVM.Me.Id;
                     status.Name = playStatus[0];
                     status.Status = (PlayStatus)Enum.Parse(typeof(PlayStatus), playStatus[1]);
                     //status.Position = (int)(Decimal.Parse(playStatus[2]))+1;
                     vm.RoomWindowVM.RoomClient.UpadateMusicStatus(vm.RoomWindowVM.RoomVM.Id, vm.RoomWindowVM.Me.Id, status, arg2);
                 }
             }
         }));
 }
Пример #4
0
        public bool OnPlayMusic(int roomId, int userId)
        {
            if (IsMusicAvailabe(roomId, userId))
            {
                if (!musicCache.ContainsKey(roomId))
                {
                    MusicStatus musicStatus = new MusicStatus();
                    musicStatus.PlayerId = userId;
                    musicCache.Add(new KeyValuePair<int,MusicStatus>(roomId,musicStatus));
                }
                return true;

            }
            return false;
        }
 void RoomCallback_UpdateMusicStatusEvent(int arg1, MusicStatus arg2)
 {
     if (arg2 != null)
     {
         flex.CallFlash(FlexCommand.PlayMusic, arg2.Name);
         //flex.CallFlash(FlexCommand.SetPlayPosition, arg2.Position.ToString());
         //if (arg2.Status == PlayStatus.Paused)
         //{
         //    flex.CallFlash(FlexCommand.TogglePauseMusic);
         //}
         if (arg2.Status == PlayStatus.Stoped)
         {
             flex.CallFlash(FlexCommand.StopMusic, "false");
         }
     }
 }