Exemplo n.º 1
0
        private void AmOnOnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
        {
            if (!args.DeviceOnLine)
            {
                CloudLog.Warn("{0} is offline!", currentDevice.ToString());
            }

            if (args.DeviceOnLine && currentDevice is AmX00)
            {
                try
                {
                    ((AmX00)currentDevice).DisplayControl.DisableAutomaticRouting();
                }
                catch (Exception e)
                {
                    CloudLog.Exception(e);
                }
            }

            try
            {
                if (DeviceCommunicatingChange != null)
                {
                    DeviceCommunicatingChange(this, args.DeviceOnLine);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
        }
        void ui_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
        {
            OnDebug(eDebugEventType.Info, "{0} online status {1}", currentDevice.ToString(), args.DeviceOnLine.ToString());
            Type type = currentDevice.GetType();

            SmartObject so            = ((BasicTriListWithSmartObject)currentDevice).SmartObjects[SG_DYNAMIC_BTN_LIST];
            int         i             = 0;
            ushort      fontsize      = 16;
            string      formattedText = UI.FormatTextForUi(currentDevice.Name, fontsize, UI.eCrestronFont.Crestron_Sans_Pro, UI.eNamedColour.White);

            SG.SetSmartObjectVisible(so, ++i, true);
            SG.SetSmartObjectText(so, i, formattedText);

            formattedText = String.Format("IPID: 0x{0:X2}", currentDevice.ID);
            formattedText = UI.FormatTextForUi(formattedText, fontsize, UI.eCrestronFont.Crestron_Sans_Pro, UI.eNamedColour.White);
            SG.SetSmartObjectVisible(so, ++i, true);
            SG.SetSmartObjectText(so, i, formattedText);

            formattedText = "Type: " + type.Name.ToString();
            formattedText = UI.FormatTextForUi(formattedText, fontsize, UI.eCrestronFont.Crestron_Sans_Pro, UI.eNamedColour.White);
            SG.SetSmartObjectVisible(so, ++i, true);
            SG.SetSmartObjectText(so, i, formattedText);

            try
            {
                if (typeof(TswFt5Button).IsAssignableFrom(currentDevice.GetType()))
                {
                    formattedText = "IP: " + ((TswFt5Button)currentDevice).ExtenderEthernetReservedSigs.IpAddressFeedback.ToString();
                    formattedText = UI.FormatTextForUi(formattedText, fontsize, UI.eCrestronFont.Crestron_Sans_Pro, UI.eNamedColour.White);
                    SG.SetSmartObjectVisible(so, ++i, true);
                    SG.SetSmartObjectText(so, i, formattedText);

                    formattedText = "MAC: " + ((TswFt5Button)currentDevice).ExtenderEthernetReservedSigs.MacAddressFeedback.ToString();
                    formattedText = UI.FormatTextForUi(formattedText, fontsize, UI.eCrestronFont.Crestron_Sans_Pro, UI.eNamedColour.White);
                    SG.SetSmartObjectVisible(so, ++i, true);
                    SG.SetSmartObjectText(so, i, formattedText);
                }

                if (typeof(TswX60BaseClass).IsAssignableFrom(currentDevice.GetType()))
                {
                    ((TswX60BaseClass)currentDevice).ExtenderHardButtonReservedSigs.DeviceExtenderSigChange -= ui_HardButton_SigChange; // remove existing event from invocation list
                    ((TswX60BaseClass)currentDevice).ExtenderHardButtonReservedSigs.DeviceExtenderSigChange += ui_HardButton_SigChange;
                }
            }
            catch (Exception e)
            {
                OnDebug(eDebugEventType.Info, "ui_OnlineStatusChange exception: {0}", e.Message);
            }
        }
Exemplo n.º 3
0
        private void DeviceOnOnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
        {
            if (!args.DeviceOnLine)
            {
                CloudLog.Warn("{0} is offline!", currentDevice.ToString());
            }

            try
            {
                if (DeviceCommunicatingChange != null)
                {
                    DeviceCommunicatingChange(this, args.DeviceOnLine);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
        }