//Private Methods /// <summary> /// Populates the list, In case we didnt create one before. /// </summary> /// <version author="Andre Cachopas" date="13/05/2018" version="1.0" machine="KLAP"></version> private void PopulateList() { AlarmModel parsedAlarm = null; //Initialize the colors picker _colors = new List <EColor>(); for (int i = 0; i < Enum.GetNames(typeof(EColor)).Length; i++) { _colors.Add((EColor)i); } //Set the color picker SelectedColors.ItemsSource = _colors; //TODO:This should com from the server! string jsonSt = Helper.GetResource(); if (string.IsNullOrEmpty(jsonSt) == false) { parsedAlarm = AlarmModel.DeSerialize(jsonSt); } if (parsedAlarm != null) { AlarmPicker.Time = AlarmTime = parsedAlarm.AlarmTime; _selectedDays = parsedAlarm.SelectedDays; SelectedColors.SelectedItem = parsedAlarm.LightColor; } else { //if we fail to parse it we initialize it as an empty thing. AlarmPicker.Time = new TimeSpan(); _selectedDays = new List <DaySelection>(); for (int i = 0; i < WeekDays; i++) { //Not pretty but works for what we want DaySelection newDaySelection = new DaySelection((EWeekDay)i); _selectedDays.Add(newDaySelection); } } ListView.ItemsSource = _selectedDays; }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> /// <version author="Andre Cachopas" date="02/06/2018" version="1.0" machine="KLAP"></version> public object Clone() { DaySelection clonedDaySelection = new DaySelection(this.Weekday, this.Active); return(clonedDaySelection); }