Ejemplo n.º 1
0
        public GetFromScanner()
        {
            this.Build();
            try
            {
                logger.Debug("init scan");
                scan                = new ScanWorks();
                scan.Pulse         += OnScanerPulse;
                scan.ImageTransfer += OnScanerImageTransfer;
                foreach (string scannerName in scan.GetScannerList())
                {
                    comboScanner.AppendText(scannerName);
                }
                if (scan.ScannerCount > 0)
                {
                    comboScanner.Active = 0;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Не удалось инициализировать библиотеку Saraff.Twain.");
                QSProjectsLib.QSMain.ErrorMessage(this, ex);
                Respond(Gtk.ResponseType.Reject);
            }

            TestCanSave();
        }
Ejemplo n.º 2
0
        public InputDocs() :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();

            FieldLables  = new Dictionary <int, Label>();
            FieldWidgets = new Dictionary <int, object>();
            FieldIcons   = new Dictionary <int, Gtk.Image>();
            ComboWorks.ComboFillReference(comboType, "doc_types", ComboWorks.ListMode.OnlyItems, false);
            ImageList = new ImageTreeStore(typeof(int),         //0 - id
                                           typeof(string),      //1 - Image Name
                                           typeof(string),      //2 - full path
                                           typeof(Document),    //3 - document
                                           typeof(Pixbuf),      //4 - thumbnails
                                           typeof(Pixbuf),      //5 - full image
                                           typeof(bool),        //6 - IsImage
                                           typeof(string),      //7 - Doc name
                                           typeof(string)       //8 - Doc Icon Name
                                           );

            TreeViewColumn ImageColumn = new TreeViewColumn();
            var            ImageCell   = new ImageListCellRenderer(Pango.FontDescription.FromString("Tahoma 10"), IconSize.Menu);

            ImageCell.Xalign = 0;
            ImageColumn.PackStart(ImageCell, true);
            ImageColumn.AddAttribute(ImageCell, "pixbuf", 4);
            ImageColumn.AddAttribute(ImageCell, "text", 7);
            ImageColumn.AddAttribute(ImageCell, "IsImageRow", 6);
            ImageColumn.AddAttribute(ImageCell, "IconName", 8);

            treeviewImages.AppendColumn(ImageColumn);
            treeviewImages.Model         = ImageList;
            treeviewImages.Reorderable   = true;
            treeviewImages.TooltipColumn = 1;
            treeviewImages.ShowAll();
            treeviewImages.Selection.Changed += OnTreeviewImagesSelectionChanged;
            NextDocNumber = 1;

            //Настраиваем сканирование
            logger.Debug("Initialaze scan");
            //scan = new ScanAuxWorks();
            try
            {
                scan                = new ScanWorks();
                scan.ScanerSetup    = ScanerSetup.Native;
                scan.Pulse         += OnScanWorksPulse;
                scan.ImageTransfer += OnScanWorksImageTransfer;

                var scanners = scan.GetScannerList();
                if (scanners.Length > 0)
                {
                    comboScaner.ItemsList = scanners;
                    comboScaner.Active    = scan.CurrentScanner;
                }
                else
                {
                    comboScaner.Sensitive = ScanAction.Sensitive = false;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Не удалось инициализировать подсистему сканирования.");
                comboScaner.Sensitive = ScanAction.Sensitive = false;
            }
        }