Ejemplo n.º 1
0
        public Auto3DBaseDevice()
        {
            using (Settings reader = new MPSettings())
              {
            bSendEventGhostEvents = reader.GetValueAsBool("Auto3DPlugin", "EventGhostEvents", false);
            bShowMessageOnModeChange = reader.GetValueAsBool("Auto3DPlugin", "ShowMessageOnModeChange", false);
              }

              if (DeviceName != "No device")
              {
            String baseDir = Config.GetFolder(Config.Dir.Config);
            _docName = Path.Combine(baseDir, "Auto3D\\" + CompanyName + ".xml");

            _deviceDoc.Load(_docName);

            // get device node

            XmlNode deviceNode = _deviceDoc.GetElementsByTagName("Device").Item(0);

            // read commands

            XmlNode commandsNode = _deviceDoc.GetElementsByTagName("Commands").Item(0);

            foreach (XmlNode node in commandsNode.ChildNodes)
            {
              _remoteCommands.Add(new RemoteCommand(node));
            }

            // read models

            XmlNodeList deviceModels = _deviceDoc.GetElementsByTagName("Model");

            foreach (XmlNode node in deviceModels)
            {
              _deviceModels.Add(new Auto3DDeviceModel(node));
            }
              }
              else
              {
            _deviceModel = new Auto3DDeviceModel();
              }

              LoadSettings();

              Type[] types = this.GetType().Assembly.GetTypes();

              foreach (Type type in types)
              {
            if (type.GetInterface("IAuto3DSetup") != null || type.GetInterface("IAuto3DUPnPSetup") != null)
            {
              _setupControl = (UserControl)Activator.CreateInstance(type, this);
            }
            else
              if (type.BaseType != null && type.BaseType.Name == "UserControl")
              {
            _remoteKeyPad = (UserControl)Activator.CreateInstance(type);

            IAuto3DKeypad iKeyPad = _remoteKeyPad as IAuto3DKeypad;

            if (iKeyPad != null)
            {
              iKeyPad.SetDevice(this);
            }
              }
              }
        }
Ejemplo n.º 2
0
        public Auto3DBaseDevice()
        {
            using (Settings reader = new MPSettings())
            {
                bSendEventGhostEvents    = reader.GetValueAsBool("Auto3DPlugin", "EventGhostEvents", false);
                bShowMessageOnModeChange = reader.GetValueAsBool("Auto3DPlugin", "ShowMessageOnModeChange", false);
            }

            if (DeviceName != "No device")
            {
                String baseDir = Config.GetFolder(Config.Dir.Config);
                _docName = Path.Combine(baseDir, "Auto3D\\" + CompanyName + ".xml");

                _deviceDoc.Load(_docName);

                // get device node

                XmlNode deviceNode = _deviceDoc.GetElementsByTagName("Device").Item(0);

                // read commands

                XmlNode commandsNode = _deviceDoc.GetElementsByTagName("Commands").Item(0);

                foreach (XmlNode node in commandsNode.ChildNodes)
                {
                    _remoteCommands.Add(new RemoteCommand(node));
                }

                // read models

                XmlNodeList deviceModels = _deviceDoc.GetElementsByTagName("Model");

                foreach (XmlNode node in deviceModels)
                {
                    _deviceModels.Add(new Auto3DDeviceModel(node));
                }
            }
            else
            {
                _deviceModel = new Auto3DDeviceModel();
            }

            LoadSettings();

            Type[] types = this.GetType().Assembly.GetTypes();

            foreach (Type type in types)
            {
                if (type.GetInterface("IAuto3DSetup") != null || type.GetInterface("IAuto3DUPnPSetup") != null)
                {
                    _setupControl = (UserControl)Activator.CreateInstance(type, this);
                }
                else
                if (type.BaseType != null && type.BaseType.Name == "UserControl")
                {
                    _remoteKeyPad = (UserControl)Activator.CreateInstance(type);

                    IAuto3DKeypad iKeyPad = _remoteKeyPad as IAuto3DKeypad;

                    if (iKeyPad != null)
                    {
                        iKeyPad.SetDevice(this);
                    }
                }
            }
        }