Add Avalonia gui
This commit is contained in:
15
KMeansGui/Shell/ShellView.axaml
Normal file
15
KMeansGui/Shell/ShellView.axaml
Normal file
@ -0,0 +1,15 @@
|
||||
<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"
|
||||
xmlns:kMeansGui="clr-namespace:KMeansGui" x:Name="LayoutRoot"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="KMeansGui.ShellView"
|
||||
Title="KMeansGui">
|
||||
<Window.DataContext>
|
||||
<kMeansGui:ShellViewModel />
|
||||
</Window.DataContext>
|
||||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,*">
|
||||
<Button Command="{Binding OpenCsvFileAsync}" CommandParameter="{Binding ElementName=LayoutRoot}" >Load CSV file</Button>
|
||||
</Grid>
|
||||
</Window>
|
22
KMeansGui/Shell/ShellView.axaml.cs
Normal file
22
KMeansGui/Shell/ShellView.axaml.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace KMeansGui
|
||||
{
|
||||
public partial class ShellView : Window
|
||||
{
|
||||
public ShellView()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
21
KMeansGui/Shell/ShellViewModel.cs
Normal file
21
KMeansGui/Shell/ShellViewModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using MvvmGen;
|
||||
|
||||
namespace KMeansGui
|
||||
{
|
||||
[ViewModel]
|
||||
public partial class ShellViewModel
|
||||
{
|
||||
|
||||
|
||||
public async Task OpenCsvFileAsync(object parent)
|
||||
{
|
||||
if (parent is Window window)
|
||||
{
|
||||
var fileDialog = new OpenFileDialog();
|
||||
var result = await fileDialog.ShowAsync(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user