Example #1
0
        protected override void OnLoad(EventArgs e)
        {
            Player_LocationSizeChanged(this, e);
            base.OnLoad(e);
            webVideo.LocationChanged += Player_LocationSizeChanged;
            webVideo.SizeChanged     += Player_LocationSizeChanged;

            AnimateWindow(this.Handle, 80, 0x00040000 | 0x00000002 | 0x20000);
            //AnimateWindow(this.Handle, 80, 0x00040000 | 0x00000001 | 0x20000);
            bool          isok = false;
            List <string> _WebVideoPlayType = SystemSettings.WebVideoPlayType;

            if (_WebVideoPlayType.Count > 0)
            {
                for (int i = 0; i < _WebVideoPlayType.Count; i++)
                {
                    TPlayerList.TopItem FtopItem = menuXList1.Items.Find(ab => ab.Name == _WebVideoPlayType[i]);
                    if (FtopItem != null)
                    {
                        isok = true;
                        menuXList1_DownClick(FtopItem);
                        break;
                    }
                }
            }
            if (!isok)
            {
                menuXList1_DownClick(menuXList1.Items[0]);
            }
            OnSizeChanged(null);
            webVideo.player.DownComplete   += Player_DownComplete;
            webVideo.player.DownProgChange += Player_DownProgChange;
        }
Example #2
0
        private void menuXList1_DownClick(TPlayerList.TopItem Item)
        {
            thisPage = 1;
            isdownok = true;
            menuXList1.SelectItemIndex = Item.Index;
            menuXList1.Tom(Item);
            webVideoList1.Items.Clear();
            webVideoList1.chatVScroll.MoveSliderToLocation(0);
            string typeUrl = $"?ac=detail&t={Item.Tag}&pg={thisPage}";

            timer1.Enabled = true;
            Action _action = () =>
            {
                LoadingCover(typeUrl);
            };

            _task.ContinueWhenAll(new Task[] { _task.StartNew(_action) }, (action =>
            {
                this.Invoke(new Action(() =>
                {
                    webVideoList1.chatVScroll.OnScrollChange(100);
                    timer1.Enabled = false;
                    if (isgo != -1)
                    {
                        isgo = -1;
                        //isgo = true;
                        pictureBox2.Image = FontAwesome.GetImage(fontlogo, "4FBB", 38, Color.Black);
                    }
                }));
            }));
        }
Example #3
0
        private void menuXList1_DownClick(TPlayerList.TopItem Item)
        {
            thisPage = 1;
            isdownok = true;
            menuXList1.SelectItemIndex = Item.Index;
            menuXList1.Tom(Item);
            webVideoList1.Items.Clear();
            webVideoList1.chatVScroll.MoveSliderToLocation(0);
            string typeUrl;

            typeUrl = "?m=vod-index-pg-1.html";
            if (!string.IsNullOrWhiteSpace(Item.Tag.ToString()))
            {
                typeUrl = $"?m=vod-type-id-{Item.Tag}-pg-" + thisPage + ".html";
            }

            isrun = timer1.Enabled = true;
            Action _action = () =>
            {
                LoadingCover(typeUrl);
            };

            _task.ContinueWhenAll(new Task[] { _task.StartNew(_action) }, (action =>
            {
                isrun = false;
                this.Invoke(new Action(() =>
                {
                    webVideoList1.chatVScroll.OnScrollChange(100);
                    timer1.Enabled = false;
                    if (isgo != -1)
                    {
                        isgo = -1;
                        //isgo = true;
                        pictureBox2.Image = FontAwesome.GetImage(fontlogo, "4FBB", 38, Color.Black);
                    }
                }));
            }));
        }
Example #4
0
        private void menuXList1_DownClick(TPlayerList.TopItem Item)
        {
            panel7.Visible             = isdownModel = false;
            btn_play.Text              = "播放全部";
            btn_down.Text              = "下载";
            playIndex                  = Item.Index;
            menuXList1.SelectItemIndex = Item.Index;
            menuXList1.Tom(Item);
            panel_videos.Visible = false;
            panel_videos.Controls.Clear();
            playAddress = video.playInformation.Find(ab => ab.playType == Item.Name);


            List <string> _WebVideoPlayType = SystemSettings.WebVideoPlayType;

            if (_WebVideoPlayType.Contains(Item.Name))
            {
                _WebVideoPlayType.Remove(Item.Name);
            }
            _WebVideoPlayType.Insert(0, Item.Name);
            SystemSettings.SetWebVideoPlayType = string.Join(";", _WebVideoPlayType);

            string _colltag = "webvideo[" + this.videotype + "]_" + playIndex + "_" + video.id;
            int    coll     = 0;

            if (SystemSettings.RememberLocation && File.Exists(Program.CachePath + "coll\\" + _colltag))
            {
                int.TryParse(File.ReadAllText(Program.CachePath + "coll\\" + _colltag), out coll);
            }
            if (coll > 0)
            {
                if (playAddress.videoUrl.Count - 1 < coll)
                {
                    coll = 0;
                    try
                    {
                        File.Delete(Program.CachePath + "coll\\" + _colltag);
                    }
                    catch { }
                }
                btn_play.Text = "继续 " + playAddress.videoUrl[coll].playName;
            }
            TSkin.TBut slabel = null;
            for (int i = 0; i < playAddress.videoUrl.Count; i++)
            {
                int      _index = i;
                VideoUrl item   = playAddress.videoUrl[i];

                TSkin.TBut but = new TSkin.TBut
                {
                    TabIndex          = _index,
                    Name              = video.id + "_" + menuXList1.SelectItemIndex + item.playName,
                    ASize             = true,
                    Radius            = 6,
                    Text              = item.playName,
                    ImageSize         = new Size(20, 20),
                    ImageMargin       = new Padding(6, 0, 0, 0),
                    TextAlign         = ContentAlignment.MiddleRight,
                    TextMargin        = new Padding(6, 4, 6, 4),
                    ValueColor        = Color.FromArgb(140, Color.OrangeRed),
                    BorderColorActive = Color.OrangeRed,
                    BorderColor       = Color.OrangeRed,

                    BackColor        = Color.FromArgb(20, 0, 0, 0),
                    BackColor2       = Color.FromArgb(20, 0, 0, 0),
                    BackColorActive  = Color.DodgerBlue,
                    BackColorActive2 = Color.DodgerBlue,
                    ForeColorActive  = Color.White,
                    Tag = item
                };

                if (coll > 0 && _index == coll)
                {
                    slabel       = but;
                    but.IsActive = true;
                    //file.Icon = Properties.Resources.icon_success;
                }
                if (File.Exists(Program.DownLoadPath + video.videoName + "\\" + item.playName + Path.GetExtension(item.playURL)))
                {
                    but.Image = Properties.Resources.icon_success;
                }
                panel_videos.Controls.Add(but);
                but.Click += (a, b) =>
                {
                    if (isdownModel)
                    {
                        if (!File.Exists(Program.DownLoadPath + video.videoName + "\\" + item.playName + Path.GetExtension(item.playURL)))
                        {
                            if (but.BorderWidth == 0)
                            {
                                but.BorderWidth = 1;
                            }
                            else
                            {
                                but.BorderWidth = 0;
                            }
                        }
                    }
                    else
                    {
                        string pathcoll = Program.CachePath + "coll\\" + _colltag;
                        (Program.CachePath + "coll\\").CreateDirectory(true);
                        File.WriteAllText(pathcoll, _index.ToString());

                        _play(_index, _colltag);
                    }
                };
            }
            panel_videos.Visible = true;
            if (slabel != null)
            {
                slabel.Focus();
            }
        }