Exemplo n.º 1
0
        private void NewDeviceUI_NewDmxDevice(object sender, NewDmxDeviceEventArgs e)
        {
            _newDeviceUI = null;
            logger.Log("New DmxDevice added: " + e.DmxDevice.Name + " @ " + e.DmxDevice.StartAddress);
            switch (e.DmxDevice.DeviceType)
            {
            case DmxDeviceTypes.Skytec_LedMovinghead:
                TabLedMovinghead tempTabLedMovinghead = new TabLedMovinghead(new LedMovinghead(e.DmxDevice.Name, e.DmxDevice.StartAddress, e.DmxDevice.DeviceType));
                _dmxDevices.Add(tempTabLedMovinghead.DmxDevice);
                tctDeviceTabs.Items.Add(tempTabLedMovinghead);
                logger.Log("TabLedMovinghead added");
                tctDeviceTabs.SelectedItem = tempTabLedMovinghead;
                sbiStartAddress.Content    = tempTabLedMovinghead.DmxDevice.StartAddress;
                break;

            case DmxDeviceTypes.Ayra_LedLaserMovinghead:
                TabLaserMovinghead tempTabLaserMovinghead = new TabLaserMovinghead(new LaserMovinghead(_availableDevices.Find(x => x.StartAddress == e.DmxDevice.StartAddress)));
                _dmxDevices.Add(tempTabLaserMovinghead.DmxDevice);
                tctDeviceTabs.Items.Add(tempTabLaserMovinghead);
                logger.Log("TabLaserMovinghead added");
                tctDeviceTabs.SelectedItem = tempTabLaserMovinghead;
                sbiStartAddress.Content    = tempTabLaserMovinghead.DmxDevice.StartAddress;
                break;

            case DmxDeviceTypes.Ayra_LedScanner:
                TabLedScanner tempTabLedScanner = new TabLedScanner(new LedScanner(e.DmxDevice.Name, e.DmxDevice.StartAddress, e.DmxDevice.DeviceType));
                _dmxDevices.Add(tempTabLedScanner.DmxDevice);
                tctDeviceTabs.Items.Add(tempTabLedScanner);
                logger.Log("TabLedScanner added");
                tctDeviceTabs.SelectedItem = tempTabLedScanner;
                sbiStartAddress.Content    = tempTabLedScanner.DmxDevice.StartAddress;
                break;

            case DmxDeviceTypes.EuroLite_LedPanel:
                TabLedPanel tempTabLedPanel = new TabLedPanel(new LedPanel(e.DmxDevice.Name, e.DmxDevice.StartAddress, e.DmxDevice.DeviceType));
                _dmxDevices.Add(tempTabLedPanel.DmxDevice);
                tctDeviceTabs.Items.Add(tempTabLedPanel);
                logger.Log("TabLedPanel added");
                tctDeviceTabs.SelectedItem = tempTabLedPanel;
                sbiStartAddress.Content    = tempTabLedPanel.DmxDevice.StartAddress;
                break;

            case DmxDeviceTypes.Showtec_LedSpot:
                TabLedSpot tempTabLedSpot = new TabLedSpot(new LedSpot(e.DmxDevice.Name, e.DmxDevice.StartAddress, e.DmxDevice.DeviceType));
                _dmxDevices.Add(tempTabLedSpot.DmxDevice);
                tctDeviceTabs.Items.Add(tempTabLedSpot);
                logger.Log("TabLedSpot added");
                tctDeviceTabs.SelectedItem = tempTabLedSpot;
                sbiStartAddress.Content    = tempTabLedSpot.DmxDevice.StartAddress;
                break;

            case DmxDeviceTypes.Unknown:
            case DmxDeviceTypes.None:
            default:
                logger.Warn("Cannot add device tab because DeviceType is None/Unknown");
                break;
            }
            _availableDevices.Remove(_availableDevices.Find(x => x.StartAddress == e.DmxDevice.StartAddress));
        }
Exemplo n.º 2
0
 private void NewDevice_Click(object sender, RoutedEventArgs e)
 {
     _newDeviceUI = new NewDeviceUI(_availableDevices);
     _newDeviceUI.NewDmxDevice += new EventHandler <NewDmxDeviceEventArgs>(NewDeviceUI_NewDmxDevice);
     _newDeviceUI.ShowDialog();
 }