public void CopyFrom(object original) { if (original is null) { throw new ArgumentNullException(nameof(original)); } var src = (Template)original; Name = src.Name; Description = src.Description; foreach (var t in src.Tags) { Tags.Add(t); } foreach (var a in src.Alarms) { Alarms.Add(a); } foreach (var z in src.Archives) { Archives.Add(z); } foreach (var d in src.DeviceToTemplates) { DeviceToTemplates.Add(d); } }
public override void AddChild(iCalObject child) { if (child is Alarm) { Alarms.Add((Alarm)child); } base.AddChild(child); }
void addAlarm(object o) { Ticker a = new Ticker(); a.Closed += new EventHandler(a_Closed); a.PropertyChanged += new PropertyChangedEventHandler(a_PropertyChanged); Alarms.Add(a); }
void ExecuteRefreshCommand() { Alarms.Clear(); foreach (var alarm in App.Alarms) { Alarms.Add(alarm); } }
public void SetAlarms(IEnumerable <Alarm> newAlarms) { Alarms.Clear(); foreach (var alarm in newAlarms) { Alarms.Add(alarm); } }
public void AddNode(string name, Node node) { if (node == null) { return; } Alarms.Add(new Alarm(name, node)); _status.Add(false); _pi.SavePluginConfig(_config); }
private void LoadMoreItems() { if (AlarmDatas.Any()) { var start = Alarms.Count; var lenght = start + AppConstant.PAGE_SIZE < AlarmDatas.Count ? start + AppConstant.PAGE_SIZE : AlarmDatas.Count; for (int i = start; i < lenght; i++) { Alarms.Add(AlarmDatas[i]); } } }
public void AddNode(string name, int nodeId) { Alarm alarm = new(name, _nodes, nodeId); if (alarm.Node == null) { return; } Alarms.Add(alarm); _status.Add(false); _pi.SavePluginConfig(_config); }
public void AddElement() { var alarms = Core.SettingsManager.Value.Alarms; var alarm = new Alarm() { Time = "08:45", IsEnabledMonday = true, IsEnabledTuesday = true, IsEnabledWednesday = true, IsEnabledThursday = true, IsEnabledFriday = true, Message = "こんにちは", PlayerType = Core.PlayerManager.PlayerVoices.First().Item1, VoiceType = Core.PlayerManager.PlayerVoices.First().Item2, }; alarms.Add(alarm); Alarms.Add(new AlarmViewModel(this, Core, alarm)); OnPropertyChanged(nameof(Alarms)); }
private void AddAlarmToStatistics(int avgX, int yPic, float length, DetectResultStatistic detectResultStatistic) { int xPos = avgX; int yPos = serialComm.LoopCount % AlarmRecord.TotalLoopCount; AlarmRecord alarmRecord = new AlarmRecord { XPos = xPos, YPos = yPos, YPic = yPic, LatestOccurTime = DateTime.Now, CreatedTime = DateTime.Now, Length = length }; App.Current?.Dispatcher.Invoke(() => { if (Alarms.Contains(alarmRecord)) { int index = Alarms.IndexOf(alarmRecord); var alarm = Alarms[index]; //alarm.XPos = alarmRecord.XPos; if (AlarmHeadFlag) { if (firstAlarmRecord == null) { firstAlarmRecord = alarmRecord; } if (firstAlarmRecord == alarmRecord) { LoopOffset = alarmRecord.YPos - alarm.YPos; } alarm.YPos = alarmRecord.YPos; AlarmHeadFlag = false; } alarm.Length = alarmRecord.Length; alarm.LatestOccurTime = alarmRecord.LatestOccurTime; } else { Alarms.Add(alarmRecord); Alarm(alarmRecord); } SelectedAlarmIndex = Alarms.IndexOf(alarmRecord); AsyncSaveObject("Alarms", Alarms); }); }
/// <summary> /// 开始告警 /// </summary> public static void AddAlarm(StartAlarm alarm) { if (alarm == null) { return; } if (Alarms == null) { Alarms = new List <StartAlarm>(); } if (AlarmKeys1 == null) { AlarmKeys1 = new Dictionary <string, StartAlarm>(); } if (AlarmKeys2 == null) { AlarmKeys1 = new Dictionary <string, StartAlarm>(); } Alarms.Add(alarm); AlarmKeys1[alarm.Id] = alarm; AlarmKeys2[CommonHelper.JoinKeys(alarm.DeviceId, alarm.PointId)] = alarm; }
public void AddAlarm(Alarm n) { if (n.report) { foreach (Alarm a in Alarms) { if (a.report) { return; } } } if (n.report) { Alarms.Insert(0, n); } else if (n.id == "") { n.id = SettingsManager.GenerateNewId(); Alarms.Add(n); } }
private void LoadAlarmSettingsVersion0() { // TODO: setting versioning Alarms.Clear(); // we are trying to load setting for the first time => there is nothing // when versioning will be supported check mechanism should be better // or someone delted the settings.dat file for example. if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey(AlarmsKey) == false) { return; } var settingsStr = Windows.Storage.ApplicationData.Current.LocalSettings.Values[AlarmsKey] as string; var alarmsJson = JsonValue.Parse(settingsStr).GetArray(); foreach (var alarmJsonValue in alarmsJson) { var alarmJson = alarmJsonValue.GetObject(); var alarm = new BaseAlarmSetting(); alarm.Id = int.Parse(alarmJson[JsonId].GetString()); alarm.Enabled = Boolean.Parse(alarmJson[JsonEnabled].GetString()); alarm.Time = new TimeSpan(long.Parse(alarmJson[JsonTime].GetString())); alarm.DaysOfWeek = (DayOfWeekType)int.Parse(alarmJson[JsonDaysOfWeek].GetString()); alarm.AudioFilename = alarmJson[JsonAudioFilename].GetString(); alarm.ImageFilename = alarmJson[JsonImageFilename].GetString(); alarm.Occurrence = (OccurrenceType)Enum.Parse(typeof(OccurrenceType), alarmJson[JsonOccurrence].GetString()); // Fix: serialization of DateTimeOffset was missing. I do not want to change "date version" so I just check whether key is available here. if (alarmJson.ContainsKey(JsonDateTimeOffset)) { alarm.DateTimeOffset = DateTimeOffset.Parse(alarmJson[JsonDateTimeOffset].GetString(), System.Globalization.CultureInfo.InvariantCulture); } Alarms.Add(alarm); } }
public void Deserialize(System.IO.TextReader rdr, Serializer serializer) { string name, value; var parameters = new System.Collections.Specialized.NameValueCollection(); while (rdr.Property(out name, out value, parameters) && !string.IsNullOrEmpty(name)) { switch (name.ToUpper()) { case "BEGIN": switch (value) { case "VALARM": var a = serializer.GetService <Alarm>(); a.Deserialize(rdr, serializer); Alarms.Add(a); break; } break; case "ATTENDEE": var contact = new Contact(); contact.Deserialize(value, parameters); Attendees.Add(contact); break; case "CATEGORIES": Categories = value.SplitEscaped().ToList(); break; case "CLASS": Class = value.ToEnum <Classes>(); break; case "CREATED": Created = value.ToDateTime(); break; case "DESCRIPTION": Description = value; break; case "DTEND": End = value.ToDateTime(); break; case "DTSTAMP": DTSTAMP = value.ToDateTime().GetValueOrDefault(); break; case "DTSTART": Start = value.ToDateTime(); break; case "LAST-MODIFIED": LastModified = value.ToDateTime(); break; case "LOCATION": Location = value; break; case "ORGANIZER": Organizer = serializer.GetService <Contact>(); Organizer.Deserialize(value, parameters); break; case "PRIORITY": Priority = value.ToInt(); break; case "SEQUENCE": Sequence = value.ToInt(); break; case "STATUS": Status = value.ToEnum <Statuses>(); break; case "SUMMARY": Summary = value; break; case "TRANSP": Transparency = value; break; case "UID": UID = value; break; case "URL": Url = value.ToUri(); break; case "ATTACH": var attach = value.ToUri(); if (attach != null) { Attachments.Add(attach); } break; case "RRULE": var rule = serializer.GetService <Recurrence>(); rule.Deserialize(null, parameters); Recurrences.Add(rule); break; case "END": return; default: Properties.Add(Tuple.Create(name, value, parameters)); break; } } IsAllDay = Start == End; }
public void addAlarm(Alarm a) { Alarms.Add(a); }