Пример #1
0
        private void BllUploadHandler(string portName, int baudRate, FileInfo input)
        {
            BllComLynxClient uploader = new BllComLynxClient();

            uploader.ProgressChanged += OnProgressChanged;
            byte[] bytes = File.ReadAllBytes(input.FullName);
            using (progressBar = new ProgressBar(100, "Initializing", ProgressBarStyling.Options))
            {
                uploader.UploadComFile(portName, bytes, baudRate);
                progressBar.Tick(100, $"Upload completed");
            }
        }
Пример #2
0
        private void BllScreenshotHandler(string portName, int baudRate, FileInfo output)
        {
            BllComLynxClient client = new BllComLynxClient();

            client.ProgressChanged += OnProgressChanged;
            byte[] screenshotData;

            using (progressBar = new ProgressBar(100, "Initializing"))
            {
                screenshotData = client.TakeScreenshot(portName, baudRate);
                if (screenshotData == null)
                {
                    throw new CommandException("Screenshot data not received");
                }
            }

            Spinner.Start("Converting image...", spinner => {
                BitmapConverter conv = new BitmapConverter();
                Bitmap bitmap        = conv.ConvertToBitmap(screenshotData);
                bitmap.Save(output.FullName);
                spinner.Succeed("Converting image... Done");
            });
        }
Пример #3
0
        private void BllResetHandler(string portName, int baudRate)
        {
            BllComLynxClient uploader = new BllComLynxClient();

            uploader.ResetProgram(portName, baudRate);
        }