Skip to content

Commit

Permalink
Add button in settings to open SteamGridDB API API Key page
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed Sep 8, 2021
1 parent bb529b9 commit 9ccbddc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions SGDBMetadata/Localization/en_US.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<sys:String x:Key="LOCSteamGridDBMetadata_SettingDimensionLabel">Dimension:</sys:String>
<sys:String x:Key="LOCSteamGridDBMetadata_SettingAdultContentLabel">Adult content:</sys:String>
<sys:String x:Key="LOCSteamGridDBMetadata_SettingHumorContentLabel">Humor:</sys:String>

<sys:String x:Key="LOCSteamGridDBMetadata_SettingGetApiKeyButton">Get API Key</sys:String>

<sys:String x:Key="LOCSteamGridDBMetadata_SettingGenericAny">Any</sys:String>
<sys:String x:Key="LOCSteamGridDBMetadata_SettingGenericNotAdult">Only get assets not tagged as adult content</sys:String>
Expand Down
13 changes: 13 additions & 0 deletions SGDBMetadata/SGDBMetadataSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,18 @@ public bool VerifySettings(out List<string> errors)
errors = new List<string>();
return true;
}

public RelayCommand<object> LoginCommand
{
get => new RelayCommand<object>((a) =>
{
Login();
});
}

private void Login()
{
System.Diagnostics.Process.Start(@"https://www.steamgriddb.com/profile/preferences/api");
}
}
}
8 changes: 6 additions & 2 deletions SGDBMetadata/SGDBMetadataSettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
d:DesignHeight="400" d:DesignWidth="600">
<ScrollViewer>
<StackPanel Margin="20">
<TextBlock Text="{DynamicResource LOCSteamGridDBMetadata_SettingApiKey}"/>
<TextBox Text="{Binding Settings.ApiKey}" Margin="0,10,0,0" />
<DockPanel>
<TextBlock Text="{DynamicResource LOCSteamGridDBMetadata_SettingApiKey}" DockPanel.Dock="Left" VerticalAlignment="Center"/>
<Button Content="{DynamicResource LOCSteamGridDBMetadata_SettingGetApiKeyButton}" DockPanel.Dock="Right" VerticalAlignment="Center"
Command="{Binding LoginCommand}" Margin="10,0,0,0"/>
<TextBox Name="AccountAccessCode" Text="{Binding Settings.ApiKey}" Margin="10,0,0,0" VerticalAlignment="Center"/>
</DockPanel>

<Label Content="{DynamicResource LOCSteamGridDBMetadata_SettingCoverLabel}" Margin="0,15,0,0"/>
<Separator/>
Expand Down

0 comments on commit 9ccbddc

Please sign in to comment.