Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target playset selection #426

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
selectedPlaysetID
IhateTrains committed Dec 20, 2023
commit e06d483cbb2d9eda7fe2e00362fb7c1d95d54c3e
14 changes: 14 additions & 0 deletions Fronter.NET/ViewModels/TargetPlaysetPickerViewModel.cs
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
using Fronter.Models.Configuration;
using System;
using System.Collections.ObjectModel;
using System.Linq;

namespace Fronter.ViewModels;

@@ -30,6 +31,19 @@ public TargetPlaysetPickerViewModel(Config config) {
public bool TabDisabled { get; } = false;

public void ReloadPlaysets() {
selectedPlaysetID = string.Empty;
_config.AutoLocatePlaysets();
}

private string selectedPlaysetID = string.Empty;

public TargetPlayset? SelectedPlayset {
get => TargetPlaysets.FirstOrDefault(p => p.Id == selectedPlaysetID);
set {
if (value is null) {
return;
}
selectedPlaysetID = value.Id;
}
}
}
7 changes: 6 additions & 1 deletion Fronter.NET/Views/TargetPlaysetPickerView.axaml
Original file line number Diff line number Diff line change
@@ -43,7 +43,12 @@
<StackPanel>
<TextBlock Text="If you select a target game playset, the application will create its copy with the conversion mod included."></TextBlock>
<StackPanel Orientation="Horizontal">
<ComboBox x:Name="PlaysetComboBox" SelectedIndex="0" ItemsSource="{Binding TargetPlaysets}">
<ComboBox
x:Name="PlaysetComboBox"
SelectedIndex="0"
ItemsSource="{Binding TargetPlaysets}"
SelectedItem="{Binding SelectedPlayset, FallbackValue={}}"
>
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" ToolTip.Tip="{Binding Name}" />