Ejemplo n.º 1
0
        public void Contents_Insert(int index, Device device)
        {
            DeviceViewer viewer = device.Collapsed? (DeviceViewer) new CollapsedDeviceViewer(device) : new DeviceViewer(device);

            viewer.Added           += Device_Insert;
            viewer.DeviceCollapsed += Device_Collapsed;

            Contents.Insert(index + 1, viewer);
            SetAlwaysShowing();
        }
Ejemplo n.º 2
0
        static IControl GetSpecificViewer(DeviceViewer sender, Device device)
        {
            foreach (Type deviceViewer in (from type in Assembly.GetExecutingAssembly().GetTypes() where type.Namespace.StartsWith("Apollo.DeviceViewers") select type))
            {
                if ((string)deviceViewer.GetField("DeviceIdentifier").GetValue(null) == device.DeviceIdentifier)
                {
                    if (device.DeviceIdentifier == "group" || device.DeviceIdentifier == "multi" || device.DeviceIdentifier == "choke")
                    {
                        return((IControl)Activator.CreateInstance(deviceViewer, new object[] { device, sender }));
                    }

                    return((IControl)Activator.CreateInstance(deviceViewer, new object[] { device }));
                }
            }

            return(null);
        }