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

Creation of a project settings window for selecting the tool chain as the cornerstone for enabling one-click builds #23

Merged
merged 5 commits into from
Oct 31, 2024
Merged
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
improvements
  • Loading branch information
HendrikMennen committed Oct 31, 2024
commit 4ffce67ab309307265f5db944777393c0f6a2dc4
Original file line number Diff line number Diff line change
@@ -6,20 +6,22 @@
using OneWare.Essentials.Controls;
using OneWare.Essentials.Models;
using OneWare.Essentials.Services;
using OneWare.Essentials.ViewModels;
using OneWare.Settings.ViewModels;
using OneWare.Settings.ViewModels.SettingTypes;
using OneWare.Settings.Views.SettingTypes;
using OneWare.UniversalFpgaProjectSystem.Models;
using OneWare.UniversalFpgaProjectSystem.Services;
using Prism.Ioc;
using ReactiveUI;

namespace OneWare.UniversalFpgaProjectSystem.ViewModels;

public class UniversalFpgaProjectSettingsEditorViewModel : ReactiveObject
public class UniversalFpgaProjectSettingsEditorViewModel : FlexibleWindowViewModelBase
{
public string Title { get; set; } = "Test";

public List<UserControl> UserControlsList { get; }
public SettingsCollectionViewModel SettingsCollection { get; } = new("")
{
ShowTitle = false
};

private UniversalFpgaProjectRoot _root;

@@ -48,13 +50,10 @@ public UniversalFpgaProjectSettingsEditorViewModel(UniversalFpgaProjectRoot root
_includesSettings = new ListBoxSetting("Files to Include", "test", includes);
_excludesSettings = new ListBoxSetting("Files to Exclude", "test", exclude);

UserControlsList = new List<UserControl>
{
new ComboBoxSettingView() {DataContext = new ComboBoxSettingViewModel(_toolchain) },
new ComboBoxSettingView() {DataContext = new ComboBoxSettingViewModel(_loader) },
new ListBoxSettingView() { DataContext = new ListBoxSettingViewModel(_includesSettings) },
new ListBoxSettingView() { DataContext = new ListBoxSettingViewModel(_excludesSettings) }
};
SettingsCollection.SettingModels.Add(new ComboBoxSettingViewModel(_toolchain) );
SettingsCollection.SettingModels.Add(new ComboBoxSettingViewModel(_loader) );
SettingsCollection.SettingModels.Add(new ListBoxSettingViewModel(_includesSettings) );
SettingsCollection.SettingModels.Add(new ListBoxSettingViewModel(_excludesSettings) );
}

private async Task SaveAsync()
Original file line number Diff line number Diff line change
@@ -14,38 +14,21 @@
x:DataType="viewModels:UniversalFpgaProjectSettingsEditorViewModel"
Name="UniversalFpgaProjectCompileViewView">
<DockPanel>
<StackPanel>
<ContentControl DockPanel.Dock="Top">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding UserControlsList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="0,10,0,50">
<ContentPresenter Content="{Binding}" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</ScrollViewer>
</ContentControl>

<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="8" Classes="WindowButtons" HorizontalAlignment="Right"
VerticalAlignment="Bottom">
<Button Command="{Binding SaveAndCloseAsync}"
CommandParameter="{Binding #UniversalFpgaProjectCompileViewView}">
<TextBlock Text="Save and Close" Margin="5 0" />
</Button>
<Button Command="{Binding Close}"
CommandParameter="{Binding #UniversalFpgaProjectCompileViewView}">
<TextBlock Text="Close" Margin="5 0" />
</Button>
</StackPanel>
<ScrollViewer DockPanel.Dock="Top">
<ContentControl Padding="4" Content="{Binding SettingsCollection}" />
</ScrollViewer>

<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="8" Classes="WindowButtons"
HorizontalAlignment="Right"
VerticalAlignment="Bottom">
<Button Command="{Binding SaveAndCloseAsync}"
CommandParameter="{Binding #UniversalFpgaProjectCompileViewView}">
<TextBlock Text="Save and Close" Margin="5 0" />
</Button>
<Button Command="{Binding Close}"
CommandParameter="{Binding #UniversalFpgaProjectCompileViewView}">
<TextBlock Text="Close" Margin="5 0" />
</Button>
</StackPanel>
</DockPanel>
</controls:FlexibleWindow>