public MainWindow() { InitializeComponent(); SDRDataSet = new SDRDataSet(); this.DataContext = SDRDataSet; // Use this for data binding? Connection = new SqlConnection(SpecialDateReminder.Properties.Settings.Default.SDRConnectionString); Connection.Open(); // Populate dataset with data from database. PersonCommand = new SqlCommand("SELECT * FROM Person", Connection); PersonDataAdapter = new SqlDataAdapter(PersonCommand); PersonCommandBuilder = new SqlCommandBuilder(PersonDataAdapter); PersonDataAdapter.Fill(SDRDataSet, "Person"); EventCommand = new SqlCommand("SELECT * FROM Event", Connection); EventDataAdapter = new SqlDataAdapter(EventCommand); EventCommandBuilder = new SqlCommandBuilder(EventDataAdapter); EventDataAdapter.Fill(SDRDataSet, "Event"); Wish_ListCommand = new SqlCommand("SELECT * FROM Wish_List", Connection); Wish_ListDataAdapter = new SqlDataAdapter(Wish_ListCommand); Wish_ListCommandBuilder = new SqlCommandBuilder(Wish_ListDataAdapter); Wish_ListDataAdapter.Fill(SDRDataSet, "Wish_List"); Wish_List_ItemCommand = new SqlCommand("SELECT * FROM Wish_List_Item", Connection); Wish_List_ItemDataAdapter = new SqlDataAdapter(Wish_List_ItemCommand); Wish_List_ItemCommandBuilder = new SqlCommandBuilder(Wish_List_ItemDataAdapter); Wish_List_ItemDataAdapter.Fill(SDRDataSet, "Wish_List_Item"); Calendar = new Calendar(SDRDataSet); Thread alertThread = new Thread(new ThreadStart(Monitor_Events)); alertThread.Start(); Loaded += MainWindow_Loaded; Closing += MainWindow_Closing; }
public Calendar(SDRDataSet sdrDataSet) { // Create dataset and populate from database and set up so updates can be done. SDRDataSet = sdrDataSet; }