static public SimulateVariableUnit Create(string _name, string type = "")
        {
            SimulateVariableUnit result = null;
            SpecialValue         svalue = SpecialValueManager.ValueOfName(_name);

            if (svalue != null)
            {
                type = svalue.Type;
            }
            if (type.Length == 0)
            {
                result = _Create(_name);
            }
            else
            {
                result = _Create(_name, type);
            }
            if (result == null)
            {
                return(result);
            }
            if (svalue != null)
            {
                SimulateSpecialUnit ssunit = new SimulateSpecialUnit(
                    result, svalue.CanRead, svalue.CanWrite);
                ssunit.Var = svalue.NickName;
                return(ssunit);
            }
            return(result);
        }
 public SimuMoniValueModel(
     SimulateVariableUnit _svunit,
     SimulateModel _smodel)
 {
     svunit = _svunit;
     smodel = _smodel;
     svunit.ValueChanged += OnValueChanged;
 }
Beispiel #3
0
 public SimulateSpecialUnit(
     SimulateVariableUnit _prototype,
     bool _canread, bool _canwrite)
 {
     Prototype = _prototype;
     CanRead   = _canread;
     CanWrite  = _canwrite;
     Prototype.ValueChanged += OnPrototypeValueChanged;
     Prototype.LockChanged  += OnPrototypeLockChanged;
 }
        public static SimulateVariableModel Create(IEnumerable <SimulateVariableUnit> svunits)
        {
            SimulateVariableUnit svunitf = svunits.First();

            if (svunitf is SimulateBitUnit)
            {
                return(SimulateBitModel.Create(svunits));
            }
            if (svunitf is SimulateWordUnit)
            {
                return(SimulateWordModel.Create(svunits));
            }
            if (svunitf is SimulateDWordUnit)
            {
                return(SimulateDWordModel.Create(svunits));
            }
            if (svunitf is SimulateFloatUnit)
            {
                return(SimulateFloatModel.Create(svunits));
            }
            return(null);
        }