private void LoadTopSearches() { try { Program.log.Info("Getting top searches"); BackGroundWorker.RunWorkAsync <List <string> >(() => GetTopSearches(), (data) => { if (tabHome.InvokeRequired) { var b = new LoadTopSearchesCallBack(LoadTopSearches); Invoke(b, new object[] { }); } else { int count = 0; foreach (var tag in data) { if (count <= 65) { flowLayoutTopSearches.Controls.Add(ControlExtensions.AddTopSearchTag(tag, count)); count++; } } // Add Credits Label to end of Top Searches panel var a = new Label { Text = "Powered by FileChef", Font = new Font(buttonFileType.Font.Name, 9, FontStyle.Regular), BackColor = Color.Transparent, ForeColor = Color.White, Margin = new Padding(0, 8, 0, 3), Cursor = Cursors.Hand, Name = "btnFileChef", AutoSize = true, }; a.Click += buttonFileChef_Click; flowLayoutTopSearches.Controls.Add(a); Program.log.Info("Top searches successful"); } }); } catch (Exception ex) { labelTopSearches.Visible = false; splitterHeaderTopSearches.Visible = false; flowLayoutTopSearches.Visible = false; Program.log.Error("Error getting top searches", ex); } /* Error occurred, so hide controls/skip... */ }