private async void SpellSearchForm_Load(object sender, EventArgs e) { var loading = new LoadingForm { ProgressText = { Text = @"Loading: Templates" } }; loading.Show(); _allData = await _npcTemplateService.Get(); loading.Close(); GetPage(); }
private async void RewardQuestSearchForm_Load(object sender, EventArgs e) { var loading = new LoadingForm { ProgressText = { Text = @"Loading: Quests" } }; loading.Show(); _allData = await _rewardService.Get(); loading.Close(); GetPage(); }
private async void MobSearch_Load(object sender, EventArgs e) { if (_allData == null || !_allData.Any()) { var loading = new LoadingForm { ProgressText = { Text = @"Loading: Mobs" } }; loading.Show(); _allData = await _mobService.GetMobs(); loading.Close(); } GetPage(); }
private async void MobSearch_Load(object sender, EventArgs e) { Text = $@"Dawn of Light Database Toolbox ({ConnectionStringService.ConnectionString.Server})"; if (_allData == null || !_allData.Any()) { var loading = new LoadingForm { ProgressText = { Text = @"Loading: Mobs" } }; loading.Show(); _allData = await Task.Run(() => DatabaseManager.Database.SelectAllObjects <Mob>()); loading.Close(); } GetPage(); }
private async void MainForm_Load(object sender, EventArgs e) { // do not open app until db connection is valid bool isDbConnected = false; while (!isDbConnected) { MySqlConnectionStringBuilder sb = ConnectionStringService.ConnectionString; MySqlConnection testConnection = new MySqlConnection(sb.ConnectionString); try { testConnection.Open(); } catch (MySqlException ex) { var response = MessageBox.Show($@"DB connection error: {ex.Message}", @"DB Connection Error", MessageBoxButtons.RetryCancel); if (response == DialogResult.Cancel) { Application.Exit(); return; } new MySqlConfig().ShowDialog(this); } isDbConnected = testConnection.State == System.Data.ConnectionState.Open; } var loading = new LoadingForm(); //prevent clicking behind berfore connections made : Loki ToolboxTabControl.Enabled = false; loading.Show(); var progress = new Progress <int>(percent => { loading.ProgressBar.Value = percent; var item = percent / (100 / DatabaseManager.RegisteredObjects.Length); if (item < DatabaseManager.RegisteredObjects.Length) { var type = DatabaseManager.RegisteredObjects[item].Name; loading.ProgressText.Text = $@"Loading: {type}"; } }); // doing this to start loading the db await Task.Run(() => { DatabaseManager.SetDatabaseConnection(progress); }); loading.ProgressText.Text = @"Loading: Model Viewer"; await Task.Run(() => new ModelViewerService()); loading.Close(); ToolboxTabControl.Enabled = true; Text = $@"Dawn of Light Database Toolbox ({ConnectionStringService.ConnectionString.Server})"; LoadTabForms(); }