Example #1
0
        private void Refresh <T>(T changedKpi, Action <DeviceIndicatorsModel, T> updater) where T : IIndicatorBase
        {
            var kpis   = _coreData.GetParent <IDeviceIndicators>(changedKpi);
            var device = _coreData.GetParent <IDevice>(kpis);
            var id     = _coreData.GetId(device);

            var localDevice = Devices.FirstOrDefault(s => s.DeviceId == id);

            if (localDevice == null)
            {
                localDevice = new DeviceIndicatorsModel {
                    DeviceId = id
                };
                if (id != _coreData.ThisDeviceId)
                {
                    Devices.Insert(0, localDevice);
                }
                else
                {
                    Devices.Add(localDevice);
                }

                UpdateDeviceNames();
            }

            updater(localDevice, changedKpi);
        }