コード例 #1
0
ファイル: Main.cs プロジェクト: Stmdotcom/sortimg
 private void imageViewer_MouseClick(object sender, MouseEventArgs e)
 {
     if ((Control.ModifierKeys & Keys.Shift) != Keys.None && (e.Button & MouseButtons.Left) == MouseButtons.Left)
     {
         ImageViewer selectedViewer = (ImageViewer)sender;
         if (selected.Contains(selectedViewer))
         {
             selected.Remove(selectedViewer);
             if (selected.Count > 0)
             {
                 activeImageViewer = selected[0];
             }
             else
             {
                 checkController(true);
             }
         }else{
             activeImageViewer = selectedViewer;
             selected.Add(selectedViewer);
         }
         fixActiveSelection();
         SetPicture();
     }
     else if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
     {
         selected.Clear();
         activeImageViewer = (ImageViewer)sender;
         currentImageFocus = activeImageViewer.ImageLocation;
         fixActiveSelection();
         SetPicture();
     }
     else // Right click thus is a request to remove the preview image
     {
         selected.Clear();
         ImageViewer oldImageViewer = activeImageViewer;
         activeImageViewer = (ImageViewer)sender;
         if (currentImageFocus == activeImageViewer.ImageLocation)
         {
             MessageBox.Show("Can't remove a highlighted image from queue");
         }
         else
         {
             activeImageViewer.Dispose();
             activeImageViewer = oldImageViewer;
             Progressupdate(1);
             fixActiveSelection();
         }
     }
     checkController(false);
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: Stmdotcom/sortimg
        /// <summary>
        /// This is the main methord called via buttons to copy file. Handles end of file list special case
        /// otherwise just calls mover() and next()
        /// </summary>
        /// <param name="num">Refrence to the place in array of the dest folder</param>
        private void Copy(int num, Button but)
        {
            String fileName = GetFilePath();
            if (fileName == "NULL")
            {
                MessageBox.Show("Can't move nothing!");
            }
            else
            {
                //If there is a mutiselect
                if (selected.Count > 0)
                {
                    foreach (ImageViewer viewer in selected)
                    {
                        activeImageViewer = viewer;
                        //activeImageViewer.IsActive = true;
                        fixActiveSelection();
                        currentImageFocus = viewer.ImageLocation;
                        moveImage(currentImageFocus, workingFolders[num], 0, but);

                        Progressupdate(1); //Update the progress bar
                        UpdatePreview(true, null, false);
                    }
                    selected.Clear();
                }
                else
                {
                    moveImage(fileName, workingFolders[num], 0, but);
                    Progressupdate(1); //Update the progress bar
                    UpdatePreview(true, null, false);
                }

            }
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: Stmdotcom/sortimg
        private void AddImage(string imageFilename)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(addImage, imageFilename);
            }
            else
            {
                int size = ImageSize;
                ImageViewer imageViewer = new ImageViewer();
                imageViewer.Dock = DockStyle.Bottom;
                imageViewer.LoadImage(imageFilename, tnb);
                imageViewer.Width = size;
                imageViewer.Height = size;
                imageViewer.IsThumbnail = true;
                imageViewer.MouseClick += new MouseEventHandler(imageViewer_MouseClick);

                imageViewer.MouseDown += new MouseEventHandler(flowLayoutPanelMain_MouseDown);
                imageViewer.MouseMove += new MouseEventHandler(flowLayoutPanelMain_MouseMove);
                imageViewer.MouseUp += new MouseEventHandler(flowLayoutPanelMain_MouseUp);

                this.OnImageSizeChanged += new ThumbnailImageEventHandler(imageViewer.ImageSizeChanged);
                this.flowLayoutPanelMain.Controls.Add(imageViewer);
            }
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: Stmdotcom/sortimg
 private void checkController(bool getFront)
 {
     if (this.flowLayoutPanelMain.Controls.Count < (thumbController.ImageLoadAmount / 2)) //Check if to load more images from the queue
     {
         thumbController.LoadSet();
     }
     if (this.flowLayoutPanelMain.Controls.Count > 0) //Check if there are still images to process
     {
         if (getFront == true)
         {
             activeImageViewer = (ImageViewer)this.flowLayoutPanelMain.Controls[0];
            // activeImageViewer.IsActive = true;
             currentImageFocus = activeImageViewer.ImageLocation;
             fixActiveSelection();
             SetPicture();
         }
     }
     else //No images in the preview panel
     {
         currentImageFocus = ""; //No image, no focus
         SetPicture();
       //  int leftoverfiles = Convert.ToInt16(label1.Text) - progress;
         MessageBox.Show("Out of images");
         DisableButtons(true); //Disable buttons till more folders are added
     }
 }
コード例 #5
0
ファイル: Main.cs プロジェクト: Stmdotcom/sortimg
        private void thumbControllerAdd(object sender, ThumbnailControllerEventArgs e)
        {
            this.AddImage(e.ImageFilename);
            this.Invalidate();

            if (firstImage == false)
            {
                activeImageViewer = (ImageViewer)this.flowLayoutPanelMain.Controls[0];
                fixActiveSelection();
                currentImageFocus = activeImageViewer.ImageLocation;
                SetPicture();
                firstImage = true;
            }
        }