List assets explorer view

This commit is contained in:
Masusder 2026-06-27 18:07:12 +02:00
parent a04f8a9008
commit 2ea4fabb70
25 changed files with 752 additions and 365 deletions

View File

@ -20,7 +20,7 @@
<ResourceDictionary Source="Views/Resources/Controls/ContextMenus/FolderContextMenu.xaml" />
<ResourceDictionary Source="Views/Resources/Resources.xaml" />
<ResourceDictionary Source="Views/Resources/Controls/TiledExplorer/Resources.xaml" />
<ResourceDictionary Source="Views/Resources/Controls/Explorer/Resources.xaml" />
</ResourceDictionary.MergedDictionaries>
<Color x:Key="{x:Static adonisUi:Colors.AccentColor}">#206BD4</Color>

View File

@ -172,3 +172,9 @@ public enum EUnluacMode
Decompile,
Disassemble,
}
public enum EExplorerViewMode
{
Grid,
List
}

View File

@ -503,6 +503,8 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" MinWidth="150" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<inputs:SearchTextBox x:Name="AssetsExplorerSearch" Grid.Column="0"
@ -512,17 +514,87 @@
<ComboBox x:Name="CategoriesSelector" Grid.Column="2"
ItemsSource="{Binding Categories}"
SelectedItem="{Binding SelectedItem.SelectedCategory, ElementName=AssetsFolderName, Mode=TwoWay}" />
<StackPanel Grid.Column="4"
Orientation="Horizontal"
HorizontalAlignment="Right">
<ToggleButton Style="{StaticResource ExplorerViewToggleButton}"
Width="32"
Height="28"
Padding="7"
ToolTip="Grid View"
IsChecked="{Binding ExplorerViewMode,
Source={x:Static local:Settings.UserSettings.Default},
Converter={x:Static converters:EnumToBoolConverter.Instance},
ConverterParameter={x:Static local:EExplorerViewMode.Grid},
Mode=TwoWay}">
<Path Data="{StaticResource GridIcon}"
Width="14"
Height="14"
Stretch="Uniform"
Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
</ToggleButton>
<ToggleButton Style="{StaticResource ExplorerViewToggleButton}"
Width="32"
Height="28"
Padding="7"
ToolTip="List View"
IsChecked="{Binding ExplorerViewMode,
Source={x:Static local:Settings.UserSettings.Default},
Converter={x:Static converters:EnumToBoolConverter.Instance},
ConverterParameter={x:Static local:EExplorerViewMode.List},
Mode=TwoWay}">
<Path Data="{StaticResource ListIcon}"
Width="14"
Height="14"
Stretch="Uniform"
Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
</ToggleButton>
</StackPanel>
</Grid>
<controls:Breadcrumb Grid.Row="1" Margin="0 5 0 0"
HorizontalAlignment="Left"
DataContext="{Binding SelectedItem.PathAtThisPoint, ElementName=AssetsFolderName}" />
<ListBox x:Name="AssetsExplorer" Grid.Row="2"
ItemsSource="{Binding SelectedItem.CombinedEntries, ElementName=AssetsFolderName, IsAsync=True}"
Style="{StaticResource TiledExplorer}"
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}"
PreviewKeyDown="OnPreviewKeyDown" />
<Grid Grid.Row="2">
<ListBox x:Name="AssetsExplorer"
ItemsSource="{Binding SelectedItem.CombinedEntries, ElementName=AssetsFolderName, IsAsync=True}"
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}"
PreviewKeyDown="OnPreviewKeyDown">
<ListBox.Style>
<Style TargetType="ListBox"
BasedOn="{StaticResource TiledExplorer}">
<Style.Triggers>
<DataTrigger Binding="{Binding ExplorerViewMode, Source={x:Static local:Settings.UserSettings.Default}}"
Value="{x:Static local:EExplorerViewMode.List}">
<Setter Property="Visibility"
Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.Style>
</ListBox>
<ListBox x:Name="AssetsListExplorer"
ItemsSource="{Binding SelectedItem.CombinedEntries, ElementName=AssetsFolderName, IsAsync=True}"
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}"
PreviewKeyDown="OnPreviewKeyDown">
<ListBox.Style>
<Style TargetType="ListBox"
BasedOn="{StaticResource ListExplorer}">
<Setter Property="Visibility"
Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding ExplorerViewMode, Source={x:Static local:Settings.UserSettings.Default}}"
Value="{x:Static local:EExplorerViewMode.List}">
<Setter Property="Visibility"
Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.Style>
</ListBox>
</Grid>
</Grid>
</Border>

View File

@ -54,8 +54,10 @@ public partial class MainWindow
InitializeComponent();
AssetsExplorer.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
AssetsListExplorer.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
AssetsListName.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
AssetsExplorer.SelectionChanged += (_, e) => SyncSelection(AssetsListName, e);
AssetsListExplorer.SelectionChanged += (_, e) => SyncSelection(AssetsListName, e);
AssetsListName.SelectionChanged += (_, e) => SyncSelection(AssetsExplorer, e);
FLogger.Logger = LogRtbName;

View File

@ -590,5 +590,13 @@ namespace FModel.Settings
get => _previewTexturesAssetExplorer;
set => SetProperty(ref _previewTexturesAssetExplorer, value);
}
private EExplorerViewMode _explorerViewMode = EExplorerViewMode.Grid;
public EExplorerViewMode ExplorerViewMode
{
get => _explorerViewMode;
set => SetProperty(ref _explorerViewMode, value);
}
}
}

View File

@ -788,6 +788,7 @@ public class CUE4ParseViewModel : ViewModel
}
case "ebd" when Provider.Versions.Game is EGame.GAME_ArcRaiders:
case "json":
case "Json":
{
var data = Provider.SaveAsset(entry);
using var stream = new MemoryStream(data) { Position = 0 };

View File

@ -0,0 +1,77 @@
<UserControl x:Class="FModel.Views.Resources.Controls.ListExplorer.FileRow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:FModel.ViewModels"
xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
mc:Ignorable="d"
d:DesignHeight="32"
d:DesignWidth="900"
d:DataContext="{d:DesignInstance Type=vm:GameFileViewModel, IsDesignTimeCreatable=False}">
<Grid Height="32"
Margin="8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ExplorerNameColumn}" />
<ColumnDefinition Width="{StaticResource ExplorerTypeColumn}" />
<ColumnDefinition Width="{StaticResource ExplorerDetailsColumn}" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"
Orientation="Horizontal"
VerticalAlignment="Center">
<Grid Width="20"
Height="20"
Margin="0 0 8 0">
<Image Stretch="Uniform"
Source="{Binding PreviewImage}" />
<Path x:Name="FallbackIcon"
Stretch="Uniform">
<Path.Style>
<Style TargetType="{x:Type Path}">
<Setter Property="Visibility"
Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding PreviewImage}"
Value="{x:Null}">
<Setter Property="Visibility"
Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
<Path.Data>
<MultiBinding Converter="{x:Static converters:FileToGeometryConverter.Instance}">
<Binding Path="AssetCategory" />
<Binding Path="ResolvedAssetType" />
</MultiBinding>
</Path.Data>
<Path.Fill>
<MultiBinding Converter="{x:Static converters:FileToGeometryConverter.Instance}">
<Binding Path="AssetCategory" />
<Binding Path="ResolvedAssetType" />
</MultiBinding>
</Path.Fill>
</Path>
</Grid>
<TextBlock Text="{Binding Asset.NameWithoutExtension}"
VerticalAlignment="Center"
FontSize="13"
FontWeight="DemiBold"
TextTrimming="CharacterEllipsis"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
</StackPanel>
<TextBlock Grid.Column="1"
Text="{Binding ResolvedAssetType}"
VerticalAlignment="Center"
FontSize="12"
TextTrimming="CharacterEllipsis"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
<TextBlock Grid.Column="2"
Text="{Binding Asset.Size, Converter={x:Static converters:SizeToStringConverter.Instance}}"
VerticalAlignment="Center"
HorizontalAlignment="Right"
FontSize="12"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
</Grid>
</UserControl>

View File

@ -0,0 +1,11 @@
using System.Windows.Controls;
namespace FModel.Views.Resources.Controls.ListExplorer;
public partial class FileRow : UserControl
{
public FileRow()
{
InitializeComponent();
}
}

View File

@ -0,0 +1,87 @@
<UserControl x:Class="FModel.Views.Resources.Controls.ListExplorer.FolderRow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:FModel.ViewModels"
xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
mc:Ignorable="d"
d:DesignHeight="32"
d:DesignWidth="900"
d:DataContext="{d:DesignInstance Type=vm:TreeItem, IsDesignTimeCreatable=False}">
<Grid Height="32"
Margin="8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ExplorerNameColumn}" />
<ColumnDefinition Width="{StaticResource ExplorerTypeColumn}" />
<ColumnDefinition Width="{StaticResource ExplorerDetailsColumn}" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"
Orientation="Horizontal"
VerticalAlignment="Center">
<Grid Width="20"
Height="20"
Margin="0 0 8 0">
<Viewbox>
<Canvas Width="128"
Height="128">
<Canvas.Resources>
<LinearGradientBrush x:Key="FolderTabGradient"
StartPoint="0,0"
EndPoint="0,1">
<GradientStop Color="#FFE8C480"
Offset="0" />
<GradientStop Color="#FFD9AA63"
Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="FolderBodyGradient"
StartPoint="0,0"
EndPoint="0,1">
<GradientStop Color="#FFF3D9A4"
Offset="0" />
<GradientStop Color="#FFE5BD77"
Offset="1" />
</LinearGradientBrush>
<SolidColorBrush x:Key="FolderOutlineBrush"
Color="#D8A360" />
</Canvas.Resources>
<Path Fill="{StaticResource FolderTabGradient}"
Stroke="{StaticResource FolderOutlineBrush}"
StrokeThickness="2"
Data="M20 34 H54 L62 46 H108 C112 46 115 49 115 53 V60 H13 V45 C13 39 16 34 20 34 Z" />
<Path Fill="{StaticResource FolderBodyGradient}"
Stroke="{StaticResource FolderOutlineBrush}"
StrokeThickness="2"
Data="M13 60 H115 V104 C115 110 110 115 104 115 H24 C18 115 13 110 13 104 Z" />
</Canvas>
</Viewbox>
</Grid>
<TextBlock Text="{Binding Header}"
VerticalAlignment="Center"
FontSize="12"
FontWeight="DemiBold"
TextTrimming="CharacterEllipsis"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" />
</StackPanel>
<TextBlock Grid.Column="1"
Text="Folder"
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
<StackPanel Grid.Column="2"
Orientation="Horizontal"
HorizontalAlignment="Right"
VerticalAlignment="Center">
<TextBlock Text="{Binding Folders.Count, StringFormat={}{0} folders}"
FontSize="12"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
<TextBlock Text=", "
FontSize="12"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
<TextBlock Text="{Binding AssetsList.Assets.Count, StringFormat={}{0} assets}"
FontSize="12"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
</StackPanel>
</Grid>
</UserControl>

View File

@ -0,0 +1,11 @@
using System.Windows.Controls;
namespace FModel.Views.Resources.Controls.ListExplorer;
public partial class FolderRow : UserControl
{
public FolderRow()
{
InitializeComponent();
}
}

View File

@ -0,0 +1,390 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vwp="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
xmlns:vm="clr-namespace:FModel.ViewModels"
xmlns:controls="clr-namespace:FModel.Views.Resources.Controls"
xmlns:tiledExplorer="clr-namespace:FModel.Views.Resources.Controls.TiledExplorer"
xmlns:listExplorer="clr-namespace:FModel.Views.Resources.Controls.ListExplorer"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
xmlns:adonisConverters="clr-namespace:AdonisUI.Converters;assembly=AdonisUI"
x:Class="FModel.Views.Resources.Controls.TiledExplorer.ResourcesDictionary">
<controls:TypeDataTemplateSelector x:Key="TiledExplorerTemplateSelector"
FolderTemplateKey="TiledFolderDataTemplate"
FileTemplateKey="TiledFileDataTemplate" />
<controls:TypeDataTemplateSelector x:Key="ListExplorerTemplateSelector"
FolderTemplateKey="ListFolderDataTemplate"
FileTemplateKey="ListFileDataTemplate" />
<Style x:Key="TiledExplorer" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="tiledExplorer:SmoothScroll.IsEnabled" Value="True" />
<Setter Property="tiledExplorer:SmoothScroll.Factor" Value="1.25" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="ContextMenu" Value="{StaticResource FileContextMenu}" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=OneWay}" />
<Setter Property="Margin" Value="5" />
<Setter Property="Padding" Value="5" />
<Setter Property="BorderThickness" Value="1.5" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="controls:ListBoxItemBehavior.IsBroughtIntoViewWhenSelected" Value="True" />
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.Layer0BackgroundBrush}}" />
<EventSetter Event="MouseDoubleClick" Handler="OnMouseDoubleClick" />
<EventSetter Event="PreviewMouseRightButtonDown" Handler="OnPreviewMouseRightButtonDown" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid>
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding adonisExtensions:CornerRadiusExtension.CornerRadius}">
<ContentPresenter />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<vwp:VirtualizingWrapPanel Orientation="Horizontal" SpacingMode="Uniform" ScrollUnit="Pixel" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<ContentControl Content="{Binding}"
ContentTemplateSelector="{StaticResource TiledExplorerTemplateSelector}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Grid>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ItemsSource, RelativeSource={RelativeSource Self}, Converter={x:Static adonisConverters:IsNullToBoolConverter.Instance}}" Value="False" />
<Condition Binding="{Binding Items.Count, RelativeSource={RelativeSource Self}, FallbackValue=0}" Value="0" />
</MultiDataTrigger.Conditions>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<TextBlock Text="No folders or packages found" FontWeight="SemiBold" TextAlignment="Center"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ErrorBrush}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</MultiDataTrigger>
</Style.Triggers>
</Style>
<GridLength x:Key="ExplorerNameColumn">3*</GridLength>
<GridLength x:Key="ExplorerTypeColumn">1*</GridLength>
<GridLength x:Key="ExplorerDetailsColumn">1.2*</GridLength>
<Style x:Key="ListExplorer"
TargetType="ListBox"
BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="tiledExplorer:SmoothScroll.IsEnabled"
Value="True" />
<Setter Property="tiledExplorer:SmoothScroll.Factor"
Value="1.25" />
<Setter Property="SelectionMode"
Value="Extended" />
<Setter Property="ContextMenu"
Value="{StaticResource FileContextMenu}" />
<Setter Property="VirtualizingPanel.IsVirtualizing"
Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode"
Value="Recycling" />
<Setter Property="ScrollViewer.CanContentScroll"
Value="True" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility"
Value="Visible" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
Value="Disabled" />
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="Margin"
Value="0 4 0 0" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}"
BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="IsSelected"
Value="{Binding IsSelected, Mode=OneWay}" />
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="Padding"
Value="0" />
<Setter Property="Margin"
Value="0" />
<Setter Property="Cursor"
Value="Hand" />
<Setter Property="controls:ListBoxItemBehavior.IsBroughtIntoViewWhenSelected"
Value="True" />
<EventSetter Event="MouseDoubleClick"
Handler="OnMouseDoubleClick" />
<EventSetter Event="PreviewMouseRightButtonDown"
Handler="OnPreviewMouseRightButtonDown" />
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<ContentControl Content="{Binding}"
ContentTemplateSelector="{StaticResource ListExplorerTemplateSelector}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0"
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer2BackgroundBrush}}"
BorderBrush="{DynamicResource {x:Static adonisUi:Brushes.Layer0BorderBrush}}"
BorderThickness="0,0,0,1">
<Grid Margin="8 0 24 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ExplorerNameColumn}" />
<ColumnDefinition Width="{StaticResource ExplorerTypeColumn}" />
<ColumnDefinition Width="{StaticResource ExplorerDetailsColumn}" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="Name"
VerticalAlignment="Center"
FontSize="11"
FontWeight="Bold"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
<TextBlock Grid.Column="1"
Text="Type"
VerticalAlignment="Center"
FontSize="11"
FontWeight="Bold"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
<TextBlock Grid.Column="3"
Text="Details"
VerticalAlignment="Center"
HorizontalAlignment="Right"
FontSize="11"
FontWeight="Bold"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.DisabledForegroundBrush}}" />
</Grid>
</Border>
<Border Grid.Row="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="TiledFileDataTemplate" DataType="{x:Type vm:GameFileViewModel}">
<tiledExplorer:FileButton />
</DataTemplate>
<DataTemplate x:Key="TiledFolderDataTemplate" DataType="{x:Type vm:TreeItem}">
<tiledExplorer:FolderButton ContextMenu="{StaticResource FolderContextMenu}" />
</DataTemplate>
<DataTemplate x:Key="ListFileDataTemplate"
DataType="{x:Type vm:GameFileViewModel}">
<listExplorer:FileRow />
</DataTemplate>
<DataTemplate x:Key="ListFolderDataTemplate"
DataType="{x:Type vm:TreeItem}">
<listExplorer:FolderRow ContextMenu="{StaticResource FolderContextMenu}" />
</DataTemplate>
<DataTemplate x:Key="TextureNumTemplate">
<Border VerticalAlignment="Top"
HorizontalAlignment="Right"
Margin="4"
Padding="6,2"
CornerRadius="3"
Opacity="0.85"
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding}"
Foreground="White"
FontSize="11"
FontWeight="SemiBold"
VerticalAlignment="Center"
Margin="0,0,5,0" />
<Path Data="{StaticResource TextureIcon}"
Fill="White"
Width="12"
Height="12"
Stretch="Uniform"
VerticalAlignment="Center" />
</StackPanel>
</Border>
</DataTemplate>
<Style x:Key="AssetsListBox"
TargetType="ListBox"
BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="ItemsSource"
Value="{Binding SelectedItem.AssetsList.AssetsView, ElementName=AssetsFolderName, IsAsync=True}" />
<Setter Property="SelectionMode"
Value="Extended" />
<Setter Property="ContextMenu"
Value="{StaticResource FileContextMenu}" />
<Setter Property="VirtualizingPanel.IsVirtualizing"
Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode"
Value="Recycling" />
<Setter Property="adonisExtensions:ScrollViewerExtension.VerticalScrollBarExpansionMode"
Value="NeverExpand" />
<Setter Property="adonisExtensions:ScrollViewerExtension.VerticalScrollBarPlacement"
Value="Docked" />
<Setter Property="adonisExtensions:ScrollViewerExtension.HorizontalScrollBarExpansionMode"
Value="NeverExpand" />
<Setter Property="adonisExtensions:ScrollViewerExtension.HorizontalScrollBarPlacement"
Value="Docked" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image x:Name="ListImage"
Source="/FModel;component/Resources/unknown_asset.png"
Width="16"
Height="16"
HorizontalAlignment="Center"
Margin="0 0 3 0" />
<TextBlock Grid.Column="1"
HorizontalAlignment="Left"
Text="{Binding Asset.Name}" />
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Asset.Extension}"
Value="uasset">
<Setter TargetName="ListImage"
Property="Source"
Value="/FModel;component/Resources/asset.png" />
</DataTrigger>
<DataTrigger Binding="{Binding Asset.Extension}"
Value="ini">
<Setter TargetName="ListImage"
Property="Source"
Value="/FModel;component/Resources/asset_ini.png" />
</DataTrigger>
<DataTrigger Binding="{Binding Asset.Extension}"
Value="png">
<Setter TargetName="ListImage"
Property="Source"
Value="/FModel;component/Resources/asset_png.png" />
</DataTrigger>
<DataTrigger Binding="{Binding Asset.Extension}"
Value="psd">
<Setter TargetName="ListImage"
Property="Source"
Value="/FModel;component/Resources/asset_psd.png" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}"
BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="Padding"
Value="5 3" />
<Setter Property="IsSelected"
Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="controls:ListBoxItemBehavior.IsBroughtIntoViewWhenSelected"
Value="True" />
<EventSetter Event="PreviewMouseRightButtonDown"
Handler="OnPreviewMouseRightButtonDown" />
</Style>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Items.Count, RelativeSource={RelativeSource Self}, FallbackValue=0}"
Value="0">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<TextBlock Text="No packages found in folder"
FontWeight="SemiBold"
TextAlignment="Center"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ErrorBrush}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@ -1,4 +1,4 @@
<UserControl x:Class="FModel.Views.Resources.Controls.TiledExplorer.FileButton2"
<UserControl x:Class="FModel.Views.Resources.Controls.TiledExplorer.FileButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@ -2,9 +2,9 @@ using System.Windows.Controls;
namespace FModel.Views.Resources.Controls.TiledExplorer;
public partial class FileButton2 : UserControl
public partial class FileButton : UserControl
{
public FileButton2()
public FileButton()
{
InitializeComponent();
}

View File

@ -1,4 +1,4 @@
<UserControl x:Class="FModel.Views.Resources.Controls.TiledExplorer.FolderButton2"
<UserControl x:Class="FModel.Views.Resources.Controls.TiledExplorer.FolderButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@ -2,9 +2,9 @@ using System.Windows.Controls;
namespace FModel.Views.Resources.Controls.TiledExplorer;
public partial class FolderButton3 : UserControl
public partial class FolderButton : UserControl
{
public FolderButton3()
public FolderButton()
{
InitializeComponent();
}

View File

@ -1,11 +0,0 @@
using System.Windows.Controls;
namespace FModel.Views.Resources.Controls.TiledExplorer;
public partial class FolderButton2 : UserControl
{
public FolderButton2()
{
InitializeComponent();
}
}

View File

@ -1,92 +0,0 @@
<UserControl x:Class="FModel.Views.Resources.Controls.TiledExplorer.FolderButton3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignWidth="128" d:DesignHeight="192"
d:DataContext="{d:DesignInstance Type=vm:TreeItem, IsDesignTimeCreatable=False}"
xmlns:vm="clr-namespace:FModel.ViewModels"
xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
Width="128" Height="192"
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer4BackgroundBrush}}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="2" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Viewbox Grid.Row="0" Height="128">
<Canvas Width="128" Height="128">
<Canvas.Resources>
<LinearGradientBrush x:Key="TabGradient" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#c9975f" Offset="0" />
<GradientStop Color="#b28c53" Offset="0.5" />
<GradientStop Color="#a67f47" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="BodyGradient" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#d4ae75" Offset="0" />
<GradientStop Color="#c9a167" Offset="0.3" />
<GradientStop Color="#b89456" Offset="1" />
</LinearGradientBrush>
</Canvas.Resources>
<Path Fill="{StaticResource TabGradient}" Data="M16.0018 36l0 -0.0701281 -0.00162402 -6.66681c-0.00509351,-0.616462 0.113829,-1.21757 0.342594,-1.77092 0.231423,-0.559917 0.572171,-1.07266 1.00696,-1.50532 0.433169,-0.431029 0.945252,-0.767794 1.50347,-0.997075 0.565823,-0.232308 1.16664,-0.355291 1.76937,-0.355291l21.1332 0c0.951601,0 1.85847,0.293947 2.61673,0.810088 0.736639,0.501452 1.3282,1.21875 1.67805,2.08502l0.00118111 -0.000442914 3.63056 8.46288 0.00346949 0.00797243 -33.6839 0z" />
<Path Fill="{StaticResource BodyGradient}" Data="M108.153 43.8407l-0.0177904 9.81969c0.785875,0.192373 1.50296,0.514888 2.10509,0.981201 1.08706,0.841681 1.75062,2.06176 1.75298,3.71021l-0.000664368 39.2644 0.00752957 0c0,1.58298 -0.652563,3.01883 -1.70758,4.06093 -1.045,1.03266 -2.48541,1.67126 -4.072,1.67126l-5.88529 0c-0.0760337,0.00967031 -0.159523,0.017126 -0.266782,0.017126l-76.1944 0c-2.15884,0 -4.12043,-0.871213 -5.54403,-2.27754 -1.43312,-1.4157 -2.32116,-3.36711 -2.32116,-5.51553l0.00752957 0 -0.0145423 -59.5726 33.6839 0 0.053814 0.125493 50.7405 0.0420768 0 -0.00745568c2.16629,0 4.07872,0.839394 5.45766,2.21856 1.38698,1.38706 2.22269,3.30945 2.22269,5.46209l-0.00752957 0z" />
<Path Fill="#b28c53" Data="M108 53.6604l-74.8763 0c-0.499091,0 -0.926356,0.196998 -1.22768,0.512895 -0.339715,0.356103 -0.542126,0.865894 -0.542126,1.43438l0 47.7579 -3.84043 0 0 -47.7579c0,-1.56880 0.600001,-3.01883 1.60733,-4.07466 1.00667,-1.05509 2.4017,-1.71304 4.00291,-1.71304l74.8763 0 0 3.84043z" />
<Ellipse Canvas.Left="80" Canvas.Top="80" Width="36" Height="36"
Opacity="0.95" Stroke="#b28c53" StrokeThickness="1.5"
Fill="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}"
Visibility="{Binding Visibility, ElementName=HintIcon}" />
<Path x:Name="HintIcon" Canvas.Left="88" Canvas.Top="88" Width="20" Height="20" Stretch="Uniform"
Data="{Binding Header, Converter={x:Static converters:FolderToGeometryConverter.Instance}}"
Fill="{Binding Header, Converter={x:Static converters:FolderToGeometryConverter.Instance}}">
<Path.Style>
<Style TargetType="Path">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding Data, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Canvas>
</Viewbox>
<Grid Grid.Row="2" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="2" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Header, FallbackValue=Folder Name}"
FontSize="13" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" FontWeight="DemiBold"
TextAlignment="Center" HorizontalAlignment="Stretch" VerticalAlignment="Top"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition>
<ColumnDefinition.Width>
<MultiBinding Converter="{x:Static converters:RatioToGridLengthConverter.Instance}">
<Binding Path="Folders.Count" />
<Binding Path="AssetsList.Assets.Count" />
</MultiBinding>
</ColumnDefinition.Width>
</ColumnDefinition>
<ColumnDefinition Width="1" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="#E8C480" />
<Border Grid.Column="2" Background="#A8D8EA" />
</Grid>
</Grid>
</Grid>
</UserControl>

View File

@ -1,211 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vwp="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
xmlns:vm="clr-namespace:FModel.ViewModels"
xmlns:controls="clr-namespace:FModel.Views.Resources.Controls"
xmlns:local="clr-namespace:FModel.Views.Resources.Controls.TiledExplorer"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
xmlns:adonisConverters="clr-namespace:AdonisUI.Converters;assembly=AdonisUI"
x:Class="FModel.Views.Resources.Controls.TiledExplorer.ResourcesDictionary">
<controls:TypeDataTemplateSelector x:Key="TemplateSelector" />
<Style x:Key="TiledExplorer" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="local:SmoothScroll.IsEnabled" Value="True" />
<Setter Property="local:SmoothScroll.Factor" Value="1.25" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="ContextMenu" Value="{StaticResource FileContextMenu}" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=OneWay}" />
<Setter Property="Margin" Value="5" />
<Setter Property="Padding" Value="5" />
<Setter Property="BorderThickness" Value="1.5" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="controls:ListBoxItemBehavior.IsBroughtIntoViewWhenSelected" Value="True" />
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.Layer0BackgroundBrush}}" />
<EventSetter Event="MouseDoubleClick" Handler="OnMouseDoubleClick" />
<EventSetter Event="PreviewMouseRightButtonDown" Handler="OnPreviewMouseRightButtonDown" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid>
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding adonisExtensions:CornerRadiusExtension.CornerRadius}">
<ContentPresenter />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<vwp:VirtualizingWrapPanel Orientation="Horizontal" SpacingMode="Uniform" ScrollUnit="Pixel" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<ContentControl Content="{Binding}" ContentTemplateSelector="{StaticResource TemplateSelector}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Grid>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Focusable="False">
<ItemsPresenter />
</ScrollViewer>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ItemsSource, RelativeSource={RelativeSource Self}, Converter={x:Static adonisConverters:IsNullToBoolConverter.Instance}}" Value="False" />
<Condition Binding="{Binding Items.Count, RelativeSource={RelativeSource Self}, FallbackValue=0}" Value="0" />
</MultiDataTrigger.Conditions>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<TextBlock Text="No folders or packages found" FontWeight="SemiBold" TextAlignment="Center"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ErrorBrush}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</MultiDataTrigger>
</Style.Triggers>
</Style>
<DataTemplate x:Key="TiledFileDataTemplate" DataType="{x:Type vm:GameFileViewModel}">
<local:FileButton2 />
</DataTemplate>
<DataTemplate x:Key="TiledFolderDataTemplate" DataType="{x:Type vm:TreeItem}">
<local:FolderButton2 ContextMenu="{StaticResource FolderContextMenu}" />
</DataTemplate>
<DataTemplate x:Key="TextureNumTemplate">
<Border VerticalAlignment="Top"
HorizontalAlignment="Right"
Margin="4"
Padding="6,2"
CornerRadius="3"
Opacity="0.85"
Background="{DynamicResource {x:Static adonisUi:Brushes.Layer3BackgroundBrush}}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding}"
Foreground="White"
FontSize="11"
FontWeight="SemiBold"
VerticalAlignment="Center"
Margin="0,0,5,0" />
<Path Data="{StaticResource TextureIcon}"
Fill="White"
Width="12"
Height="12"
Stretch="Uniform"
VerticalAlignment="Center" />
</StackPanel>
</Border>
</DataTemplate>
<Style x:Key="AssetsListBox" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="ItemsSource" Value="{Binding SelectedItem.AssetsList.AssetsView, ElementName=AssetsFolderName, IsAsync=True}" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="ContextMenu" Value="{StaticResource FileContextMenu}" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
<Setter Property="adonisExtensions:ScrollViewerExtension.VerticalScrollBarExpansionMode" Value="NeverExpand"/>
<Setter Property="adonisExtensions:ScrollViewerExtension.VerticalScrollBarPlacement" Value="Docked"/>
<Setter Property="adonisExtensions:ScrollViewerExtension.HorizontalScrollBarExpansionMode" Value="NeverExpand"/>
<Setter Property="adonisExtensions:ScrollViewerExtension.HorizontalScrollBarPlacement" Value="Docked"/>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image x:Name="ListImage" Source="/FModel;component/Resources/unknown_asset.png"
Width="16" Height="16" HorizontalAlignment="Center" Margin="0 0 3 0" />
<TextBlock Grid.Column="1" HorizontalAlignment="Left" Text="{Binding Asset.Name}" />
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Asset.Extension}" Value="uasset">
<Setter TargetName="ListImage" Property="Source" Value="/FModel;component/Resources/asset.png" />
</DataTrigger>
<DataTrigger Binding="{Binding Asset.Extension}" Value="ini">
<Setter TargetName="ListImage" Property="Source" Value="/FModel;component/Resources/asset_ini.png" />
</DataTrigger>
<DataTrigger Binding="{Binding Asset.Extension}" Value="png">
<Setter TargetName="ListImage" Property="Source" Value="/FModel;component/Resources/asset_png.png" />
</DataTrigger>
<DataTrigger Binding="{Binding Asset.Extension}" Value="psd">
<Setter TargetName="ListImage" Property="Source" Value="/FModel;component/Resources/asset_psd.png" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="5 3" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="controls:ListBoxItemBehavior.IsBroughtIntoViewWhenSelected" Value="True" />
<EventSetter Event="PreviewMouseRightButtonDown" Handler="OnPreviewMouseRightButtonDown" />
</Style>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Items.Count, RelativeSource={RelativeSource Self}, FallbackValue=0}" Value="0">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<TextBlock Text="No packages found in folder" FontWeight="SemiBold" TextAlignment="Center"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ErrorBrush}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@ -4,15 +4,25 @@ using FModel.ViewModels;
namespace FModel.Views.Resources.Controls;
public class TypeDataTemplateSelector : DataTemplateSelector
public sealed class TypeDataTemplateSelector : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
public object FolderTemplateKey { get; set; }
public object FileTemplateKey { get; set; }
public override DataTemplate? SelectTemplate(object? item, DependencyObject container)
{
return item switch
if (container is not FrameworkElement element)
return base.SelectTemplate(item, container);
var key = item switch
{
TreeItem when container is FrameworkElement f => f.FindResource("TiledFolderDataTemplate") as DataTemplate,
GameFileViewModel when container is FrameworkElement f => f.FindResource("TiledFileDataTemplate") as DataTemplate,
_ => base.SelectTemplate(item, container)
TreeItem => FolderTemplateKey,
GameFileViewModel => FileTemplateKey,
_ => null
};
return key is not null
? element.TryFindResource(key) as DataTemplate
: base.SelectTemplate(item, container);
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace FModel.Views.Resources.Converters;
public sealed class EnumToBoolConverter : IValueConverter
{
public static readonly EnumToBoolConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is null || parameter is null)
return false;
var enumType = value.GetType();
if (!enumType.IsEnum)
return false;
var target = parameter is string text
? Enum.Parse(enumType, text, ignoreCase: true)
: parameter;
return value.Equals(target);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is true && parameter is not null
? parameter
: Binding.DoNothing;
}
}

View File

@ -1,32 +0,0 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace FModel.Views.Resources.Converters;
public class RatioToGridLengthConverter : IMultiValueConverter
{
public static readonly RatioToGridLengthConverter Instance = new();
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length < 2)
return new GridLength(1, GridUnitType.Star);
var count1 = values[0] is int c1 ? c1 : 0;
var count2 = values[1] is int c2 ? c2 : 0;
var total = count1 + count2;
if (total == 0) return new GridLength(1, GridUnitType.Star);
var ratio = (double)count1 / total;
return new GridLength(ratio, GridUnitType.Star);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

View File

@ -111,7 +111,9 @@
<Geometry x:Key="World4">M11.5 3a17 17 0 0 0 0 18</Geometry>
<Geometry x:Key="World5">M12.5 3a17 17 0 0 1 0 18</Geometry>
<Geometry x:Key="ThemeIcon">M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z</Geometry>
<Geometry x:Key="GridIcon">M3 11H11V3H3M3 21H11V13H3M13 21H21V13H13M13 3V11H21V3</Geometry>
<Geometry x:Key="ListIcon">M9 5V9H21V5M9 19H21V15H9M9 14H21V10H9M4 9H8V5H4M4 19H8V15H4M4 14H8V10H4V14Z</Geometry>
<!-- For specific games-->
<Geometry x:Key="BorderlandsIcon">M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6 ZM12,11A3,3 0 1,0 12,17A3,3 0 0,0 12,11 ZM12,12.5L14,16H13L12,14.5L11,16H10L12,12.5Z</Geometry>
<Geometry x:Key="AionIcon">M609 180.1c-19.4 2.3-38.2 7.8-56.5 16.8-53.8 26.5-89.2 74.9-98.7 135.1-1.1 7-1.3 133.1-1.3 739 0 693.9.1 731 1.8 741.4 12.8 79.4 70.7 137.8 149.2 150.6 11.8 2 20.6 2 563.5 2s551.7 0 563.5-2c57.2-9.3 104-43 130.8-94.1 9.1-17.2 14.6-33.9 18.4-55.4 1.6-9.4 1.8-40.6 2-554l.3-544-268.2-268.2L1345.5 179l-364.5.1c-200.5.1-367.9.5-372 1m893 378.4L1747.5 804H1256V558.5c0-135 .1-245.5.3-245.5.1 0 110.7 110.5 245.7 245.5m-792.1 532c24.5 1.3 47 2.9 49.8 3.4 7.1 1.3 12.8 5.5 22.5 16.4 6.4 7.3 9.2 11.5 13.6 20.7 9.2 19.4 21.4 47.2 44.4 101.5 27.5 65.1 39.7 92.3 55.5 124 6.9 13.7 16.1 32.9 20.5 42.5 8.2 17.9 15.4 31.9 18.3 35.5 1.5 1.8 1.5-7.2.9-109-.6-108.7-.7-111.1-2.7-116.5-3.1-8.3-10-14.5-24.7-22-10.1-5.1-11.9-6.4-10.9-7.6 1.6-2 5.8-1.8 21.3 1.1 19.3 3.6 39.1 4.5 97.7 4.5 42.1 0 51.9.3 53.4 1.4 1.8 1.3 1.8 1.4-.1 1.9-1 .3-3.9.8-6.4 1.2s-8.5 1.7-13.5 3c-4.9 1.3-12.1 2.6-16 3-7.9.8-14.3 3.2-18 6.9l-2.5 2.5v123.7c0 121.8 0 123.8 2 125.9 1.4 1.5 2.1 4.1 2.6 9.2.8 8.1 2.2 10.1 12.6 17.2 9.3 6.5 9.3 6.5-26.7 7.3-17.6.4-45.3.7-61.5.5-29.2-.2-29.5-.2-29.8-2.3-.2-1.7.7-2.5 5.5-4.5 3.2-1.3 7.5-4.1 9.8-6.4 4.5-4.5 8.3-11 7.2-12.2-1.3-1.2-72.8-1.6-90.2-.5-13.5.9-16.2.8-17.5-.4-1.9-1.9-.9-2.7 8-6.4 9.8-4.1 11-5.2 11-11 0-3.9-3.7-13.2-22.3-56.1l-22.3-51.4-4.5-.6c-13.1-2-52.1-3.1-69.3-2-14.4.9-38.5 3.6-39.3 4.4-.1.1-5.6 13.5-12.3 29.7s-16 38.7-20.7 50c-7.4 17.9-8.5 21.1-8.1 25.1.6 5.6 3.9 10.3 10.2 14.3 4.8 3 5.8 5.1 2.9 5.8-1 .2-10.6 0-21.3-.5-21.7-.9-83.9-.2-108.4 1.3-22.1 1.4-22.5.3-1.7-5 17.9-4.6 33.3-9.6 42.4-13.7l7.7-3.6 6.9-13.1c3.8-7.2 14.2-27.5 23.1-45.2 17.9-35.6 19-38.9 15.5-47.9-1-2.7-1.4-5.6-1.1-7.1.4-1.5 8.1-10.1 17.5-19.8 9.2-9.4 17.6-18.6 18.5-20.4s6.4-15.7 12.2-30.8c5.7-15.1 17.9-46.7 27.1-70.2l16.6-42.7-9.3-18.2c-5.1-10-10.7-19.8-12.5-21.6-6-6.1-16.6-9.9-32-11.4-7.8-.8-8-.9-8.3-3.6s-.3-2.7 5.9-2.7c3.5 0 26.3 1.1 50.8 2.5m999.3 20.4c3 5.2 4.8 10.9 9.7 31 8.8 35.5 11.8 55.6 14.2 93.1 1.5 24.1.6 87-1.5 108-1.8 17.4-4.4 37.5-5.3 40.5-.3 1.3-.2 1.7.5 1 1.2-1.2 11.9-33.8 16.2-49.5 1.8-6.3 3.7-12.4 4.2-13.4 3.4-6.4 2.2 14.4-2 34.9-1.3 6.3-1.5 9.6-.9 10.7 2.1 3.3-9.4 55.8-18.3 83.3-5.5 17.2-15.6 42.7-18.1 45.9-1.1 1.5-2.6 2.3-3.4 1.9-.8-.3-5.7-6.9-10.9-14.7-17.4-26.2-33.3-45.2-60.7-72.1-16.4-16.1-29.1-27.5-45.6-41-4-3.2-7.5-6.5-7.8-7.3-1.2-3.2 5.5.3 19.9 10.4 8.1 5.8 15 10.3 15.2 10.2.4-.5-17.3-14.6-37.1-29.4-43.5-32.7-81.4-58.4-86.1-58.4-1.3 0-1.4 9.9-.8 86.7.4 61.2 1 87.5 1.8 89.3 1.4 3.1 7.5 7.2 14 9.5 6.9 2.4 7.6 3.2 4.6 5.5-2.4 1.9-5 2-74.2 2-45.3 0-71.8-.4-71.8-1 0-.9 3.2-1.9 12-3.9 9.2-2.1 22.3-6.2 26.9-8.6 7.6-3.8 8.9-8.7 10.1-38 1.3-29.8 2.5-203 1.5-217.8-.7-11.3-.9-12-3.8-15.3-1.6-1.9-4.3-4.2-6-5-5.1-2.7-24.7-6.3-42.9-7.9-9.7-.8-18.4-1.8-19.2-2.1-1.4-.5-2.2-2-1.3-2.6.3-.2 73.8-1.9 90.7-2.1 12.6-.2 13.9-.4 19.5-3 4.8-2.3 8.6-3.1 19.5-4.2 18.5-1.9 34.2-2.3 34.7-.9.3 1-2.3 4.6-10.9 14.7l-3.3 3.9-.3 20.2-.3 20.2 5.7 8c17.5 24.5 49.6 55.6 93.9 91 20 16.1 58.7 45.6 59.1 45.1.7-.7 6.5-38.1 8.5-55.7 3-25 3.3-66.8.6-84-2.5-16.2-9.6-43-11.4-43-.2 0-8.1 7.2-17.5 16.1-9.3 8.8-17.2 15.8-17.5 15.5s2.7-4.5 6.8-9.3c13-15.6 35.1-41.7 37.2-44.1 1.1-1.2 1.8-2.2 1.4-2.2-.3 0-16.9 17-36.8 37.7-37.3 38.8-41.5 43-42.6 41.9-.8-.8-4.1 3.1 54-63.3 28.4-32.6 51.7-59.6 51.7-59.9s-3.2 2.3-7 5.7c-14.3 12.9-15.9 13.8-7.5 4.4 16.1-18.1 32.8-35.6 33.9-35.2.6.2 2.8 3.2 4.8 6.6m-578.4 94.3c-.3.7-5 4.4-10.5 8.3-13.5 9.4-17.7 12.9-31.6 26.4-8.1 8-13.5 14.2-17.6 20.5-6.8 10.7-11.5 18.6-10.9 18.6.3 0 2-2.1 3.8-4.8 5.1-7.1 19.5-21.6 28.5-28.7 24.4-19.1 53.7-31.3 89-37.2 13.7-2.2 53.7-2.5 68.5-.5 45.5 6.4 82.4 22.6 109.1 48 26 24.7 40.4 54.7 45 93.7 1.7 14.2.6 42.3-2.1 54.9-8.5 39.6-25.4 68.8-53.5 92.6-15.5 13-29.1 20.9-45.7 26.5-18.4 6.1-35.4 7.7-56 5.3l-10.3-1.3 10.5-.6c11.4-.8 27.2-3.2 31.1-4.9 2.3-.9 2.2-1-.6-.5-15.1 2.4-38.9 3.2-48.9 1.5-11.5-1.9-10.1-4 6.3-9.9 6.2-2.3 15.4-6.2 20.4-8.8 56.5-29.2 84.7-97.9 69.1-168.3-11.5-51.5-43.4-85-89.3-93.6-11.4-2.1-32.9-2.2-44.2 0-40.6 7.7-70 34.9-84.5 78.1-5.8 17.5-7.7 31.8-7.1 54 .6 21.3 2.2 32.3 7.3 49.2 11.8 39 34.4 64.6 78.4 88.7 4.7 2.6 9.6 5.8 11 7.1 2.3 2.4 2.4 2.6.7 4.2-1.6 1.6-3.8 1.8-17 1.7-45.3-.2-82.1-18.2-112.6-55-4.2-5.1-9.6-12.4-12.1-16.2-2.5-3.9-4.9-7.1-5.4-7.1-.5-.1-.6 3.7-.3 8.5l.5 8.5-2.4-2.2c-3-2.8-10.5-17.2-14.3-27.7-7.2-19.5-12.1-46.9-12.1-67.8 0-30.8 5.7-56.3 18.5-81.9 16.2-32.6 43.1-58.4 79-75.7 10.3-4.9 13-5.7 12.3-3.6 M731 1231.2c-6.2 15.5-15.9 40.1-21.6 54.5-5.7 14.5-10.4 26.7-10.4 27.2 0 1.5 7.9 2 39 2.7 26.5.5 51.1-.3 52.6-1.8.6-.6-46.1-108.6-47.5-110.1-.5-.5-5.9 11.9-12.1 27.5</Geometry>

View File

@ -2258,4 +2258,27 @@
</Setter>
</Style>
<!-- Just to keep border color during toggle -->
<Style x:Key="ExplorerViewToggleButton"
TargetType="{x:Type ToggleButton}"
BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Width"
Value="32" />
<Setter Property="Height"
Value="28" />
<Setter Property="Padding"
Value="7" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="BorderBrush"
Value="{DynamicResource {x:Static adonisUi:Brushes.Layer0BorderBrush}}" />
<Style.Triggers>
<Trigger Property="IsChecked"
Value="True">
<Setter Property="BorderBrush"
Value="{DynamicResource {x:Static adonisUi:Brushes.Layer1InteractionBorderBrush}}" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>