diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-09 21:30:49 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-09 21:30:49 +0800 |
| commit | 6b9268d2d88c81c18f2cc21e343d321989dad99c (patch) | |
| tree | 051a3e1ca1c49a8e67a4da2c59fec576fc9e6ec5 /JVDesktop/Views | |
| parent | 3f8e818b58127a2fad66ed67032344f553632c38 (diff) | |
Set up project structure and CLI integration
Diffstat (limited to 'JVDesktop/Views')
| -rw-r--r-- | JVDesktop/Views/DashboardView.axaml | 63 | ||||
| -rw-r--r-- | JVDesktop/Views/DashboardView.axaml.cs | 15 | ||||
| -rw-r--r-- | JVDesktop/Views/MainWindow.axaml | 23 | ||||
| -rw-r--r-- | JVDesktop/Views/MainWindow.axaml.cs | 11 |
4 files changed, 78 insertions, 34 deletions
diff --git a/JVDesktop/Views/DashboardView.axaml b/JVDesktop/Views/DashboardView.axaml new file mode 100644 index 0000000..553754f --- /dev/null +++ b/JVDesktop/Views/DashboardView.axaml @@ -0,0 +1,63 @@ +<Window + xmlns="https://github.com/avaloniaui" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:vm="using:JVDesktop.ViewModels" + 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="550" + x:Class="JVDesktop.Views.DashboardView" + x:DataType="vm:DashboardViewModel" + Icon="/Assets/avalonia-logo.ico" + Title="JVDesktop" + Width="800" + Height="550" + MinWidth="550" + MinHeight="400" + WindowStartupLocation="CenterScreen" + ExtendClientAreaToDecorationsHint="True" +> + + <Design.DataContext> + <vm:DashboardViewModel /> + </Design.DataContext> + + <Grid RowDefinitions="65,*,32"> + + <!-- Header --> + <Border Grid.Row="0" Background="#424242" PointerPressed="MoveWindow"> + <TextBlock + Text="Header" + HorizontalAlignment="Center" + VerticalAlignment="Center" + /> + </Border> + + <!-- Content --> + <Border Grid.Row="1" Background="Black"> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock + Text="{Binding Greeting}" + HorizontalAlignment="Center" + VerticalAlignment="Center" + /> + <Button + Content="Click" + Command="{Binding ButtonClickCommand}" + Margin="0,10,0,0" + /> + </StackPanel> + </Border> + + <!-- Footer --> + <Border Grid.Row="2" Background="#424242"> + <TextBlock + Text="Footer" + HorizontalAlignment="Center" + VerticalAlignment="Center" + /> + </Border> + </Grid> + +</Window> diff --git a/JVDesktop/Views/DashboardView.axaml.cs b/JVDesktop/Views/DashboardView.axaml.cs new file mode 100644 index 0000000..ae58263 --- /dev/null +++ b/JVDesktop/Views/DashboardView.axaml.cs @@ -0,0 +1,15 @@ +using Avalonia.Controls; +using Avalonia.Input; + +namespace JVDesktop.Views; + +public partial class DashboardView : Window +{ + public DashboardView() => InitializeComponent(); + + private void MoveWindow(object sender, PointerPressedEventArgs e) + { + if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) + BeginMoveDrag(e); + } +} diff --git a/JVDesktop/Views/MainWindow.axaml b/JVDesktop/Views/MainWindow.axaml deleted file mode 100644 index 13f20c4..0000000 --- a/JVDesktop/Views/MainWindow.axaml +++ /dev/null @@ -1,23 +0,0 @@ -<Window xmlns="https://github.com/avaloniaui" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:vm="using:JVDesktop.ViewModels" - 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="JVDesktop.Views.MainWindow" - x:DataType="vm:MainWindowViewModel" - Icon="/Assets/avalonia-logo.ico" - Title="JVDesktop"> - - <Design.DataContext> - <!-- This only sets the DataContext for the previewer in an IDE, - to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) --> - <vm:MainWindowViewModel/> - </Design.DataContext> - - <Grid> - <TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/> - <Button Content="Click" Command="{Binding ButtonClickCommand}"/> - </Grid> - -</Window> diff --git a/JVDesktop/Views/MainWindow.axaml.cs b/JVDesktop/Views/MainWindow.axaml.cs deleted file mode 100644 index 37f530e..0000000 --- a/JVDesktop/Views/MainWindow.axaml.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Avalonia.Controls; - -namespace JVDesktop.Views; - -public partial class MainWindow : Window -{ - public MainWindow() - { - InitializeComponent(); - } -}
\ No newline at end of file |
