bool changeAddFlag; //falsefor change, true for add public ModSteps(Recipe recipe, int _recipeNum) { InitializeComponent(); //mainGrid.IsEnabled = true; _recipe = recipe; //_copy = GlobalData.Instance.copy(recipe); _copy = new Recipe(recipe); foodTitle.Text = _recipe._name; recipeNum = _recipeNum; for (int i = 0; i < _recipe._steps.Count; i++) { ModUserControl step = new ModUserControl(_recipe._steps[i]); step.Change.Tag = i; //This will be used to determine which user control is connected to which button step.Delete.Tag = i; //Same as above to use it for delete button //Instead of this...Use a user control... /* * System.Windows.Controls.TextBlock newStep = new System.Windows.Controls.TextBlock(); * newStep.TextWrapping = System.Windows.TextWrapping.Wrap; * newStep.FontSize = 18; * newStep.Text = _recipe._steps[i];*/ step.IES.Text = (i + 1).ToString() + ") " + step.IES.Text; step.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; step.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; Thickness margin = step.Margin; margin.Top = 20; step.Margin = margin; step.Change.Click += Change_Click; step.Delete.Click += Delete_Click; Steps.Children.Add(step); } }
bool changeAddFlag; //falsefor change, true for add public ModIngredients(Recipe recipe, int _recipeNum) { InitializeComponent(); //mainGrid.IsEnabled = true; _recipe = recipe; foodTitle.Text = _recipe._name; recipeNum = _recipeNum; for (int i = 0; i < _recipe._ingredients.Count; i++) { ModUserControl ing; if (_recipe._ingredients[i]._unitStr != "NO UNIT") { ing = new ModUserControl(_recipe._ingredients[i]._measurementStr + " " + _recipe._ingredients[i]._unitStr + " " + _recipe._ingredients[i]._mainText); } else { ing = new ModUserControl(_recipe._ingredients[i]._measurementStr + " " + _recipe._ingredients[i]._mainText); } ing.Change.Tag = i; //This will be used to determine which user control is connected to which button ing.Delete.Tag = i; //Same as above to use it for delete button //Instead of this...Use a user control... ing.IES.Text = (i + 1).ToString() + ") " + ing.IES.Text; ing.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; ing.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; Thickness margin = ing.Margin; margin.Top = 20; ing.Margin = margin; ing.Change.Click += Change_Click; ing.Delete.Click += Delete_Click; Ings.Children.Add(ing); } initUnitMenu(); //_backButton.transitionPageButton.Click += BackButton_Click; }