This commit is contained in:
Wiesław Šoltés 2021-08-24 21:56:00 +02:00
Родитель b7ed911864
Коммит 40b8c02bfc
36 изменённых файлов: 233 добавлений и 141 удалений

Просмотреть файл

Просмотреть файл

@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>True</IsPackable>
<Nullable>enable</Nullable>
<RootNamespace>SvgConverter</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<AnalysisLevel>latest</AnalysisLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>0.10.6</VersionPrefix>
<VersionSuffix>preview1</VersionSuffix>
<Authors>Wiesław Šoltés</Authors>
<Company>Wiesław Šoltés</Company>
<Copyright>Copyright © Wiesław Šoltés 2021</Copyright>
<PackageProjectUrl>https://github.com/wieslawsoltes/SvgToXaml</PackageProjectUrl>
</PropertyGroup>
<PropertyGroup>
<Description>An Svg to Xaml conveter.</Description>
<PackageId>SvgConverter</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>svg;xaml;axaml;avalonia;avaloniaui;convert;converter;vector graphics;rendering;2d;graphics;geometry;shapes;skiasharp;skia</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Svg.Skia" Version="0.5.7.1" />
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.120" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SvgModel\Model\**\*.cs">
<LinkBase>Converter\Model</LinkBase>
</Compile>
</ItemGroup>
</Project>

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>True</IsPackable>
<Nullable>enable</Nullable>
<RootNamespace>SvgToXamlConverter</RootNamespace>
<RootNamespace>SvgModel</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<AnalysisLevel>latest</AnalysisLevel>
@ -19,8 +19,8 @@
<PackageProjectUrl>https://github.com/wieslawsoltes/SvgToXaml</PackageProjectUrl>
</PropertyGroup>
<PropertyGroup>
<Description>An Svg to Xaml conveter.</Description>
<PackageId>SvgToXamlConverter</PackageId>
<Description>An Svg drawing model.</Description>
<PackageId>SvgModel</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>svg;xaml;axaml;avalonia;avaloniaui;convert;converter;vector graphics;rendering;2d;graphics;geometry;shapes;skiasharp;skia</PackageTags>
</PropertyGroup>

Просмотреть файл

@ -0,0 +1,6 @@
#if NET461 || NETSTANDARD
namespace System.Runtime.CompilerServices
{
internal static class IsExternalInit {}
}
#endif

Просмотреть файл

@ -5,7 +5,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgToXaml", "SvgToXaml\SvgT
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "svgxaml", "svgxaml\svgxaml.csproj", "{06BE0887-524B-4119-814D-42AE1DCA4C91}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgToXamlConverter", "SvgToXamlConverter\SvgToXamlConverter.csproj", "{DFCAD52A-92A3-4421-9620-923A9271D016}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgModel", "SvgModel\SvgModel.csproj", "{DFCAD52A-92A3-4421-9620-923A9271D016}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgConverter", "SvgConverter\SvgConverter.csproj", "{DC4DBC06-FA81-4658-8718-F0A004CE0C2E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -25,5 +27,9 @@ Global
{DFCAD52A-92A3-4421-9620-923A9271D016}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFCAD52A-92A3-4421-9620-923A9271D016}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFCAD52A-92A3-4421-9620-923A9271D016}.Release|Any CPU.Build.0 = Release|Any CPU
{DC4DBC06-FA81-4658-8718-F0A004CE0C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC4DBC06-FA81-4658-8718-F0A004CE0C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC4DBC06-FA81-4658-8718-F0A004CE0C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC4DBC06-FA81-4658-8718-F0A004CE0C2E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Просмотреть файл

@ -11,9 +11,7 @@ namespace SvgToXaml
{
public class App : Application
{
private const string SettingsFileName = "settings.json";
private const string PathsFileName = "paths.txt";
private const string ProjectFileName = "project.json";
public override void Initialize()
{
@ -35,36 +33,26 @@ namespace SvgToXaml
desktop.Startup += (_, _) =>
{
if (File.Exists(SettingsFileName))
if (File.Exists(ProjectFileName))
{
var json = File.ReadAllText(SettingsFileName);
var settings = JsonSerializer.Deserialize<SettingsViewModel>(json);
if (settings is { })
var json = File.ReadAllText(ProjectFileName);
var project = JsonSerializer.Deserialize<ProjectViewModel>(json);
if (project is { })
{
mainViewModel.Settings = settings;
}
}
if (File.Exists(PathsFileName))
{
var paths = File.ReadAllLines(PathsFileName);
if (paths.Length > 0)
{
mainViewModel.Add(paths);
mainViewModel.Project = project;
foreach (var fileItemViewModel in mainViewModel.Project.Items)
{
mainViewModel.Initialize(fileItemViewModel);
}
}
}
};
desktop.Exit += (_, _) =>
{
var paths = mainViewModel.Items?.Select(x => x.Path);
if (paths is { })
{
File.WriteAllLines(PathsFileName, paths);
}
var json = JsonSerializer.Serialize(mainViewModel.Settings);
File.WriteAllText(SettingsFileName, json);
var json = JsonSerializer.Serialize(mainViewModel.Project);
File.WriteAllText(ProjectFileName, json);
};
}

Просмотреть файл

@ -24,13 +24,13 @@
<PackageReference Include="System.Text.Json" Version="5.0.2" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SvgToXamlConverter\Model\**\*.cs">
<Compile Include="..\SvgModel\Model\**\*.cs">
<LinkBase>Converter\Model</LinkBase>
</Compile>
<Compile Include="..\SvgToXamlConverter\Generator\**\*.cs">
<Compile Include="..\SvgConverter\Generator\**\*.cs">
<LinkBase>Converter\Generator</LinkBase>
</Compile>
<Compile Include="..\SvgToXamlConverter\*.cs">
<Compile Include="..\SvgConverter\*.cs">
<LinkBase>Converter</LinkBase>
</Compile>
</ItemGroup>

Просмотреть файл

@ -1,4 +1,5 @@
using System;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
@ -14,44 +15,60 @@ namespace SvgToXaml.ViewModels
private SKSvg? _svg;
private SkiaSharp.SKPicture? _picture;
[JsonInclude]
public string Name
{
get => _name;
private set => this.RaiseAndSetIfChanged(ref _name, value);
}
[JsonInclude]
public string Path
{
get => _path;
private set => this.RaiseAndSetIfChanged(ref _path, value);
}
[JsonIgnore]
public SKSvg? Svg
{
get => _svg;
private set => this.RaiseAndSetIfChanged(ref _svg, value);
}
[JsonIgnore]
public SkiaSharp.SKPicture? Picture
{
get => _picture;
private set => this.RaiseAndSetIfChanged(ref _picture, value);
}
public ICommand PreviewCommand { get; }
[JsonIgnore]
public ICommand? PreviewCommand { get; private set; }
public ICommand RemoveCommand { get; }
[JsonIgnore]
public ICommand? RemoveCommand { get; private set; }
public FileItemViewModel(string name, string path, Func<FileItemViewModel, Task> preview, Func<FileItemViewModel, Task> remove)
[JsonConstructor]
public FileItemViewModel(string name, string path)
{
_name = name;
_path = path;
PreviewCommand = ReactiveCommand.CreateFromTask(async () => await preview(this));
RemoveCommand = ReactiveCommand.Create(async () => await remove(this));
}
public FileItemViewModel(string name, string path, Func<FileItemViewModel, Task> preview, Func<FileItemViewModel, Task> remove)
: this(name, path)
{
Initialize(preview, remove);
}
public void Initialize(Func<FileItemViewModel, Task> preview, Func<FileItemViewModel, Task> remove)
{
PreviewCommand = ReactiveCommand.CreateFromTask(async () => await preview(this));
RemoveCommand = ReactiveCommand.Create(async () => await remove(this));
}
public async Task Load()
{
if (_isLoading)

Просмотреть файл

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
@ -20,56 +20,41 @@ namespace SvgToXaml.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{
private FileItemViewModel? _selectedItem;
private ObservableCollection<FileItemViewModel>? _items;
private SettingsViewModel _settings;
private ProjectViewModel _project;
public FileItemViewModel? SelectedItem
[JsonInclude]
public ProjectViewModel Project
{
get => _selectedItem;
set => this.RaiseAndSetIfChanged(ref _selectedItem, value);
}
public ObservableCollection<FileItemViewModel>? Items
{
get => _items;
set => this.RaiseAndSetIfChanged(ref _items, value);
}
public SettingsViewModel Settings
{
get => _settings;
set => this.RaiseAndSetIfChanged(ref _settings, value);
get => _project;
set => this.RaiseAndSetIfChanged(ref _project, value);
}
[JsonIgnore]
public ICommand ClearCommand { get; }
[JsonIgnore]
public ICommand AddCommand { get; }
[JsonIgnore]
public ICommand CopySelectedCommand { get; }
[JsonIgnore]
public ICommand CopyAllCommand { get; }
[JsonIgnore]
public ICommand ExportSelectedCommand { get; }
[JsonIgnore]
public ICommand ExportAllCommand { get; }
[JsonIgnore]
public ICommand ClipboardCommand { get; }
[JsonConstructor]
public MainWindowViewModel()
{
_items = new ObservableCollection<FileItemViewModel>();
_settings = new SettingsViewModel()
{
EnableGenerateImage = true,
EnableGeneratePreview = true,
UseResources = true,
ReuseExistingResources = true,
UseCompatMode = false,
UseBrushTransform = false,
};
_project = new ProjectViewModel();
ClearCommand = ReactiveCommand.Create(Clear);
AddCommand = ReactiveCommand.CreateFromTask(async () => await Add());
@ -85,7 +70,7 @@ namespace SvgToXaml.ViewModels
ClipboardCommand = ReactiveCommand.CreateFromTask<string>(async format => await Clipboard(format));
// ReSharper disable once AsyncVoidLambda
this.WhenAnyValue(x => x.SelectedItem).Subscribe(async x =>
this.WhenAnyValue(x => x.Project.SelectedItem).Subscribe(async x =>
{
if (x is { })
{
@ -94,13 +79,13 @@ namespace SvgToXaml.ViewModels
});
// ReSharper disable once AsyncVoidLambda
this.WhenAnyValue(x => x.Settings.UseCompatMode).Subscribe(async _ =>
this.WhenAnyValue(x => x.Project.Settings.UseCompatMode).Subscribe(async _ =>
{
await Reload();
});
// ReSharper disable once AsyncVoidLambda
this.WhenAnyValue(x => x.Settings.UseBrushTransform).Subscribe(async _ =>
this.WhenAnyValue(x => x.Project.Settings.UseBrushTransform).Subscribe(async _ =>
{
await Reload();
});
@ -108,8 +93,8 @@ namespace SvgToXaml.ViewModels
private void Clear()
{
SelectedItem = null;
_items?.Clear();
Project.SelectedItem = null;
Project.Items.Clear();
}
private async Task Add()
@ -133,12 +118,12 @@ namespace SvgToXaml.ViewModels
private async Task CopySelected(string format)
{
if (_selectedItem is null || string.IsNullOrWhiteSpace(format))
if (Project.SelectedItem is null || string.IsNullOrWhiteSpace(format))
{
return;
}
var xaml = await ToXaml(_selectedItem, _settings.EnableGenerateImage);
var xaml = await ToXaml(Project.SelectedItem, Project.Settings.EnableGenerateImage);
await SetClipboard(xaml);
}
@ -150,17 +135,14 @@ namespace SvgToXaml.ViewModels
return;
}
var paths = Items?.Select(x => x.Path).ToList();
if (paths is { })
{
var xaml = await ToXamlStyles(paths);
await SetClipboard(xaml);
}
var paths = Project.Items.Select(x => x.Path).ToList();
var xaml = await ToXamlStyles(paths);
await SetClipboard(xaml);
}
private async Task ExportSelected(string format)
{
if (_selectedItem is null || string.IsNullOrWhiteSpace(format))
if (Project.SelectedItem is null || string.IsNullOrWhiteSpace(format))
{
return;
}
@ -169,11 +151,11 @@ namespace SvgToXaml.ViewModels
dlg.Filters.Add(new FileDialogFilter() { Name = "AXAML Files (*.axaml)", Extensions = new List<string> { "axaml" } });
dlg.Filters.Add(new FileDialogFilter() { Name = "XAML Files (*.xaml)", Extensions = new List<string> { "xaml" } });
dlg.Filters.Add(new FileDialogFilter() { Name = "All Files (*.*)", Extensions = new List<string> { "*" } });
dlg.InitialFileName = Path.GetFileNameWithoutExtension(_selectedItem.Path);
dlg.InitialFileName = Path.GetFileNameWithoutExtension(Project.SelectedItem.Path);
var result = await dlg.ShowAsync((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow);
if (result is { })
{
var xaml = await ToXaml(_selectedItem, _settings.EnableGenerateImage);
var xaml = await ToXaml(Project.SelectedItem, Project.Settings.EnableGenerateImage);
try
{
@ -201,8 +183,8 @@ namespace SvgToXaml.ViewModels
var result = await dlg.ShowAsync((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow);
if (result is { })
{
var paths = Items?.Select(x => x.Path).ToList();
if (paths is { })
var paths = Project.Items.Select(x => x.Path).ToList();
if (paths.Count > 0)
{
try
{
@ -251,14 +233,14 @@ namespace SvgToXaml.ViewModels
var text = await Task.Run(() =>
{
if (_settings.EnableGenerateImage)
if (Project.Settings.EnableGenerateImage)
{
var converter = new SvgConverter()
{
UseCompatMode = _settings.UseCompatMode,
UseBrushTransform = _settings.UseBrushTransform,
ReuseExistingResources = _settings.ReuseExistingResources,
Resources = _settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
UseCompatMode = Project.Settings.UseCompatMode,
UseBrushTransform = Project.Settings.UseBrushTransform,
ReuseExistingResources = Project.Settings.ReuseExistingResources,
Resources = Project.Settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
};
var xaml = converter.ToXamlImage(skSvg.Model);
@ -268,10 +250,10 @@ namespace SvgToXaml.ViewModels
{
var converter = new SvgConverter()
{
UseCompatMode = _settings.UseCompatMode,
UseBrushTransform = _settings.UseBrushTransform,
ReuseExistingResources = _settings.ReuseExistingResources,
Resources = _settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
UseCompatMode = Project.Settings.UseCompatMode,
UseBrushTransform = Project.Settings.UseBrushTransform,
ReuseExistingResources = Project.Settings.ReuseExistingResources,
Resources = Project.Settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
};
var xaml = converter.ToXamlDrawingGroup(skSvg.Model);
@ -304,9 +286,8 @@ namespace SvgToXaml.ViewModels
private async Task Reload()
{
var items = _items;
if (items is null || items.Count == 0)
var items = Project.Items;
if (items.Count == 0)
{
return;
}
@ -319,7 +300,7 @@ namespace SvgToXaml.ViewModels
}
});
if (_selectedItem is { } selectedItem)
if (Project.SelectedItem is { } selectedItem)
{
await selectedItem.Load();
}
@ -340,10 +321,10 @@ namespace SvgToXaml.ViewModels
{
var converter = new SvgConverter()
{
UseCompatMode = _settings.UseCompatMode,
UseBrushTransform = _settings.UseBrushTransform,
ReuseExistingResources = _settings.ReuseExistingResources,
Resources = _settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
UseCompatMode = Project.Settings.UseCompatMode,
UseBrushTransform = Project.Settings.UseBrushTransform,
ReuseExistingResources = Project.Settings.ReuseExistingResources,
Resources = Project.Settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
};
var xaml = converter.ToXamlImage(fileItemViewModel.Svg.Model);
@ -353,10 +334,10 @@ namespace SvgToXaml.ViewModels
{
var converter = new SvgConverter()
{
UseCompatMode = _settings.UseCompatMode,
UseBrushTransform = _settings.UseBrushTransform,
ReuseExistingResources = _settings.ReuseExistingResources,
Resources = _settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
UseCompatMode = Project.Settings.UseCompatMode,
UseBrushTransform = Project.Settings.UseBrushTransform,
ReuseExistingResources = Project.Settings.ReuseExistingResources,
Resources = Project.Settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
};
var xaml = converter.ToXamlDrawingGroup(fileItemViewModel.Svg.Model);
@ -374,13 +355,13 @@ namespace SvgToXaml.ViewModels
{
var converter = new SvgConverter()
{
UseCompatMode = _settings.UseCompatMode,
UseBrushTransform = _settings.UseBrushTransform,
ReuseExistingResources = _settings.ReuseExistingResources,
Resources = _settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
UseCompatMode = Project.Settings.UseCompatMode,
UseBrushTransform = Project.Settings.UseBrushTransform,
ReuseExistingResources = Project.Settings.ReuseExistingResources,
Resources = Project.Settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
};
var xaml = converter.ToXamlStyles(paths, _settings.EnableGenerateImage, _settings.EnableGeneratePreview);
var xaml = converter.ToXamlStyles(paths, Project.Settings.EnableGenerateImage, Project.Settings.EnableGeneratePreview);
return converter.Format(xaml);
});
}
@ -411,11 +392,8 @@ namespace SvgToXaml.ViewModels
private async Task Add(string path)
{
if (_items is { })
{
var item = await Task.Run(() => new FileItemViewModel(Path.GetFileName(path), path, Preview, Remove));
_items.Add(item);
}
var item = await Task.Run(() => new FileItemViewModel(Path.GetFileName(path), path, Preview, Remove));
Project.Items.Add(item);
}
private async Task Preview(FileItemViewModel item)
@ -436,10 +414,10 @@ namespace SvgToXaml.ViewModels
{
var converter = new SvgConverter()
{
UseCompatMode = _settings.UseCompatMode,
UseBrushTransform = _settings.UseBrushTransform,
ReuseExistingResources = _settings.ReuseExistingResources,
Resources = _settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
UseCompatMode = Project.Settings.UseCompatMode,
UseBrushTransform = Project.Settings.UseBrushTransform,
ReuseExistingResources = Project.Settings.ReuseExistingResources,
Resources = Project.Settings.UseResources ? new SvgToXamlConverter.ResourceDictionary() : null
};
var xaml = converter.ToXamlDrawingGroup(item.Svg.Model);
@ -478,22 +456,21 @@ namespace SvgToXaml.ViewModels
{
await Task.Run(() =>
{
if (_items is { })
{
_items.Remove(item);
}
Project.Items.Remove(item);
});
}
public void Initialize(FileItemViewModel item)
{
item.Initialize(Preview, Remove);
}
public void Add(IEnumerable<string> paths)
{
if (_items is { })
foreach (var path in paths)
{
foreach (var path in paths)
{
var item = new FileItemViewModel(Path.GetFileName(path), path, Preview, Remove);
_items.Add(item);
}
var item = new FileItemViewModel(Path.GetFileName(path), path, Preview, Remove);
Project.Items.Add(item);
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
using System.Collections.ObjectModel;
using System.Text.Json.Serialization;
using ReactiveUI;
namespace SvgToXaml.ViewModels
{
public class ProjectViewModel : ViewModelBase
{
private FileItemViewModel? _selectedItem;
private ObservableCollection<FileItemViewModel> _items;
private SettingsViewModel _settings;
[JsonIgnore]
public FileItemViewModel? SelectedItem
{
get => _selectedItem;
set => this.RaiseAndSetIfChanged(ref _selectedItem, value);
}
[JsonInclude]
public ObservableCollection<FileItemViewModel> Items
{
get => _items;
set => this.RaiseAndSetIfChanged(ref _items, value);
}
[JsonInclude]
public SettingsViewModel Settings
{
get => _settings;
set => this.RaiseAndSetIfChanged(ref _settings, value);
}
[JsonConstructor]
public ProjectViewModel()
{
_items = new ObservableCollection<FileItemViewModel>();
_settings = new SettingsViewModel()
{
EnableGenerateImage = true,
EnableGeneratePreview = true,
UseResources = true,
ReuseExistingResources = true,
UseCompatMode = false,
UseBrushTransform = false,
};
}
}
}

Просмотреть файл

@ -1,4 +1,5 @@
using ReactiveUI;
using System.Text.Json.Serialization;
using ReactiveUI;
namespace SvgToXaml.ViewModels
{
@ -11,40 +12,51 @@ namespace SvgToXaml.ViewModels
private bool _useCompatMode;
private bool _useBrushTransform;
[JsonInclude]
public bool EnableGenerateImage
{
get => _enableGenerateImage;
set => this.RaiseAndSetIfChanged(ref _enableGenerateImage, value);
}
[JsonInclude]
public bool EnableGeneratePreview
{
get => _enableGeneratePreview;
set => this.RaiseAndSetIfChanged(ref _enableGeneratePreview, value);
}
[JsonInclude]
public bool UseResources
{
get => _useResources;
set => this.RaiseAndSetIfChanged(ref _useResources, value);
}
[JsonInclude]
public bool ReuseExistingResources
{
get => _reuseExistingResources;
set => this.RaiseAndSetIfChanged(ref _reuseExistingResources, value);
}
[JsonInclude]
public bool UseCompatMode
{
get => _useCompatMode;
set => this.RaiseAndSetIfChanged(ref _useCompatMode, value);
}
[JsonInclude]
public bool UseBrushTransform
{
get => _useBrushTransform;
set => this.RaiseAndSetIfChanged(ref _useBrushTransform, value);
}
[JsonConstructor]
public SettingsViewModel()
{
}
}
}

Просмотреть файл

@ -92,8 +92,8 @@
Opacity="0.3"
Height="0.55"/>
<!-- Items List -->
<ListBox Items="{Binding Items}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
<ListBox Items="{Binding Project.Items}"
SelectedItem="{Binding Project.SelectedItem, Mode=TwoWay}"
Background="Transparent"
Margin="12,12,12,12">
<ListBox.Styles>
@ -250,7 +250,7 @@
<Button.Flyout>
<Flyout ShowMode="TransientWithDismissOnPointerMoveAway"
Placement="BottomEdgeAlignedRight">
<StackPanel Spacing="12" DataContext="{Binding Settings}">
<StackPanel Spacing="12" DataContext="{Binding Project.Settings}">
<CheckBox IsChecked="{Binding EnableGenerateImage}"
Content="Generate Image Control"
HorizontalAlignment="Stretch"
@ -325,7 +325,7 @@
</Border.Background>
</Border>
<Viewbox>
<SKPictureControl Picture="{Binding SelectedItem.Picture, FallbackValue={x:Null}}" />
<SKPictureControl Picture="{Binding Project.SelectedItem.Picture, FallbackValue={x:Null}}" />
</Viewbox>
</Panel>
</DockPanel>

Просмотреть файл

@ -37,13 +37,13 @@
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.0-preview.120" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SvgToXamlConverter\Model\**\*.cs">
<Compile Include="..\SvgModel\Model\**\*.cs">
<LinkBase>Converter\Model</LinkBase>
</Compile>
<Compile Include="..\SvgToXamlConverter\Generator\**\*.cs">
<Compile Include="..\SvgConverter\Generator\**\*.cs">
<LinkBase>Converter\Generator</LinkBase>
</Compile>
<Compile Include="..\SvgToXamlConverter\*.cs">
<Compile Include="..\SvgConverter\*.cs">
<LinkBase>Converter</LinkBase>
</Compile>
</ItemGroup>