示例#1
0
        public override void LoadAdditionals(XPathNavigator reader)
        {
            _usedHardware.Clear();
            Connections.Clear();
            var readerAdd = reader.Select("UsedHardware/Hardware");

            while (readerAdd.MoveNext())
            {
                var id = readerAdd.Current.GetAttribute("Id", readerAdd.Current.NamespaceURI);
                id = ControlProcessorHardware.FixForNewVersion(id);
                _usedHardware.Add(id, false);
            }
            readerAdd = reader.Select("Connectors/Connector");
            while (readerAdd.MoveNext())
            {
                var c = new Connector
                {
                    Id    = int.Parse(readerAdd.Current.GetAttribute("Id", readerAdd.Current.NamespaceURI)),
                    Order = int.Parse(readerAdd.Current.GetAttribute("Order", readerAdd.Current.NamespaceURI)),
                    Name  = readerAdd.Current.GetAttribute("Name", readerAdd.Current.NamespaceURI),
                };
                var item = new Assignment();
                item.SetConnector(c);
                item.SetAssignedHardware(readerAdd.Current.GetAttribute("AssignedCode", readerAdd.Current.NamespaceURI));
                Connections.Add(item);
            }
        }
        public override void LoadAdditionals(XPathNavigator reader)
        {
            Connections.Clear();
            var readerAdd = reader.Select("Connectors/Connector");

            while (readerAdd.MoveNext())
            {
                var c = new Connector();
                c.Id    = int.Parse(readerAdd.Current.GetAttribute("Id", readerAdd.Current.NamespaceURI));
                c.Order = c.Id;
                c.Name  = readerAdd.Current.GetAttribute("Name", readerAdd.Current.NamespaceURI);
                var a = new AssignmentForButton();
                a.SetInverseState(bool.Parse(readerAdd.Current.GetAttribute("Invert", readerAdd.Current.NamespaceURI)));
                a.SetAssignedHardware(ControlProcessorHardware.FixForNewVersion(readerAdd.Current.GetAttribute("AssignedHardware", readerAdd.Current.NamespaceURI)));
                a.SetConnector(c);
                Connections.Add(a);
            }
        }
 public virtual void LoadAdditionals(XPathNavigator reader)
 {
     // Фикс для старой версии профиля
     Connections[0].SetAssignedHardware(reader.GetAttribute("AssignedHardware", reader.NamespaceURI));
     if (string.IsNullOrEmpty(Connections[0].GetAssignedHardware()))
     {
         Connections.Clear();
         var readerAdd = reader.Select("Connectors/Connector");
         while (readerAdd.MoveNext())
         {
             var c = new Connector
             {
                 Id    = int.Parse(readerAdd.Current.GetAttribute("Id", readerAdd.Current.NamespaceURI)),
                 Order = int.Parse(readerAdd.Current.GetAttribute("Order", readerAdd.Current.NamespaceURI)),
                 Name  = readerAdd.Current.GetAttribute("Name", readerAdd.Current.NamespaceURI)
             };
             var a = new AssignmentForButton();
             a.SetInverseState(bool.Parse(readerAdd.Current.GetAttribute("Invert", readerAdd.Current.NamespaceURI)));
             a.SetAssignedHardware(ControlProcessorHardware.FixForNewVersion(readerAdd.Current.GetAttribute("AssignedHardware", readerAdd.Current.NamespaceURI)));
             a.SetConnector(c);
             Connections.Add(a);
         }
     }
 }