private void equipButton_Click(object sender, RoutedEventArgs e) { //GlobalData.Instance.currentlyModifying = GlobalData.Instance.copy(recipeMod); GlobalData.Instance.currentlyModifying = new Recipe(recipeMod); ModEquipments modEquipPg = new ModEquipments(recipeMod, recipeNum); ((MainWindow)App.Current.MainWindow).Main.Content = modEquipPg; }
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._equipment.RemoveAt(equipNum); //Steps.Children.RemoveAt(stepNum); int x = 0; if (Int32.TryParse(incBox.Text, out x)) { x = Int32.Parse(incBox.Text) - 1; } _recipe._equipment.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._equipment.Insert(x, stepBox.Text); } ModEquipments updatePage = new ModEquipments(_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; //MessageBox.Show("One does not simply put in an empty step!!!!!! You stupid Biiimbo"); } }
private void yesButton_Click(object sender, RoutedEventArgs e) { _recipe._equipment.RemoveAt(equipNum); //Steps.Children.RemoveAt(stepNum); //Or i can update the page ModEquipments updatePage = new ModEquipments(_recipe, recipeNum); ((MainWindow)App.Current.MainWindow).Main.Content = updatePage; mainGrid.IsEnabled = true; //GlobalData.Instance.modRecipeList.Add(_recipe); }