Exemplo n.º 1
0
        private int GetIndex(AlarmViewModel alarmViewModel)
        {
            for (int i = 0; i < Alarms.Count; i++)
            {
                if (Alarms[i].Equals(alarmViewModel))
                {
                    return(i);
                }
            }

            return(-1);
        }
Exemplo n.º 2
0
        public void RemoveElement(AlarmViewModel alarmViewModel)
        {
            var index = GetIndex(alarmViewModel);

            if (index >= 0)
            {
                var alarms = Core.SettingsManager.Value.Alarms;

                alarms.RemoveAt(index);
                Alarms.RemoveAt(index);

                OnPropertyChanged(nameof(Alarms));
            }
        }
Exemplo n.º 3
0
        public void CopyElement(AlarmViewModel alarmViewModel)
        {
            var index = GetIndex(alarmViewModel);

            if (index >= 0)
            {
                var alarms = Core.SettingsManager.Value.Alarms;
                var alarm  = alarms[index].Clone();

                alarms.Insert(index, alarm);
                Alarms.Insert(index, new AlarmViewModel(this, Core, alarm));

                OnPropertyChanged(nameof(Alarms));
            }
        }