src/TF2HUD.Editor/MainWindow.xaml.cs
/// <summary>
///     Add a HUD to the list of available HUDs.
/// </summary>
/// <param name="hud">HUd object to add to the list.</param>
Add a HUD to the list of available HUDs.
Add a HUD to the list of available HUDs .
public void AddHUDToGridView(HUD hud)
        {
            Logger.Info($"Loading {hud.Name}");
            var border = new Border
            {
                Style = (Style)Application.Current.Resources["HudListBorder"]
            };
            border.MouseEnter += (_, _) => border.BorderBrush = Brushes.Black;
            border.MouseLeave += (_, _) => border.BorderBrush = Brushes.LightGray;
            border.MouseUp += (_, _) =>
            {
                if (Json.HighlightedHUD == hud)
                {
                    Json.SelectedHUD = hud;
                }
                else
                {
                    Json.SelectedHUD = null;
                    Json.HighlightedHUD = hud;
                    HudInfo.ScrollToVerticalOffset(0);
                    Logger.Info($"Highlighting {hud.Name}");
                }
            };
            var thumbnailIcon = new Label
            {
                Content = hud.Unique ? "B" : "",
                Style = (Style)Application.Current.Resources["HudListIcon"]
            };
            var thumbnailImage = new Image
            {
                Source = hud.Thumbnail != null ? new BitmapImage(new Uri(hud.Thumbnail)) : null,
                Style = (Style)Application.Current.Resources["HudListImage"]
            };
            RenderOptions.SetBitmapScalingMode(thumbnailImage, BitmapScalingMode.Fant);
            var hudIconContainer = new Grid();
            hudIconContainer.RowDefinitions.Add(new RowDefinition());
            hudIconContainer.RowDefinitions.Add(new RowDefinition());
            hudIconContainer.Children.Add(thumbnailImage);
            hudIconContainer.Children.Add(thumbnailIcon);
            hudIconContainer.Children.Add(new Label
            { Content = hud.Name, Style = (Style)Application.Current.Resources["HudListLabel"] });
            border.Child = hudIconContainer;
            GridSelectHud.Children.Add(border);
            HudThumbnails.Add((hud, border));
        }
public void AddHUDToGridView ( HUD hud ) { Logger . Info ( $" Loading  { hud . Name } " ) ; var border = new Border { Style = ( Style ) Application . Current . Resources [ " " ] } ; border . MouseEnter += ( _ , _ ) => border . BorderBrush = Brushes . Black ; border . MouseLeave += ( _ , _ ) => border . BorderBrush = Brushes . LightGray ; border . MouseUp += ( _ , _ ) => { if ( Json . HighlightedHUD == hud ) { Json . SelectedHUD = hud ; } else { Json . SelectedHUD = null ; Json . HighlightedHUD = hud ; HudInfo . ScrollToVerticalOffset ( 0 ) ; Logger . Info ( $" Highlighting  { hud . Name } " ) ; } } ; var thumbnailIcon = new Label { Content = hud . Unique ? " " : " " , Style = ( Style ) Application . Current . Resources [ " " ] } ; var thumbnailImage = new Image { Source = hud . Thumbnail != null ? new BitmapImage ( new Uri ( hud . Thumbnail ) ) : null , Style = ( Style ) Application . Current . Resources [ " " ] } ; RenderOptions . SetBitmapScalingMode ( thumbnailImage , BitmapScalingMode . Fant ) ; var hudIconContainer = new Grid ( ) ; hudIconContainer . RowDefinitions . Add ( new RowDefinition ( ) ) ; hudIconContainer . RowDefinitions . Add ( new RowDefinition ( ) ) ; hudIconContainer . Children . Add ( thumbnailImage ) ; hudIconContainer . Children . Add ( thumbnailIcon ) ; hudIconContainer . Children . Add ( new Label { Content = hud . Name , Style = ( Style ) Application . Current . Resources [ " " ] } ) ; border . Child = hudIconContainer ; GridSelectHud . Children . Add ( border ) ; HudThumbnails . Add ( ( hud , border ) ) ; }
Add a HUD to the list of available HUDs.
Add a HUD to the list of available HUDs .
// Prevents image from looking grainy when resized // Build the HUD container.
hud
HUD
HUd object to add to the list.
HUd object to add to the list .