mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
List select views
This commit is contained in:
parent
c8b383cecc
commit
fa8606732c
15
Wabbajack.App/Controls/InstalledListView.axaml
Normal file
15
Wabbajack.App/Controls/InstalledListView.axaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
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:i="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="Wabbajack.App.Controls.InstalledListView">
|
||||||
|
<Grid RowDefinitions="Auto, Auto" ColumnDefinitions="*, Auto">
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" x:Name="Title"></TextBlock>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="InstallationPath"></TextBlock>
|
||||||
|
<Button Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" x:Name="PlayButton">
|
||||||
|
<i:MaterialIcon Kind="PlayArrow"></i:MaterialIcon>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
28
Wabbajack.App/Controls/InstalledListView.axaml.cs
Normal file
28
Wabbajack.App/Controls/InstalledListView.axaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using Avalonia.Controls.Mixins;
|
||||||
|
using Avalonia.ReactiveUI;
|
||||||
|
using ReactiveUI;
|
||||||
|
using Wabbajack.App.Utilities;
|
||||||
|
|
||||||
|
namespace Wabbajack.App.Controls;
|
||||||
|
|
||||||
|
public partial class InstalledListView : ReactiveUserControl<InstalledListViewModel>, IActivatableView
|
||||||
|
{
|
||||||
|
public InstalledListView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.WhenActivated(disposables =>
|
||||||
|
{
|
||||||
|
this.OneWayBind(ViewModel, vm => vm.Name, view => view.Title.Text)
|
||||||
|
.DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.OneWayBind(ViewModel, vm => vm.InstallPath, view => view.Title.Text,
|
||||||
|
p => p.ToString())
|
||||||
|
.DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.BindCommand(ViewModel, vm => vm.Play, view => view.PlayButton)
|
||||||
|
.DisposeWith(disposables);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
32
Wabbajack.App/Controls/InstalledListViewModel.cs
Normal file
32
Wabbajack.App/Controls/InstalledListViewModel.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System.Reactive;
|
||||||
|
using ReactiveUI;
|
||||||
|
using ReactiveUI.Fody.Helpers;
|
||||||
|
using Wabbajack.App.Messages;
|
||||||
|
using Wabbajack.App.Screens;
|
||||||
|
using Wabbajack.App.ViewModels;
|
||||||
|
using Wabbajack.DTOs.SavedSettings;
|
||||||
|
using Wabbajack.Paths;
|
||||||
|
|
||||||
|
namespace Wabbajack.App.Controls;
|
||||||
|
|
||||||
|
public class InstalledListViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private readonly InstallationConfigurationSetting _setting;
|
||||||
|
public AbsolutePath InstallPath => _setting.Install;
|
||||||
|
|
||||||
|
public string Name => _setting.Metadata?.Title ?? "";
|
||||||
|
public ReactiveCommand<Unit, Unit> Play { get; }
|
||||||
|
|
||||||
|
public InstalledListViewModel(InstallationConfigurationSetting setting)
|
||||||
|
{
|
||||||
|
Activator = new ViewModelActivator();
|
||||||
|
_setting = setting;
|
||||||
|
|
||||||
|
Play = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
MessageBus.Instance.Send(new ConfigureLauncher(InstallPath));
|
||||||
|
MessageBus.Instance.Send(new NavigateTo(typeof(LauncherViewModel)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
Wabbajack.App/Screens/PlaySelectView.axaml
Normal file
22
Wabbajack.App/Screens/PlaySelectView.axaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
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:controls="clr-namespace:Wabbajack.App.Controls"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="Wabbajack.App.Screens.PlaySelectView">
|
||||||
|
<Grid RowDefinitions="*">
|
||||||
|
<ItemsControl x:Name="Lists">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel></StackPanel>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<controls:InstalledListView></controls:InstalledListView>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
19
Wabbajack.App/Screens/PlaySelectView.axaml.cs
Normal file
19
Wabbajack.App/Screens/PlaySelectView.axaml.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Avalonia.Controls.Mixins;
|
||||||
|
using ReactiveUI;
|
||||||
|
using Wabbajack.App.Views;
|
||||||
|
|
||||||
|
namespace Wabbajack.App.Screens;
|
||||||
|
|
||||||
|
public partial class PlaySelectView : ScreenBase<PlaySelectViewModel>
|
||||||
|
{
|
||||||
|
public PlaySelectView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.WhenActivated(disposables =>
|
||||||
|
{
|
||||||
|
this.OneWayBind(ViewModel, vm => vm.Items, view => view.Lists.Items)
|
||||||
|
.DisposeWith(disposables);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
40
Wabbajack.App/Screens/PlaySelectViewModel.cs
Normal file
40
Wabbajack.App/Screens/PlaySelectViewModel.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reactive.Disposables;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ReactiveUI;
|
||||||
|
using ReactiveUI.Fody.Helpers;
|
||||||
|
using Wabbajack.App.Controls;
|
||||||
|
using Wabbajack.App.Models;
|
||||||
|
using Wabbajack.App.ViewModels;
|
||||||
|
using Wabbajack.Common;
|
||||||
|
using Wabbajack.DTOs.SavedSettings;
|
||||||
|
|
||||||
|
namespace Wabbajack.App.Screens;
|
||||||
|
|
||||||
|
public class PlaySelectViewModel : ViewModelBase, IActivatableViewModel
|
||||||
|
{
|
||||||
|
private readonly InstallationStateManager _manager;
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public IEnumerable<InstalledListViewModel> Items { get; set; }
|
||||||
|
|
||||||
|
public PlaySelectViewModel(InstallationStateManager manager)
|
||||||
|
{
|
||||||
|
_manager = manager;
|
||||||
|
Activator = new ViewModelActivator();
|
||||||
|
|
||||||
|
this.WhenActivated(disposables =>
|
||||||
|
{
|
||||||
|
LoadAndSetItems().FireAndForget();
|
||||||
|
Disposable.Empty.DisposeWith(disposables);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task LoadAndSetItems()
|
||||||
|
{
|
||||||
|
var items = await _manager.GetAll();
|
||||||
|
Items = items.Settings.Select(a => new InstalledListViewModel(a)).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -36,11 +36,11 @@ namespace Wabbajack.App
|
|||||||
services.AddSingleton<MessageBus>();
|
services.AddSingleton<MessageBus>();
|
||||||
services.AddSingleton<MainWindow>();
|
services.AddSingleton<MainWindow>();
|
||||||
services.AddSingleton<BrowseViewModel>();
|
services.AddSingleton<BrowseViewModel>();
|
||||||
|
|
||||||
services.AddTransient<BrowseItemViewModel>();
|
services.AddTransient<BrowseItemViewModel>();
|
||||||
|
|
||||||
services.AddTransient<LogViewModel>();
|
services.AddTransient<LogViewModel>();
|
||||||
|
|
||||||
|
services.AddTransient<InstalledListViewModel>();
|
||||||
|
|
||||||
services.AddDTOConverters();
|
services.AddDTOConverters();
|
||||||
services.AddDTOSerializer();
|
services.AddDTOSerializer();
|
||||||
services.AddSingleton<ModeSelectionViewModel>();
|
services.AddSingleton<ModeSelectionViewModel>();
|
||||||
@ -55,11 +55,13 @@ namespace Wabbajack.App
|
|||||||
services.AddSingleton<IScreenView, SettingsView>();
|
services.AddSingleton<IScreenView, SettingsView>();
|
||||||
services.AddSingleton<IScreenView, BrowseView>();
|
services.AddSingleton<IScreenView, BrowseView>();
|
||||||
services.AddSingleton<IScreenView, LauncherView>();
|
services.AddSingleton<IScreenView, LauncherView>();
|
||||||
|
services.AddSingleton<IScreenView, PlaySelectView>();
|
||||||
|
|
||||||
services.AddSingleton<InstallationStateManager>();
|
services.AddSingleton<InstallationStateManager>();
|
||||||
services.AddSingleton<HttpClient>();
|
services.AddSingleton<HttpClient>();
|
||||||
|
|
||||||
services.AddSingleton<LogScreenViewModel>();
|
services.AddSingleton<LogScreenViewModel>();
|
||||||
|
services.AddSingleton<PlaySelectViewModel>();
|
||||||
services.AddAllSingleton<IReceiverMarker, ErrorPageViewModel>();
|
services.AddAllSingleton<IReceiverMarker, ErrorPageViewModel>();
|
||||||
services.AddAllSingleton<IReceiverMarker, StandardInstallationViewModel>();
|
services.AddAllSingleton<IReceiverMarker, StandardInstallationViewModel>();
|
||||||
services.AddAllSingleton<IReceiverMarker, InstallConfigurationViewModel>();
|
services.AddAllSingleton<IReceiverMarker, InstallConfigurationViewModel>();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<controls:LargeIconButton Grid.Column="0" Text="Browse" Icon="CloudDownload" x:Name="BrowseButton"></controls:LargeIconButton>
|
<controls:LargeIconButton Grid.Column="0" Text="Browse" Icon="CloudDownload" x:Name="BrowseButton"></controls:LargeIconButton>
|
||||||
<controls:LargeIconButton Grid.Column="1" Text="Install" Icon="HarddiskPlus" x:Name="InstallButton"></controls:LargeIconButton>
|
<controls:LargeIconButton Grid.Column="1" Text="Install" Icon="HarddiskPlus" x:Name="InstallButton"></controls:LargeIconButton>
|
||||||
<controls:LargeIconButton Grid.Column="2" Text="Compile" Icon="DatabaseImport" x:Name="CompileButton"></controls:LargeIconButton>
|
<controls:LargeIconButton Grid.Column="2" Text="Compile" Icon="DatabaseImport" x:Name="CompileButton"></controls:LargeIconButton>
|
||||||
<controls:LargeIconButton Grid.Column="3" Text="Play" Icon="TelevisionPlay"></controls:LargeIconButton>
|
<controls:LargeIconButton Grid.Column="3" Text="Play" Icon="TelevisionPlay" x:Name="LaunchButton"></controls:LargeIconButton>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -29,6 +29,11 @@ namespace Wabbajack.App.Views
|
|||||||
{
|
{
|
||||||
MessageBus.Instance.Send(new NavigateTo(typeof(CompilerConfigurationViewModel)));
|
MessageBus.Instance.Send(new NavigateTo(typeof(CompilerConfigurationViewModel)));
|
||||||
}).DisposeWith(disposables);
|
}).DisposeWith(disposables);
|
||||||
|
|
||||||
|
LaunchButton.Button.Command = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
MessageBus.Instance.Send(new NavigateTo(typeof(PlaySelectViewModel)));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user