コード例 #1
0
            public PinMarker(MapPinData pinData)
            {
                if (pinData.PrimaryCategory != null)
                {
                    System.Windows.Controls.Image imgPin = new System.Windows.Controls.Image();
                    var categoryParam = CategoryHelper.CategoryList[pinData.PrimaryCategory.TypeCode];
                    BitmapImage bmp = new BitmapImage(new Uri(categoryParam.Icon, UriKind.Relative));
                    imgPin.Source = bmp;
                    //imgPin.Width = 60;
                    //imgPin.Height = 60;

                    Content = imgPin;
                    DataContext = pinData;
                    GeoCoordinate = new System.Device.Location.GeoCoordinate(pinData.Latitude, pinData.Longitude);
                    PositionOrigin = new System.Windows.Point(0.0, 0.0);
                }
            }
コード例 #2
0
        public void LoadMapData()
        {
            AppData.Discount.MapPinCollection.Clear();

            var contactList = from co in database.Table<Contact>()
                          from d in database.Table<Discount>()
                          where co.DiscountId == d.Id
                          select new
                          {
                              d.Id,
                              DocumentId = co.DocumentId,
                              PartnerId = d.DocumentId,
                              co.Latitude,
                              co.Longitude,
                              d.PercentValue,
                          };

            foreach (var contactRec in contactList)
            {
                MapPinData mapPinData = new MapPinData();
                mapPinData.Id = contactRec.DocumentId;
                mapPinData.PartnerId = contactRec.PartnerId;
                mapPinData.Discount = contactRec.PercentValue;
                mapPinData.Latitude = contactRec.Latitude;
                mapPinData.Longitude = contactRec.Longitude;


                var categoryList = from c in database.Table<Categorie>()
                                   where c.DiscountId == contactRec.Id
                                   select c;
                foreach (var categoryrec in categoryList)
                    mapPinData.CategorieList.Add(new CategorieData { TypeCode = categoryrec.TypeCode });
               
                if (mapPinData.CategorieList.Count > 0)
                    mapPinData.PrimaryCategory = mapPinData.CategorieList[0];
                else
                    mapPinData.PrimaryCategory = new CategorieData { TypeCode = -1 };

                var nameList = (from ds in database.Table<DiscountsStrings>()
                               from ls in database.Table<LangString>()
                               where ds.LangStringId == ls.Id
                               where ds.OwnerId == contactRec.Id
                               where ds.Appointment == StrAppointmentTitle
                               select new { ls.Text, ls.LanguageCode }).ToList();

                foreach (var nameRec in nameList)
                    mapPinData.SetName( nameRec.LanguageCode, nameRec.Text);

                AppData.Discount.MapPinCollection.Add(mapPinData);
            }
        }
コード例 #3
0
 public MapPinDataEventArgs(MapPinData pinData)
 {
     PinData = pinData;
 }