Beispiel #1
0
 public void StopPlayer()
 {
     Interlocked.CompareExchange(ref _isPlayerOpen, 0, 1);
     _lastPlayerChannel = null;
     _playerCallback = null;
 }
Beispiel #2
0
 public bool Load(UserIdentity userIdentity, string uniqueName, int slideId, bool autoPrepare)
 {
     // если кэширование в процессе - отлуп
     //if (Interlocked.CompareExchange(ref _nowInPreparationProgress, 1, 0) == 1) return false;
     _showPreparator.AutoPrepare = autoPrepare; // Пусть подготовится автоматически, если надо.
     bool isSuccess = _showPreparator.StartPreparation(userIdentity, uniqueName, slideId,
                                      AskClientForNotEnoughFreeSpace,
                                      _showPreparator_OnPreparationFinish,
                                      _showPreparator_OnResourceTransmit,
                                      _showPreparator_OnReceiveAgentResourcesList,
                                      _showPreparator_OnUploadSpeed,
                                      _showPreparator_OnPreparationForDisplayEnded,
                                      _showPreparator_OnLogMessage);
     if (isSuccess)
     {
         _callback = OperationContext.Current.GetCallbackChannel<IShowNotifier>();
     }
     return isSuccess;
 }
Beispiel #3
0
 public bool StartPlayer()
 {
     bool retValue = Interlocked.CompareExchange(ref _isPlayerOpen, 1, 0) == 0;
     if (!retValue)
     {
         if (_lastPlayerChannel != null
             && _lastPlayerChannel.State != CommunicationState.Closed
             && _lastPlayerChannel.State != CommunicationState.Closing
             && _lastPlayerChannel.State != CommunicationState.Faulted)
         {
             try
             {
                 if (_playerCallback != null)
                     _playerCallback.Ping();
             }
             catch (Exception ex)
             {
                 _config.EventLog.WriteWarning(string.Format("ShowService.StartPlayer: Мертвый канал ранне запущенного плеера, новый запуск разрешен\n {0}", ex));
                 _lastPlayerChannel = OperationContext.Current.Channel;
                 _playerInstanceRemoteAddress = GetRemoteAddress(OperationContext.Current);
                 _playerCallback = OperationContext.Current.GetCallbackChannel<IShowNotifier>();
                 return true;
             }
             _config.EventLog.WriteInformation(string.Format("ShowService.StartPlayer: Запущен другой экземпляр плеера по адресу: {0}", _playerInstanceRemoteAddress));
             return false;
         }
         else
         {
             _lastPlayerChannel = OperationContext.Current.Channel;
             _playerInstanceRemoteAddress = GetRemoteAddress(OperationContext.Current);
             _playerCallback = OperationContext.Current.GetCallbackChannel<IShowNotifier>();
             return true;
         }
     }
     else
     {
         _lastPlayerChannel = OperationContext.Current.Channel;
         _playerInstanceRemoteAddress = GetRemoteAddress(OperationContext.Current);
         _playerCallback = OperationContext.Current.GetCallbackChannel<IShowNotifier>();
         return true;
     }
 }