private static void ShowSkipOSD() { MediaModelSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <MediaModelSettings>(); ISuperLayerManager superLayerManager = ServiceRegistration.Get <ISuperLayerManager>(); superLayerManager.ShowSuperLayer(SKIP_OSD_SUPERLAYER_SCREEN_NAME, TimeSpan.FromSeconds(settings.SkipStepTimeout)); }
private void ShowZapOSD() { SlimTvClientSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <SlimTvClientSettings>(); ISuperLayerManager superLayerManager = ServiceRegistration.Get <ISuperLayerManager>(); superLayerManager.ShowSuperLayer(CHANNEL_ZAP_SUPERLAYER_SCREEN_NAME, TimeSpan.FromSeconds(settings.ZapTimeout)); }
protected void TryEvent_NoLock(InputEvent evt) { bool showBusyScreen = false; lock (_syncObj) { if (IsTerminated) { return; } if (_callingClientStart.HasValue && _callingClientStart.Value < DateTime.Now - BUSY_TIMEOUT) { // Client call lasts longer than our BUSY_TIMEOUT ClearInputBuffer(); // Discard all later input if (!_busyScreenVisible) { showBusyScreen = true; } } } if (showBusyScreen) { ISuperLayerManager superLayerManager = ServiceRegistration.Get <ISuperLayerManager>(); superLayerManager.ShowBusyScreen(); lock (_syncObj) _busyScreenVisible = true; return; // Finished, no further processing } EnqueueEvent(evt); }
protected void Dispatch(object o) { lock (_syncObj) _callingClientStart = DateTime.Now; try { ParameterlessMethod cmd = o as ParameterlessMethod; if (cmd != null) cmd(); InputEvent evt = o as InputEvent; if (evt != null) DispatchEvent(evt); } catch (Exception e) { ServiceRegistration.Get<ILogger>().Error("InputManager: Error dispatching '{0}'", e, o); } finally { bool hideBusyScreen; lock (_syncObj) { hideBusyScreen = _busyScreenVisible; _busyScreenVisible = false; _callingClientStart = null; } if (hideBusyScreen && !IsTerminated) { ISuperLayerManager superLayerManager = ServiceRegistration.Get<ISuperLayerManager>(); superLayerManager.HideBusyScreen(); } } }
protected static void ChangeVolume(int delta) { ISuperLayerManager superLayerManager = ServiceRegistration.Get <ISuperLayerManager>(); superLayerManager.ShowSuperLayer(Consts.SCREEN_SUPERLAYER_VOLUME, VOLUME_SUPERLAYER_TIME); IPlayerManager playerManager = ServiceRegistration.Get <IPlayerManager>(); playerManager.Volume += delta; }
protected void Dispatch(object o) { System.Threading.Timer timer; lock (_syncObj) { _callingClientStart = DateTime.Now; // Start a timer to show the busy screen if we don't complete the event within the timeout. // We create a new timer on every event so that we can use it's Dispose(WaitHandle) to // ensure that the callback has either finished or is guaranteed not to run after we have // checked whether to hide the busy screen below. This shouldn't have a negative performance // impact because the Timer class is specifically designed for this scenario. // See comment here: https://referencesource.microsoft.com/#mscorlib/system/threading/timer.cs,32 timer = new System.Threading.Timer(BusyTimeoutTimerCallback, null, BUSY_TIMEOUT, Timeout.InfiniteTimeSpan); } try { ParameterlessMethod cmd = o as ParameterlessMethod; if (cmd != null) { cmd(); } InputEvent evt = o as InputEvent; if (evt != null) { DispatchEvent(evt); } } catch (Exception e) { ServiceRegistration.Get <ILogger>().Error("InputManager: Error dispatching '{0}'", e, o); } finally { // Make sure the timer callback is guaranteed not to run // before checking whether the busy screen has been shown. _timoutTimerResetEvent.Reset(); timer.Dispose(_timoutTimerResetEvent); _timoutTimerResetEvent.WaitOne(); bool hideBusyScreen; lock (_syncObj) { hideBusyScreen = _busyScreenVisible; _busyScreenVisible = false; _callingClientStart = null; } if (hideBusyScreen && !IsTerminated) { ISuperLayerManager superLayerManager = ServiceRegistration.Get <ISuperLayerManager>(); superLayerManager.HideBusyScreen(); } } }
private void BusyTimeoutTimerCallback(object state) { lock (_syncObj) { if (IsTerminated || !_callingClientStart.HasValue) { return; } // Client call lasts longer than our BUSY_TIMEOUT ClearInputBuffer(); // Discard all later input if (_busyScreenVisible) { return; } } ISuperLayerManager superLayerManager = ServiceRegistration.Get <ISuperLayerManager>(); superLayerManager.ShowBusyScreen(); lock (_syncObj) _busyScreenVisible = true; }