Esempio n. 1
0
 public GenerateData(MyForm myform,
     IBiblioItemsWindow detailWindow)
 {
     this._myForm = myform;
     this.MainForm = myform.MainForm;
     this.DetailWindow = detailWindow;
 }
Esempio n. 2
0
 public GenerateData(MyForm myform,
                     IBiblioItemsWindow detailWindow)
 {
     this._myForm      = myform;
     this.MainForm     = myform.MainForm;
     this.DetailWindow = detailWindow;
 }
Esempio n. 3
0
        NormalResult DisplayVideo(string url, CancellationToken token)
        {
            MyForm.FaceChannel channel = MyForm.StartFaceChannel(
                Program.MainForm.FaceReaderUrl,
                out string strError);
            if (channel == null)
            {
                return new NormalResult
                       {
                           Value     = -1,
                           ErrorInfo = strError
                       }
            }
            ;

            try
            {
                while (token.IsCancellationRequested == false)
                {
                    var result = channel.Object.GetImage("");
                    if (result.Value == -1)
                    {
                        return(result);
                    }
                    using (MemoryStream stream = new MemoryStream(result.ImageData))
                    {
                        this.pictureBox1.Image = Image.FromStream(stream);
                    }
                }

                return(new NormalResult());
            }
            catch (Exception ex)
            {
                strError = $"针对 {url} 的 GetImage() 请求失败: { ex.Message}";
                return(new NormalResult
                {
                    Value = -1,
                    ErrorInfo = strError
                });
            }
            finally
            {
                MyForm.EndFaceChannel(channel);
            }
        }
    }