Esempio n. 1
0
        public void Write(ElementModel emodel)
        {
            SimulateVariableUnit svunit = smodel.GetVariableUnit(emodel.ShowName, _Type(emodel.DataType));

            switch (svunit.Type)
            {
            case "BIT":
                switch (emodel.SetValue.ToUpper())
                {
                case "0":
                case "OFF":
                case "FALSE":
                    svunit.Value = 0; break;

                case "1":
                case "ON":
                case "TRUE":
                    svunit.Value = 1; break;
                }
                break;

            case "WORD":
                svunit.Value = Int32.Parse(emodel.SetValue); break;

            case "DWORD":
                svunit.Value = Int64.Parse(emodel.SetValue); break;

            case "FLOAT":
                svunit.Value = double.Parse(emodel.SetValue); break;
            }
            svunit.Set(smodel.SManager.DllModel);
            //emodel.CurrentValue = svunit.Value.ToString();
        }
Esempio n. 2
0
 /// <summary>
 /// 修改变量的值
 /// </summary>
 /// <param name="svunit"></param>
 public void Change(SimulateVariableUnit svunit)
 {
     if (svunit.Islocked)
     {
         svunit.Set(dllmodel);
         svunit.Islocked = false;
     }
 }