Пример #1
0
        void refreshTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                if (imgQueue.Count <= 0)
                {
                    this.refreshTimer.Enabled = false;
                    return;
                }

                RepositionCursor();

                Cell      dstCell   = this.cells[cursor];
                ImageCell imgToShow = this.imgQueue.Dequeue();

                if (this.AutoDisposeImage && dstCell.Image != null)
                {
                    dstCell.Image.Dispose();
                }

                dstCell.Image = imgToShow.Image;
                dstCell.Text  = imgToShow.Text;
                dstCell.Path  = imgToShow.Path;
                dstCell.Tag   = imgToShow.Tag;

                this.Invalidate(Rectangle.Round(dstCell.Rec));
                cursor++;
            }
            catch (InvalidOperationException ex)// the queue is empty
            {
                this.refreshTimer.Enabled = false;
            }

            System.Diagnostics.Debug.WriteLine("tick");
        }
        void refreshTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                ImageCell imgToShow = null;
                lock (this.imgQueueLocker)
                {
                    if (imgQueue.Count <= 0)
                    {
                        this.refreshTimer.Enabled = false;
                        return;
                    }
                    else
                    {
                        imgToShow = imgQueue.Dequeue();
                    }
                }

                RepositionCursor();

                ClearPrevCell();
                Cell dstCell = this.cells[cursor];

                if (this.AutoDisposeImage && dstCell.Image != null)
                {
                    dstCell.Image.Dispose();
                }

                dstCell.Image      = imgToShow.Image;
                dstCell.Text       = imgToShow.Text;
                dstCell.Path       = imgToShow.Path;
                dstCell.Tag        = imgToShow.Tag;
                dstCell.HightLight = true;

                this.Invalidate(dstCell.Bound);
                cursor++;
            }
            catch (InvalidOperationException)// the queue is empty
            {
                this.refreshTimer.Enabled = false;
            }

            System.Diagnostics.Debug.WriteLine("tick");
        }
Пример #3
0
        public void ShowImages(ImageDetail[] images)
        {
            ImageCell[] cells = new ImageCell[images.Length];
            for (int i = 0; i < cells.Length; i++)
            {
                Image img = Image.FromFile(images[i].Path);
                string text = images[i].CaptureTime.ToString();
                ImageCell newCell = new ImageCell() { Image = img, Path = images[i].Path, Text = text, Tag = null };
                cells[i] = newCell;
            }

            this.squareListView1.ShowImages(cells);
        }
Пример #4
0
        public void ShowImages(ImageCell[] imgs)
        {
            lock (this.imgQueueLocker)
            {
                Array.ForEach(imgs, imgQueue.Enqueue);

                if (imgQueue.Count > 0 && this.Visible)
                {
                    EnableTimer(true);
                    System.Diagnostics.Debug.WriteLine("tick");
                }
            }

        }
Пример #5
0
        public void ShowImages(ImageCell[] imgs)
        {
            Array.ForEach(imgs, imgQueue.Enqueue);

            if (imgQueue.Count > 0 && this.Visible)
            {
                refreshTimer.Enabled = true;
                System.Diagnostics.Debug.WriteLine("tick");
            }
        }
Пример #6
0
        public void ShowImages(ImageDetail[] images)
        {
            ImageCell[] cells = new ImageCell[images.Length];
            for (int i = 0; i < cells.Length; i++)
            {
                Image img = Damany.Util.Extensions.MiscHelper.FromFileBuffered(images[i].Path);
                string text = images[i].CaptureTime.ToString();
                ImageCell newCell = new ImageCell() { Image = img, Path = images[i].Path, Text = text, Tag = null };
                cells[i] = newCell;
            }

            ShowLiveFace(images);

            // this.squareListView1.ShowImages(cells);
        }