示例#1
0
文件: scanpage.cs 项目: lzk/windowVOP
        /// <summary>
        /// Get the file paths of selected image item.
        /// </summary>
        /// <param name="files"> Container used to store the file name.  </param>
        private void GetSelectedFile(List <string> files)
        {
            files.Clear();

            int nCount = GetSelectedItemCount();

            if (nCount > 0)
            {
                files.AddRange(new string[nCount]);

                foreach (object obj in image_wrappanel.Children)
                {
                    ImageItem img = obj as ImageItem;

                    if (null != img && 0 < img.m_num)
                    {
                        files[img.m_num - 1] = img.m_images.m_pathOrig;
                    }
                }
            }
        }
示例#2
0
文件: scanpage.cs 项目: lzk/windowVOP
        /// <summary>
        /// Update the number of selected image items.
        /// </summary>
        private void UpdateSelItemNum()
        {
            List <int> lst = new List <int>();

            for (int i = 0; i < image_wrappanel.Children.Count; i++)
            {
                ImageItem img1 = image_wrappanel.Children[i] as ImageItem;

                if (null != img1 && 0 < img1.m_num)
                {
                    lst.Add(img1.m_num);
                }
            }

            lst.Sort();

            int nMiss = 0;

            for (int i = 0; i < lst.Count; i++)
            {
                if (lst[i] != i + 1)
                {
                    nMiss = i + 1;
                    break;
                }
            }

            if (nMiss > 0)
            {
                for (int i = 0; i < image_wrappanel.Children.Count; i++)
                {
                    ImageItem img1 = image_wrappanel.Children[i] as ImageItem;

                    if (null != img1 && 0 < img1.m_num && nMiss <= img1.m_num)
                    {
                        img1.m_num--;
                    }
                }
            }
        }
示例#3
0
文件: scanpage.cs 项目: lzk/windowVOP
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (WM_VOPSCAN_PROGRESS == msg)
            {
                handled = true;

                progressBar1.Value = wParam.ToInt32();
            }
            else if (WM_VOPSCAN_COMPLETED == msg)
            {
                _isScanning = false;
                handled     = true;

                btnCancel.IsEnabled  = false;
                btnSetting.IsEnabled = true;
                m_MainWin.statusPanelPage.EnableSwitchPrinter(true);
                this.image_wrappanel.IsEnabled = true;

                if (0 < GetSelectedItemCount())
                {
                    btnPrint.IsEnabled = true;
                    btnSave.IsEnabled  = true;
                }

                btnScan.IsEnabled = (false == common.IsOffline(m_currentStatus) && false == m_isScanning);
                m_MainWin.EnableTabItems(true);

                progressBar1.Value = 0;

                if (RETSCAN_OK == (int)wParam)
                {
                    ImageItem img = new ImageItem();

                    lock ( objLock )
                    {
                        img.m_images = m_shareObj;
                    }

                    if (img.m_iSimgReady)
                    {
                        img.ImageSingleClick += ImageItemSingleClick;
                        img.ImageDoubleClick += ImageItemDoubleClick;
                        img.CloseIconClick   += ImageItemCloseIconClick;
                        img.m_num             = 0;
                        UpdateSelItemNum();

                        img.Margin = new Thickness(10);
                        this.image_wrappanel.Children.Insert(0, img);
                        App.scanFileList.Add(img.m_images);
                    }
                    else
                    {
                        VOP.Controls.MessageBoxEx.Show(
                            VOP.Controls.MessageBoxExStyle.Simple,
                            m_MainWin,
                            (string)this.FindResource("ResStr_Operation_cannot_be_carried_out_due_to_insufficient_memory_or_hard_disk_space_Please_try_again_after_freeing_memory_or_hard_disk_space_"),
                            (string)this.FindResource("ResStr_Error")
                            );
                    }
                }
                else if (RETSCAN_CANCEL == (int)wParam)
                {
                    m_MainWin.EnableTabItems(true);
                }
                else if (RETSCAN_NO_ENOUGH_SPACE == (int)wParam)
                {
                    m_MainWin.EnableTabItems(true);
                    VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple, Application.Current.MainWindow, (string)this.FindResource("ResStr_insufficient_system_disk_space"), (string)this.FindResource("ResStr_Error"));
                }
                else
                {
                    m_MainWin.EnableTabItems(true);
                    m_MainWin.statusPanelPage.ShowMessage((string)this.FindResource("ResStr_Scan_Fail"), Brushes.Red);

                    if (RETSCAN_OPENFAIL == (int)wParam ||
                        RETSCAN_ERRORDLL == (int)wParam ||
                        RETSCAN_ERROR_PORT == (int)wParam)
                    {
                        VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple,
                                                       m_MainWin,
                                                       (string)this.FindResource("ResStr_can_not_be_carried_out_due_to_software_has_error__please_try__again_after_reinstall_the_Driver_and_Virtual_Operation_Panel_"),
                                                       (string)this.FindResource("ResStr_Error"));
                    }
                    else if (RETSCAN_ERROR == (int)wParam)
                    {
                        VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple,
                                                       m_MainWin,
                                                       (string)this.FindResource("ResStr_Operation_can_not_be_carried_out_due_to_machine_malfunction_"),
                                                       (string)this.FindResource("ResStr_Error"));
                    }
                    else if (RETSCAN_BUSY == (int)wParam)
                    {
                        VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple_Busy,
                                                       m_MainWin,
                                                       (string)this.FindResource("ResStr_The_machine_is_busy__please_try_later_"),
                                                       (string)this.FindResource("ResStr_Error"));
                    }
                }
            }

            return(IntPtr.Zero);
        }
示例#4
0
文件: scanpage.cs 项目: lzk/windowVOP
        private void ImageItemDoubleClick(object sender, RoutedEventArgs e)
        {
            ImageItem img = (ImageItem)sender;

            if (0 == img.m_num && GetSelectedItemCount() < m_maxImgNum)
            {
                img.m_num = GetSelectedItemCount() + 1;
            }

            btnPrint.IsEnabled = true;
            btnSave.IsEnabled  = true;

            ScanPreview win = new ScanPreview();

            win.Owner    = m_MainWin;
            win.m_images = img.m_images;
            win.isPrint  = false;

            win.ShowDialog();

            if (true == win.isPrint)
            {
                List <string> files = new List <string>();

                if (0 != win.m_rotatedAngle && null != win.m_rotatedObj)
                {
                    files.Add(win.m_rotatedObj.m_pathOrig);
                }
                else
                {
                    files.Add(img.m_images.m_pathOrig);
                }

                m_MainWin.SwitchToPrintingPage(files);
            }

            if (0 != win.m_rotatedAngle && null != win.m_rotatedObj)
            {
                int index = -1;
                for (int i = 0; i < image_wrappanel.Children.Count; i++)
                {
                    if (image_wrappanel.Children[i] == img)
                    {
                        index = i;
                        break;
                    }
                }

                if (-1 != index)
                {
                    ImageItem tmp = new ImageItem();
                    tmp.m_images = win.m_rotatedObj;

                    if (tmp.m_iSimgReady)
                    {
                        this.image_wrappanel.Children.RemoveAt(index);

                        // Collect the rubbish files.
                        App.rubbishFiles.Add(img.m_images);

                        tmp.ImageSingleClick += ImageItemSingleClick;
                        tmp.ImageDoubleClick += ImageItemDoubleClick;
                        tmp.CloseIconClick   += ImageItemCloseIconClick;

                        if (GetSelectedItemCount() < m_maxImgNum)
                        {
                            tmp.m_num = GetSelectedItemCount() + 1;
                        }
                        else
                        {
                            tmp.m_num = 0;
                        }

                        tmp.Margin = new Thickness(5);
                        this.image_wrappanel.Children.Insert(index, tmp);
                        App.scanFileList.Add(tmp.m_images);
                    }
                }
            }
        }