Beispiel #1
0
        static async Task RenderPreviewAsync(string zplData)
        {
            var client      = new LabelaryClient();
            var previewData = await client.GetPreviewAsync(zplData, PrintDensity.PD8dpmm, new LabelSize(6, 8, Measure.Inch));

            if (previewData.Length == 0)
            {
                return;
            }

            var fileName = $"preview-{Guid.NewGuid()}.png";
            await File.WriteAllBytesAsync(fileName, previewData);

            var processStartInfo = new ProcessStartInfo
            {
                FileName        = fileName,
                UseShellExecute = true,
                CreateNoWindow  = true,
                Verb            = string.Empty
            };

            Process.Start(processStartInfo);
        }
        private async void LoadLabelary_OnClick(object sender, RoutedEventArgs e)
        {
            var image = await LabelaryClient.GetImage(ZplText.Text);

            LabelaryImage.Source = BitmapToImageSource(image);
        }