-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added game selector for GB downloads
- Loading branch information
1 parent
450a0c7
commit 84b7434
Showing
8 changed files
with
186 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<Window x:Class="HedgeModManager.UI.GBModGameSelectorWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:HedgeModManager.UI" | ||
xmlns:controls="clr-namespace:HedgeModManager.Controls" | ||
mc:Ignorable="d" | ||
Title="{StaticResource GameSelectorTitle}" Height="240" Width="400" | ||
MinHeight="240" MinWidth="400" ResizeMode="NoResize" | ||
Style="{DynamicResource HedgeWindow}" WindowStartupLocation="CenterScreen"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="40"/> | ||
</Grid.RowDefinitions> | ||
<TextBlock x:Name="Header" Text="{StaticResource GameSelectorHeader}" TextAlignment="Center" FontSize="30" Foreground="{DynamicResource HMM.Window.HeaderAccentBrush}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="20,0" TextWrapping="Wrap"/> | ||
<Grid Width="Auto" Margin="5,0" Grid.Row="1"> | ||
<TextBlock HorizontalAlignment="Center" Margin="0,10" Text="{StaticResource GameSelectorDescription}" /> | ||
<ComboBox x:Name="GameComboBox" ItemsSource="{Binding Games}" SelectedItem="{Binding SelectedGame}" Width="300" Height="40" HorizontalAlignment="Center"> | ||
<ComboBox.ItemTemplate> | ||
<DataTemplate> | ||
<StackPanel Orientation="Horizontal"> | ||
<Border Width="32" Height="32" CornerRadius="3" RenderOptions.BitmapScalingMode="Fant" x:Name="GameImageBorder"> | ||
<Border.Background> | ||
<ImageBrush ImageSource="{Binding GameImage}"/> | ||
</Border.Background> | ||
</Border> | ||
<Label Content="{Binding GameName}" VerticalAlignment="Center" /> | ||
</StackPanel> | ||
</DataTemplate> | ||
</ComboBox.ItemTemplate> | ||
</ComboBox> | ||
</Grid> | ||
|
||
<Grid HorizontalAlignment="Stretch" Grid.Row="2" Margin="-4,0,-4,-4" Background="{DynamicResource HMM.Window.DialogBottom}"> | ||
<StackPanel x:Name="Stack" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Stretch" Margin="0,0,5,0"> | ||
<Button Width="60" Height="23" Margin="5" Content="{StaticResource CommonUIOK}" Click="Ok_Click" IsDefault="True"/> | ||
<Button Width="60" Height="23" Margin="5" Content="{StaticResource CommonUICancel}" IsCancel="True"/> | ||
</StackPanel> | ||
</Grid> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using GameBananaAPI; | ||
using System.Net; | ||
using System.Windows.Controls.Primitives; | ||
using HedgeModManager.Controls; | ||
using System.Net.Cache; | ||
using System.Net.Http; | ||
using PropertyTools.Wpf; | ||
using static HedgeModManager.Lang; | ||
using PopupBox = HedgeModManager.Controls.PopupBox; | ||
using System.Diagnostics; | ||
using System.Windows.Shell; | ||
using HedgeModManager.Misc; | ||
using HedgeModManager.Exceptions; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace HedgeModManager.UI | ||
{ | ||
/// <summary> | ||
/// Interaction logic for GBModGameSelectorWindow.xaml | ||
/// </summary> | ||
public partial class GBModGameSelectorWindow : Window | ||
{ | ||
|
||
public GBModGameSelectorWindowViewModel ViewModel = null; | ||
public GameInstall SelectedGame = null; | ||
|
||
public GBModGameSelectorWindow(List<GameInstall> compatibleGameInstalls) | ||
{ | ||
DataContext = ViewModel = new GBModGameSelectorWindowViewModel | ||
{ | ||
Games = new ObservableCollection<GameInstall>(compatibleGameInstalls), | ||
SelectedGame = compatibleGameInstalls.FirstOrDefault() | ||
}; | ||
|
||
InitializeComponent(); | ||
} | ||
|
||
private void Ok_Click(object sender, RoutedEventArgs e) | ||
{ | ||
SelectedGame = ViewModel.SelectedGame; | ||
DialogResult = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using GongSolutions.Wpf.DragDrop; | ||
using HedgeModManager.CodeCompiler; | ||
using HedgeModManager.Exceptions; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace HedgeModManager.UI | ||
{ | ||
public class GBModGameSelectorWindowViewModel | ||
{ | ||
public ObservableCollection<GameInstall> Games { get; set; } = new ObservableCollection<GameInstall>(); | ||
public GameInstall SelectedGame { get; set; } | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters