示例#1
0
        private void LogoButton_Click(object sender, EventArgs e)
        {
            Bitmap logoBitmap;

            using (var imageConverterWindow = new ImageConverterWindow(true))
            {
                if (imageConverterWindow.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                logoBitmap = imageConverterWindow.GetConvertedImage();
                if (logoBitmap == null)
                {
                    return;
                }
            }

            using (logoBitmap)
            {
                var imageData = BitmapProcessor.CreateRawFromBitmap(logoBitmap);

                var block1ImageMetadata = new FirmwareImage1Metadata {
                    Width = LogoWidth, Height = LogoHeight
                };
                var block2ImageMetadata = new FirmwareImage2Metadata {
                    Width = LogoWidth, Height = LogoHeight
                };

                var block1ImageBytes = block1ImageMetadata.Save(imageData);
                var block2ImageBytes = block2ImageMetadata.Save(imageData);

                m_worker.RunWorkerAsync(new AsyncProcessWrapper(worker => UpdateLogoAsyncWorker(worker, block1ImageBytes, block2ImageBytes)));
            }
        }
示例#2
0
        private void LogoButton_Click(object sender, EventArgs e)
        {
            if (!m_deviceInfo.CanUploadLogo)
            {
                InfoBox.Show("Logo uploading for this device is not supported.");
                return;
            }

            Bitmap logoBitmap;

            using (var imageConverterWindow = new ImageConverterWindow(true, m_deviceInfo.LogoWidth, m_deviceInfo.LogoHeight))
            {
                if (imageConverterWindow.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                logoBitmap = imageConverterWindow.GetConvertedImage();
                if (logoBitmap == null)
                {
                    return;
                }
            }

            using (logoBitmap)
            {
                var imageData = logoBitmap.CreateRawFromBitmap();

                var block1ImageMetadata = new FirmwareImage1Metadata {
                    Width = m_deviceInfo.LogoWidth, Height = m_deviceInfo.LogoHeight
                };
                var block2ImageMetadata = new FirmwareImage2Metadata {
                    Width = m_deviceInfo.LogoWidth, Height = m_deviceInfo.LogoHeight
                };

                var block1ImageBytes = block1ImageMetadata.Save(imageData);
                var block2ImageBytes = block2ImageMetadata.Save(imageData);

                m_worker.RunWorkerAsync(new AsyncProcessWrapper(worker => UpdateLogoAsyncWorker(worker, block1ImageBytes, block2ImageBytes)));
            }
        }