private void HandleCharacterSelectionChange() { EVEData.Character c = CharacterDropDown.SelectedItem as EVEData.Character; EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion; if (c != null && FollowCharacter) { EVEData.System s = EVEManager.GetEveSystem(c.Location); if (s != null) { if (s.Region != rd.Name) { // change region SelectRegion(s.Region); } SelectSystem(c.Location); CharacterDropDown.SelectedItem = c; // force the follow as this will be reset by the region change FollowCharacter = true; } } }
private void SysContexMenuItemSetDestination_Click(object sender, RoutedEventArgs e) { EVEData.MapSystem eveSys = ((System.Windows.FrameworkElement)((System.Windows.FrameworkElement)sender).Parent).DataContext as EVEData.MapSystem; EVEData.Character c = CharacterDropDown.SelectedItem as EVEData.Character; if (c != null) { c.AddDestination(eveSys.ActualSystem.ID, true); } }
private void ShapeMouseDownHandler(object sender, MouseButtonEventArgs e) { Shape obj = sender as Shape; EVEData.MapRegion currentRegion = RegionDropDown.SelectedItem as EVEData.MapRegion; EVEData.MapSystem selectedSys = obj.DataContext as EVEData.MapSystem; if (e.ChangedButton == MouseButton.Left) { if (e.ClickCount == 1) { bool redraw = false; if (MapConf.ShowJumpDistance) { redraw = true; } SelectSystem(selectedSys.Name); ReDrawMap(redraw); } if (e.ClickCount == 2 && selectedSys.Region != currentRegion.Name) { foreach (EVEData.MapRegion rd in EVEManager.Regions) { if (rd.Name == selectedSys.Region) { RegionDropDown.SelectedItem = rd; ReDrawMap(); SelectSystem(selectedSys.Name); break; } } } } if (e.ChangedButton == MouseButton.Right) { ContextMenu cm = this.FindResource("SysRightClickContextMenu") as ContextMenu; cm.PlacementTarget = obj; cm.DataContext = selectedSys; MenuItem setDesto = cm.Items[2] as MenuItem; MenuItem addWaypoint = cm.Items[3] as MenuItem; setDesto.IsEnabled = false; addWaypoint.IsEnabled = false; EVEData.Character c = CharacterDropDown.SelectedItem as EVEData.Character; if (c != null && c.ESILinked) { setDesto.IsEnabled = true; addWaypoint.IsEnabled = true; } cm.IsOpen = true; } }