11/14
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using BatchOszExtractor.Core;
|
using BatchOszExtractor.Core;
|
||||||
|
|
||||||
Extract.SelectMaps(SelectionType.Single,ImmutableList.Create("/home/gwargoomba/Downloads/osuextract/740535 Cartoon & Futuristik Feat. Mikk Mae - C U Again.osz"),"/home/gwargoomba/Downloads/osuextract");
|
Extract.SelectMaps(SelectionType.Selection,ImmutableList.Create("/home/gwargoomba/Downloads/osuextract/740535 Cartoon & Futuristik Feat. Mikk Mae - C U Again.osz"),"/home/gwargoomba/Downloads/osuextract");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -3,18 +3,18 @@ using System.IO.Compression;
|
|||||||
|
|
||||||
namespace BatchOszExtractor.Core;
|
namespace BatchOszExtractor.Core;
|
||||||
|
|
||||||
public class Extract
|
public static class Extract
|
||||||
{
|
{
|
||||||
public static void SelectMaps(SelectionType type, ImmutableList<string> maps, string extractPath)
|
public static void SelectMaps(SelectionType type, ImmutableList<string> maps, string extractPath)
|
||||||
{
|
{
|
||||||
// both are immutable lists of strings
|
// both are immutable lists of strings
|
||||||
if (type is SelectionType.Multiple or SelectionType.Single)
|
if (type == SelectionType.Selection)
|
||||||
{
|
{
|
||||||
foreach (string map in maps)
|
foreach (var map in maps)
|
||||||
{
|
{
|
||||||
using (ZipArchive archive = ZipFile.Open(map, ZipArchiveMode.Update))
|
using (var archive = ZipFile.Open(map, ZipArchiveMode.Update))
|
||||||
{
|
{
|
||||||
string file = Path.GetFileName(map);
|
var file = Path.GetFileName(map);
|
||||||
archive.ExtractToDirectory(Path.GetFullPath(Path.Combine(extractPath, file.Remove(file.Length - 4))));
|
archive.ExtractToDirectory(Path.GetFullPath(Path.Combine(extractPath, file.Remove(file.Length - 4))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ namespace BatchOszExtractor.Core;
|
|||||||
|
|
||||||
public enum SelectionType
|
public enum SelectionType
|
||||||
{
|
{
|
||||||
Single,
|
Selection,
|
||||||
Multiple,
|
|
||||||
Range
|
Range
|
||||||
}
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<Window 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"
|
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
||||||
x:Class="BatchOszExtractor.UI.MainWindow"
|
|
||||||
Title="BatchOszExtractor.UI">
|
|
||||||
Welcome to Avalonia!
|
|
||||||
</Window>
|
|
||||||
@@ -4,7 +4,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.Core", "B
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.CLI", "BatchOszExtractor.CLI\BatchOszExtractor.CLI.csproj", "{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.CLI", "BatchOszExtractor.CLI\BatchOszExtractor.CLI.csproj", "{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchOszExtractor.UI", "BatchOszExtractor.UI\BatchOszExtractor.UI.csproj", "{7549EED7-5008-43AE-AC5A-4000863E4DA5}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToDoList", "ToDoList\ToDoList.csproj", "{A7C2BD74-8C51-463A-9535-3E0F63CEC757}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -20,9 +20,9 @@ Global
|
|||||||
{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{5CEC0641-FE89-4E88-8428-F1C0B00BD05C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{7549EED7-5008-43AE-AC5A-4000863E4DA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{7549EED7-5008-43AE-AC5A-4000863E4DA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7549EED7-5008-43AE-AC5A-4000863E4DA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{7549EED7-5008-43AE-AC5A-4000863E4DA5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A7C2BD74-8C51-463A-9535-3E0F63CEC757}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
<Application xmlns="https://github.com/avaloniaui"
|
<Application xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:Class="BatchOszExtractor.UI.App"
|
x:Class="ToDoList.App"
|
||||||
|
xmlns:local="using:ToDoList"
|
||||||
RequestedThemeVariant="Default">
|
RequestedThemeVariant="Default">
|
||||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||||
|
|
||||||
|
<Application.DataTemplates>
|
||||||
|
<local:ViewLocator/>
|
||||||
|
</Application.DataTemplates>
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<FluentTheme />
|
<FluentTheme />
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
using ToDoList.ViewModels;
|
||||||
|
using ToDoList.Views;
|
||||||
|
|
||||||
namespace BatchOszExtractor.UI;
|
namespace ToDoList;
|
||||||
|
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
@@ -15,7 +17,10 @@ public partial class App : Application
|
|||||||
{
|
{
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
desktop.MainWindow = new MainWindow();
|
desktop.MainWindow = new MainWindow
|
||||||
|
{
|
||||||
|
DataContext = new MainWindowViewModel(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnFrameworkInitializationCompleted();
|
base.OnFrameworkInitializationCompleted();
|
||||||
BIN
ToDoList/Assets/avalonia-logo.ico
Normal file
BIN
ToDoList/Assets/avalonia-logo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 KiB |
9
ToDoList/DataModel/ToDoItem.cs
Normal file
9
ToDoList/DataModel/ToDoItem.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ToDoList.DataModel;
|
||||||
|
|
||||||
|
public class ToDoItem
|
||||||
|
{
|
||||||
|
public string Description { get; set; } = String.Empty;
|
||||||
|
public bool IsChecked { get; set; }
|
||||||
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
using Avalonia.ReactiveUI;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace BatchOszExtractor.UI;
|
namespace ToDoList;
|
||||||
|
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
@@ -17,5 +18,6 @@ class Program
|
|||||||
=> AppBuilder.Configure<App>()
|
=> AppBuilder.Configure<App>()
|
||||||
.UsePlatformDetect()
|
.UsePlatformDetect()
|
||||||
.WithInterFont()
|
.WithInterFont()
|
||||||
.LogToTrace();
|
.LogToTrace()
|
||||||
|
.UseReactiveUI();
|
||||||
}
|
}
|
||||||
14
ToDoList/Services/ToDoListService.cs
Normal file
14
ToDoList/Services/ToDoListService.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ToDoList.DataModel;
|
||||||
|
|
||||||
|
namespace ToDoList.Services;
|
||||||
|
|
||||||
|
public class ToDoListService
|
||||||
|
{
|
||||||
|
public IEnumerable<ToDoItem> GetItems() => new[]
|
||||||
|
{
|
||||||
|
new ToDoItem { Description = "Walk the dog" },
|
||||||
|
new ToDoItem { Description = "Buy some milk" },
|
||||||
|
new ToDoItem { Description = "Learn Avalonia", IsChecked = true },
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<AvaloniaResource Include="Assets\**"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="11.0.0"/>
|
<PackageReference Include="Avalonia" Version="11.0.0"/>
|
||||||
@@ -16,5 +20,11 @@
|
|||||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.0"/>
|
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.0"/>
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0"/>
|
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0"/>
|
||||||
|
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BatchOszExtractor.Core\BatchOszExtractor.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
27
ToDoList/ViewLocator.cs
Normal file
27
ToDoList/ViewLocator.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Controls.Templates;
|
||||||
|
using ToDoList.ViewModels;
|
||||||
|
|
||||||
|
namespace ToDoList;
|
||||||
|
|
||||||
|
public class ViewLocator : IDataTemplate
|
||||||
|
{
|
||||||
|
public Control Build(object data)
|
||||||
|
{
|
||||||
|
var name = data.GetType().FullName!.Replace("ViewModel", "View");
|
||||||
|
var type = Type.GetType(name);
|
||||||
|
|
||||||
|
if (type != null)
|
||||||
|
{
|
||||||
|
return (Control)Activator.CreateInstance(type)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TextBlock { Text = "Not Found: " + name };
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Match(object data)
|
||||||
|
{
|
||||||
|
return data is ViewModelBase;
|
||||||
|
}
|
||||||
|
}
|
||||||
9
ToDoList/ViewModels/AddItemViewModel.cs
Normal file
9
ToDoList/ViewModels/AddItemViewModel.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ToDoList.ViewModels
|
||||||
|
{
|
||||||
|
public class AddItemViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
public string Description { get; set; } = String.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
32
ToDoList/ViewModels/MainWindowViewModel.cs
Normal file
32
ToDoList/ViewModels/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using ReactiveUI;
|
||||||
|
using ToDoList.Services;
|
||||||
|
|
||||||
|
namespace ToDoList.ViewModels
|
||||||
|
{
|
||||||
|
public class MainWindowViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private ViewModelBase _contentViewModel;
|
||||||
|
|
||||||
|
//this has a dependency on the ToDoListService
|
||||||
|
|
||||||
|
public MainWindowViewModel()
|
||||||
|
{
|
||||||
|
var service = new ToDoListService();
|
||||||
|
ToDoList = new ToDoListViewModel(service.GetItems());
|
||||||
|
_contentViewModel = ToDoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToDoListViewModel ToDoList { get; }
|
||||||
|
|
||||||
|
public ViewModelBase ContentViewModel
|
||||||
|
{
|
||||||
|
get => _contentViewModel;
|
||||||
|
private set => this.RaiseAndSetIfChanged(ref _contentViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddItem()
|
||||||
|
{
|
||||||
|
ContentViewModel = new AddItemViewModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
ToDoList/ViewModels/ToDoListViewModel.cs
Normal file
16
ToDoList/ViewModels/ToDoListViewModel.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using ToDoList.DataModel;
|
||||||
|
|
||||||
|
namespace ToDoList.ViewModels
|
||||||
|
{
|
||||||
|
public class ToDoListViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
public ToDoListViewModel(IEnumerable<ToDoItem> items)
|
||||||
|
{
|
||||||
|
ListItems = new ObservableCollection<ToDoItem>(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<ToDoItem> ListItems { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
7
ToDoList/ViewModels/ViewModelBase.cs
Normal file
7
ToDoList/ViewModels/ViewModelBase.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
|
namespace ToDoList.ViewModels;
|
||||||
|
|
||||||
|
public class ViewModelBase : ReactiveObject
|
||||||
|
{
|
||||||
|
}
|
||||||
20
ToDoList/Views/AddItemView.axaml
Normal file
20
ToDoList/Views/AddItemView.axaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:ToDoList.ViewModels"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="400"
|
||||||
|
x:DataType="vm:AddItemViewModel"
|
||||||
|
x:Class="ToDoList.Views.AddItemView">
|
||||||
|
<DockPanel>
|
||||||
|
<Button DockPanel.Dock="Bottom"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Center">Cancel</Button>
|
||||||
|
<Button DockPanel.Dock="Bottom"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Center">OK</Button>
|
||||||
|
<TextBox AcceptsReturn="True"
|
||||||
|
Text="{Binding Description}"
|
||||||
|
Watermark="Enter your to do item"/>
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
13
ToDoList/Views/AddItemView.axaml.cs
Normal file
13
ToDoList/Views/AddItemView.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace ToDoList.Views;
|
||||||
|
|
||||||
|
public partial class AddItemView : UserControl
|
||||||
|
{
|
||||||
|
public AddItemView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
12
ToDoList/Views/MainWindow.axaml
Normal file
12
ToDoList/Views/MainWindow.axaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:ToDoList.ViewModels"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="400"
|
||||||
|
x:Class="ToDoList.Views.MainWindow"
|
||||||
|
x:DataType="vm:MainWindowViewModel"
|
||||||
|
Icon="/Assets/avalonia-logo.ico"
|
||||||
|
Title="Avalonia To Do List"
|
||||||
|
Content="{Binding ContentViewModel}">
|
||||||
|
</Window>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
|
||||||
namespace BatchOszExtractor.UI;
|
namespace ToDoList.Views;
|
||||||
|
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
27
ToDoList/Views/ToDoListView.axaml
Normal file
27
ToDoList/Views/ToDoListView.axaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<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"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="400"
|
||||||
|
xmlns:vm="using:ToDoList.ViewModels"
|
||||||
|
x:DataType="vm:ToDoListViewModel"
|
||||||
|
x:Class="ToDoList.Views.ToDoListView">
|
||||||
|
<DockPanel>
|
||||||
|
<Button DockPanel.Dock="Bottom"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
x:CompileBindings="False"
|
||||||
|
Command="{Binding $parent[Window].DataContext.AddItem}">
|
||||||
|
Add Item
|
||||||
|
</Button>
|
||||||
|
<ItemsControl ItemsSource="{Binding ListItems}">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<CheckBox Margin="4"
|
||||||
|
IsChecked="{Binding IsChecked}"
|
||||||
|
Content="{Binding Description}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
13
ToDoList/Views/ToDoListView.axaml.cs
Normal file
13
ToDoList/Views/ToDoListView.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace ToDoList.Views;
|
||||||
|
|
||||||
|
public partial class ToDoListView : UserControl
|
||||||
|
{
|
||||||
|
public ToDoListView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user