示例#1
0
 private void moveUp()
 {
     if (thumbnailList1.SelectedItems.Count > 0)
     {
         if (thumbnailList1.SelectedItems[0].Index > 0)
         {
             foreach (ListViewItem it in thumbnailList1.SelectedItems)
             {
                 int           before = getImageBefore((int)it.Tag);
                 CScannedImage temp   = images[before];
                 images[before]      = images[(int)it.Tag];
                 images[(int)it.Tag] = temp;
                 thumbnailList1.Items[thumbnailList1.Items.IndexOf(it) - 1].Selected = true;
                 it.Selected = false;
             }
             updateView();
         }
     }
 }
示例#2
0
 private void moveDown()
 {
     if (thumbnailList1.SelectedItems.Count > 0)
     {
         if (thumbnailList1.SelectedItems[thumbnailList1.SelectedItems.Count - 1].Index < images.Count - 1)
         {
             for (int i = thumbnailList1.SelectedItems.Count - 1; i >= 0; i--)
             {
                 ListViewItem  it    = thumbnailList1.SelectedItems[i];
                 int           after = getImageAfter((int)it.Tag);
                 CScannedImage temp  = images[after];
                 images[after]       = images[(int)it.Tag];
                 images[(int)it.Tag] = temp;
                 thumbnailList1.Items[thumbnailList1.Items.IndexOf(it) + 1].Selected = true;
                 it.Selected = false;
             }
             updateView();
         }
     }
 }
示例#3
0
        private void scanWIA(CScanSettings Profile)
        {
            CWIAAPI api;

            try
            {
                api = new CWIAAPI(Profile);
            }
            catch (Exceptions.EScannerNotFound)
            {
                MessageBox.Show("Device not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            CScannedImage img = api.GetImage();

            if (img != null)
            {
                int next = images.Count > 0 ? images.Keys[images.Count - 1] + 1 : 0;
                images.Add(next, img);
            }
            thumbnailList1.UpdateImages(images);
            Application.DoEvents();

            if (Profile.Source != CScanSettings.ScanSource.GLASS)
            {
                while (img != null)
                {
                    img = api.GetImage();
                    if (img != null)
                    {
                        int next = images.Count > 0 ? images.Keys[images.Count - 1] + 1 : 0;
                        images.Add(next, img);
                    }
                    thumbnailList1.UpdateImages(images);
                    Application.DoEvents();
                }
            }
        }