public TvProgramManageForm()
 {
     InitializeComponent();
     ProgramManager = new TvProgramManager();
     channelSelector.Items.AddRange(ProgramManager.GetTvChannels().ToArray());
     ResetFilters();
     ProgramsReveiced += OnTvProgramsReveived;
     programs          = new List <TvProgram>();
 }
Exemple #2
0
        public PieStatistics(Dictionary <TvProgramGenre, int> genreStats)
        {
            InitializeComponent();
            chart1.Series.Clear();
            Series s = new Series();

            s.ChartType           = SeriesChartType.Pie;
            s.IsValueShownAsLabel = true;
            foreach (KeyValuePair <TvProgramGenre, int> item in genreStats)
            {
                s.Points.AddXY(TvProgramManager.GetGenresAsString(item.Key), item.Value);
            }
            chart1.Series.Add(s);
            Text = "Legtöbbet nézett műfajok aránya";
        }
        public TvProgramBrowser()
        {
            InitializeComponent();
            ProgramManager = new TvProgramManager();
            channelSelector.SelectedIndexChanged += UpdateChannelChangeButtons;
            buttonChannelBackward.Click          += (s, args) => { ChangeChannel(-1); };
            buttonChannelForward.Click           += (s, args) => { ChangeChannel(1); };

            datePicker.ValueChanged      += UpdateCalendarChangeButtons;
            buttonCalendarForward.Click  += (s, args) => { ChangeDate(1); };
            buttonCalendarBackward.Click += (s, args) => { ChangeDate(-1); };

            foreach (ToolStripMenuItem item in korhatárToolStripMenuItem.DropDownItems)
            {
                item.Click += (sender, args) => { UpdateTvShowList(); };
            }

            reserveProgramDisplayMenuItem.Click += UpdateProgramDisplay;
            freeProgramDisplayMenuItem.Click    += UpdateProgramDisplay;
        }
        public void UpdateTvShowList()
        {
            loadingLabel.Text    = "Betöltés...";
            queryLabel.Text      = "";
            programList.Enabled  = false;
            FilterButton.Enabled = false;
            List <string> selectedChannels = new List <string>();

            foreach (string item in channelSelector.CheckedItems)
            {
                selectedChannels.Add(item);
            }
            ProgramDisplay display = programDisplay;

            if (onlyReserverProgramsCheckBox.Checked)
            {
                display = ProgramDisplay.OnlyReserved;
            }
            string   channel   = channelSelector.Text;
            DateTime startTime = datePickerStart.Value;
            DateTime endTime   = datePickerEnd.Value;
            Tuple <DateTime, DateTime> dateRange = new Tuple <DateTime, DateTime>(startTime, endTime);

            Task.Run(() =>
            {
                List <TvProgram> programs = ProgramManager.RetrieveTvPrograms(dateRange, selectedChannels, display, TvProgramManager.AllAgeLimit());
                ProgramsReveiced?.Invoke(null, new TvProgramReceivedEventArgs()
                {
                    Programs = programs
                });
            });
        }