zhaw-dnet2/Tasks/Lab8/DataAdapter/MainWindow.xaml.cs

58 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DataAdapter
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private FlughafenDBDataSet flughafenDBDataSet;
private FlughafenDBDataSetTableAdapters.FlugTableAdapter flughafenDBDataSetFlugTableAdapter;
private CollectionViewSource flugViewSource;
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
flughafenDBDataSet = (FlughafenDBDataSet)FindResource("flughafenDBDataSet");
// Load data into the table Flug. You can modify this code as needed.
flughafenDBDataSetFlugTableAdapter = new FlughafenDBDataSetTableAdapters.FlugTableAdapter();
flughafenDBDataSetFlugTableAdapter.Fill(flughafenDBDataSet.Flug);
flugViewSource = (CollectionViewSource)FindResource("flugViewSource");
flugViewSource.View.MoveCurrentToFirst();
}
private void BackButton_Click(object sender, RoutedEventArgs e)
{
flugViewSource.View.MoveCurrentToPrevious();
}
private void NextButton_Click(object sender, RoutedEventArgs e)
{
flugViewSource.View.MoveCurrentToNext();
}
private void saveButton_Click(object sender, RoutedEventArgs e)
{
flughafenDBDataSetFlugTableAdapter.Update(flughafenDBDataSet.Flug);
}
}
}