private void mapImage_MouseMove(object sender, MouseEventArgs e) { Color color = GetColorFromImage(e); MapCountry mapCountry = GetCountryByColor(color); if (mapCountry != null) { this.mapImage.Cursor = Cursors.Hand; this.mapImage.Source = mapCountry.GetMapImage(); this.txtSelectedCountry.Text = mapCountry.GetDescription(); this.refColor.Fill = new SolidColorBrush(mapCountry.GetSecondaryColor()); } else { this.mapImage.Cursor = Cursors.Arrow; if (_selectedCountry != null) { this.mapImage.Source = _selectedCountry.GetMapImage(); this.txtSelectedCountry.Text = _selectedCountry.GetDescription(); this.refColor.Fill = new SolidColorBrush(_selectedCountry.GetSecondaryColor()); } else { this.mapImage.Source = _worldMapImage; this.txtSelectedCountry.Text = _defaultText; } } }
private void mapImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { try { Color color = GetColorFromImage(e); MapCountry mapCountry = GetCountryByColor(color); if (mapCountry != null) { _selectedCountry = mapCountry; this.nextButton.IsEnabled = true; this.txtSelectedCountry.Text = mapCountry.GetDescription(); this.mapImage.Source = mapCountry.GetMapImage(); this.refColor.Visibility = System.Windows.Visibility.Visible; this.refColor.Fill = new SolidColorBrush(mapCountry.GetSecondaryColor()); } if (_selectedCountry != null) { if (_selectedCountry.IsOwnCode("AR")) //HACK, Como siempre es argentina, hardcodeo las regiones y sus Ids { _allRegionsForSelectedCountry = new List <Region>(); //Inicializacion de variables var selectRegionOption = new Region(0, Labels.SelectRegion, "AR"); var saltaRegionOption = new Region(1, "Salta", "AR"); var chacoRegionOption = new Region(2, "Chaco", "AR"); _allRegionsForSelectedCountry.Add(selectRegionOption); _allRegionsForSelectedCountry.Add(saltaRegionOption); _allRegionsForSelectedCountry.Add(chacoRegionOption); this.regionsCombo.ItemsSource = _allRegionsForSelectedCountry; this.regionsCombo.SelectedValue = selectRegionOption.Id; this.Regions.Visibility = Visibility.Visible; this.nextButton.IsEnabled = true; } else { regionRequests.GetRegionsByCountryCode(_selectedCountry.GetCode()); this.nextButton.IsEnabled = false; } } } catch (Exception ex) { throw ex; } }