Example #1
0
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         CALogger.InitLogFile(Properties.Settings.Default.LogFile);
     }
     catch
     {
         MessageBox.Show("Ошибка в файле конфигурации");
         Close();
     }
     CALogger.WriteToLogFile("Программа запущена");
     CALogger.WriteToLogFile("Подключение к БД…");
     try
     {
         string UserLevelPath = Properties.Settings.Default.DBFilePath;
         if (ConnectionStringGiver.GetValidConnectionString(ref UserLevelPath) != null)
         {
             Properties.Settings.Default.DBFilePath = UserLevelPath;
         }
         else
         {
             CALogger.WriteToLogFile("Не найдена БД"); Close();
         }
     }
     catch
     {
         CALogger.WriteToLogFile("Ошибка при считывании строки подключения!");
         MessageBox.Show("Ошибка в файле конфигурации");
         Close();
     }
 }