/// <summary> /// Load the dacpac model /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void ButtonLoadModel_Click(object sender, RoutedEventArgs e) { try { if (string.IsNullOrEmpty(DacpacPath)) { MessageBox.Show("No dacpac file selected.", "Error to load", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { _loading++; buttonLoadModel.IsEnabled = false; IsEnabled = false; Model = await Task.Run(() => TSqlModelHelper.LoadModel(DacpacPath)); LoadTablesFromModel(); Roles = Model.GetAllRoles(); ucGlobalSettings.InitGlobalSettings(); ucGlobalSettings.IsEnabled = true; IsEnabled = true; buttonLoadConfig.IsEnabled = true; buttonSaveConfig.IsEnabled = true; _loading--; MessageBox.Show("Model loaded successfully", "Info", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception exc) { MessageBox.Show(exc.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { buttonLoadModel.IsEnabled = true; } }