Ejemplo n.º 1
0
 /// <summary>
 /// Lädt einen IOPort mit Bit aus einem DataSafe
 /// </summary>
 /// <param name="bit">Positionsindex, aus dem die Werte geladen werden sollen.</param>
 /// <param name="ds">DataSafe aus dem geladen werden soll.</param>
 /// <returns></returns>
 public static IOPort Load(int pos, Data.DataSafe ds)
 {
     int b = ds.Ints["Bit-" + pos, -1];
     if (b >= 0)
     {
         IOPort p = new IOPort(b, (IOPortType)ds.Ints["PortType-" + pos, 3]);
         p.InName = ds.Strings["InName-" + pos, ""];
         p.OutName = ds.Strings["OutName-" + pos, ""];
         return p;
     }
     return null;
 }
Ejemplo n.º 2
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            string[] all = HWC.IOControllerControlIdents;
            foreach (string s in all)
            {
                IOController i = HWC.GetIOController(s);
                i.RemoveAllPorts();
            }

            foreach (var r in Data.Parameters)
            {
                if (!string.IsNullOrEmpty(r.ParamController) && !string.IsNullOrWhiteSpace(r.ParamController) )
                {
                    IOController ic = HWC.GetIOController(r.ParamController);
                    if (ic != null)
                    {
                        if (!ic.ContainsPort(r.ParamBit))
                        {
                            //Port neu erstellen
                            IOPort pn = new IOPort(r.ParamBit, r.ParamPortType);
                            pn.InName = r.ParamInName;
                            pn.OutName = r.ParamOutName;
                            ic.AddPort(pn);
                        }
                        else
                        {
                            //Port verändern
                            IOPort p = ic.GetPort(r.ParamBit);
                            p.PortType = r.ParamPortType;
                            p.InName = r.ParamInName;
                            p.OutName = r.ParamOutName;
                        }
                    }
                }
            }
            HWC.Save();
        }
Ejemplo n.º 3
0
 public virtual void AddPort(IOPort port)
 {
     this.AllIOPorts.Add(port);
 }
Ejemplo n.º 4
0
 public virtual void AddPort(IOPort port)
 {
     this.AllIOPorts.Add(port);
 }