Example #1
0
        public System.Drawing.Image DIOSnapPicture(UInt64 dwStrmId)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealSnap dwStrmId:" + dwStrmId);
            string filename = Environment.GetFolderPath(Environment.SpecialFolder.Templates) + "\\" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".bmp";
            UInt32 retVal   = IVXStreamIOSDKProtocol.StrmRealSnap(dwStrmId, filename);

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }
            System.Drawing.Image img = null;
            if (System.IO.File.Exists(filename))
            {
                try
                {
                    Image temp = System.Drawing.Image.FromFile(filename);
                    img = new Bitmap(temp);
                    temp.Dispose();
                }
                catch (Exception ex)
                {
                    MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmRealSnap error:" + ex.ToString());
                }
                try
                {
                    System.IO.File.Delete(filename);
                }
                catch
                { }
            }
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol DIOSnapPicture ret:" + 0);

            return(img);
        }