protected virtual void AddDevice(IAudioDevice device)
        {
            var newDevice = new DeviceViewModel(this, _deviceManager, device);

            AllDevices.Add(newDevice);
        }
Esempio n. 2
0
        private void AddDevice(IAudioDevice device)
        {
            var newDevice = new DeviceViewModel(_deviceManager, device);

            AllDevices.Add(newDevice);
        }
Esempio n. 3
0
        private void LoadAllDevices()
        {
            if (File.Exists(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\Devices.xml"))
            {
                XElement root = XElement.Load(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\Devices.xml");
                root.Elements("Device").All <XElement>(xeDevices =>
                {
                    DeviceCapabilities devCap            = new DeviceCapabilities();
                    DeviceEventCollection devEventColl   = new DeviceEventCollection();
                    DeviceFunctionCollection devfuncColl = new DeviceFunctionCollection();
                    DevicePropertyCollection devPropColl = new DevicePropertyCollection();
                    xeDevices.Elements("Capabilities").Elements("events").Elements("event").All <XElement>(xe =>
                    {
                        devEventColl.AddDeviceEvent(xe.Attribute("id").Value, xe.Attribute("name").Value);
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("functions").Elements("function").All <XElement>(xe =>
                    {
                        devfuncColl.AddDeviceFunctions(xe.Attribute("id").Value,
                                                       xe.Attribute("functionname").Value,
                                                       fpc, /* this will taken care later*/
                                                       (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("returntype").Value.ToLower()));
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("properties").Elements("property").All <XElement>(xe =>
                    {
                        devPropColl.AddDeviceProperties(xe.Attribute("id").Value,
                                                        xe.Attribute("name").Value,
                                                        (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("type").Value.ToLower()),
                                                        Convert.ToBoolean(xe.Attribute("Readonly").Value));
                        return(true);
                    });


                    devCap.Events     = devEventColl;
                    devCap.Functions  = devfuncColl;
                    devCap.Properties = devPropColl;

                    AllDevices.AddDevice(xeDevices.Attribute("id").Value,
                                         xeDevices.Attribute("name").Value, devCap);
                    return(true);
                });
            }
            if (File.Exists(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\SOA.xml"))
            {
                XElement root = XElement.Load(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\SOA.xml");
                root.Elements("Device").All <XElement>(xeDevices =>
                {
                    DeviceCapabilities devCap            = new DeviceCapabilities();
                    DeviceEventCollection devEventColl   = new DeviceEventCollection();
                    DeviceFunctionCollection devfuncColl = new DeviceFunctionCollection();
                    DevicePropertyCollection devPropColl = new DevicePropertyCollection();
                    xeDevices.Elements("Capabilities").Elements("events").Elements("event").All <XElement>(xe =>
                    {
                        devEventColl.AddDeviceEvent(xe.Attribute("id").Value, xe.Attribute("name").Value);
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("functions").Elements("function").All <XElement>(xe =>
                    {
                        devfuncColl.AddDeviceFunctions(xe.Attribute("id").Value,
                                                       xe.Attribute("functionname").Value,
                                                       fpc, /* this will taken care later*/
                                                       (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("returntype").Value.ToLower()));
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("properties").Elements("property").All <XElement>(xe =>
                    {
                        devPropColl.AddDeviceProperties(xe.Attribute("id").Value,
                                                        xe.Attribute("name").Value,
                                                        (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("type").Value.ToLower()),
                                                        Convert.ToBoolean(xe.Attribute("Readonly").Value));
                        return(true);
                    });

                    devCap.Events     = devEventColl;
                    devCap.Functions  = devfuncColl;
                    devCap.Properties = devPropColl;

                    AllDevices.AddDevice(xeDevices.Attribute("id").Value,
                                         xeDevices.Attribute("name").Value, devCap);
                    return(true);
                });
            }
        }