Esempio n. 1
0
            private void CheckAdapter()
            {
                var hMonitor = NativeMethods.MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST);

                if (MonitorId == hMonitor)
                {
                    return;
                }
                MonitorId = hMonitor;
                Logger.Debug("MonitorFromWindow: 0x{0}", MonitorId.ToString("X"));

                var adapter = GetAdapterId(Handle);

                if (adapter == null)
                {
                    AdapterId = 0;
                    Logger.Debug("AdapterId: {0}", AdapterId);
                }
                else
                {
                    AdapterId = adapter.Adapter;
                    Logger.Debug(
                        "AdapterId: {0} [\"{1}\", \"{2}\"]",
                        AdapterId,
                        adapter.Information.DeviceName,
                        adapter.Information.Description);
                }
            }
Esempio n. 2
0
 public virtual void OnMonitorActionHandled(string monitorTypeName, MonitorId monitorId, string currentStateName, string actionName)
 {
     if (IsVerbose)
     {
         WriteLine($"<MonitorLog> Monitor '{ monitorTypeName }' with id '{ monitorId }' in state '{ currentStateName }' handled action '{ actionName }'");
     }
     MonitorActionHandled?.Invoke(monitorTypeName, monitorId, currentStateName, actionName);
 }
        public void RemoteMonitor(MonitorId target, Event e)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            GetOrAddChannel(target.Endpoint).Monitor(target, e);
        }
Esempio n. 4
0
        protected void RemoteMonitor(MonitorId target, Event e)
        {
            if (Runtime.NetworkProvider is ICommunicationProvider networkProvider2)
            {
                networkProvider2.RemoteMonitor(target, e);
                return;
            }

            Runtime.InvokeMonitor(target, e);
        }
Esempio n. 5
0
        private void MonitorForm_Load(object sender, EventArgs e)
        {
            monitor.Id = MonitorId;

            GenerateListsOfControls();

            // Check if we already a monitor with this ID
            Monitor newMonitor = Monitor.GetOne(MonitorId);

            if (newMonitor.Id == 0)
            {
                monitor.Save();
            }

            monitorNumber.Text = MonitorId.ToString();
        }
Esempio n. 6
0
 public virtual void OnMonitorEvent(string monitorTypeName, MonitorId monitorId, string currentStateName, string eventName, bool isProcessing)
 {
     MonitorEvent?.Invoke(monitorTypeName, monitorId, currentStateName, eventName, isProcessing);
 }
Esempio n. 7
0
 public SafetyMonitorBundler(RuntimeHost runtimeHost, MonitorId id, ISafetyMonitorReceiver receiver) :
     base(runtimeHost, id, receiver)
 {
 }
 static TSender NewCore(RuntimeHost runtimeHost, MonitorId id, Type senderType)
 {
     return((TSender)Activator.CreateInstance(senderType, runtimeHost, id));
 }
 public void RemoteMonitor(MonitorId target, Event e)
 {
     m_remoteNetworkProvider.RemoteMonitor(target, e);
 }
Esempio n. 10
0
 public SafetyMonitorSender(RuntimeHost runtimeHost, MonitorId id) :
     base(runtimeHost, id)
 {
 }
Esempio n. 11
0
 protected MethodizedMonitorSender(RuntimeHost runtimeHost, MonitorId id)
 {
     RuntimeHost = runtimeHost;
     Id          = id;
 }
 public void Monitor(MonitorId target, Event e)
 {
     m_runtimeHost.InvokeMonitor(target, e);
 }
 protected MethodizedMonitorBundler(RuntimeHost runtimeHost, MonitorId id, TReceiver receiver)
 {
     RuntimeHost = runtimeHost;
     Id          = id;
     Receiver    = receiver;
 }
        static TSender New(RuntimeHost runtimeHost, MonitorId id)
        {
            var senderType = ms_senderType.Value;

            return(NewCore(runtimeHost, id, senderType));
        }
Esempio n. 15
0
 public TSender GetSender <TSender>(MonitorId monitorId) where TSender : class, IMethodizedMonitorSender
 {
     return(RuntimeHost.GetSender <TSender>(Id, monitorId));
 }
 public static void Set(ref MonitorId id, TSender value)
 {
     id = value.Id;
     ms_senders.AddOrUpdate(id, value, (_1, _2) => value);
 }
Esempio n. 17
0
 public virtual void OnMonitorAction(string monitorTypeName, MonitorId monitorId, string currentStateName, string actionName)
 {
     MonitorAction?.Invoke(monitorTypeName, monitorId, currentStateName, actionName);
 }
Esempio n. 18
0
 internal override void InvokeMonitor(MonitorId target, Event e)
 {
     throw new NotSupportedException();
 }
Esempio n. 19
0
 public override void InvokeMonitor(MonitorId target, ApplicationEvent e)
 {
     m_networkProvider2.RemoteMonitor(target, e);
 }
Esempio n. 20
0
 public void SetSender <TSender>(ref MonitorId monitorId, TSender monitor) where TSender : class, IMethodizedMonitorSender
 {
     RuntimeHost.SetSender(ref monitorId, monitor);
 }
Esempio n. 21
0
 public virtual void OnMonitorState(string monitorTypeName, MonitorId monitorId, string stateName, bool isEntry, bool?isInHotState)
 {
     MonitorState?.Invoke(monitorTypeName, monitorId, stateName, isEntry, isInHotState);
 }
Esempio n. 22
0
 public virtual void OnCreateMonitor(string monitorTypeName, MonitorId monitorId)
 {
     MonitorCreated?.Invoke(monitorTypeName, monitorId);
 }
 public static TSender Get(CommunicationId key, MonitorId id)
 {
     return(ms_senders.GetOrAdd(id, _ => New(RuntimeHostReferences.Get(key.RuntimeHostId), id)));
 }