public MainWindow() { InitializeComponent(); string connectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString; string dataProvider = ConfigurationManager.AppSettings["provider"]; try { _dataAccessLayer = new HospitalDAL(dataProvider, connectionString); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); } _canvasPainter = new CanvasPainter(MainCanvas); }