private void AddtoListivew(NewFrameEventArgs eventArgs)
        {
            string text = string.Concat(new object[]
            {
                this._parent.GetSetting().ImageDir,
                DateTime.Now.ToString("yyyyMMddHHmmssfff"),
                ".",
                this._parent.GetSetting().FType
            });
            EncoderParameters encoderParameters = new EncoderParameters(1);
            EncoderParameter  encoderParameter  = new EncoderParameter(Encoder.Quality, this._parent.GetSetting().ImgRatio);

            encoderParameters.Param[0] = encoderParameter;
            eventArgs.Frame.Save(text, this._parent.GetSetting().FType.ToImageCodecInfo(), encoderParameters);
            TmpFileMgr.AddTmpFile(text);
            bool flag = File.Exists(text);

            if (flag)
            {
                ListViewItem listViewItem = new ListViewItem();
                Image        value        = UCPreviewer.LoadSizedImage(text, this._parent.GetSetting().ThumbWidth, this._parent.GetSetting().ThumbHeight);
                this._iconlist.Images.Add(value);
                listViewItem.ImageIndex = this._iconlist.Images.Count - 1;
                listViewItem.Text       = text;
                this.listView1.Items.Add(listViewItem);
            }
        }
        public static Image LoadSizedImage(string strSourceFileName, int intWidth, int intHeight)
        {
            Image result;

            using (Stream stream = new FileStream(strSourceFileName, FileMode.Open, FileAccess.Read))
            {
                Image img   = Image.FromStream(stream);
                Image image = UCPreviewer.Change2Size(img, intWidth, intHeight);
                result = image;
            }
            return(result);
        }
        public bool Acquire()
        {
            bool result;

            try
            {
                FormContainer formContainer = new FormContainer();
                UCPreviewer   uCPreviewer   = new UCPreviewer(this);
                uCPreviewer.Start();
                formContainer.SetControl(uCPreviewer);
                formContainer.SetKeyEscCloseForm(true);
                formContainer.Parent = this.Parent;
                bool flag = formContainer.ShowDialog() == DialogResult.OK;
                if (flag)
                {
                    List <string> images = uCPreviewer.GetImages();
                    bool          flag2  = this.OnAcquired != null;
                    if (flag2)
                    {
                        foreach (string current in images)
                        {
                            this.OnAcquired(this, new TEventArg <string>(current));
                        }
                    }
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception ex)
            {
                bool flag3 = this.OnError != null;
                if (flag3)
                {
                    this.OnError(this, new TEventArg <string>(ex.ToString()));
                }
                result = false;
            }
            return(result);
        }
 public NestSetting(UCPreviewer parent)
 {
     this._parent = parent;
 }