コード例 #1
0
        public virtual Bitmap GetScreenshot(IJobMonitor jobMonitor)
        {
            Bitmap result = null;

            //Note: No check for connected here
            if (this.Open())
            {
                try
                {
                    GlobalsatPacket packet   = PacketFactory.GetScreenshot();
                    GlobalsatPacket response = (GlobalsatPacket)this.SendPacket(packet);

                    System.Drawing.RotateFlipType rotate = RotateFlipType.RotateNoneFlipNone;
                    if (this.FitnessDevice.CanRotateScreen)
                    {
                        //try getting screen orientaion
                        try
                        {
                            packet = PacketFactory.GetSystemConfiguration2();
                            GlobalsatPacket response2 = (GlobalsatPacket)this.SendPacket(packet);
                            GlobalsatSystemConfiguration2 systemInfo = response2.ResponseGetSystemConfiguration2();
                            if (systemInfo.ScreenOrientation == 1)
                            {
                                rotate = RotateFlipType.Rotate90FlipNone;
                            }
                        }
                        catch {}
                    }
                    result = response.ResponseGetScreenshot(rotate);
                }
                catch (Exception e)
                {
                    jobMonitor.ErrorText = Properties.Resources.Device_GetInfo_Error + e;
                    //throw new Exception(Properties.Resources.Device_GetInfo_Error + e);
                }
                finally
                {
                    this.Close();
                }
            }
            if (!this.DataRecieved)
            {
                NoCommunicationError(jobMonitor);
            }
            return(result);
        }