예제 #1
0
        /// <summary>
        /// Delegate function to receive the show data from the home page
        /// </summary>
        /// <param name="showName"></param>
        /// <param name="seasonNumber"></param>
        /// <param name="episodeCount"></param>
        public void ViewShowData(int id, string showName, int seasonNumber, int episodeCount, string watchList)
        {
            //Initialize the season data for currently viewed show
            season_data.ID           = id;
            season_data.ShowName     = showName;
            season_data.SeasonNumber = seasonNumber;
            season_data.EpisodeCount = episodeCount;
            season_data.WatchList    = watchList;
            //season_data.Watchlist_SetSeasonViewState();

            lblId.Text = id.ToString();

            //Placement of the Artwork
            ShowArtworkControl artwork_control = new ShowArtworkControl();

            artwork_control.Location = new Point((PanelDetailsArea.Width - artwork_control.Width) / 2, (PanelDetailsArea.Height - artwork_control.Height) / 2);
            artwork_control.Anchor   = AnchorStyles.None;
            PanelDetailsArea.Controls.Add(artwork_control);

            //Update with the show details
            artwork_control.LoadArtwork(id, showName, seasonNumber, episodeCount, watchList);
            artwork_control.BringToFront();

            SetupWatchlist(episodeCount);
        }
예제 #2
0
        //private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    //TODO: Add try/catch here & status reporting

        //    if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
        //    {
        //        //gets the row index of the selected cell
        //        int row = dataGridView1.CurrentCell.RowIndex;

        //        int id = (int)dataGridView1.Rows[row].Cells[db.ID_COL_NUM].Value;
        //        string showName = dataGridView1.Rows[row].Cells[db.SHOWNAME_COL_NUM].Value.ToString();
        //        int seasonNum = (int)dataGridView1.Rows[row].Cells[db.SEASONNUM_COL_NUM].Value;
        //        int episodeCount = (int)dataGridView1.Rows[row].Cells[db.EPISODECOUNT_COL_NUM].Value;
        //        string watchList = dataGridView1.Rows[row].Cells[db.WATCHLIST_COL_NUM].Value.ToString();

        //        //Set the Watchlist property upon retrievel so that it can be parsed
        //        //season_data.WatchList = watchList;

        //        //With all the data retrieved, show the "ViewShow" form, and pass all the data
        //        ViewShow viewShowForm = new ViewShow();
        //        dPassToViewShowForm del = new dPassToViewShowForm(viewShowForm.ViewShowData);   //TODO: UPDATE TO SEND ALL SHOW DATA
        //        del(id, showName, seasonNum, episodeCount, watchList);

        //        //Show the View Show form
        //        viewShowForm.ShowDialog();

        //        //Load the data from the database - we want to get the latest updates when the child form is closed, and
        //        //focus is set back on this Home form.
        //        LoadHomeGrid();
        //    }
        //}

        //private void LoadHomeGrid()
        //{
        //    DataSet ds = db.LoadDataGrid();
        //    dataGridView1.ReadOnly = true;
        //    dataGridView1.DataSource = ds.Tables[0];
        //    dataGridView1.Sort(dataGridView1.Columns[db.ID_COL_NUM], ListSortDirection.Ascending);
        //    dataGridView1.SendToBack(); //TODO: do this temporarily
        //}

        private void LoadLayoutPanel()
        {
            ds = db.LoadDataGrid();

            int rows = ds.Tables[0].Rows.Count;

            //initialize the episode to
            //int episode_num = 1;

            //Clear Layoutpanel
            flowLayoutPanel1.Controls.Clear();

            //TODO: if rows are "0" then display text saying add a show, or something.

            for (int i = 0; i < rows; i++)
            {
                //Initialize the season information
                int    id           = (int)ds.Tables[0].Rows[i][db.ID_COL_NUM];
                string showName     = (string)ds.Tables[0].Rows[i][db.SHOWNAME_COL_NUM];
                int    seasonNumber = (int)ds.Tables[0].Rows[i][db.SEASONNUM_COL_NUM];
                int    episodeCount = (int)ds.Tables[0].Rows[i][db.EPISODECOUNT_COL_NUM];
                string watchList    = (string)ds.Tables[0].Rows[i][db.WATCHLIST_COL_NUM];

                //Initialize the properties of the Artwork Control
                ShowArtworkControl artwork_control = new ShowArtworkControl();
                artwork_control.Click += new EventHandler(Season_Click);            //TODO: Need to figure out how to get a click on the picture box from the user control. Something to do with enabling the click event on an control within the user control?
                artwork_control.Anchor = AnchorStyles.None;
                artwork_control.Margin = new Padding(25);
                artwork_control.Tag    = i; //used as row index in click event

                flowLayoutPanel1.Controls.Add(artwork_control);

                artwork_control.LoadArtwork(id, showName, seasonNumber, episodeCount, watchList);
            }
            //for
            flowLayoutPanel1.AutoScroll   = true;
            flowLayoutPanel1.WrapContents = false;
        }