public void Scan(out IDocument document, IDocument.FormatType formatType = IDocument.FormatType.JPG)
        {
            document = null;
            if (State == IDevice.State.on)
            {
                string scanType = "";
                switch (formatType)
                {
                case IDocument.FormatType.JPG:
                    scanType = $"ImageScan{++ScanCounter}.jpg";
                    document = new ImageDocument(scanType);
                    break;

                case IDocument.FormatType.PDF:
                    scanType = $"PDFScan{++ScanCounter}.pdf";
                    document = new PDFDocument(scanType);
                    break;

                case IDocument.FormatType.TXT:
                    scanType = $"TextScan{++ScanCounter}.txt";
                    document = new TextDocument(scanType);
                    break;
                }
                Console.WriteLine($"{DateTime.Now} Scan: {scanType}");
            }
        }
        void imageDocumentEditor1_OnApplay(object sender, EventArgs e)
        {
            this.tsbtnEditImage.Checked = false;
            if (this.CurrentViewImage == null)
            {
                ImageDocument newimg = imageDocumentEditor1.GetImage() as ImageDocument;
                this.CurrentViewImage = newimg;
            }
            else
            {
                ImageDocument ff = imageDocumentEditor1.GetImage();
                CurrentViewImage.layers = ff.layers;
                CurrentViewImage.Stream = ff.Stream;

                ImageViewer.RefreshCurrent();
            }

            try
            {
                CurrentViewImage.ThumbnailStream = CurrentImageTools.GetThumbnailStream(CurrentViewImage.Stream, this.thumbnailList1.ThumbnailSize.Width, this.thumbnailList1.ThumbnailSize.Height, 1.0);

                OnCreatedThumbnailImage(new ImageEventArg(CurrentViewImage));
            }
            catch (Exception) { }

            OnEditededImage(new ImageEventArg(CurrentViewImage));
            OnEndEditImage(new ImageEventArg(CurrentViewImage));
            OnEndEditImage();

            imageDocumentEditor1.Clear();
        }
Example #3
0
        public void MFD_ScanCounter()
        {
            MultifunctionalDevice device = new MultifunctionalDevice();

            device.PowerOn();

            IDocument doc1;

            device.Scan(out doc1);
            IDocument doc2;

            device.Scan(out doc2);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            device.Print(in doc3);

            device.PowerOff();
            device.Print(in doc3);
            device.Scan(out doc1);
            device.PowerOn();

            device.ScanAndPrint();
            device.ScanAndPrint();

            // 4 skany, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(4, device.ScanCounter);
        }
Example #4
0
        public void MFD_PowerOnCounter()
        {
            MultifunctionalDevice device = new MultifunctionalDevice();

            device.PowerOn();
            device.PowerOn();
            device.PowerOn();

            IDocument doc1;

            device.Scan(out doc1);
            IDocument doc2;

            device.Scan(out doc2);

            device.PowerOff();
            device.PowerOff();
            device.PowerOff();
            device.PowerOn();

            IDocument doc3 = new ImageDocument("aaa.jpg");

            device.Print(in doc3);

            device.PowerOff();
            device.Print(in doc3);
            device.Scan(out doc1);
            device.PowerOn();

            device.ScanAndPrint();
            device.ScanAndPrint();

            // 3 w³¹czenia
            Assert.AreEqual(3, device.Counter);
        }
Example #5
0
        public void Scan(out IDocument document, IDocument.FormatType formatType)
        {
            if (GetState() == IDevice.State.on)
            {
                switch (formatType)
                {
                case IDocument.FormatType.JPG:
                    document = new ImageDocument($"ImageScan{Counter}.jpg");
                    break;

                case IDocument.FormatType.TXT:
                    document = new ImageDocument($"TextScan{Counter}.txt");
                    break;

                case IDocument.FormatType.PDF:
                default:
                    document = new PDFDocument($"PDFScan{Counter}.pdf");
                    break;
                }
                Console.WriteLine($"{DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss")} Scan: {document.GetFileName()}");
                Counter++;
            }
            else
            {
                document = null;
            }
        }
Example #6
0
        public void Copier_ScanCounter()
        {
            var copier = new Copier();

            copier.PowerOn();

            IDocument doc1;

            copier.Scan(out doc1);
            IDocument doc2;

            copier.Scan(out doc2);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 4 skany, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(4, copier.ScanCounter);
        }
        public void Copier_PrintCounter()
        {
            var p      = new Printer();
            var s      = new Scanner();
            var copier = new Copier(p, s);

            copier.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            copier.Print(in doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            copier.Print(in doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint(out doc1, doc1.GetFormatType());
            copier.ScanAndPrint(out doc2, doc2.GetFormatType());

            // 5 wydruków, gdy urządzenie włączone
            Assert.AreEqual(5, copier.PrintCounter);
        }
Example #8
0
        void ucImageListView_RetrieveVirtualItemThumbnail(object sender, VirtualItemThumbnailEventArgs e)
        {
            // return;
            ImageDocument img = null;

            if (e.Key is ImageDocument)
            {
                img = e.Key as ImageDocument;
            }

            if (img == null)
            {
                return;
            }

            InitialImage(img);

            var imgTemp = CurrentImageTools.GetWholeImage(img);

            if (imgTemp != null)
            {
                e.ThumbnailImage = CurrentImageTools.BaseTools.ScaleImage(imgTemp, e.ThumbnailDimensions.Width, e.ThumbnailDimensions.Height, 0);
                imgTemp.Dispose();
                return;
            }
        }
Example #9
0
        public void MultiFunctionalDevice_PowerOnCounter()
        {
            var fax = new MultifunctionalDevice();

            fax.PowerOn();
            fax.PowerOn();
            fax.PowerOn();

            IDocument doc1;

            fax.Scan(out doc1);
            IDocument doc2;

            fax.Scan(out doc2);

            fax.PowerOff();
            fax.PowerOff();
            fax.PowerOff();
            fax.PowerOn();

            IDocument doc3 = new ImageDocument("aaa.jpg");

            fax.Print(in doc3);

            fax.PowerOff();
            fax.Print(in doc3);
            fax.Scan(out doc1);
            fax.PowerOn();

            fax.ScanAndPrint();
            fax.ScanAndPrint();

            // 3 w³¹czenia
            Assert.AreEqual(3, fax.Counter);
        }
Example #10
0
        public ImageDocument InitialImage(ImageDocument img)
        {
            //try
            //{
            //    img.Image.Save("c:\\aeae.jpeg");
            //}
            //catch
            //{ }

            try
            {
                if (img.Stream == null || img.Stream.Length < 10)
                {
                    if (Path.IsPathRooted(img.Description) && File.Exists(img.Description))
                    {
                        img.Stream = File.ReadAllBytes(img.Description);
                        //using (Image image = Image.FromFile(img.Description))
                        //{
                        //    img.Stream = BaseTools.GetStreamImage(image, System.Drawing.Imaging.ImageFormat.Tiff);
                        //}
                    }
                    else
                    {
                        OnNeedImage(new ImageEventArg(img));
                    }
                }
                return(img);
            }
            catch
            { }

            return(null);
        }
Example #11
0
        public void MultidimensionalDevice_PowerOnCounter()
        {
            var fax = new MultidimensionalDevice();

            fax.PowerOn();
            fax.PowerOn();
            fax.PowerOn();

            IDocument doc1;

            fax.Scan(IDocument.FormatType.TXT);
            IDocument doc2;

            fax.Scan(IDocument.FormatType.TXT);

            fax.PowerOff();
            fax.PowerOff();
            fax.PowerOff();
            fax.PowerOn();

            IDocument doc3 = new ImageDocument("aaa.jpg");

            fax.Print(doc3);

            fax.PowerOff();
            fax.Print(doc3);
            fax.Scan(IDocument.FormatType.TXT);
            fax.PowerOn();

            fax.ScanAndPrint(IDocument.FormatType.TXT);
            fax.ScanAndPrint(IDocument.FormatType.TXT);

            // 3 w³¹czenia
            Assert.AreEqual(3, fax.Counter);
        }
Example #12
0
        public void MultidimensionalDevice_ScanCounter()
        {
            var fax = new MultidimensionalDevice();

            fax.PowerOn();

            IDocument doc1;

            fax.Scan(IDocument.FormatType.TXT);
            IDocument doc2;

            fax.Scan(IDocument.FormatType.TXT);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            fax.Print(doc3);

            fax.PowerOff();
            fax.Print(doc3);
            fax.Scan(IDocument.FormatType.TXT);
            fax.PowerOn();

            fax.ScanAndPrint(IDocument.FormatType.TXT);
            fax.ScanAndPrint(IDocument.FormatType.TXT);

            // 4 skany, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(4, fax.ScanCounter);
        }
Example #13
0
        public void MultidimensionalDevice_PrintCounter()
        {
            var fax = new MultidimensionalDevice();

            fax.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            fax.Print(doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            fax.Print(doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            fax.Print(doc3);

            fax.PowerOff();
            fax.Print(doc3);
            fax.Scan(IDocument.FormatType.JPG);
            fax.PowerOn();

            fax.ScanAndPrint(IDocument.FormatType.TXT);
            fax.ScanAndPrint(IDocument.FormatType.TXT);

            // 5 wydruków, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(5, fax.PrintCounter);
        }
Example #14
0
        public void Copier_PowerOnCounter()
        {
            var copier = new Copier();

            copier.PowerOn();
            copier.PowerOn();
            copier.PowerOn();

            IDocument doc1;

            copier.Scan(IDocument.FormatType.JPG);
            IDocument doc2;

            copier.Scan(IDocument.FormatType.PDF);

            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOn();

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(doc3);

            copier.PowerOff();
            copier.Print(doc3);
            copier.Scan(IDocument.FormatType.PDF);
            copier.PowerOn();

            copier.ScanAndPrint(IDocument.FormatType.TXT);
            copier.ScanAndPrint(IDocument.FormatType.JPG);

            // 3 w³¹czenia
            Assert.AreEqual(3, copier.Counter);
        }
        public void Copier_ScanCounter()
        {
            var p      = new Printer();
            var s      = new Scanner();
            var copier = new Copier(p, s);

            copier.PowerOn();

            IDocument doc1;

            copier.Scan(out doc1);
            IDocument doc2;

            copier.Scan(out doc2);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint(out doc3, doc3.GetFormatType());
            copier.ScanAndPrint(out doc2);

            // 4 skany, gdy urządzenie włączone
            Assert.AreEqual(4, copier.ScanCounter);
        }
Example #16
0
        private void rbtnCurrentView_CheckedChanged(object sender, EventArgs e)
        {
            if (rbtnCurrentView.Checked)
                this.Image = CurrentViewImage;

        
        }
Example #17
0
        public void Scan(out IDocument document, IDocument.FormatType formatType)
        {
            if (state == IDevice.State.on)
            {
                scanCounter++;
            }

            if (formatType == IDocument.FormatType.TXT)
            {
                document = new TextDocument($"TXTScan{ScanCounter}.txt");
            }
            else if (formatType == IDocument.FormatType.PDF)
            {
                document = new PDFDocument($"PDFScan{ScanCounter}.pdf");
            }
            else if (formatType == IDocument.FormatType.JPG)
            {
                document = new ImageDocument($"IMAGEScan{ScanCounter}.jpg");
            }
            else
            {
                throw new FormatException();
            }

            if (state == IDevice.State.on)
            {
                Console.WriteLine($"{DateTime.Now} Scan: {document.GetFileName()}");
            }
        }
Example #18
0
        public void MD_FaxCounter()
        {
            var d = new MultifunctionalDevice();

            d.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            d.Fax(in doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            d.Fax(in doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            d.Fax(in doc3);

            d.PowerOff();
            d.Fax(in doc3);
            d.PowerOn();

            d.Fax(in doc1);
            d.Fax(in doc2);

            // 5 faksów, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(5, d.FaxCounter);
        }
Example #19
0
        public void MFD_PrintCounter()
        {
            MultifunctionalDevice device = new MultifunctionalDevice();

            device.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            device.Print(in doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            device.Print(in doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            device.Print(in doc3);

            device.PowerOff();
            device.Print(in doc3);
            device.Scan(out doc1);
            device.PowerOn();

            device.ScanAndPrint();
            device.ScanAndPrint();

            // 5 wydruków, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(5, device.PrintCounter);
        }
Example #20
0
        public void Copier_PrintCounter()
        {
            var copier = new Copier();

            copier.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            copier.Print(in doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            copier.Print(in doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 5 wydruków, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(5, copier.PrintCounter);
        }
        public void MultifunctionalDevice_PowerOnCounter()
        {
            var copier = new MultifunctionalDevice();

            copier.PowerOn();
            copier.PowerOn();
            copier.PowerOn();

            IDocument doc1;

            copier.Scan(out doc1);
            IDocument doc2;

            copier.Scan(out doc2);

            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOff();
            copier.PowerOn();

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 3 włączenia
            Assert.AreEqual(3, copier.Counter);
        }
Example #22
0
        public void Copier_ScanCounter()
        {
            var copier = new Copier();

            copier.PowerOn();

            IDocument doc1;

            copier.Scan(IDocument.FormatType.PDF);
            IDocument doc2;

            copier.Scan(IDocument.FormatType.JPG);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(doc3);

            copier.PowerOff();
            copier.Print(doc3);
            copier.Scan(IDocument.FormatType.PDF);
            copier.PowerOn();

            copier.ScanAndPrint(IDocument.FormatType.TXT);
            copier.ScanAndPrint(IDocument.FormatType.PDF);

            // 4 skany, gdy urz¹dzenie w³¹czone
            Assert.AreEqual(4, copier.ScanCounter);
        }
        public void MultifunctionalDevice_ScanCounter()
        {
            var copier = new MultifunctionalDevice();

            copier.PowerOn();

            IDocument doc1;

            copier.Scan(out doc1);
            IDocument doc2;

            copier.Scan(out doc2);

            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 4 skany, gdy urządzenie włączone
            Assert.AreEqual(4, copier.ScanCounter);
        }
        public void MultifunctionalDevice_FaxCounter()
        {
            var copier = new MultifunctionalDevice();

            copier.PowerOn();
            string    to   = "1234";
            IDocument doc1 = new PDFDocument("aaa.pdf");

            copier.SendFax(in doc1, to);
            IDocument doc2 = new TextDocument("aaa.txt");

            copier.SendFax(in doc2, to);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.SendFax(in doc3, to);

            copier.PowerOff();
            copier.SendFax(in doc3, to);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndFax(to);
            copier.ScanAndFax(to);

            // 5 wydruków, gdy urządzenie włączone
            Assert.AreEqual(5, copier.FaxCounter);
        }
        public void MultifunctionalDevice_PrintCounter()
        {
            var copier = new MultifunctionalDevice();

            copier.PowerOn();

            IDocument doc1 = new PDFDocument("aaa.pdf");

            copier.Print(in doc1);
            IDocument doc2 = new TextDocument("aaa.txt");

            copier.Print(in doc2);
            IDocument doc3 = new ImageDocument("aaa.jpg");

            copier.Print(in doc3);

            copier.PowerOff();
            copier.Print(in doc3);
            copier.Scan(out doc1);
            copier.PowerOn();

            copier.ScanAndPrint();
            copier.ScanAndPrint();

            // 5 wydruków, gdy urządzenie włączone
            Assert.AreEqual(5, copier.PrintCounter);
        }
Example #26
0
            public void Copier_PowerOnCounter()
            {
                var copier = new Copier();

                copier.scanner.PowerOn();
                copier.printer.PowerOn();
                copier.printer.PowerOn();

                IDocument doc1;

                copier.scanner.Scan(out doc1);
                IDocument doc2;

                copier.scanner.Scan(out doc2);

                copier.scanner.PowerOff();
                copier.scanner.PowerOff();
                copier.printer.PowerOff();
                copier.printer.PowerOn();

                IDocument doc3 = new ImageDocument("aaa.jpg");

                copier.printer.Print(in doc3);

                copier.printer.PowerOff();
                copier.printer.Print(in doc3);
                copier.scanner.Scan(out doc1);
                copier.scanner.PowerOn();

                copier.ScanAndPrint();
                copier.ScanAndPrint();

                Assert.AreEqual(2, copier.printer.Counter);
            }
Example #27
0
            public void Copier_PrintCounter()
            {
                var copier = new Copier();

                copier.printer.PowerOn();

                IDocument doc1 = new PDFDocument("aaa.pdf");

                copier.printer.Print(in doc1);
                IDocument doc2 = new TextDocument("aaa.txt");

                copier.printer.Print(in doc2);
                IDocument doc3 = new ImageDocument("aaa.jpg");

                copier.printer.Print(in doc3);

                copier.printer.PowerOff();
                copier.printer.Print(in doc3);
                copier.scanner.Scan(out doc1);
                copier.scanner.PowerOn();

                copier.ScanAndPrint();
                copier.ScanAndPrint();

                Assert.AreEqual(3, copier.printer.PrintCounter);
            }
Example #28
0
 public WorkTemplate()
 {
     Experience   = new InfoBlockDocument();
     ProfileImage = new ImageDocument();
     Name         = new TextDocument();
     ContactInfo  = new InfoBlockDocument();
     Birthday     = new TextDocument();
 }
Example #29
0
        private Image GetImage(ImageDocument imageDocument)
        {
            ImageData imageData = ImageDataFactory.Create(imageDocument.Filepath);
            // Create layout image object and provide parameters. Page number = 1
            Image image = new Image(imageData).SetWidth(150).SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.RIGHT);

            return(image);
        }
        public void AddTag_AddsTagToDocument()
        {
            ImageDocument innerDocument = new ImageDocument();
            Image         image         = new Image(innerDocument);

            image.AddTag("tag");

            Assert.AreEqual(innerDocument.Tags[0].Name, "tag");
        }