Esempio n. 1
0
        void tarea(object obj)
        {
            Hilo h = (Hilo)obj;

            while (true)
            {
                if (h.inet.queue.Count > 0)
                {
                    ImageQuery query = h.inet.queue.Dequeue();
                    try
                    {
                        h.inet.imageProxy.internetDiskCachedImage(query.x, query.y, query.zoom, query.mode, h.id);
                        Bitmap bmp = h.inet.imageProxy.getDiskCachedImage(query.x, query.y, query.zoom, query.mode);
                        if (bmp != null)
                        {
                            h.inet.imageProxy.imageCache.putImage(query.x, query.y, query.zoom, query.mode, bmp);
                            h.inet.imageProxy.listeners.Invoke();
                        }
                    }
                    catch (Exception) { }
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
        }
Esempio n. 2
0
 public void Clean()
 {
     for (int i = 0; i < cacheQuery.Length; i++)
     {
         cacheQuery[i] = new ImageQuery();
     }
 }
Esempio n. 3
0
        void tarea(object obj)
        {
            TaskImageDisk t = (TaskImageDisk)obj;

            while (true)
            {
                if (t.queue.Count > 0)
                {
                    ImageQuery query = t.queue.Dequeue();
                    Bitmap     bmp   = t.imageProxy.getDiskCachedImage(query.x, query.y, query.zoom, query.mode);
                    if (bmp != null)
                    {
                        t.imageProxy.imageCache.putImage(query.x, query.y, query.zoom, query.mode, bmp);
                        t.imageProxy.listeners.Invoke();
                    }
                    else
                    {
                        bmp = t.imageProxy.getImageInterpolated(query.x, query.y, query.zoom, query.mode, Origen.DISK);
                        t.imageProxy.imageCache.putImage(query.x, query.y, query.zoom, query.mode, bmp);

                        inet.AddElement(new ImageQuery(query.x, query.y, query.zoom, query.mode));
                    }
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
        }
Esempio n. 4
0
 public void Clean()
 {
     for (int i = 0; i < cacheQuery.Length; i++)
     {
         cacheQuery[i] = new ImageQuery();
     }
 }
Esempio n. 5
0
 public override bool Equals(object obj)
 {
     if (obj.GetType() == this.GetType())
     {
         ImageQuery t = (ImageQuery)obj;
         if (t.x == this.x && t.y == this.y && t.zoom == this.zoom && t.mode.Equals(this.mode))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 6
0
        public void AddElement(ImageQuery elem)
        {
            if (!queue.Contains(elem))
            {
                queue.Enqueue(elem);
            }

            if (thread == null)
            {
                thread = new Thread(new ParameterizedThreadStart(tarea));
                thread.IsBackground = true;
                thread.Start(this);
            }
        }
Esempio n. 7
0
        public void AddElement(ImageQuery elem)
        {
            if(!queue.Contains(elem))
            {
                queue.Enqueue(elem);
            }

            if (thread == null)
            {
                thread = new Thread(new ParameterizedThreadStart(tarea));
                thread.IsBackground = true;
                thread.Start(this);                
            }

        }
Esempio n. 8
0
        public void AddElement(ImageQuery elem)
        {
            try
            {
                if (!queue.Contains(elem))
                {
                    queue.Enqueue(elem);
                }
            }
            catch (Exception) { } // Mirar por que lanza una excepcion a veces


            if (thread == null)
            {
                thread = new Thread[4];
                for (int i = 0; i < thread.Length; i++)
                {
                    thread[i] = new Thread(new ParameterizedThreadStart(tarea));
                    thread[i].IsBackground = true;
                    thread[i].Start(new Hilo(i, this));
                }
            }
        }
Esempio n. 9
0
        public void AddElement(ImageQuery elem)
        {
            try
            {
                if (!queue.Contains(elem))
                {
                    queue.Enqueue(elem);
                }
            }
            catch (Exception) { } // Mirar por que lanza una excepcion a veces


            if (thread == null)
            {
                thread = new Thread[4];
                for (int i = 0; i <thread.Length; i++)
                {
                    thread[i] = new Thread(new ParameterizedThreadStart(tarea));
                    thread[i].IsBackground = true;
                    thread[i].Start(new Hilo(i,this));
                }
            }

        }