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.º 2
0
 /// <summary>
 /// Get the ComPort collection from the endpoint at the given output channel.
 /// If there is no endpoint or if the endpoint does not support ComPorts then NULL is returned.
 /// </summary>
 /// <param name="output">The output channel connected to the target endpoint</param>
 /// <returns>a collection of ComPorts on that output or NULL if there is no endpoint or comports are not supported.</returns>
 /// <exception cref="ArgumentException">If "output" is greater than the number of output channels on the AV switch device.</exception>
 public CrestronCollection <ComPort> GetEndpointComports(uint output)
 {
     if (output > NumOutputs)
     {
         throw new ArgumentException("Argument 'output' cannot be greater than the number of output channels.");
     }
     if (IsInitialized)
     {
         try
         {
             GenericBase  obj          = avSwitch.Outputs[output].Endpoint;
             CType        endpointType = obj.GetType();
             PropertyInfo endProp      = endpointType.GetProperty("ComPorts");
             return((CrestronCollection <ComPort>)endProp.GetValue(obj, new object[] { }));
         }
         catch (Exception e)
         {
             ErrorLog.Error("Problem retreiving endpoint ComPort: {0} -- {1}", e.Message, e.StackTrace);
             return(null);
         }
     }
     else
     {
         throw new InvalidOperationException("AvSwitchController has not been initialized.");
     }
 }
        private void ValueOnSigChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
#if DEBUG
            CrestronConsole.PrintLine("{0}.SmartObject[{3}].SigChange ID 0x{1:X2} {2}", currentDevice.GetType().Name,
                                      currentDevice.ID, args.Sig.ToString(), args.SmartObjectArgs.ID);
#endif
            OnPanelActivity(this, new UIControllerActivityEventArgs(args.Sig, args.Event));
        }
Exemplo n.º 4
0
 void Device_IpInformationChange(GenericBase currentDevice, ConnectedIpEventArgs args)
 {
     if (currentDevice is CrestronApp)
     {
         // ignore
     }
     else
     {
         if (args.Connected)
         {
             ErrorLog.Notice("UI Device {0} with ID {1} is online with IP Address {2}", currentDevice.GetType().Name, currentDevice.ID.ToString("X2"),
                             args.DeviceIpAddress);
         }
         else
         {
             ErrorLog.Notice("UI Device {0} with ID {1} is offline with IP Address {2}", currentDevice.GetType().Name, currentDevice.ID.ToString("X2"),
                             args.DeviceIpAddress);
         }
     }
     FusionUpdate();
 }