Esempio n. 1
0
        private void Videocomments_Closing(object sender, FormClosingEventArgs e)
        {
            ////
            //// Write log file
            ////
            //string date = System.DateTime.Now.ToShortDateString().Replace("/", "-");
            //string filename = @"Logs\" + date + " " + VideoTitleLbl.Text + ".xml";
            //DataTable dT = LogTable;
            //DataSet dS = new DataSet();
            //dS.Tables.Add(dT);
            //dS.WriteXml(File.OpenWrite(filename));

            Q1N  = null;
            Q1C  = null;
            Q2N  = null;
            Q2C  = null;
            Live = null;

            if (SO == null)
            {
            }
            else
            {
                SO.Close();
                SO = null;
            }
        }
Esempio n. 2
0
        private void Videocomments_Load(object sender, EventArgs e)
        {
            Cursor.Clip = Screen.PrimaryScreen.Bounds;

            if (Selectvideo.VideoID == null)
            {
                var Selectvideo = new Selectvideo();
                Selectvideo.ShowDialog(this);
            }

            else
            {
            }

            if (Selectvideo.VideoID == null)
            {
                this.Close();
                timer1.Stop();
            }
            VideoTitleLbl.Text = Selectvideo.VideoTitle;

            QueTable.Columns.Add("CommentID", typeof(string));
            QueTable.Columns.Add("Name", typeof(string));
            QueTable.Columns.Add("Comment", typeof(string));

            PreviewTable.Columns.Add("CommentID", typeof(string));
            PreviewTable.Columns.Add("Name", typeof(string));
            PreviewTable.Columns.Add("Comment", typeof(string));

            LiveTable.Columns.Add("CommentID", typeof(string));
            LiveTable.Columns.Add("Name", typeof(string));
            LiveTable.Columns.Add("Comment", typeof(string));

            LogTable.Columns.Add("CommentID", typeof(string));
            LogTable.Columns.Add("Name", typeof(string));
            LogTable.Columns.Add("Comment", typeof(string));
            LogTable.Columns.Add("TimeSelected", typeof(string));

            InitTimer();

            var fb = new FacebookClient(Selectpage.PageAccessToken);
            var LiveVideosComments = string.Format(
                @"{0}/comments?limit=1000&order=reverse_chronological",
                Selectvideo.VideoID);
            var    result = fb.Get(LiveVideosComments);
            string json   = result.ToString();

            RootObject rootobject = JsonConvert.DeserializeObject <RootObject>(json);

            this.CommentsDataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            this.CommentsDataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.CommentsDataGridView.AutoSizeRowsMode        = DataGridViewAutoSizeRowsMode.AllCells;

            this.CommentsDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            this.QueDataGridView.DefaultCellStyle.WrapMode      = DataGridViewTriState.True;
            this.PreviewDataGridView.DefaultCellStyle.WrapMode  = DataGridViewTriState.True;
            this.LiveDataGridView.DefaultCellStyle.WrapMode     = DataGridViewTriState.True;

            CommentsDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            CommentsDataGridView.MultiSelect   = false;
            CommentsDataGridView.RowPrePaint  += new DataGridViewRowPrePaintEventHandler(CommentsDataGridView_RowPrePaint);
            QueDataGridView.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;
            QueDataGridView.MultiSelect        = false;
            QueDataGridView.RowPrePaint       += new DataGridViewRowPrePaintEventHandler(QueDataGridView_RowPrePaint);
            PreviewDataGridView.SelectionMode  = DataGridViewSelectionMode.FullRowSelect;
            PreviewDataGridView.MultiSelect    = false;
            PreviewDataGridView.RowPrePaint   += new DataGridViewRowPrePaintEventHandler(PreviewDataGridView_RowPrePaint);
            LiveDataGridView.SelectionMode     = DataGridViewSelectionMode.FullRowSelect;
            LiveDataGridView.MultiSelect       = false;
            LiveDataGridView.RowPrePaint      += new DataGridViewRowPrePaintEventHandler(LiveDataGridVie_RowPrePaint);

            int i = 0;

            foreach (Datum d in rootobject.data)
            {
                CommentsDataGridView.Rows.Add();
                CommentsDataGridView.Rows[i].Cells[0].Value   = d.id;
                CommentsDataGridView.Rows[i].Cells[1].Value   = d.from.name;
                CommentsDataGridView.Rows[i++].Cells[2].Value = d.message;
            }

            if (SO == null)
            {
                SO = new Studioout();
                Screen[]  screen1 = Screen.AllScreens;
                Rectangle bound1  = screen1[1].Bounds;
                SO.SetBounds(bound1.X, bound1.Y, bound1.Width, bound1.Height);
                SO.StartPosition = FormStartPosition.Manual;
                SO.Show();
            }

            QueDataGridView.DataSource     = QueTable;
            PreviewDataGridView.DataSource = PreviewTable;
            LiveDataGridView.DataSource    = LiveTable;

            this.QueDataGridView.Columns[1].AutoSizeMode     = DataGridViewAutoSizeColumnMode.DisplayedCells;
            this.QueDataGridView.Columns[2].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            QueDataGridView.AutoSizeRowsMode                 = DataGridViewAutoSizeRowsMode.AllCells;
            this.PreviewDataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            this.PreviewDataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            PreviewDataGridView.AutoSizeRowsMode             = DataGridViewAutoSizeRowsMode.AllCells;
            this.LiveDataGridView.Columns[1].AutoSizeMode    = DataGridViewAutoSizeColumnMode.DisplayedCells;
            this.LiveDataGridView.Columns[2].AutoSizeMode    = DataGridViewAutoSizeColumnMode.Fill;
            LiveDataGridView.AutoSizeRowsMode                = DataGridViewAutoSizeRowsMode.AllCells;

            QueDataGridView.Columns[0].Visible     = false;
            PreviewDataGridView.Columns[0].Visible = false;
            LiveDataGridView.Columns[0].Visible    = false;
        }