In this page, you can add items. now you press "Save" to add another one. Heres the code:
private void Btn_Save_Click(object sender, RoutedEventArgs e)
{
// Adding the item to DB and List
MainData.MainDataItem MDI_Temp = new MainData.MainDataItem();
MDI_Temp.Int_AF = Convert.ToInt32(Tb_AF.Text);
MDI_Temp.Int_HO = Convert.ToInt32(Tb_HO.Text);
MDI_Temp.Int_ST = Convert.ToInt32(Tb_ST.Text);
MDI_Temp.Int_STD = Convert.ToInt32(Tb_STD.Text);
MDI_Temp.Int_DIA = Convert.ToInt32(Tb_DIA.Text);
MDI_Temp.Int_ECK = Convert.ToInt32(Tb_ECK.Text);
MDI_Temp.Int_MID = ((HelperClasses.Main_VM)this.DataContext).MDO_TmpStore.Int_ID;
MDI_Temp.Str_Bauteil = Str_Bauteil;
MDI_Temp.Str_Defekt = Str_Defekt;
MDI_Temp.Str_Massnahme = Str_Massnahme;
MDI_Temp.Str_Feld = Tb_Feld.Text;
MDI_Temp.Str_Zeile = Tb_Zeile.Text;
MDI_Temp.Int_Pos = Convert.ToInt32(Tb_Pos.Text);
HelperClasses.SQL_Class.DBAddItem(MDI_Temp);
// Navigate
HelperClass.Navigate("pages/New_Item.xaml");
}
And this is the void in the helperclass:
public static void Navigate(string Str_Uri)
{
((MainWindow)Application.Current.Windows[0]).Fm_MainContainer.Source = new Uri(Str_Uri, UriKind.Relative);
}
The first time you click on Btn_Save the page reloads, the second time it onyl add the item