コード例 #1
0
ファイル: GetFromScanner.cs プロジェクト: kozlov-d/QSProjects
        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();
        }
コード例 #2
0
ファイル: InputDocs.cs プロジェクト: QualitySolution/earchive
        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 ScanWorks();

            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;
        }
コード例 #3
0
        private async Task HandleOfflineData(string nodeAddress)
        {
            ScanWorks scan            = new ScanWorks(this.Db);
            var       offlineDataList = await NodesClient.Instance.GetOfflineData(nodeAddress);

            if (!offlineDataList.IsEmptyList())
            {
                foreach (var offline in offlineDataList)
                {
                    if (!String.IsNullOrEmpty(offline.Operation) && !String.IsNullOrEmpty(offline.Json))
                    {
                        try
                        {
                            switch (offline.Operation)
                            {
                            case "SaveScanInstance":
                                ScanInstanceModel sim = JsonConvert.DeserializeObject <ScanInstanceModel>(offline.Json);
                                await scan.SaveScanInstance(sim);

                                break;

                            case "SaveScanInstanceOrEditResult":
                                ScanInstanceModel sim2 = JsonConvert.DeserializeObject <ScanInstanceModel>(offline.Json);
                                await scan.SaveScanInstanceOrEditResult(sim2);

                                break;

                            case "EditScan":    //Burası kuyruğa eklendiği için iptal edildçi.
                                //ScanModel sm = JsonConvert.DeserializeObject<ScanModel>(offline.Json);
                                //  await scan.EditScan(sm);
                                break;

                            case "AddChildScans":
                                AddChildScansModel asm = JsonConvert.DeserializeObject <AddChildScansModel>(offline.Json);
                                await scan.AddChildScans(asm);

                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            var logger = Utility.CreateLogger(nameof(HandleOfflineData), nameof(HandleOfflineData)).Code(468);
                            await logger.Error(ex.FindRoot() ?? ex).SaveAsync();

                            ConsoleObserver.Instance.Notify(nameof(HandleOfflineData), nameof(HandleOfflineData), ex);
                        }
                    }

                    try
                    {
                        if (offline.Id > 0)
                        {
                            await NodesClient.Instance.DeleteOfflineData(nodeAddress, offline.Id);
                        }
                    }
                    catch (Exception ex)
                    {
                        var logger = Utility.CreateLogger(nameof(HandleOfflineData), nameof(HandleOfflineData)).Code(467);
                        await logger.Error(ex.FindRoot() ?? ex).SaveAsync();

                        ConsoleObserver.Instance.Notify(nameof(HandleOfflineData), nameof(HandleOfflineData), ex);
                    }
                }
            }
        }
コード例 #4
0
ファイル: InputDocs.cs プロジェクト: QualitySolution/earchive
        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;
            }
        }