Example #1
0
        public void VisitCity(Futar aktualisFutar, Rendeles aktualisRendeles)
        {
            string KiszallitasiCim = aktualisRendeles.RendelesiCim().ToString();

            System.Drawing.Color           futarSzin         = aktualisFutar.GetJeloloSzin();
            System.Drawing.Color           eredetiEpuletSzin = System.Drawing.Color.Blue;
            System.Collections.IEnumerator elemek            = CityDrawArea.Children.GetEnumerator();
            System.Windows.Media.Color     ConvertedColor;
            UIElement elem = null;
            string    aktualisCim;

            while (elemek.MoveNext())
            {
                elem = (UIElement)elemek.Current;

                if (elem is Rectangle)
                {
                    aktualisCim = (elem as Rectangle).ToolTip.ToString();
                    if (KiszallitasiCim == aktualisCim)
                    {
                        ConvertedColor           = System.Windows.Media.Color.FromArgb(futarSzin.A, futarSzin.R, futarSzin.G, futarSzin.B);
                        (elem as Rectangle).Fill = new SolidColorBrush(ConvertedColor);
                        this.Refresh();
                        break;
                    }
                }
            }
            System.Threading.Thread.Sleep(2 * 1000);
            if (elem != null && elem is Rectangle)
            {
                ConvertedColor           = System.Windows.Media.Color.FromArgb(eredetiEpuletSzin.A, eredetiEpuletSzin.R, eredetiEpuletSzin.G, eredetiEpuletSzin.B);
                (elem as Rectangle).Fill = new SolidColorBrush(ConvertedColor);
                this.Refresh();
            }

            return;
        }
        public void InitializeDelivers(Futarok futarok)
        {
            Futar  futar = null;
            string FutarNeve;
            Color  FutarSzine;

            List <Futar> .Enumerator FutarIterator  = futarok.GetFutarIterator();
            ListViewItem             listaFutarElem = null;
            Bitmap SzinDoboz  = null;
            int    listaIndex = 0;

            while (FutarIterator.MoveNext())
            {
                futar      = FutarIterator.Current;
                FutarNeve  = futar.GetFutarNev();
                FutarSzine = futar.GetJeloloSzin();

                listaFutarElem            = new ListViewItem();
                listaFutarElem.Text       = FutarNeve;
                listaFutarElem.ImageIndex = listaIndex;
                SzinDoboz = new Bitmap(60, 60);

                for (int y = 0; y < SzinDoboz.Width; y++)
                {
                    for (int x = 0; x < SzinDoboz.Width; x++)
                    {
                        SzinDoboz.SetPixel(x, y, FutarSzine);
                    }
                }
                ilLegend.Images.Add(SzinDoboz);
                lvDelivers.Items.Add(listaFutarElem);
                listaIndex++;
            }

            return;
        }