예제 #1
0
        private void removeImageViewer()
        {
            //    VisitRepository visitRepo = new VisitRepository();
            //    VisitModel v = visitRepo.GetById(IVLVariables.ActiveVisitID);
            //    v.NoOfImages = v.NoOfImages - thumbnail_FLP.SelectedThumbnailFileNames.Count;
            //    visitRepo.Update(v);
            List <int>    removedImageIds      = new List <int>();
            List <string> removeImageFilePaths = new List <string>();

            foreach (var item in thumbnail_FLP.SelectedThumbnailFileNames)
            {
                foreach (var item1 in thumbnail_FLP.Controls)
                {
                    if (item1 is ImageViewer)
                    {
                        ImageViewer imgView = item1 as ImageViewer;
                        if (item.Equals(imgView.ImageLocation))
                        {
                            if (File.Exists(imgView.ImageLocation))//This
                            {
                                //ImageModel imgVal = imageRepo.GetById(imgView.ImageID);
                                //imgVal.HideShowRow = true;
                                //imageRepo.Update(imgVal);
                                if (image_names.Contains(imgView.ImageLocation))
                                {
                                    image_names.Remove(imgView.ImageLocation);
                                }
                                removedImageIds.Add(imgView.ImageID);
                                removeImageFilePaths.Add(imgView.ImageLocation);
                                thumbnail_FLP.Controls.Remove(item1 as Control);
                            }
                            else
                            {
                                CustomMessageBox.Show(DeletedImageMsg, DeletedImageHeader, CustomMessageBoxButtons.OK, CustomMessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                }
            }
            Dictionary <string, object> img = new Dictionary <string, object>();

            img.Add("ImageIds", removedImageIds);
            img.Add("ImageLocations", removeImageFilePaths);
            deleteimgs(img);
            this.thumbnail_FLP.selectedThumbnails.Clear();
            this.thumbnail_FLP.SelectedThumbnailFileNames.Clear();
            thumbnail_FLP.TotalThumbnails = this.thumbnail_FLP.Controls.Count;
            ImageViewer[] item2 = new ImageViewer[thumbnail_FLP.Controls.Count];//to update the items in thumbnail after deleting image.By Ashutosh 11-08-2017.
            for (int i = 0; i < thumbnail_FLP.Controls.Count; i++)
            {
                item2[i]       = thumbnail_FLP.Controls[i] as ImageViewer;
                item2[i].Index = item2.Length - i;
            }
            for (int i = 0; i < thumbnail_FLP.Controls.Count; i++)
            {
                item2[i] = thumbnail_FLP.Controls[i] as ImageViewer;
                if (i == 0)
                {
                    this.thumbnailSelection(item2[i]);
                    break;
                }
            }
            RefreshThumbNailImageName();
        }
예제 #2
0
        private void ShiftKeyThumbNailSelection(ImageViewer sender)
        {
            m_ActiveImageViewer = (ImageViewer)sender;
            int startIndx = 0;
            int endIndx   = 0;

            if (this.thumbnail_FLP.selectedThumbnails.Count == 0)
            {
                Thumbnail_noshiftcntrlSelection(sender);
            }
            else
            {
                if (m_ActiveImageViewer.Index > this.thumbnail_FLP.selectedThumbnails[0])
                {
                    startIndx = this.thumbnail_FLP.selectedThumbnails[0];
                    endIndx   = m_ActiveImageViewer.Index;
                }
                else
                {
                    endIndx   = this.thumbnail_FLP.selectedThumbnails[0];
                    startIndx = m_ActiveImageViewer.Index;
                }
            }
            //for (int i = startIndx; i <= endIndx; i++)
            //{
            //Added by darshan to resolve the issue 0000657: Reports no limit is set,No images are shown.
            uint noOfImagesSelected = (uint)(endIndx - startIndx);
            //if ((noOfImagesSelected + 1) <= NoOfImagesToBeSelected && this.thumbnail_FLP.selectedThumbnails.Count < NoOfImagesToBeSelected)// && (this.thumbnail_FLP.selectedThumbnails.Count + noOfImagesSelected) <= NoOfImagesToBeSelected)
            {
                for (int i = endIndx; i >= startIndx; --i)
                {
                    foreach (Control item in this.thumbnail_FLP.Controls)
                    {
                        if (item is ImageViewer)
                        {
                            ImageViewer tempImgViewer = (ImageViewer)item;
                            if (tempImgViewer.Index == i)
                            {
                                if (!image_names.Contains(tempImgViewer.ImageLocation))
                                {
                                    image_names.Add(tempImgViewer.ImageLocation);
                                }
                                ThumbnailData data = new ThumbnailData();
                                data.fileName = m_ActiveImageViewer.ImageLocation;
                                data.id       = m_ActiveImageViewer.ImageID;
                                data.side     = m_ActiveImageViewer.ImageSide;
                                data.Name     = m_ActiveImageViewer.ImageName;
                                displayThumbnailImage(data);
                                //verticalSroll(tempImgViewer);
                                tempImgViewer.IsActive = true;
                                //this.thumbnail_FLP.AutoScrollPosition = new Point(tempImgViewer.Location.X, tempImgViewer.Location.Y+10);
                                if (!this.thumbnail_FLP.selectedThumbnails.Contains(tempImgViewer.Index))
                                {
                                    this.thumbnail_FLP.selectedThumbnails.Add(tempImgViewer.Index);
                                }
                                if (!this.thumbnail_FLP.SelectedThumbnailFileNames.Contains(tempImgViewer.ImageLocation))//checks if SelectedThumbnailFileNames contains ImageLocation, if it doesn't contain , then adds the ImageLocation.By Ashutosh 06-09-2017.
                                {
                                    this.thumbnail_FLP.SelectedThumbnailFileNames.Add(tempImgViewer.ImageLocation);
                                }
                            }
                        }
                    }
                }
            }
            //else
            //{
            //    //Added by darshan to resolve the issue 0000657: Reports no limit is set,No images are shown Note no (0002575).
            //    CustomMessageBox.Show(NoOfImagesToBeSelectedText1 + " " + NoOfImagesToBeSelected.ToString() + " " + NoOfImagesToBeSelectedText2, NoOfImagesToBeSelectedHeader, CustomMessageBoxButtons.OK, CustomMessageBoxIcon.Information);
            //}
        }
예제 #3
0
        private void AddImage(string imageFilename, int id, int indx, int side, bool isannotated, bool isCDR)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(m_AddImageDelegate, imageFilename, id, indx, side, isannotated, isCDR);
                //this.BeginInvoke(m_AddImageDelegate, imageFilename, id, indx, side, isannotated, isCDR);
            }
            else
            {
                //int size = 192;
                ImageViewer imageViewer = new ImageViewer();
                imageViewer.Dock = DockStyle.Bottom;
                imageViewer.LoadImage(imageFilename, id, 256, 256);
                if (Screen.PrimaryScreen.Bounds.Width == 1366)
                {
                    imageViewer.Width  = 118;
                    imageViewer.Height = 128;
                }
                else
                if (Screen.PrimaryScreen.Bounds.Width == 1280)
                {
                    imageViewer.Width  = 118;
                    imageViewer.Height = 128;
                }
                else
                {
                    imageViewer.Width  = 192;
                    imageViewer.Height = 192;
                }
                //This below code has been added by darshan in order to solve defect no:0000530
                this.thumbnail_FLP.AutoScrollOffset = new Point(0, imageViewer.Height);
                imageViewer.IsAnnotated             = isannotated;
                imageViewer.IsCDR       = isCDR;
                imageViewer.IsThumbnail = true;
                imageViewer.MouseClick += new MouseEventHandler(imageViewer_MouseClick);
                // imageViewer.textBox1.Click += textBox1_Click;
                imageViewer.label1.Click += label1_Click;
                imageViewer.ImageLocation = imageFilename;
                imageViewer.ImageSide     = side;
                string format_string;
                //if (this.thumbnail_FLP.TotalThumbnails == 0)
                //{
                //    this.thumbnail_FLP.TotalThumbnails = 1;
                //}
                if (indx == -1)
                {
                    imageViewer.Index = this.thumbnail_FLP.TotalThumbnails;//this.thumbnail_FLP.TotalThumbnails;
                    indx = ++imageViewer.Index;
                    //imageViewer.Index = indx + 1;
                }
                else
                {
                    imageViewer.Index = indx + 1;
                }
                this.isannotated        = isannotated;
                this.isCDR              = isCDR;
                imageViewer.label1.Text = GetImage_Name(imageViewer.ImageSide, imageViewer.Index);
                imageViewer.label1.Font = new Font("Tahoma", 10.5F, System.Drawing.FontStyle.Bold);
                //if (indx == -1)
                //{
                //    imageViewer.Index = this.thumbnail_FLP.TotalThumbnails;//this.thumbnail_FLP.TotalThumbnails;
                //    indx = imageViewer.Index;
                //   // imageViewer.Index = indx + 1;

                //}
                //else
                //    imageViewer.Index = indx + 1;
                //// imageViewer.textBox1.Text = "\t\t" + this.thumbnailString + "\t\t" + imageViewer.Index.ToString();
                //imageViewer.label1.Text = this.thumbnailString + "\t\t" + imageViewer.Index.ToString();
                // imageViewer.label1.Enabled = false;
                this.OnImageSizeChanged += new ThumbnailImageEventHandler(imageViewer.ImageSizeChanged);
                //imageViewer.checkBox1.CheckedChanged += checkBox1_CheckedChanged;
                this.thumbnail_FLP.Controls.Add(imageViewer);
                this.thumbnail_FLP.Controls.SetChildIndex(imageViewer, 0);
                this.thumbnail_FLP.TotalThumbnails++;
                //if (this.isFirstThumbnail_Selected)
                //{
                //    selectThumbnail(imageViewer);
                //    this.thumbnail_FLP.Controls.SetChildIndex(imageViewer, 0);
                //    isThumbnailAddEvent = false;
                //}
            }
        }
예제 #4
0
        private void ControlKeyThumbNailSelection(ImageViewer sender)
        {
            m_ActiveImageViewer = (ImageViewer)sender;
            if (this.thumbnail_FLP.selectedThumbnails.Contains(m_ActiveImageViewer.Index))
            {
                m_ActiveImageViewer.IsActive = false;
                int imagename_index;
                //if (image_names.Last() == m_ActiveImageViewer.ImageLocation && image_names.First() == m_ActiveImageViewer.ImageLocation)
                //{
                imagename_index = image_names.IndexOf(m_ActiveImageViewer.ImageLocation);
                //}
                //else
                //    if (image_names.Last() == m_ActiveImageViewer.ImageLocation)
                //    {
                //        imagename_index = image_names.IndexOf(m_ActiveImageViewer.ImageLocation);
                //        imagename_index--;
                //    }
                //    else
                //    {
                //        imagename_index = image_names.IndexOf(m_ActiveImageViewer.ImageLocation);
                //    }
                image_names.Remove(m_ActiveImageViewer.ImageLocation);
                this.thumbnail_FLP.selectedThumbnails.Remove(m_ActiveImageViewer.Index);
                this.thumbnail_FLP.SelectedThumbnailFileNames.Remove(m_ActiveImageViewer.ImageLocation);
                Dictionary <string, object> thumbNailDic = new Dictionary <string, object>();
                if (image_names.Count != 0)
                {
                    //image_names.Reverse();
                    foreach (Control item in this.thumbnail_FLP.Controls)
                    {
                        if (item is ImageViewer)
                        {
                            ImageViewer imgViewer = item as ImageViewer;
                            if (imgViewer.ImageLocation == image_names[image_names.Count - 1])
                            {
                                ThumbnailData data = new ThumbnailData();
                                data.fileName = imgViewer.ImageLocation;
                                data.id       = imgViewer.ImageID;
                                data.side     = imgViewer.ImageSide;
                                data.Name     = imgViewer.ImageName;
                                displayThumbnailImage(data);
                            }
                        }
                    }
                }
                else
                {
                    NoImages_Selected();
                }
            }
            else
            {
                //if (this.thumbnail_FLP.SelectedThumbnailFileNames.Count < NoOfImagesToBeSelected)
                {
                    m_ActiveImageViewer.IsActive = true;
                    //this.thumbnail_FLP.AutoScrollPosition = m_ActiveImageViewer.Location;
                    {
                        if (!image_names.Contains(m_ActiveImageViewer.ImageLocation))//This condition has been added to prevent the unnecessary addition same image into image_names when the image is already present.
                        {
                            image_names.Add(m_ActiveImageViewer.ImageLocation);
                        }
                        ThumbnailData data = new ThumbnailData();
                        data.fileName = m_ActiveImageViewer.ImageLocation;
                        data.id       = m_ActiveImageViewer.ImageID;
                        data.side     = m_ActiveImageViewer.ImageSide;
                        data.Name     = m_ActiveImageViewer.ImageName;
                        displayThumbnailImage(data);
                    }
                    if (!this.thumbnail_FLP.selectedThumbnails.Contains(m_ActiveImageViewer.Index))
                    {
                        this.thumbnail_FLP.selectedThumbnails.Add(m_ActiveImageViewer.Index);
                    }

                    if (!this.thumbnail_FLP.SelectedThumbnailFileNames.Contains(m_ActiveImageViewer.ImageLocation))//checks if SelectedThumbnailFileNames contains ImageLocation, if it doesn't contain , then adds the ImageLocation.By Ashutosh 06-09-2017.
                    {
                        this.thumbnail_FLP.SelectedThumbnailFileNames.Add(m_ActiveImageViewer.ImageLocation);
                    }
                    ////else
                    //    //Added by darshan to resolve the issue 0000657: Reports no limit is set,No images are shown Note no (0002575).
                    //    CustomMessageBox.Show(NoOfImagesToBeSelectedText1 + " " + NoOfImagesToBeSelected.ToString() + " " + NoOfImagesToBeSelectedText2, NoOfImagesToBeSelectedHeader, CustomMessageBoxButtons.OK, CustomMessageBoxIcon.Information);
                }
            }
        }
예제 #5
0
        public void verticalSroll(ImageViewer img)
        {
            int index = this.thumbnail_FLP.Controls.GetChildIndex(img);

            this.AutoScrollPosition = new Point(this.AutoScrollPosition.X, img.Height * index);
        }