Beispiel #1
0
        private void Done(bool IsWeb)
        {
            //if (System.Diagnostics.Debugger.IsAttached)
            //{
            //    if (AllImages.Count == 0)
            //    {
            //        MessageBox.Show("No Image Found, Error in Image search function.");
            //        //return;
            //    }
            //}

            foreach (var item in AllImages)
            {
                //Create Thumbnails
                Task task = new Task(async() =>
                {
                    await imageIO.DirectConn_CreateThumbnails(item);
                });
                task.Start();
                if (InvokeRequired)
                {
                    Invoke(new Action(() => ReportProgressForThumbnails(item.ImageDirName)));
                }
            }

            if (AllImages.Count != 0)
            {
                imageIO.BubbleSortImages(AllImages);
                AllImages.Reverse();
            }

            if (InvokeRequired)
            {
                Invoke(new Action(() => waiter.Close()));
                Invoke(new Action(() => RefreshGalleryNotify = true));
                if (fileChangedCounter > 1)
                {// again raise event.
                    Invoke(new Action(() => FilesChanged = true));
                }
                Invoke(new Action(() => fileChangedCounter = 0));
                Invoke(new Action(() => CheckForMaxImageWarning()));
            }
            else
            {
                waiter.Close();
                RefreshGalleryNotify = true;
                CheckForMaxImageWarning();
                if (fileChangedCounter > 1)
                {// again raise event.
                    FilesChanged = true;
                }
                fileChangedCounter = 0;
            }
        }
        /// <summary>
        /// This method is called after images are searched inside directory, its a call back method
        /// </summary>
        /// <param name="IsWeb"></param>
        private void Done(bool IsWeb)
        {
            foreach (var item in AllImages)
            {
                //Create Thumbnails
                Task task = new Task(async() =>
                {
                    await imageIO.DirectConn_CreateThumbnails(item);
                });
                task.Start();
                if (InvokeRequired)
                {
                    Invoke(new Action(() => ReportProgressForThumbnails(item.ImageDirName)));
                }
            }



            if (InvokeRequired)
            {
                Invoke(new Action(() => { waiter.Close(); waiter.Dispose(); }));
                Invoke(new Action(() => RefreshGalleryNotify = true));
                //if (fileChangedCounter > 1)
                //{// again raise event.
                //    Invoke(new Action(() => FilesChanged = true));
                //}
                //Invoke(new Action(() => fileChangedCounter = 0));
                Invoke(new Action(() => CheckForMaxImageWarning()));
            }
            else
            {
                if (waiter != null)
                {
                    waiter.Close(); waiter.Dispose();
                }

                RefreshGalleryNotify = true;
                CheckForMaxImageWarning();
            }
        }