/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Language display initialization InitializeLanguage(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { Application.Current.Host.Settings.EnableFrameRateCounter = true; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } // Specify the local database connection string. string DBConnectionString = "Data Source=isostore:/Venue.sdf"; // Create the database if it does not exist. using (VenueDataContext db = new VenueDataContext(DBConnectionString)) { if (db.DatabaseExists() == false) { // Create the local database. db.CreateDatabase(); // Save categories to the database. db.SubmitChanges(); } } // Create the ViewModel object. _viewModel = new VenueViewModel(DBConnectionString); _viewModel.LoadCollectionsFromDatabase(); }
// Class constructor, create the data context object. public VenueViewModel(string venueDBConnectionString) { venueDB = new VenueDataContext(venueDBConnectionString); }