/// <summary> /// Handles the <see cref="ButtonBase.Click"/> event for the "Faction Status" <see /// cref="Button"/>.</summary> /// <param name="sender"> /// The <see cref="Object"/> where the event handler is attached.</param> /// <param name="args"> /// A <see cref="RoutedEventArgs"/> object containing event data.</param> /// <remarks> /// <b>OnFactionStatus</b> displays a <see cref="ShowFactions"/> dialog containing /// information on the selected item in the "Faction" list view, if any.</remarks> private void OnFactionStatus(object sender, RoutedEventArgs args) { args.Handled = true; // retrieve selected faction, if any object item = FactionList.SelectedItem; if (item == null) { return; } Faction faction = ((FactionListItem)item).Item1; // show info dialog for faction class var dialog = new ShowFactions(Session.MapView, faction.FactionClass); dialog.Owner = this; dialog.ShowDialog(); }
/// <summary> /// Handles the <see cref="Control.MouseDoubleClick"/> event for a <see /// cref="ListViewItem"/> of the "Faction" <see cref="ListView"/>.</summary> /// <param name="sender"> /// The <see cref="Object"/> where the event handler is attached.</param> /// <param name="args"> /// A <see cref="MouseButtonEventArgs"/> object containing event data.</param> /// <remarks> /// <b>OnFactionActivate</b> displays a <see cref="ShowFactions"/> dialog containing /// information on the double-clicked item in the "Faction" list view.</remarks> private void OnFactionActivate(object sender, MouseButtonEventArgs args) { args.Handled = true; // retrieve double-clicked item, if any var source = args.OriginalSource as DependencyObject; var listItem = ItemsControl.ContainerFromElement(FactionList, source) as ListViewItem; if (listItem == null) { return; } // show info dialog for faction class FactionListItem item = (FactionListItem)listItem.Content; var dialog = new ShowFactions(Session.MapView, item.Item1.FactionClass); dialog.Owner = this; dialog.ShowDialog(); }
/// <summary> /// Handles the <see cref="Control.MouseDoubleClick"/> event for a <see /// cref="ListViewItem"/> of the "Compare" <see cref="ListView"/> on any tab page.</summary> /// <param name="sender"> /// The <see cref="Object"/> where the event handler is attached.</param> /// <param name="args"> /// A <see cref="MouseButtonEventArgs"/> object containing event data.</param> /// <remarks> /// <b>OnCompareActivate</b> displays a <see cref="ShowVariable"/> dialog containing /// information on the double-clicked item in the "Compare" list view for <see /// cref="ResourceClass"/> criteria, or a <see cref="ShowFactions"/> dialog for <see /// cref="FactionHistory"/> criteria.</remarks> private void OnCompareActivate(object sender, MouseButtonEventArgs args) { args.Handled = true; // retrieve double-clicked item, if any var source = args.OriginalSource as DependencyObject; ListView listView = (TablesTab.IsSelected ? CompareTableList : CompareGraphList); var listItem = ItemsControl.ContainerFromElement(listView, source) as ListViewItem; if (listItem == null || !(listItem.Content is CompareListItem)) { return; } var item = (CompareListItem)listItem.Content; // show info dialog for resources, if applicable var resource = item.Item3 as ResourceClass; if (resource != null) { var dialog = new ShowVariables(resource) { Owner = this }; dialog.ShowDialog(); return; } // show info dialog for factions, if applicable var history = item.Item3 as FactionHistory; if (history != null) { var dialog = new ShowFactions(this._mapView, history.FactionClass); dialog.Owner = this; dialog.ShowDialog(); } }