private async Task LoadTypeAndWorkplans(RecipeModel model, IReadOnlyCollection <WorkplanViewModel> workplans)
        {
            Workplans = workplans;
            NotifyOfPropertyChange(nameof(Workplans));

            var customization = await ProductServiceModel.GetCustomization();

            var typeModel = customization.RecipeTypes.FirstOrDefault(t => t.Name == model.Type);

            if (typeModel == null)
            {
                throw new InvalidOperationException("Recipe type not found");
            }

            Definition = new RecipeDefinitionViewModel(typeModel);
        }
Esempio n. 2
0
        private async Task UpdateTreeAsync()
        {
            try
            {
                var customization = await ProductServiceModel.GetCustomization(true);

                var productTypes = customization.ProductTypes;

                var products = await ProductServiceModel.GetProducts(Query.GetQuery());

                Merge(productTypes, products);
            }
            catch (Exception e)
            {
                ProductGroups.Clear();
                ShowEmpty();
            }
        }
Esempio n. 3
0
        private async Task LoadTypeAndWorkplans(RecipeModel model, IReadOnlyCollection <WorkplanViewModel> workplans)
        {
            if (!workplans.Any(w => w.Id == (model.WorkplanModel?.Id ?? model.WorkplanId)) && model.WorkplanModel is not null)
            {
                Workplans = workplans.Concat(new WorkplanViewModel[] { new WorkplanViewModel(model.WorkplanModel) }).ToList();
            }
            else
            {
                Workplans = workplans;
            }
            NotifyOfPropertyChange(nameof(Workplans));

            var customization = await ProductServiceModel.GetCustomization();

            var typeModel = customization.RecipeTypes.FirstOrDefault(t => t.Name == model.Type);

            if (typeModel == null)
            {
                throw new InvalidOperationException("Recipe type not found");
            }

            Definition = new RecipeDefinitionViewModel(typeModel);
        }