private void stepsButton_Click(object sender, RoutedEventArgs e) { //GlobalData.Instance.currentlyModifying = GlobalData.Instance.copy(recipeMod); GlobalData.Instance.currentlyModifying = new Recipe(recipeMod); ModSteps modStepsPg = new ModSteps(recipeMod, recipeNum); ((MainWindow)App.Current.MainWindow).Main.Content = modStepsPg; }
private void Save_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(stepBox.Text)) { //Exit the popup modBox.IsEnabled = false; this.modBox.Visibility = System.Windows.Visibility.Hidden; if (!changeAddFlag) //When change flag is set { //Change the step and place it accordingly _recipe._steps.RemoveAt(stepNum); //Steps.Children.RemoveAt(stepNum); int x = 0; if (Int32.TryParse(incBox.Text, out x)) { x = Int32.Parse(incBox.Text) - 1; } _recipe._steps.Insert(x, stepBox.Text); //Make the new step and add it in //ModUserControl changedStep = new ModUserControl(stepBox.Text); /* * changedStep.Change.Tag = x; //This will be used to determine which user control is connected to which button * changedStep.Delete.Tag = x; //Same as above to use it for delete button * changedStep.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; * changedStep.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; * changedStep.Change.Click += Change_Click; * changedStep.Delete.Click += Delete_Click; * Steps.Children.Insert(x, changedStep); */ //OR i can just update the page } else { int x = 0; if (Int32.TryParse(incBox.Text, out x)) { x = Int32.Parse(incBox.Text) - 1; } _recipe._steps.Insert(x, stepBox.Text); } ModSteps updatePage = new ModSteps(_recipe, recipeNum); ((MainWindow)App.Current.MainWindow).Main.Content = updatePage; mainGrid.IsEnabled = true; InvalidInput.Visibility = System.Windows.Visibility.Hidden; } else { InvalidInput.Visibility = System.Windows.Visibility.Visible; } }
private void yesButton_Click(object sender, RoutedEventArgs e) { _recipe._steps.RemoveAt(stepNum); // need to delete corresponding time for step _recipe._timerValuesForSteps.RemoveAt(stepNum); //Steps.Children.RemoveAt(stepNum); //Or i can update the page ModSteps updatePage = new ModSteps(_recipe, recipeNum); ((MainWindow)App.Current.MainWindow).Main.Content = updatePage; mainGrid.IsEnabled = true; //GlobalData.Instance.modRecipeList.Add(_recipe); }