コード例 #1
0
        public void ProcessImages(IEnumerable <Image> images, string printerName)
        {
            foreach (var image in images)
            {
                InstagramMessageDto imageDto = _mappingEngine.Map <InstagramMessageDto>(image);
                _imageService.SaveImage(new ImageViewModel(image.Data));
                _imagePrinter.Print(imageDto.Data, printerName);

                //await _queueUtilizer.SendMessage(imageDto);
            }
        }
コード例 #2
0
        private void Print()
        {
            Action <byte[]> print = null;

            if (!string.IsNullOrEmpty(_printerName))
            {
                print = (data) => _printer.Print(data, _printerName);
            }
            else
            {
                print = (data) => _printer.Print(data);
            }

            foreach (var image in _checkedImages.Value)
            {
                print(image.Image.Data);
            }
        }
コード例 #3
0
        private async void Print()
        {
            var result = await _patternVmProvider.GetPatternsAsync();

            TemplateViewModel instaTemplate = result.SingleOrDefault(x => x.IsInstaPrinterTemplate);
            Action <byte[]>   print         = null;

            if (!string.IsNullOrEmpty(_printerName))
            {
                print = (data) => _printer.Print(data, _printerName);
            }
            else
            {
                print = (data) => _printer.Print(data);
            }

            byte[] imageData = new byte[] { };
            Size   imageStreamSize;

            using (var stream = new MemoryStream(_checkedImage.Data))
            {
                var img = Image.FromStream(stream);
                imageStreamSize = img.Size;
            }

            if (instaTemplate != null)
            {
                imageData = _imageUtils.ProcessImages(new List <byte[]> {
                    _checkedImage.Data
                }, imageStreamSize,
                                                      _mappingEngine.Map <EntityTemplate>(instaTemplate));
            }

            else
            {
                //если раземер имени превышает допустимое значение то мы обрезаем его
                var imageName = _checkedImage.FullName.Length < 23 ? _checkedImage.FullName : (_checkedImage.UserName.Length < 23 ? _checkedImage.UserName : (_checkedImage.UserName.Substring(0, 20) + "..."));
                imageData = _imageUtils.GetCaptureForInstagramControl(_checkedImage.Data, imageName, DateTime.Now, _checkedImage.ProfilePictureData);
            }
            print(imageData);

            _navigator.NavigateForward <SelectActivityViewModel>(this, null);
        }
コード例 #4
0
        public void Print_AnyState_PdfDocOnExit()
        {
            var printer = new ImagePrinter();

            const string filePath =
                @"C:\Users\phantomer\Documents\Visual Studio 2013\Projects\ImageMaker\Test\5_ozer.png";

            byte[] fileContent = new byte[0];
            if (File.Exists(filePath))
            {
                fileContent = File.ReadAllBytes(filePath);
            }

            printer.Print(fileContent);
        }
コード例 #5
0
 private void Print()
 {
     _printer.Print(Image, _printerName, CopiesCount);
     _imageService.SaveImage(new ImageViewModel(Image));
     Complete();
 }
コード例 #6
0
 public void Print()
 {
     imagePrinter.Print(image);
 }