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();
     }
       }
 }
Beispiel #2
0
 public void Dispose()
 {
     if (_disposeDlgt != null)
     {
         _disposeDlgt();
     }
     _disposeDlgt = null;
 }
Beispiel #3
0
 protected void EnqueueCommand(ParameterlessMethod command)
 {
     lock (_syncObj)
     {
         _commandQueue.Enqueue(command);
         _inputAvailableEvent.Set();
     }
 }
        protected void FirePlaylistsChanged()
        {
            ParameterlessMethod dlgt = PlaylistsChanged;

            if (dlgt != null)
            {
                dlgt();
            }
        }
        protected void FireMIATypeRegistrationsChanged()
        {
            ParameterlessMethod dlgt = MIATypeRegistrationsChanged;

            if (dlgt != null)
            {
                dlgt();
            }
        }
        protected void FireRegisteredSharesChangeCounterChanged()
        {
            ParameterlessMethod dlgt = RegisteredSharesChangeCounterChanged;

            if (dlgt != null)
            {
                dlgt();
            }
        }
        protected void FireConnectedClientsChanged()
        {
            ParameterlessMethod dlgt = ConnectedClientsChanged;

            if (dlgt != null)
            {
                dlgt();
            }
        }
        protected void FireCurrentlyImportingSharesChanged()
        {
            ParameterlessMethod dlgt = CurrentlyImportingSharesChanged;

            if (dlgt != null)
            {
                dlgt();
            }
        }
 protected void EnqueueCommand(ParameterlessMethod command)
 {
     if (IsTerminated)
     {
         return;
     }
     lock (_syncObj)
     {
         _commandQueue.Enqueue(command);
         _inputAvailableEvent.Set();
     }
 }
        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();
                }
            }
        }
Beispiel #11
0
 private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
 {
     if (message.ChannelName == ClientManagerMessaging.CHANNEL)
     {
         ClientManagerMessaging.MessageType messageType =
             (ClientManagerMessaging.MessageType)message.MessageType;
         switch (messageType)
         {
         case ClientManagerMessaging.MessageType.ClientAttached:
         case ClientManagerMessaging.MessageType.ClientDetached:
         case ClientManagerMessaging.MessageType.ClientOnline:
         case ClientManagerMessaging.MessageType.ClientOffline:
             ParameterlessMethod d = UpdateClientsList;
             Invoke(d);
             break;
         }
     }
 }
 public MethodDelegateAction(Guid actionId, string name, IEnumerable<Guid> sourceStateIds, IResourceString displayTitle,
     ParameterlessMethod executor) :
     base(actionId, name, sourceStateIds, displayTitle)
 {
   _executor = executor;
 }
Beispiel #13
0
 public ScreenSaverController(ParameterlessMethod disposeDlgt)
 {
     _disposeDlgt = disposeDlgt;
 }
Beispiel #14
0
 public void ExecuteCommand(ParameterlessMethod command)
 {
   EnqueueCommand(command);
 }
Beispiel #15
0
 protected void EnqueueCommand(ParameterlessMethod command)
 {
   if (IsTerminated)
     return;
   lock (_syncObj)
   {
     _commandQueue.Enqueue(command);
     _inputAvailableEvent.Set();
   }
 }
 public MethodDelegateCommand(ParameterlessMethod methodDelegate)
 {
   _methodDelegate = methodDelegate;
 }
Beispiel #17
0
 public MethodDelegateAction(Guid actionId, string name, IEnumerable <Guid> sourceStateIds, IResourceString displayTitle,
                             ParameterlessMethod executor) :
     base(actionId, name, sourceStateIds, displayTitle)
 {
     _executor = executor;
 }
 public void Dispose()
 {
   if (_disposeDlgt != null)
     _disposeDlgt();
   _disposeDlgt = null;
 }
 public ScreenSaverController(ParameterlessMethod disposeDlgt)
 {
   _disposeDlgt = disposeDlgt;
 }
Beispiel #20
0
 protected void ExecuteInMainThread(ParameterlessMethod method)
 {
     Invoke(method);
 }
Beispiel #21
0
 protected void ExecuteInMainThread(ParameterlessMethod method)
 {
   Invoke(method);
 }
 public MethodDelegateCommand(ParameterlessMethod methodDelegate)
 {
     _methodDelegate = methodDelegate;
 }
Beispiel #23
0
 public void ExecuteCommand(ParameterlessMethod command)
 {
     EnqueueCommand(command);
 }