public void Create_For_Left_Column(Entire_Process process) { Create_Video(); nameFood.Content = process.name; process.ingredients = process.ingredients.Replace(", ", "\n"); var label = new Label(); label.Content = process.ingredients; label.FontSize = 13; label.Margin = new Thickness(30, 0, 0, 0); ingredient.Children.Add(label); for (int i = 0; i < process.steps.Count; i++) { for (int j = 0; j < process.steps[i].images.Count; j++) { var grid_temp = new Grid(); var boder = new Border(); boder.CornerRadius = new CornerRadius(15); var temp = new ImageBrush(); temp.ImageSource = process.steps[i].images[j]; boder.Background = temp; grid_temp.Children.Add(boder); boder.Width = 80; boder.Height = 80; grid_temp.Margin = new Thickness(2); carousel.Children.Add(grid_temp); } } }
public DetailScreen(string foodName) { InitializeComponent(); process = ProcessDAO.GetAll(foodName); Create_For_Right_Column(process.steps); Create_For_Left_Column(process); }
public static Entire_Process GetAll(string foodName) { var result = new Entire_Process(); result.name = foodName; string folder = ""; folder = AppDomain.CurrentDomain.BaseDirectory; folder += $"/data/{ foodName}"; //doc so luong buoc cua mon an var amount_file = System.IO.File.ReadAllLines($"{folder}/amount.txt"); int amount = 0; Int32.TryParse(amount_file[0], out amount); //lay bitmap cua avatar tu file var uri = new Uri($"{folder}/thumbnail.jpg", UriKind.Absolute); var bitmap = new BitmapImage(uri); result.avatar = bitmap; //lay data cua ingredient tu chuoi var ingredient_file = System.IO.File.ReadAllLines($"{folder}/description.txt"); //lay link youtube tu file ingredient.txt result.link_youtube = ingredient_file[1]; //lay danh sach cac thanh phan tu file result.ingredients = ingredient_file[2]; // List <Step> tempListStep = new List <Step>(); for (int i = 1; i <= amount; i++) { tempListStep.Add(GetStep(folder, i)); } result.steps = tempListStep; return(result); }