public ModifierItemViewModel(RMenuGroupModifierVM menuGroupModifierVM) { MenuGroupModifierVM = menuGroupModifierVM; var minApplied = MenuGroupModifierVM.MenuModifierGroup.MinApplied; var maxApplied = MenuGroupModifierVM.MenuModifierGroup.MaxApplied; if (minApplied.HasValue && minApplied > 0) { if (maxApplied.HasValue && maxApplied != minApplied) { Title = string.Format(AppResources.ChooseRequired, minApplied + "-" + maxApplied + " " + MenuGroupModifierVM.MenuModifierGroup.DisplayName + " -"); } else { Title = string.Format(AppResources.ChooseRequired, minApplied + " " + MenuGroupModifierVM.MenuModifierGroup.DisplayName + " -"); } } else { if (maxApplied.HasValue && maxApplied > 0) { Title = string.Format(AppResources.ChooseOptional, "up to " + maxApplied + " " + MenuGroupModifierVM.MenuModifierGroup.DisplayName + " -"); } else { Title = string.Format(AppResources.ChooseOptional, MenuGroupModifierVM.MenuModifierGroup.DisplayName + " -"); } } }
public ModifierItemViewModel(RMenuGroupModifierVM menuGroupModifierVM, RMenuModifierVM menuModifier, bool applyByDefault = true) { MenuModifierVM = menuModifier; MenuGroupModifierVM = menuGroupModifierVM; Quantity = Math.Max(1, MenuModifierVM.Quantity); IsSelected = MenuModifierVM.IsSelected; if (applyByDefault) { if (!this.IsSelected) { Quantity = 1; this.IsSelected = MenuModifierVM.MenuModifier.ApplyByDefault; } } }