Пример #1
0
        public void showSelectedFiles(string[] files)
        {
            BackGroundWorker.RunWorkAsync <List <string> >(() => searchFiles(files), (data) =>
            {
                if (tabFiles.InvokeRequired)
                {
                    loadFilesCallBack b = new loadFilesCallBack(showSelectedFiles);
                    Invoke(b, new object[] { files });
                }
                else
                {
                    ComponentResourceManager resources = new ComponentResourceManager(typeof(frmOpenTheatre));
                    cmboBoxFilesSort.SelectedIndex     = 0; dataGridFiles.Rows.Clear();
                    cmboBoxFilesHost.Items.Clear(); cmboBoxFilesHost.Items.Add(resources.GetString("cmboBoxFilesHost.Items"));
                    cmboBoxFilesFormat.Items.Clear(); cmboBoxFilesFormat.Items.Add(resources.GetString("cmboBoxFilesFormat.Items"));

                    foreach (string jsonData in data)
                    {
                        var dataJson     = DatabaseFilesEntity.FromJson(jsonData);
                        string dateAdded = dataJson.DateAdded;
                        if (dataJson.DateAdded != "-")
                        {
                            dateAdded = UtilityTools.getTimeAgo(Convert.ToDateTime(dataJson.DateAdded));
                        }
                        dataGridFiles.Rows.Add(dataJson.Type, dataJson.Title, dataJson.Size, dateAdded, dataJson.Host, dataJson.URL);
                        if (!(cmboBoxFilesFormat.Items.Contains(dataJson.Type)))
                        {
                            cmboBoxFilesFormat.Items.Add(dataJson.Type);
                        }
                        if (!(cmboBoxFilesHost.Items.Contains(dataJson.Host)))
                        {
                            cmboBoxFilesHost.Items.Add(dataJson.Host);
                        }
                    }

                    cmboBoxFilesHost.DropDownWidth = DropDownWidth(cmboBoxFilesHost);
                    imgSpinner.Visible             = false;
                }
            });
        }
Пример #2
0
        public void loadMovies(int count)
        {
            imgSpinnerGIF.Visible = true;
            BackGroundWorker.RunWorkAsync <List <ctrlMoviesPoster> >(() => LoadMovies(count), (data) =>
            {
                if (panelMovies.InvokeRequired)
                {
                    loadMoviesCallBack b = new loadMoviesCallBack(loadMovies);
                    Invoke(b, new object[] { count });
                }
                else
                {
                    foreach (ctrlMoviesPoster item in data)
                    {
                        panelMovies.Controls.Add(item);
                    }

                    imgSpinnerGIF.Visible = false;
                    tab.SelectedTab       = tabMovies;
                }
            });
        }