示例#1
0
 private void OnTvProgramsReveived(object sender, TvProgramReceivedEventArgs e)
 {
     flowLayoutPanel1.Invoke((Action)(() =>
     {
         flowLayoutPanel1.Controls.Clear();
     }));
     foreach (TvProgram item in e.Programs)
     {
         flowLayoutPanel1.Invoke(
             (Action)(() =>
         {
             TvProgramControl ctrl = new TvProgramControl(item, room);
             ctrl.buttonFoglalas.Click += (o, i) => { UpdateTvShowList(); };
             flowLayoutPanel1.Controls.Add(ctrl);
             ctrl.SelectedProgramChaned += (o, args) => { ChangeChannel(args.Program.TvChannel); };
         })
             );
     }
     if (e.Programs.Count == 0)
     {
         flowLayoutPanel1.Invoke(
             (Action)(() =>
         {
             flowLayoutPanel1.Controls.Add(new Label()
             {
                 Text = "Nem található műsor", Size = new Size(400, 30)
             });
         })
             );
     }
     loadingLabel.Text = "Kész.";
 }
        private void OnTvProgramsReveived(object sender, TvProgramReceivedEventArgs e)
        {
            programList.Invoke((Action)(() =>
            {
                programList.Items.Clear();
            }));
            programs = e.Programs;
            DoOrderBy(ref programs);
            foreach (TvProgram item in programs)
            {
                programList.Invoke(
                    (Action)(() =>
                {
                    AddTvProgramToList(item);
                })
                    );
            }
            loadingLabel.Text = "Kész.";
            queryLabel.Text   = programList.Items.Count + " műsor listázva";

            if (FilterButton.InvokeRequired)
            {
                FilterButton.Invoke((Action)(() => { FilterButton.Enabled = true; }));
            }
            else
            {
                FilterButton.Enabled = true;
            }
            if (programList.InvokeRequired)
            {
                programList.Invoke((Action)(() => { programList.Enabled = true; }));
            }
            else
            {
                programList.Enabled = true;
            }
        }