예제 #1
0
        private Image getImage(VmProxy vmProxy)
        {
            // Default image
            Image image = (Bitmap)Properties.Resources.Blue_VM.Clone();

            byte[] imageBytes;

            if (string.IsNullOrEmpty(vmProxy.ProxyInterface.image_path))
            {
                return(image);
            }

            try
            {
                vmProxy.ProxyInterface.read_icon(out imageBytes);
                using (MemoryStream stream = new MemoryStream(imageBytes))
                {
                    image = new Bitmap(stream);
                }
            }
            catch (Exception e)
            {
                log.Info(e);
#if DEBUG
                System.Windows.Forms.MessageBox.Show(e.Message);
#endif
            }

            return(image);
        }
        private Image getImage(VmProxy vmProxy)
        {
            // Default image
            Image image = (Bitmap)Properties.Resources.Blue_VM.Clone();
            byte[] imageBytes;

            if (string.IsNullOrEmpty(vmProxy.ProxyInterface.image_path))
            {
                return image;
            }

            try
            {
                vmProxy.ProxyInterface.read_icon(out imageBytes);
                using (MemoryStream stream = new MemoryStream(imageBytes))
                {
                    image = new Bitmap(stream);
                }
            }
            catch (Exception e)
            {
                log.Info(e);
            #if DEBUG
                System.Windows.Forms.MessageBox.Show(e.Message);
            #endif
            }

            return image;
        }