Esempio n. 1
0
        public void loaduploads()
        {
            if (this.Controls.ContainsKey("hmw"))
            {
                this.Controls.RemoveByKey("hmw");
            }
            if (this.Controls.ContainsKey("wthvid"))
            {
                this.Controls.RemoveByKey("wthvid");
            }
            if (this.Controls.ContainsKey("channel"))
            {
                this.Controls.RemoveByKey("channel");
            }

            homeview hmv = new homeview(this);

            hmv.Name             = "hmw";
            hmv.label4.BackColor = Color.Red;

            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }


            int x     = 10;
            int y     = 10;
            int arjau = 0;

            string sqlText1 = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate,logins.username FROM videos JOIN logins ON videos.channelid = logins.ID ORDER BY uploaddate DESC limit 16;");
            var    readerr  = DBFunctions.ExecuteSqlSelect(sqlText1, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid vidd = new vid();
                vidd.label1.Text     = readerr[1].ToString();
                vidd.linkLabel1.Text = readerr[0].ToString() + " views";
                vidd.linkLabel2.Text = readerr[5].ToString();
                vidd.linkLabel1.Name = readerr[3].ToString();
                vidd.linkLabel2.Name = readerr[2].ToString();
                if (active == true && Convert.ToUInt64(readerr[2]) == user.user_ID)
                {
                    vidd.button1.Visible = true;
                    vidd.button1.Name    = readerr[2].ToString();
                }
                else
                {
                    vidd.button1.Visible = false;
                }

                vidd.button1.Click    += Button1_Click;
                vidd.linkLabel2.Click += LinkLabel2_Click;
                vidd.linkLabel1.Click += LinkLabel1_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidd.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidd.Location = new Point(x, y);
                hmv.panel1.Controls.Add(vidd);
                arjau++;
                x += 220;

                if (arjau == 4)
                {
                    x     = 10;
                    y    += 200;
                    arjau = 0;
                }
            }
            hmv.Location = new Point(259, 124);
            this.Controls.Add(hmv);
            readerr.Close();
            readerr.Dispose();
            connectionn.Close();
            connectionn.Dispose();
        }
Esempio n. 2
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            if (this.Controls.ContainsKey("hmw"))
            {
                this.Controls.RemoveByKey("hmw");
            }
            if (this.Controls.ContainsKey("wthvid"))
            {
                this.Controls.RemoveByKey("wthvid");
            }
            if (this.Controls.ContainsKey("channel"))
            {
                this.Controls.RemoveByKey("channel");
            }

            Subscriptions sbs = new Subscriptions();

            sbs.Name = "hmw";

            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            int y = 10;

            string sqlText = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate,logins.username, videos.description FROM videos JOIN logins ON videos.channelid = logins.ID WHERE videos.name LIKE '%{0}%' ORDER BY uploaddate DESC limit 12 ;", textBox1.Text);
            var    readerr = DBFunctions.ExecuteSqlSelect(sqlText, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid_his_sub vidsub = new vid_his_sub();

                vidsub.label1.Text     = readerr[1].ToString() + " views";
                vidsub.linkLabel1.Text = readerr[0].ToString();
                vidsub.linkLabel3.Hide();
                vidsub.linkLabel2.Text = readerr[5].ToString();
                vidsub.linkLabel1.Name = readerr[3].ToString();
                vidsub.textBox3.Text   = readerr[6].ToString();

                vidsub.linkLabel2.Name   = readerr[2].ToString();
                vidsub.linkLabel1.Click += LinkLabel1_Click;
                vidsub.linkLabel2.Click += LinkLabel2_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidsub.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidsub.Location   = new Point(0, y);
                sbs.panel1.Height = this.Height - groupBox1.Height - 80;
                sbs.panel1.Controls.Add(vidsub);

                y += 200;
            }
            sbs.Location = new Point(259, 124);
            this.Controls.Add(sbs);
            readerr.Close();
            readerr.Dispose();
        }
Esempio n. 3
0
        public void loadchannel(long id)
        {
            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }
            channel chl    = new channel();
            int     x      = 10;
            int     y      = 10;
            int     arjau  = 0;
            string  sqlTxt = string.Format("SELECT username from logins where id = {0}", id);
            var     read   = DBFunctions.ExecuteSqlSelect(sqlTxt, connectionn);

            if (read == null)
            {
                return;
            }
            while (read.Read())
            {
                username = read[0].ToString();
            }
            read.Close();
            read.Dispose();

            string sqlText1 = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate FROM videos WHERE channelID = {0};", id);
            var    readerr  = DBFunctions.ExecuteSqlSelect(sqlText1, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid vidd = new vid();
                vidd.label1.Text     = readerr[1].ToString();
                vidd.linkLabel1.Text = readerr[0].ToString() + " views";
                vidd.linkLabel2.Text = username;
                vidd.linkLabel1.Name = readerr[3].ToString();
                vidd.linkLabel2.Name = readerr[2].ToString();
                if (active == true && Convert.ToUInt64(readerr[2]) == user.user_ID)
                {
                    vidd.button1.Visible = true;
                    vidd.button1.Name    = readerr[3].ToString();
                }
                else
                {
                    vidd.button1.Visible = false;
                }
                vidd.linkLabel1.Name   = readerr[3].ToString();
                vidd.linkLabel1.Click += LinkLabel1_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidd.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidd.Location = new Point(x, y);

                chl.panel1.Controls.Add(vidd);
                arjau++;
                x += 220;

                if (arjau == 4)
                {
                    x     = 10;
                    y    += 200;
                    arjau = 0;
                }
            }

            readerr.Close();
            readerr.Dispose();
            connectionn.Close();
            connectionn.Dispose();
        }
Esempio n. 4
0
        private void historyBtn_Click(object sender, EventArgs e)
        {
            MessageBox.Show("COMING SOON!!!!");
            return;

            if (this.Controls.ContainsKey("hmw"))
            {
                this.Controls.RemoveByKey("hmw");
            }
            if (this.Controls.ContainsKey("wthvid"))
            {
                this.Controls.RemoveByKey("wthvid");
            }
            if (this.Controls.ContainsKey("channel"))
            {
                this.Controls.RemoveByKey("channel");
            }

            Subscriptions sbs = new Subscriptions();

            sbs.Name = "hmw";

            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            int y = 10;

            string sqlText1 = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate,historyvideo.videoid FROM video JOIN historyvideo ON historyvideo.userid = {0};", user.user_ID);
            var    readerr  = DBFunctions.ExecuteSqlSelect(sqlText1, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid_his_sub vidsub = new vid_his_sub();

                vidsub.label1.Text     = readerr[1].ToString();
                vidsub.linkLabel1.Text = readerr[0].ToString();
                vidsub.linkLabel3.Text = readerr[5].ToString();
                vidsub.linkLabel2.Text = readerr[5].ToString();
                vidsub.linkLabel1.Name = readerr[3].ToString();
                vidsub.textBox3.Text   = readerr[6].ToString();

                //vidsub.linkLabel1.Click += LinkLabel1_Click;
                vidsub.linkLabel1.Click += LinkLabel1_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidsub.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidsub.Location = new Point(0, y);
                sbs.panel1.Controls.Add(vidsub);

                y += 200;
            }
            sbs.Location = new Point(259, 124);
            this.Controls.Add(sbs);
            readerr.Close();
            readerr.Dispose();
        }