Esempio n. 1
0
        private void LoadTopSearches()
        {
            try
            {
                Program.log.Info("Getting most searches");

                BackGroundWorker.RunWorkAsync <List <string> >(() => GetTopSearches(), (data) =>
                {
                    if (this.InvokeRequired)
                    {
                        Invoke(new LoadTopSearchesCallBack(LoadTopSearches), new object[] { });
                    }
                    else
                    {
                        int count = 0;
                        foreach (var tag in data)
                        {
                            if (count <= 100)
                            {
                                flowPanelMostSearches.Controls.Add(ControlExtensions.GetMostSearchTag(tag, count));
                                count++;
                            }
                        }

                        Program.log.Info("Most searches returned successfully");
                    }
                });
            }
            catch (Exception ex) { labelMostSearches.Visible = false; flowPanelMostSearches.Visible = false; Program.log.Error("Error getting top searches", ex); } /* Error occurred, so hide controls/skip... */
        }