示例#1
0
 private void Player_DownProgChange(DownItem Item, double val, double maxval)
 {
     if (menuXList1.SelectItemIndex > -1)
     {
         Control[] Controls = panel_videos.Controls.Find(Item.ID, false);
         if (Controls != null && Controls.Length > 0)
         {
             TSkin.TBut but = Controls[0] as TSkin.TBut;
             but.MaxValue = maxval;
             but.Value    = val;
         }
     }
 }
示例#2
0
 private void Player_DownComplete(DownItem Item)
 {
     if (menuXList1.SelectItemIndex > -1)
     {
         Control[] Controls = panel_videos.Controls.Find(Item.ID, false);
         if (Controls != null && Controls.Length > 0)
         {
             TSkin.TBut but = Controls[0] as TSkin.TBut;
             but.MaxValue = but.Value = 0;
             but.Image    = Properties.Resources.icon_success;
         }
     }
 }
示例#3
0
        public SeqViewModel()
        {
            Seq    = AUTDSettings.Instance.ToReactivePropertySlimAsSynchronized(i => i.Seq);
            Points = AUTDSettings.Instance.Seq.PointsReactive;

            SendSeqCommand = AUTDHandler.Instance.IsOpen.Select(b => b).ToReactiveCommand();
            SendSeqCommand.Subscribe(_ =>
            {
                if (Points.Count == 0)
                {
                    return;
                }
                AUTDHandler.Instance.SendSeq();
            });

            Current    = new ReactivePropertySlim <Vector3Reactive?>();
            AddItem    = new ReactiveCommand();
            RemoveItem = Current.Select(c => c != null).ToReactiveCommand();
            UpItem     = Current.Select(c => c != null && c.No.Value != 0).ToReactiveCommand();
            DownItem   = Current.Select(c => c != null && c.No.Value != Points.Count - 1).ToReactiveCommand();

            AddItem.Subscribe(_ =>
            {
                var item = new Vector3Reactive(Points.Count);
                Points.Add(item);
                Current.Value = item;
            });
            RemoveItem.Subscribe(_ =>
            {
                if (Current.Value == null)
                {
                    return;
                }

                var delNo = Current.Value.No.Value;
                Points.RemoveAt(delNo);
                ResetNo();
                Current.Value = Points.Count > delNo ? Points[delNo] : Points.Count > 0 ? Points[delNo - 1] : null;
            });
            UpItem.Subscribe(_ =>
            {
                if (Current.Value == null)
                {
                    return;
                }

                var cNo = Current.Value.No.Value;
                var up  = Points[cNo - 1];
                Points.Insert(cNo - 1, Current.Value);
                Points.RemoveAt(cNo);
                Points[cNo] = up;
                ResetNo();
                Current.Value = Points[cNo - 1];
            });
            DownItem.Subscribe(_ =>
            {
                if (Current.Value == null)
                {
                    return;
                }

                var cNo  = Current.Value.No.Value;
                var down = Points[cNo + 1];
                Points.RemoveAt(cNo + 1);
                Points.Insert(cNo + 1, Current.Value);
                Points[cNo] = down;
                ResetNo();
                Current.Value = Points[cNo + 1];
            });
        }
示例#4
0
        private void btn_down_Click(object sender, EventArgs e)
        {
            if (playAddress != null)
            {
                if (!isdownModel)
                {
                    panel7.Visible = true;
                    isdownModel    = true;
                    btn_down.Text  = "下载选中";
                    foreach (TSkin.TBut file in panel_videos.Controls)
                    {
                        VideoUrl videoUrl = file.Tag as VideoUrl;
                        if (!File.Exists(Program.DownLoadPath + video.videoName + "\\" + videoUrl.playName + Path.GetExtension(videoUrl.playURL)))
                        {
                            file.BorderWidth = 1;
                        }
                    }
                }
                else
                {
                    //bool isDownok = true;
                    //if (SystemSettings.AduDownload)
                    //{
                    //    TPlayerDownLib.VideoTask videoTask = new TPlayerDownLib.VideoTask
                    //    {
                    //        name = video.videoName,
                    //        cover = video.videoImgUrl,
                    //        intro = video.videoSynopsis,
                    //        list = new List<TPlayerDownLib.VideoTaskList>()
                    //    };

                    //    foreach (TSkin.TBut file in panel3.Controls)
                    //    {
                    //        if (file.BorderWidth == 1)
                    //        {

                    //            VideoUrl videoUrl = file.Tag as VideoUrl;

                    //            TPlayerDownLib.VideoTaskList videoTaskList = new TPlayerDownLib.VideoTaskList
                    //            {
                    //                name = videoUrl.playName,
                    //                url = videoUrl.playURL,
                    //                fileName = videoUrl.playName + Path.GetExtension(videoUrl.playURL),
                    //                tempPath = Program.DownLoadPath + video.videoName + "\\" + videoUrl.playName + "\\"
                    //            };
                    //            videoTaskList.savePath = Program.DownLoadPath + video.videoName + "\\" + videoTaskList.fileName;

                    //            videoTask.list.Add(videoTaskList);
                    //        }
                    //    }
                    //    Action _action = () =>
                    //    {
                    //        if (!TPlayerDownLib.DownLib.RunDownLoad)
                    //        {
                    //            bool isRun = false;
                    //            LL2:
                    //            if (string.IsNullOrEmpty(SystemSettings.AduDownloadPath))
                    //            {
                    //                if (File.Exists("AduDownload.exe"))
                    //                {
                    //                    Api.OpenMessage(this, MessageType.Info, "正在启动 AduDownload");
                    //                    System.Diagnostics.Process.Start("AduDownload.exe");
                    //                    isRun = true;
                    //                }
                    //                else
                    //                {
                    //                    using (HasDownLoad noAduDownLoad = new HasDownLoad("AduDownLoad 下载器未找到"))
                    //                    {
                    //                        DialogResult dialogResult = DialogResult.No;
                    //                        this.Invoke(new Action(() =>
                    //                        {
                    //                            dialogResult = noAduDownLoad.ShowDialog();
                    //                        }));
                    //                        switch (dialogResult)
                    //                        {
                    //                            case DialogResult.OK:
                    //                                goto LL2;
                    //                                break;
                    //                            case DialogResult.Retry:
                    //                                SystemSettings.AduDownload = false;
                    //                                isDownok = false;
                    //                                break;
                    //                        }
                    //                    }
                    //                }
                    //            }
                    //            else
                    //            {
                    //                Api.OpenMessage(this, MessageType.Info, "正在启动 AduDownload");
                    //                System.Diagnostics.Process.Start(SystemSettings.AduDownloadPath);
                    //                isRun = true;
                    //            }
                    //            int ErrCount = 0;
                    //            while (isRun)
                    //            {
                    //                System.Threading.Thread.Sleep(500);
                    //                if (!TPlayerDownLib.DownLib.RunDownLoad)
                    //                {
                    //                    ErrCount++;
                    //                    if (ErrCount > 10)
                    //                    {
                    //                        isRun = false; break;
                    //                    }
                    //                }
                    //                else
                    //                {
                    //                    isRun = false;
                    //                }
                    //            }
                    //        }
                    //        if (TPlayerDownLib.DownLib.SendDownLoad(videoTask))
                    //        {
                    //            Api.OpenMessage(webVideo, MessageType.Success, "下载任务已发送成功");
                    //        }
                    //        else
                    //        {
                    //            using (HasDownLoad noAduDownLoad = new HasDownLoad("AduDownLoad 下载器无法使用"))
                    //            {
                    //                DialogResult dialogResult = DialogResult.No;
                    //                this.Invoke(new Action(() =>
                    //                {
                    //                    dialogResult = noAduDownLoad.ShowDialog();
                    //                }));
                    //                switch (dialogResult)
                    //                {
                    //                    case DialogResult.OK:
                    //                        isDownok = false;
                    //                        break;
                    //                    case DialogResult.Retry:
                    //                        SystemSettings.AduDownload = false;
                    //                        isDownok = false;
                    //                        break;
                    //                }
                    //            }

                    //        }

                    //    };
                    //    _task.ContinueWhenAll(new Task[] { _task.StartNew(_action) }, (action =>
                    //    {
                    //    }));
                    //}
                    //else
                    //{
                    List <DownItem> downItems = new List <DownItem>();
                    foreach (TBut file in panel_videos.Controls)
                    {
                        if (file.BorderWidth == 1)
                        {
                            VideoUrl videoUrl = file.Tag as VideoUrl;

                            DownItem downItem = new DownItem
                            {
                                url      = videoUrl.playURL,
                                imgUrl   = video.videoImgUrl,
                                img      = video.videoImg,
                                ID       = video.id + "_" + menuXList1.SelectItemIndex + videoUrl.playName,
                                basepath = Program.DownLoadPath + video.videoName + "\\" + videoUrl.playName + "\\",
                                name     = video.videoName + " - " + videoUrl.playName,
                                fileName = videoUrl.playName + Path.GetExtension(videoUrl.playURL),
                            };
                            downItem.savepath = Program.DownLoadPath + video.videoName + "\\" + downItem.fileName;
                            downItems.Add(downItem);
                        }
                    }

                    if (downItems.Count > 0)
                    {
                        bool   isok    = false;
                        Action _action = () =>
                        {
                            isok = webVideo.player.AddDownList(downItems);
                        };
                        webVideo.player._task.ContinueWhenAll(new Task[] { webVideo.player._task.StartNew(_action) }, (action =>
                        {
                            this.BeginInvoke(new Action(() =>
                            {
                                panel7.Visible = isdownModel = false;
                                btn_down.Text = "下载";
                            }));
                        }));
                    }
                    else
                    {
                        foreach (TSkin.TBut file in panel_videos.Controls)
                        {
                            if (file.BorderWidth == 1)
                            {
                                file.BorderWidth = 0;
                            }
                        }
                        panel7.Visible = isdownModel = false;
                        btn_down.Text  = "下载";
                    }
                }
            }
        }