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 | |
| parent | 3f8e818b58127a2fad66ed67032344f553632c38 (diff) | |
Set up project structure and CLI integration
28 files changed, 381 insertions, 84 deletions
@@ -1,5 +1,18 @@ +######################## +### IntelliJ (Rider) ### +######################## .idea/ + +##################### +### Build Targets ### +##################### **/bin **/obj bin/** obj/** + +######################## +### Temporary Folder ### +######################## +**/.Temp/ +**/.temp/ diff --git a/Collect-Command-Line.ps1 b/Collect-Command-Line.ps1 new file mode 100644 index 0000000..d8705a2 --- /dev/null +++ b/Collect-Command-Line.ps1 @@ -0,0 +1,61 @@ +# Set current working directory to the script's directory +Set-Location -Path $PSScriptRoot + +# Define the path to the target CLI executable +$cliPath = ".\.Temp\Debug\JustEnoughVCS.exe" + +# Check if the target CLI file already exists +if (-not (Test-Path $cliPath)) { + # If the file does not exist, define the relative path to the command-line project directory + $commandLineDir = ".\..\CommandLine" + + # Check if the command-line project directory exists + if (-not (Test-Path $commandLineDir)) { + # If the directory does not exist, output an error and exit the script + Write-Error "Error: $commandLineDir Not Found!" + exit 1 + } + + # Define the path to the pre-built CLI executable + $jvExePath = "$commandLineDir\.temp\deploy\bin\jv.exe" + + # Check if the pre-built CLI file exists + if (Test-Path $jvExePath) { + # If the pre-built file exists, ensure the target directory exists + $null = New-Item -ItemType Directory -Path (Split-Path $cliPath) -Force + # Copy the pre-built file to the target location + Copy-Item -Path $jvExePath -Destination $cliPath -Force + # Output a completion notification + Write-Host "CLI copied to $cliPath" + } + else { + # If the pre-built file does not exist, define the path to the deployment script + $deployScriptPath = "$commandLineDir\deploy.ps1" + + # Check if the deployment script exists + if (-not (Test-Path $deployScriptPath)) { + # If the deployment script does not exist, output an error and exit + Write-Error "Error: $deployScriptPath Not Found!" + exit 1 + } + + # Output a notification that building is starting + Write-Host "Building CLI from deploy.ps1..." + # Execute the deployment script to build the CLI + & $deployScriptPath + + # Check if the CLI file is generated after building + if (-not (Test-Path $jvExePath)) { + # If the file still does not exist after building, output an error and exit + Write-Error "Error: $jvExePath Not Found after deployment!" + exit 1 + } + + # Ensure the target directory exists + $null = New-Item -ItemType Directory -Path (Split-Path $cliPath) -Force + # Copy the newly built file to the target location + Copy-Item -Path $jvExePath -Destination $cliPath -Force + # Output a notification that building and copying are complete + Write-Host "CLI built and copied to $cliPath" + } +} diff --git a/Collect-Command-Line.sh b/Collect-Command-Line.sh new file mode 100644 index 0000000..61545b7 --- /dev/null +++ b/Collect-Command-Line.sh @@ -0,0 +1,53 @@ +# Get the absolute path of the directory where the current script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Switch to the script's directory, exit if it fails +cd "$SCRIPT_DIR" || exit 1 + +# Define the target path for the CLI tool +cliPath=".Temp/Debug/JustEnoughVCS" + +# Check if the CLI already exists at the target path +if [ ! -f "$cliPath" ]; then + # Check if the CommandLine directory exists in the parent directory + if [ -d "./../CommandLine/" ]; then + # Check if a built CLI executable already exists + if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then + # Create the target directory (if it doesn't exist) + mkdir -p "$(dirname "$cliPath")" + # Copy the CLI executable to the target path + cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath" + # Add execute permission + chmod +x "$cliPath" + echo "CLI copied to $cliPath" + else + # Check if a deployment script exists + if [ -f "./../CommandLine/deploy.sh" ]; then + echo "Building CLI from deploy.sh..." + # Enter the CommandLine directory and execute the deployment script + (cd "./../CommandLine" && ./deploy.sh) + # Check if the CLI executable was generated after deployment + if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then + # Create the target directory (if it doesn't exist) + mkdir -p "$(dirname "$cliPath")" + # Copy the newly built CLI executable + cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath" + # Add execute permission + chmod +x "$cliPath" + echo "CLI built and copied to $cliPath" + else + # CLI executable still not found after deployment, error and exit + echo "Error: ./../CommandLine/.temp/deploy/bin/jv Not Found after deployment!" + exit 1 + fi + else + # Deployment script not found, error and exit + echo "Error: ./../CommandLine/deploy.sh Not Found!" + exit 1 + fi + fi + else + # CommandLine directory not found, error and exit + echo "Error: ./../CommandLine/ Not Found!" + exit 1 + fi +fi diff --git a/CommandLineWrapper/Class1.cs b/CommandLineWrapper/Class1.cs new file mode 100644 index 0000000..f8ed117 --- /dev/null +++ b/CommandLineWrapper/Class1.cs @@ -0,0 +1,6 @@ +namespace CommandLineWrapper; + +public class Class1 +{ + +} diff --git a/CommandLineWrapper/CommandLineWrapper.csproj b/CommandLineWrapper/CommandLineWrapper.csproj new file mode 100644 index 0000000..b92e51b --- /dev/null +++ b/CommandLineWrapper/CommandLineWrapper.csproj @@ -0,0 +1,9 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + +</Project> diff --git a/CommandLineWrapperExample/CommandLineWrapperExample.csproj b/CommandLineWrapperExample/CommandLineWrapperExample.csproj new file mode 100644 index 0000000..3732733 --- /dev/null +++ b/CommandLineWrapperExample/CommandLineWrapperExample.csproj @@ -0,0 +1,21 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputPath>..\.Temp\Debug\</OutputPath> + <OutDir>$(OutputPath)</OutDir> + </PropertyGroup> + + <ItemGroup> + <ProjectReference + Include="..\CommandLineWrapper\CommandLineWrapper.csproj" + /> + </ItemGroup> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + +</Project> diff --git a/CommandLineWrapperExample/Program.cs b/CommandLineWrapperExample/Program.cs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/CommandLineWrapperExample/Program.cs diff --git a/DesktopClient.sln b/DesktopClient.sln index 97fd4d3..f240af4 100644 --- a/DesktopClient.sln +++ b/DesktopClient.sln @@ -1,16 +1,58 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JVDesktop", "JVDesktop\JVDesktop.csproj", "{2EF80E70-ACDD-431B-A773-9CA2EA00A233}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLineWrapper", "CommandLineWrapper\CommandLineWrapper.csproj", "{46D98A4E-DF14-4553-837D-CA20CAAF5E8F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLineWrapperExample", "CommandLineWrapperExample\CommandLineWrapperExample.csproj", "{9AF08E06-0378-412D-BCF0-99BA0B1C63E0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Debug|x64.ActiveCfg = Debug|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Debug|x64.Build.0 = Debug|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Debug|x86.ActiveCfg = Debug|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Debug|x86.Build.0 = Debug|Any CPU {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Release|Any CPU.ActiveCfg = Release|Any CPU {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Release|Any CPU.Build.0 = Release|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Release|x64.ActiveCfg = Release|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Release|x64.Build.0 = Release|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Release|x86.ActiveCfg = Release|Any CPU + {2EF80E70-ACDD-431B-A773-9CA2EA00A233}.Release|x86.Build.0 = Release|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Debug|x64.ActiveCfg = Debug|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Debug|x64.Build.0 = Debug|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Debug|x86.ActiveCfg = Debug|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Debug|x86.Build.0 = Debug|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Release|Any CPU.Build.0 = Release|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Release|x64.ActiveCfg = Release|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Release|x64.Build.0 = Release|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Release|x86.ActiveCfg = Release|Any CPU + {46D98A4E-DF14-4553-837D-CA20CAAF5E8F}.Release|x86.Build.0 = Release|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Debug|x64.ActiveCfg = Debug|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Debug|x64.Build.0 = Debug|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Debug|x86.ActiveCfg = Debug|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Debug|x86.Build.0 = Debug|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Release|Any CPU.Build.0 = Release|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Release|x64.ActiveCfg = Release|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Release|x64.Build.0 = Release|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Release|x86.ActiveCfg = Release|Any CPU + {9AF08E06-0378-412D-BCF0-99BA0B1C63E0}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..40fe69a --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,19 @@ +<Project> + <PropertyGroup> + <BaseOutputPath + >$(MSBuildThisFileDirectory).Temp\$(MSBuildProjectName)\</BaseOutputPath> + <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> + + <BaseIntermediateOutputPath + >$(MSBuildThisFileDirectory).Temp\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath> + <IntermediateOutputPath + >$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath> + + <BaseOutputPath + Condition="!HasTrailingSlash('$(BaseOutputPath)')" + >$(BaseOutputPath)\</BaseOutputPath> + <BaseIntermediateOutputPath + Condition="!HasTrailingSlash('$(BaseIntermediateOutputPath)')" + >$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath> + </PropertyGroup> +</Project> diff --git a/JVDesktop/App.axaml b/JVDesktop/App.axaml index 4d268d0..1bebd8d 100644 --- a/JVDesktop/App.axaml +++ b/JVDesktop/App.axaml @@ -1,15 +1,16 @@ -<Application xmlns="https://github.com/avaloniaui" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - x:Class="JVDesktop.App" - xmlns:local="using:JVDesktop" - RequestedThemeVariant="Default"> - <!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. --> +<Application + xmlns="https://github.com/avaloniaui" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + x:Class="JVDesktop.App" + xmlns:local="using:JVDesktop" + RequestedThemeVariant="Default" +> <Application.DataTemplates> - <local:ViewLocator/> + <local:ViewLocator /> </Application.DataTemplates> <Application.Styles> - <FluentTheme /> + <SimpleTheme /> </Application.Styles> </Application> diff --git a/JVDesktop/App.axaml.cs b/JVDesktop/App.axaml.cs index 4c26724..a2ba079 100644 --- a/JVDesktop/App.axaml.cs +++ b/JVDesktop/App.axaml.cs @@ -1,11 +1,10 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Data.Core; using Avalonia.Data.Core.Plugins; using System.Linq; using Avalonia.Markup.Xaml; -using JVDesktop.ViewModels; using JVDesktop.Views; +using JVDesktop.ViewModels; namespace JVDesktop; @@ -20,12 +19,10 @@ public partial class App : Application { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - // Avoid duplicate validations from both Avalonia and the CommunityToolkit. - // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins DisableAvaloniaDataAnnotationValidation(); - desktop.MainWindow = new MainWindow + desktop.MainWindow = new DashboardView { - DataContext = new MainWindowViewModel(), + DataContext = new DashboardViewModel(), }; } @@ -34,11 +31,9 @@ public partial class App : Application private void DisableAvaloniaDataAnnotationValidation() { - // Get an array of plugins to remove var dataValidationPluginsToRemove = BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray(); - // remove each entry found foreach (var plugin in dataValidationPluginsToRemove) { BindingPlugins.DataValidators.Remove(plugin); diff --git a/JVDesktop/JVDesktop.csproj b/JVDesktop/JVDesktop.csproj index e103899..2940b03 100644 --- a/JVDesktop/JVDesktop.csproj +++ b/JVDesktop/JVDesktop.csproj @@ -5,24 +5,39 @@ <Nullable>enable</Nullable> <BuiltInComInteropSupport>true</BuiltInComInteropSupport> <ApplicationManifest>app.manifest</ApplicationManifest> - <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> + <AvaloniaUseCompiledBindingsByDefault + >true</AvaloniaUseCompiledBindingsByDefault> + <BaseOutputPath>..\.Temp\Debug\</BaseOutputPath> + <OutDir>$(OutputPath)</OutDir> + <AppendTargetFrameworkToOutputPath + >false</AppendTargetFrameworkToOutputPath> + <AppendRuntimeIdentifierToOutputPath + >false</AppendRuntimeIdentifierToOutputPath> </PropertyGroup> <ItemGroup> - <Folder Include="Models\"/> - <AvaloniaResource Include="Assets\**"/> + <Folder Include="Models\" /> + <AvaloniaResource Include="Assets\**" /> </ItemGroup> <ItemGroup> - <PackageReference Include="Avalonia" Version="11.3.4"/> - <PackageReference Include="Avalonia.Desktop" Version="11.3.4"/> - <PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.4"/> - <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.4"/> - <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> + <PackageReference Include="Avalonia" Version="11.3.4" /> + <PackageReference Include="Avalonia.Desktop" Version="11.3.4" /> + <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.4" /> <PackageReference Include="Avalonia.Diagnostics" Version="11.3.4"> - <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets> - <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> + <IncludeAssets + Condition="'$(Configuration)' != 'Debug'" + >None</IncludeAssets> + <PrivateAssets + Condition="'$(Configuration)' != 'Debug'" + >All</PrivateAssets> </PackageReference> - <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1"/> + <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference + Include="..\CommandLineWrapper\CommandLineWrapper.csproj" + /> </ItemGroup> </Project> diff --git a/JVDesktop/Program.cs b/JVDesktop/Program.cs index 8d39a63..850598c 100644 --- a/JVDesktop/Program.cs +++ b/JVDesktop/Program.cs @@ -1,18 +1,14 @@ -using Avalonia; +using Avalonia; using System; namespace JVDesktop; sealed class Program { - // Initialization code. Don't use any Avalonia, third-party APIs or any - // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. [STAThread] public static void Main(string[] args) => BuildAvaloniaApp() .StartWithClassicDesktopLifetime(args); - // Avalonia configuration, don't remove; also used by visual designer. public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>() .UsePlatformDetect() diff --git a/JVDesktop/ViewLocator.cs b/JVDesktop/ViewLocator.cs index 6015998..57507a5 100644 --- a/JVDesktop/ViewLocator.cs +++ b/JVDesktop/ViewLocator.cs @@ -25,6 +25,6 @@ public class ViewLocator : IDataTemplate public bool Match(object? data) { - return data is ViewModelBase; + return data is ViewModel; } } diff --git a/JVDesktop/ViewModels/MainWindowViewModel.cs b/JVDesktop/ViewModels/DashboardViewModel.cs index 4dd12b4..5ae7d95 100644 --- a/JVDesktop/ViewModels/MainWindowViewModel.cs +++ b/JVDesktop/ViewModels/DashboardViewModel.cs @@ -1,15 +1,15 @@ -using System; -using System.Windows.Input; +using System; using CommunityToolkit.Mvvm.Input; namespace JVDesktop.ViewModels; -public class MainWindowViewModel : ViewModelBase +public partial class DashboardViewModel : ViewModel { public string Greeting => "Welcome to Avalonia!"; - public ICommand ButtonClickCommand { get; } = new RelayCommand(() => + [RelayCommand] + private void ButtonClick() { Console.WriteLine("Button clicked"); - }); + } } diff --git a/JVDesktop/ViewModels/ViewModel.cs b/JVDesktop/ViewModels/ViewModel.cs new file mode 100644 index 0000000..c1c5055 --- /dev/null +++ b/JVDesktop/ViewModels/ViewModel.cs @@ -0,0 +1,7 @@ +using CommunityToolkit.Mvvm.ComponentModel; + +namespace JVDesktop.ViewModels; + +public class ViewModel : ObservableObject +{ +} diff --git a/JVDesktop/ViewModels/ViewModelBase.cs b/JVDesktop/ViewModels/ViewModelBase.cs deleted file mode 100644 index bd3dbd8..0000000 --- a/JVDesktop/ViewModels/ViewModelBase.cs +++ /dev/null @@ -1,7 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; - -namespace JVDesktop.ViewModels; - -public class ViewModelBase : ObservableObject -{ -} 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 diff --git a/JVDesktop/app.manifest b/JVDesktop/app.manifest index 85ade99..25cb8eb 100644 --- a/JVDesktop/app.manifest +++ b/JVDesktop/app.manifest @@ -1,9 +1,9 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <!-- This manifest is used on Windows only. Don't remove it as it might cause problems with window transparency and embedded controls. For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests --> - <assemblyIdentity version="1.0.0.0" name="JVDesktop.Desktop"/> + <assemblyIdentity version="1.0.0.0" name="JVDesktop.Desktop" /> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> diff --git a/Run-Desktop.ps1 b/Run-Desktop.ps1 new file mode 100644 index 0000000..4cd542d --- /dev/null +++ b/Run-Desktop.ps1 @@ -0,0 +1,5 @@ +& ".\Collect-Command-Line.ps1" + +if ($LASTEXITCODE -eq 0) { + dotnet run --project .\JVDesktop +} diff --git a/Run-Desktop.sh b/Run-Desktop.sh new file mode 100644 index 0000000..21a21f0 --- /dev/null +++ b/Run-Desktop.sh @@ -0,0 +1,6 @@ +#!/bin/bash +./Collect-Command-Line.sh + +if [ $? -eq 0 ]; then + dotnet run --project ./JVDesktop +fi diff --git a/Run-WrapperExample.ps1 b/Run-WrapperExample.ps1 new file mode 100644 index 0000000..b2fda22 --- /dev/null +++ b/Run-WrapperExample.ps1 @@ -0,0 +1,6 @@ +& ".\Collect-Command-Line.ps1" + +if ($LASTEXITCODE -eq 0) { + Clear-Host + dotnet run --project .\CommandLineWrapperExample +} diff --git a/Run-WrapperExample.sh b/Run-WrapperExample.sh new file mode 100644 index 0000000..c51bbdb --- /dev/null +++ b/Run-WrapperExample.sh @@ -0,0 +1,7 @@ +#!/bin/bash +./Collect-Command-Line.sh + +if [ $? -eq 0 ]; then + clear + dotnet run --project ./CommandLineWrapperExample +fi @@ -1,2 +0,0 @@ -#!/bin/bash -dotnet run --project ./JVDesktop
\ No newline at end of file |
