예제 #1
0
        public SortingResult()
        {
            InitializeComponent();
            _path  = null;
            picNum = 0;
            for (int i = 0; i < MainInfo.tot; i++)
            {
                if (MainInfo.selected[i])
                {
                    picNum++;
                }
            }
            progress = 0;
            int    id             = 0;
            Thread progressThread = new Thread(progress_thread);

            progressThread.IsBackground = true;
            progressThread.Start();
            originArray = new SortObject[picNum];
            sortedArray = new SortObject[picNum];
            for (int i = 0; i < MainInfo.tot; i++)
            {
                if (MainInfo.selected[i])
                {
                    double result = NR_algorithm.NR_method(
                        SettingInfo.imageSort_NRmethod,
                        MainInfo.picInfo[MainInfo.path_name[i]].rgb,
                        MainInfo.picInfo[MainInfo.path_name[i]].height,
                        MainInfo.picInfo[MainInfo.path_name[i]].width);
                    MainInfo.picInfo[MainInfo.path_name[i]].grade_none = NR_algorithm.NR_grade(SettingInfo.imageSort_NRmethod, result);
                    originArray[id]   = new SortObject(MainInfo.picInfo[MainInfo.path_name[i]].grade_none, MainInfo.path_name[i], MainInfo.name[i]);
                    sortedArray[id++] = new SortObject(MainInfo.picInfo[MainInfo.path_name[i]].grade_none, MainInfo.path_name[i], MainInfo.name[i]);
                }
                progress = 1000 * id / picNum;
            }
            Array.Sort(sortedArray, new sortObjectComparer()); //图片排序调用
            origin_e1 = new EventHandler(origin_item_double_click);
            origin_e2 = new EventHandler(origin_pictureBox_double_click);
            origin_e3 = new EventHandler(origin_label_double_click);
            sorted_e1 = new EventHandler(sorted_item_double_click);
            sorted_e2 = new EventHandler(sorted_pictureBox_double_click);
            sorted_e3 = new EventHandler(sorted_label_double_click);
        }
예제 #2
0
        private void confirm_Click(object sender, EventArgs e)
        {
            Dispose();
            int tot = 0;

            for (int i = 0; i < MainInfo.tot; i++)
            {
                if (MainInfo.selected[i])
                {
                    tot++;
                }
            }
            int index = 0;

            if (ratioButton.Checked)
            {
                SortObject[] sortedArray = new SortObject[tot];
                for (int i = 0; i < MainInfo.tot; i++)
                {
                    if (MainInfo.selected[i])
                    {
                        double result = NR_algorithm.NR_method(
                            SettingInfo.imageClear_NRmethod,
                            MainInfo.picInfo[MainInfo.path_name[i]].rgb,
                            MainInfo.picInfo[MainInfo.path_name[i]].height,
                            MainInfo.picInfo[MainInfo.path_name[i]].width);
                        MainInfo.picInfo[MainInfo.path_name[i]].grade_none = NR_algorithm.NR_grade(SettingInfo.imageClear_NRmethod, result);
                        sortedArray[index++] = new SortObject(MainInfo.picInfo[MainInfo.path_name[i]].grade_none, MainInfo.path_name[i], MainInfo.name[i]);
                    }
                }

                Array.Sort(sortedArray, new sortObjectComparer());
                DeleteComfirm imageDeleteComfirmForm = new DeleteComfirm(clearingRatioBar.Value, mf, sortedArray);
                imageDeleteComfirmForm.Show();
            }
            else
            {
                SortObject[] sortedArrayTemp = new SortObject[tot];

                for (int i = 0; i < MainInfo.tot; i++)
                {
                    if (MainInfo.selected[i])
                    {
                        double result = NR_algorithm.NR_method(SettingInfo.imageClear_NRmethod,
                                                               MainInfo.picInfo[MainInfo.path_name[i]].rgb,
                                                               MainInfo.picInfo[MainInfo.path_name[i]].height,
                                                               MainInfo.picInfo[MainInfo.path_name[i]].width);
                        MainInfo.picInfo[MainInfo.path_name[i]].grade_none = NR_algorithm.NR_grade(SettingInfo.imageClear_NRmethod, result);
                        if (MainInfo.picInfo[MainInfo.path_name[i]].grade_none <= threadsoldBar.Value)
                        {
                            sortedArrayTemp[index++] = new SortObject(MainInfo.picInfo[MainInfo.path_name[i]].grade_none, MainInfo.path_name[i], MainInfo.name[i]);
                        }
                    }
                }
                SortObject[] sortedArray = new SortObject[index];
                for (int i = 0; i < index; i++)
                {
                    sortedArray[i] = sortedArrayTemp[i];
                }

                Array.Sort(sortedArray, new sortObjectComparer());
                DeleteComfirm imageDeleteComfirmForm = new DeleteComfirm(100, mf, sortedArray);
                imageDeleteComfirmForm.Show();
            }
        }