Beispiel #1
0
 /// <summary>
 /// Disposes all subobjects and initiates a full reload.
 /// </summary>
 public void Reload()
 {
     if (_disposing)
     {
         return;
     }
     _version = "";
     _rpc.Clear();
     if (_families != null)
     {
         _families.Dispose();
     }
     _families = new Families(_rpc, _rpc.Families);
     if (_devices != null)
     {
         _devices.Dispose();
     }
     _devices = new Devices(_rpc, _rpc.Devices);
     foreach (KeyValuePair <Int32, Device> device in _devices)
     {
         device.Value.VariableReloadRequiredEvent += OnDevice_VariableReloadRequired;
     }
     if (_interfaces != null)
     {
         _interfaces.Dispose();
     }
     _interfaces = null;
     if (_systemVariables != null)
     {
         _systemVariables.Dispose();
     }
     _systemVariables = new SystemVariables(_rpc, _rpc.SystemVariables);
     if (Reloaded != null)
     {
         Reloaded(this);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Disposes all subobjects and initiates a full reload.
        /// </summary>
        public void Reload()
        {
            if (_disposing)
            {
                return;
            }

            _version = "";
            _rpc.Clear();
            _families?.Dispose();
            _families = new Families(_rpc, _rpc.Families);
            _devices?.Dispose();
            _devices = new Devices(_rpc, _rpc.Devices);
            foreach (KeyValuePair <long, Device> device in _devices)
            {
                device.Value.VariableReloadRequiredEvent += OnDevice_VariableReloadRequired;
            }

            _interfaces?.Dispose();
            _interfaces = null;
            _systemVariables?.Dispose();
            _systemVariables = new SystemVariables(_rpc, _rpc.SystemVariables);
            Reloaded?.Invoke(this);
        }