public SupplementsGridViewModel(SuplementsEntryDTO entry, bool readOnly) { this.readOnly = readOnly; this.entry = entry; foreach (DosageType type in Enum.GetValues(typeof(DosageType))) { DosageTypes.Add(new ListItem <DosageType>(EnumLocalizer.Default.Translate(type), type)); } foreach (TimeType type in Enum.GetValues(typeof(TimeType))) { timeTypes.Add(new ListItem <TimeType>(EnumLocalizer.Default.Translate(type), type)); } foreach (var itemDto in entry.Items.Select(x => new SupplementItemViewModel(x, readOnly))) { items.Add(itemDto); } EnsureNewRowAdded(); }
public usrSupplementsCycleDosageEditor() { InitializeComponent(); foreach (DosageType dosageType in Enum.GetValues(typeof(DosageType))) { DosageTypes.Add(new ListItem <DosageType>(EnumLocalizer.Default.Translate(dosageType), dosageType)); } foreach (DosageUnit dosageUnit in Enum.GetValues(typeof(DosageUnit))) { DosageUnits.Add(new ListItem <DosageUnit>(EnumLocalizer.Default.Translate(dosageUnit), dosageUnit)); } foreach (SupplementCycleDayRepetitions repetition in Enum.GetValues(typeof(SupplementCycleDayRepetitions))) { Repetitions.Add(new ListItem <SupplementCycleDayRepetitions>(EnumLocalizer.Default.Translate(repetition), repetition)); } foreach (TimeType timeType in Enum.GetValues(typeof(TimeType))) { TimeTypes.Add(new ListItem <TimeType>(EnumLocalizer.Default.Translate(timeType), timeType)); } }