예제 #1
0
        private async Task GetImages(string searchString, bool pagination)
        {
            List <ImageItem> items = await _imageGalleryManager.GetImages(searchString, pagination);

            if (items.Count == 0)
            {
                return;
            }

            List <ImageDataItem> imageList = new List <ImageDataItem>();
            List <Task <bool> >  taskList  = new List <Task <bool> >();

            int index = ImageCollection.Count;

            for (int i = 0; i < items.Count; i++)
            {
                ImageDataItem dataItem = new ImageDataItem(index++, items[i].Title, items[i].Url, ActiveService, _imageCreator);
                imageList.Add(dataItem);
                Task <bool> task = dataItem.Init();
            }

            await Task.WhenAll(taskList.ToArray());

            if (!pagination)
            {
                ImageCollection.Clear();
            }

            foreach (var dataItem in imageList)
            {
                ImageCollection.Add(dataItem);
            }
        }
        /// <summary>Загрузка списка контролеров из базы данных</summary>
        /// <param name="TableName">Имя таблицы для загрузки данных</param>
        /// <param name="IsExpDirection">Развернуть узлы направлений</param>
        public void LoadMethodList(string TableName = null, bool IsExpDirection = true)
        {
            if (ReferenceEquals(TableName, null))
            {
                TableName = "ResearchMethods." + ParentForm.Name;
            }

            _TableName      = TableName;
            _IsExpDirection = System.Convert.ToString(IsExpDirection);
            // загружаем изображения в коллекцию
            if (this.tlMethods.Nodes.Count != 0)
            {
                Filling_ndList();
            }
            mdVariables.EventChangedControl = false;

            ImageCol.Clear();
            ImageCol.AddImage(global::My.Resources.Resources.directions_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.microscope_16x16);
            mdQuery.SelectQueryData(
                TableName,
                "EXEC GetTreeListResearchMethods " +
                "@IsExpDirection = " + System.Convert.ToString(Convert.ToInt16(IsExpDirection)),
                "Class.GetResearchMethods"
                );

            if (ReferenceEquals(this.tlMethods.DataSource, null))
            {
                this.tlMethods.ClearNodes();
                this.tlMethods.DataSource      = mdQuery.iDataSet.Tables[TableName];
                this.tlMethods.ParentFieldName = "ParentId";
                this.tlMethods.KeyFieldName    = "Id";
                this.tlMethods.BestFitColumns(true);
                this.tlMethods.StateImageList = ImageCol;
                mdHidenAllColumns.HidenAllColumns_TreeList(this.tlMethods);
                // если столбец существует, показываем его
                if (!ReferenceEquals(this.tlMethods.Columns[UserControlProperty.ColumnsNameInTreeList], null))
                {
                    this.tlMethods.Columns[UserControlProperty.ColumnsNameInTreeList].Visible = true;
                }
            }
            mdVariables.EventChangedControl = true;
            // всем нодам присваиваем иконку
            foreach (TreeListNode nd in this.tlMethods.Nodes)
            {
                FillSelectImageIndex(nd);
                SettingsNode(nd);
            }
            // извлечение из коллекций состояний нодов
            foreach (var n in ndList)
            {
                if (this.tlMethods.FindNodeByKeyID(n.Id) != null)
                {
                    this.tlMethods.FindNodeByKeyID(n.Id).Expanded = System.Convert.ToBoolean(n.Expanded);
                    this.tlMethods.FindNodeByKeyID(n.Id).Checked  = System.Convert.ToBoolean(n.Checked);
                }
            }
            this.tlMethods.FocusedNode = this.tlMethods.FindNodeByKeyID(SelectedItemId);
        }
        public void NewOpeningAndRecognition()
        {
            ImageCollection.Clear();
            SingleClassLabelCollection.Clear();
            for (int i = 0; i <= 999; i++)
            {
                AllClassLabelsCollection[i].NumberOfTimes = 0;
            }

            ImageRecognitionInWPF();
        }
        public static void LoadImages()
        {
            var retrievedImages = DatabaseService.GetAllImages();
            ImageCollection.Clear();

            foreach (var dao in retrievedImages)
            {
                var img = ImageEncodingService.Base64ToSKImage(dao.Base64);
                var galleryImageEntry = new ImageEntry(img, dao.Name, dao.CreationTime, dao.Id);
                if (ImageCollection.ContainsKey(dao.CreationTime.Date))
                {
                    ImageCollection[dao.CreationTime.Date].Add(galleryImageEntry);
                }
                else
                {
                    ImageCollection.Add(dao.CreationTime.Date, new GalleryImageSection(dao.CreationTime.Date));
                    ImageCollection[dao.CreationTime.Date].Add(galleryImageEntry);
                }
            }
        }
예제 #5
0
        void IDropTarget.Drop(IDropInfo dropInfo)
        {
            dropInfo.Effects = DragDropEffects.Copy;

            var dragFileList = ((DataObject)dropInfo.Data).GetFileDropList();

            String[] fileList = (string[])((DataObject)dropInfo.Data).GetData(DataFormats.FileDrop);

            ImageCollection.Clear();
            for (int i = 0; i < dragFileList.Count; i++)
            {
                ImageCollection.Add(new ImageObject
                {
                    displayName = dragFileList[i],
                    location    = dragFileList[i]
                });
            }

            if (fileList.Count() > 0)
            {
                // backend.HandleFileDrop(SaveMainImage, fileList, UpdateConsole);
                backend.HandleFileDrop(SaveMainImage, fileList);
            }
        }
예제 #6
0
        /// <summary>Загрузка списка контролеров из базы данных</summary>
        /// <param name="TableName">Имя таблицы для загрузки данных</param>
        /// <param name="CountryId">Если NULL, выгружается вся продукция, иначе по стране</param>
        /// <param name="ProductId">Если NULL, выгружается вся продукция, иначе по продукция</param>
        public void LoadTreeList(string TableName = null, string CountryId = "NULL", string ProductId = "NULL")
        {
            if (ReferenceEquals(TableName, null))
            {
                TableName = "ObjectsQurantine." + ParentForm.Name;
            }

            _TableName = TableName;
            _CountryId = CountryId;
            _ProductId = ProductId;
            // загружаем изображения в коллекцию
            if (this.tlQurantineObjects.Nodes.Count != 0)
            {
                Filling_ndList();
            }
            mdVariables.EventChangedControl = false;

            ImageCol.Clear();
            ImageCol.AddImage(global::My.Resources.Resources.microscope_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.bakterii_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.virus_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.gribi16x16);
            ImageCol.AddImage(global::My.Resources.Resources.cleshi_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.molliuski_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.nasekomye_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.nematody_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.sorniaki_16x16);
            mdQuery.SelectQueryData(
                TableName,
                "EXEC GetTreeListObjectsQurantine " +
                "@CountryId = " + CountryId + ", " +
                "@ProductId = " + ProductId,
                "Class.GetObjectsQurantine"
                );

            if (ReferenceEquals(this.tlQurantineObjects.DataSource, null))
            {
                this.tlQurantineObjects.ClearNodes();
                this.tlQurantineObjects.DataSource      = mdQuery.iDataSet.Tables[TableName];
                this.tlQurantineObjects.ParentFieldName = "ParentId";
                this.tlQurantineObjects.KeyFieldName    = "Id";
                this.tlQurantineObjects.BestFitColumns(true);
                this.tlQurantineObjects.StateImageList = ImageCol;
                mdHidenAllColumns.HidenAllColumns_TreeList(this.tlQurantineObjects);
                // если столбец существует, показываем его
                if (!ReferenceEquals(this.tlQurantineObjects.Columns[UserControlProperty.ColumnsNameInTreeList], null))
                {
                    this.tlQurantineObjects.Columns[UserControlProperty.ColumnsNameInTreeList].Visible = true;
                }
            }
            mdVariables.EventChangedControl = true;
            // всем нодам присваиваем иконку
            foreach (TreeListNode nd in this.tlQurantineObjects.Nodes)
            {
                FillSelectImageIndex(nd);
                SettingsNode(nd);
            }
            // извлечение из коллекций состояний нодов
            foreach (var n in ndList)
            {
                if (this.tlQurantineObjects.FindNodeByKeyID(n.Id) != null)
                {
                    this.tlQurantineObjects.FindNodeByKeyID(n.Id).Expanded = System.Convert.ToBoolean(n.Expanded);
                    this.tlQurantineObjects.FindNodeByKeyID(n.Id).Checked  = System.Convert.ToBoolean(n.Checked);
                }
            }
            this.tlQurantineObjects.FocusedNode = this.tlQurantineObjects.FindNodeByKeyID(SelectedItemId);
        }
예제 #7
0
        private void AttachDocument()
        {
            Person person = null;

            using (personSearchForm = new PersonSearchForm())
            {
                personSearchForm.ShowDialog();
                person = personSearchForm.SelectedPerson;
                personSearchForm.Dispose();
            }

            if (person != null)
            {
                this.Cursor = Cursors.WaitCursor;

                string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

                myDocType docType = (myDocType)getCheckedMenuItem(miDocumentType).Tag;

                PersonAttribute pa = new PersonAttribute(person.PersonID, docType.AttributeId);

                if (pa.IntValue == -1 ||
                    MessageBox.Show(
                        string.Format("{0} already has a {1} document associated with their record. Do you want to overwrite the existing document?", person.NickName, docType.TypeName),
                        "Document Already Exists", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
                {
                    Arena.Utility.ArenaDataBlob blob = new Arena.Utility.ArenaDataBlob(pa.IntValue);

                    Atalasoft.Imaging.Codec.Pdf.PdfEncoder pdf = new Atalasoft.Imaging.Codec.Pdf.PdfEncoder();
                    pdf.Metadata = new Atalasoft.Imaging.Codec.Pdf.PdfMetadata(
                        person.FullName, "", docType.DocType.TypeName,
                        "", organization.Name, "", DateTime.Now, DateTime.Now);

                    string fileName = string.Format("{0}_{1}.pdf",
                                                    person.FullName.Replace(" ", ""),
                                                    docType.TypeName.Replace(" ", ""));

                    blob.SetFileInfo(fileName);

                    using (MemoryStream ms = new MemoryStream())
                    {
                        ScannedImages.Save(ms, pdf, null);
                        blob.ByteArray = ms.ToArray();
                        ms.Close();
                    }

                    blob.Cache          = false;
                    blob.DocumentTypeID = docType.DocType.DocumentTypeId;
                    blob.Title          = docType.DocType.TypeName;

                    pa.IntValue    = blob.Save(userName);
                    pa.PersonID    = person.PersonID;
                    pa.AttributeId = docType.AttributeId;
                    pa.Save(organizationID, userName);

                    PersonDocument pDoc = new PersonDocument(person.PersonID, pa.IntValue);
                    pDoc.PersonID   = person.PersonID;
                    pDoc.DocumentID = pa.IntValue;
                    pDoc.SaveRelationship(userName);

                    ScannedImages.Clear();
                    tViewer.Items.Clear();
                    RefreshView();
                }

                this.Cursor = Cursors.Default;
            }
        }
예제 #8
0
        /// <summary>Загрузка списка контролеров из базы данных</summary>
        /// <param name="TableName">Имя таблицы для загрузки данных</param>
        /// <param name="CountryId">Если NULL, выгружается вся классификация, иначе по стране</param>
        /// <param name="IsExpClassification">Развернуть узлы направлений</param>
        /// <param name="ShowCountProducts">Показывать кол-во продукций у классификации</param>
        public void LoadTreeList(string TableName = null, string CountryId = "NULL", bool IsExpClassification = true, bool ShowCountProducts = false, string FilterParametr = "NULL")
        {
            if (ReferenceEquals(TableName, null))
            {
                TableName = "Classification." + ParentForm.Name;
            }

            _TableName           = TableName;
            _CountryId           = CountryId;
            _IsExpClassification = IsExpClassification;
            _ShowCountProducts   = ShowCountProducts;
            _FilterParametr      = FilterParametr;
            // загружаем изображения в коллекцию
            if (this.tlClassification.Nodes.Count != 0)
            {
                Filling_ndList();
            }
            mdVariables.EventChangedControl = false;

            ImageCol.Clear();
            ImageCol.AddImage(global::My.Resources.Resources.directions_16x16);
            ImageCol.AddImage(global::My.Resources.Resources.ClassificationProducts_16x16);
            mdQuery.SelectQueryData(
                TableName,
                "EXEC GetTreeListClassificationProducts " +
                "@CountryId = " + CountryId + ", " +
                "@IsExpClassification = " + System.Convert.ToString(Convert.ToInt16(IsExpClassification)) + ", " +
                "@ShowCountProducts = " + System.Convert.ToString(Convert.ToInt16(ShowCountProducts)) + ", " +
                "@FilterParametr = " + clsForSQL.InDataBase(FilterParametr),
                "Class.GetResearchMethods"
                );

            if (ReferenceEquals(this.tlClassification.DataSource, null))
            {
                this.tlClassification.ClearNodes();
                this.tlClassification.DataSource      = mdQuery.iDataSet.Tables[TableName];
                this.tlClassification.ParentFieldName = "ParentId";
                this.tlClassification.KeyFieldName    = "Id";
                this.tlClassification.BestFitColumns(true);
                this.tlClassification.StateImageList = ImageCol;
                mdHidenAllColumns.HidenAllColumns_TreeList(this.tlClassification);
                // если столбец существует, показываем его
                if (!ReferenceEquals(this.tlClassification.Columns[UserControlProperty.ColumnsNameInTreeList], null))
                {
                    this.tlClassification.Columns[UserControlProperty.ColumnsNameInTreeList].Visible = true;
                }
            }
            mdVariables.EventChangedControl = true;
            // всем нодам присваиваем иконку
            foreach (TreeListNode nd in this.tlClassification.Nodes)
            {
                FillSelectImageIndex(nd);
                SettingsNode(nd);
            }
            // извлечение из коллекций состояний нодов
            foreach (var n in ndList)
            {
                if (this.tlClassification.FindNodeByKeyID(n.Id) != null)
                {
                    this.tlClassification.FindNodeByKeyID(n.Id).Expanded = System.Convert.ToBoolean(n.Expanded);
                    this.tlClassification.FindNodeByKeyID(n.Id).Checked  = System.Convert.ToBoolean(n.Checked);
                }
            }
            this.tlClassification.FocusedNode = this.tlClassification.FindNodeByKeyID(SelectedItemId);
        }