Beispiel #1
0
        /// <summary>
        /// draw all CurrencyExchangers markers on map
        /// </summary>
        private void DrawMarkers()
        {
            try {
                using (var objProvider = new BankProvider()) {
                    objMarkersOverlay.Clear();
                    List <CurrencyExchanger> objExchangers = objProvider.GetAllExchangers();

                    foreach (var exchanger in objExchangers)
                    {
                        ExchangeRate objUsd = objProvider.GetRateByBank("USD", exchanger.Bank);
                        ExchangeRate objEur = objProvider.GetRateByBank("EUR", exchanger.Bank);
                        ExchangeRate objRur = objProvider.GetRateByBank("RUR", exchanger.Bank);

                        var objMarker = new GMarkerGoogle(new PointLatLng(exchanger.X, exchanger.Y), GMarkerGoogleType.yellow)
                        {
                            ToolTipText = String.Format(
                                "{0} office:{1}\nBuy\n" +
                                "USD:{2}\nEUR:{3}\nRUR:{4}\n" +
                                "Sell\n" +
                                "USD:{5}\nEUR:{6}\nRUR:{7}",
                                exchanger.Bank.Name,
                                exchanger.Number,
                                objUsd.Buy,
                                objEur.Buy,
                                objRur.Buy,
                                objUsd.Sale,
                                objEur.Sale,
                                objRur.Sale
                                ),
                            Tag = exchanger.Id
                        };

                        objMarkersOverlay.Markers.Add(objMarker);
                        gMapControl1.UpdateMarkerLocalPosition(objMarker);
                    }
                }
                gMapControl1.Overlays.Clear();
                gMapControl1.Overlays.Add(objMarkersOverlay);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }