Beispiel #1
0
        public static void UpdateAlarm(AlarmRecord record)
        {
            var obj = record;

            // Update native alarm
            DependencyService.Get <IAlarm>().UpdateAlarm(ref obj);
            record = obj;
            string alarmUID = record.GetUniqueIdentifier();

            // Update list
            for (int i = 0; i < ObservableAlarmList.Count; i++)
            {
                AlarmRecord item = ObservableAlarmList[i];
                //AlarmModel.Compare(record, item);
                if (item.GetUniqueIdentifier() == alarmUID)
                {
                    DependencyService.Get <ILog>().Debug("  Found AlarmRecord(UID: " + item.GetUniqueIdentifier() + ") in ObservableAlarmList.");
                    AlarmRecordDictionary.Remove(alarmUID);
                    item.DeepCopy(record);
                    AlarmRecordDictionary.Add(alarmUID, item);
                    SaveDictionary();
                    break;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Update alarm record
        /// </summary>
        /// <param name="record">AlarmRecord</param>
        public static void UpdateAlarm(AlarmRecord record)
        {
            var obj = record;

            // Update native alarm
            AlarmNativeHandler.UpdateAlarm(ref obj);
            record = obj;
            string alarmUID = record.GetUniqueIdentifier();

            // Update list
            for (int i = 0; i < ObservableAlarmList.Count; i++)
            {
                AlarmRecord item = ObservableAlarmList[i];
                if (item.GetUniqueIdentifier() == alarmUID)
                {
                    Console.WriteLine("Found AlarmRecord(UID: " + item.GetUniqueIdentifier() + ") in ObservableAlarmList.");
                    AlarmRecordDictionary.Remove(alarmUID);
                    item.DeepCopy(record);
                    AlarmRecordDictionary.Add(alarmUID, item);
                    SaveDictionary();
                    break;
                }
            }
        }