private void ButtonEditChairs_Click(object sender, RoutedEventArgs e) { if (firebirdClient == null) { firebirdClient = new Infoscreen.FirebirdClient( configuration.DataBaseAddress, configuration.DataBaseName, configuration.DataBaseUserName, configuration.DataBasePassword); } if (chairItemsCache.Count == 0) { GetChairItems(); } if (chairItemsCache.Count == 0) { return; } Infoscreen.Configuration.ItemSystem itemSystem = (sender as Button).DataContext as Infoscreen.Configuration.ItemSystem; string systemName = itemSystem.SystemName; WindowEditSystemChairs windowAddOrEditSystem = new WindowEditSystemChairs(chairItemsCache, systemName, itemSystem.ChairItems); windowAddOrEditSystem.Owner = Window.GetWindow(this); windowAddOrEditSystem.ShowDialog(); }
private async void UpdateChairItems() { firebirdClient = null; chairItemsCache.Clear(); if (string.IsNullOrEmpty(configuration.DataBaseAddress) || string.IsNullOrEmpty(configuration.DataBaseName)) { MessageBox.Show(Application.Current.MainWindow, "Не заданы параметры подключения к БД в разделе 'Внутренние настройки'", "Ошибка конфигурации", MessageBoxButton.OK, MessageBoxImage.Error); return; } firebirdClient = new Infoscreen.FirebirdClient( configuration.DataBaseAddress, configuration.DataBaseName, configuration.DataBaseUserName, configuration.DataBasePassword); if (!firebirdClient.IsDbAvailable()) { return; } await Task.Run(() => { GetChairItems(); }); }
private void ButtonCheckDBConnect_Click(object sender, RoutedEventArgs e) { if (firebirdClient == null) { firebirdClient = new Infoscreen.FirebirdClient( configuration.DataBaseAddress, configuration.DataBaseName, configuration.DataBaseUserName, configuration.DataBasePassword); } if (firebirdClient.IsDbAvailable()) { MessageBox.Show(Window.GetWindow(this), "Соединение выполнено успешно", "", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(Window.GetWindow(this), "Не удалось выполнить тестовый запрос. " + "Подробности можно узнать в журнале работы, расположенном в папке с программой.", "", MessageBoxButton.OK, MessageBoxImage.Error); } }