public ButtonCandy(CandyCategory category) { InitializeComponent(); _category = category; button_main.Background = new ImageBrush(new BitmapImage(new Uri(category.ImageUrl))); (button_main.Background as ImageBrush).Stretch = Stretch.UniformToFill; button_main.Content = category.Name; button_main.Click += Category_Click; }
/// <summary> /// Default constructor /// </summary> public CandyTypesViewModel(CandyCategory category) { Category = category; // Create commands SelectCandyTypeCommand = new RelayParameterizedCommand(async(parameter) => await SelectCandyTypeAsync(parameter)); BackCommand = new RelayCommand(() => Back()); }
/// <summary> /// Initializes a new instance of the <see cref="Candy"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="productArticle">The product article.</param> /// <param name="weight">The weight.</param> public Candy(string name, string productArticle, double weight, CandyFlavor candyFlavor, CandyCategory category, DateTime expirationDate, double sugar) : base(name, productArticle, weight) { this.CandyFlavor = candyFlavor; this.Category = category; this.ExpirationDate = expirationDate; this.SugarContent = sugar; }
/// <summary> /// Initializes a new instance of the <see cref="Candy"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="productArticle">The product article.</param> /// <param name="weight">The weight.</param> public Candy(string name, string productArticle, double weight, CandyFlavor candyFlavor, CandyCategory category) : base(name, productArticle, weight) { this.CandyFlavor = candyFlavor; this.Category = category; }
private void Awake() { _movement = GetComponent <CandyMoved>(); _category = GetComponent <CandyCategory>(); _clean = GetComponent <CandyClean>(); }
private static async Task <List <CandyCategory> > LoadCategoryConfig(string configFolderPath) { var filePath = $"{configFolderPath}{Path.DirectorySeparatorChar}candycategories.yaml"; if (!File.Exists(filePath)) { File.Create(filePath).Dispose(); } var candyCategories = new List <CandyCategory>(); var root = "candycategories"; var yamlFile = new YamlFile(filePath); if (yamlFile.GetString(root) != null) { foreach (var child in yamlFile.GetChildren(root)) { var candyCategory = new CandyCategory { Name = yamlFile.GetString($"{root}.{child}.name"), ImageUrl = yamlFile.GetString($"{root}.{child}.imageurl"), }; var candyTypes = new List <CandyType>(); foreach (var candyType in yamlFile.GetChildren($"{root}.{child}.candytypes")) { var candyTypeObject = new CandyType { Category = candyCategory, Name = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.name"), ImageUrl = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.imageurl"), Price = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.price"), Ingredients = new List <Ingredient>(), Sizes = new List <string>(), }; foreach (var ingredient in yamlFile.GetChildren($"{root}.{child}.candytypes.{candyType}.ingredients")) { candyTypeObject.Ingredients.Add(new Ingredient { Name = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.ingredients.{ingredient}.name"), IsAllergic = bool.Parse(yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.ingredients.{ingredient}.allergic")), WarningImagePath = yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.ingredients.{ingredient}.warningimage"), }); } foreach (var size in yamlFile.GetChildren($"{root}.{child}.candytypes.{candyType}.sizes")) { candyTypeObject.Sizes.Add(yamlFile.GetString($"{root}.{child}.candytypes.{candyType}.sizes.{size}.name")); } candyTypes.Add(candyTypeObject); } candyCategory.CandyTypes = candyTypes; candyCategories.Add(candyCategory); } } return(candyCategories); }