Esempio n. 1
0
        public async Task <IEnumerable <TimeOfDayState> > GetTimeOfDayStates()
        {
            IEnumerable <string> stateFiles = this.storageService.GetAllFilesByExtension(".tods", "TimeOfDayStates");
            var states = new List <TimeOfDayState>();

            foreach (string file in stateFiles)
            {
                var state = new TimeOfDayState();
                state.Name = await this.storageService.LoadValueFromKeyAsync(file, state.GetPropertyName(p => p.Name));

                state.StateStartTime.Hour = Convert.ToInt32(await this.storageService.LoadValueFromKeyAsync(
                                                                file,
                                                                state.StateStartTime.GetPropertyName(p => p.Hour)));
                state.StateStartTime.Minute = Convert.ToInt32(await this.storageService.LoadValueFromKeyAsync(
                                                                  file,
                                                                  state.StateStartTime.GetPropertyName(p => p.Minute)));
                state.StateStartTime.HoursPerDay = Convert.ToInt32(await this.storageService.LoadValueFromKeyAsync(
                                                                       file,
                                                                       state.StateStartTime.GetPropertyName(p => p.HoursPerDay)));

                states.Add(state);
            }

            return(states);
        }