浏览代码

Add project files.

Veloe 8 月之前
父节点
当前提交
7f5b65abb1
共有 30 个文件被更改,包括 1052 次插入0 次删除
  1. 454 0
      .gitignore
  2. 6 0
      Directory.Build.props
  3. 二进制
      VeloeMonitorApp.Android/Icon.png
  4. 24 0
      VeloeMonitorApp.Android/MainActivity.cs
  5. 5 0
      VeloeMonitorApp.Android/Properties/AndroidManifest.xml
  6. 13 0
      VeloeMonitorApp.Android/Resources/drawable/splash_screen.xml
  7. 4 0
      VeloeMonitorApp.Android/Resources/values-night/colors.xml
  8. 4 0
      VeloeMonitorApp.Android/Resources/values/colors.xml
  9. 12 0
      VeloeMonitorApp.Android/Resources/values/styles.xml
  10. 28 0
      VeloeMonitorApp.Android/VeloeMonitorApp.Android.csproj
  11. 24 0
      VeloeMonitorApp.Desktop/Program.cs
  12. 19 0
      VeloeMonitorApp.Desktop/VeloeMonitorApp.Desktop.csproj
  13. 18 0
      VeloeMonitorApp.Desktop/app.manifest
  14. 39 0
      VeloeMonitorApp.sln
  15. 11 0
      VeloeMonitorApp/App.axaml
  16. 36 0
      VeloeMonitorApp/App.axaml.cs
  17. 二进制
      VeloeMonitorApp/Assets/avalonia-logo.ico
  18. 13 0
      VeloeMonitorApp/Models/SimpleDataModel.cs
  19. 12 0
      VeloeMonitorApp/Services/DataService.cs
  20. 27 0
      VeloeMonitorApp/VeloeMonitorApp.csproj
  21. 6 0
      VeloeMonitorApp/ViewLocator.cs
  22. 67 0
      VeloeMonitorApp/ViewModels/IndexViewModel.cs
  23. 9 0
      VeloeMonitorApp/ViewModels/MainViewModel.cs
  24. 7 0
      VeloeMonitorApp/ViewModels/ViewModelBase.cs
  25. 29 0
      VeloeMonitorApp/Views/IndexView.axaml
  26. 12 0
      VeloeMonitorApp/Views/IndexView.axaml.cs
  27. 139 0
      VeloeMonitorApp/Views/MainView.axaml
  28. 11 0
      VeloeMonitorApp/Views/MainView.axaml.cs
  29. 12 0
      VeloeMonitorApp/Views/MainWindow.axaml
  30. 11 0
      VeloeMonitorApp/Views/MainWindow.axaml.cs

+ 454 - 0
.gitignore

@@ -0,0 +1,454 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# Tye
+.tye/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+##
+## Visual studio for Mac
+##
+
+
+# globs
+Makefile.in
+*.userprefs
+*.usertasks
+config.make
+config.status
+aclocal.m4
+install-sh
+autom4te.cache/
+*.tar.gz
+tarballs/
+test-results/
+
+# Mac bundle stuff
+*.dmg
+*.app
+
+# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
+# Windows thumbnail cache files
+Thumbs.db
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+##
+## Visual Studio Code
+##
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json

+ 6 - 0
Directory.Build.props

@@ -0,0 +1,6 @@
+<Project>
+  <PropertyGroup>
+    <Nullable>enable</Nullable>
+    <AvaloniaVersion>11.0.2</AvaloniaVersion>
+  </PropertyGroup>
+</Project>

二进制
VeloeMonitorApp.Android/Icon.png


+ 24 - 0
VeloeMonitorApp.Android/MainActivity.cs

@@ -0,0 +1,24 @@
+using Android.App;
+using Android.Content.PM;
+
+using Avalonia;
+using Avalonia.Android;
+using Avalonia.ReactiveUI;
+
+namespace VeloeMonitorApp.Android;
+
+[Activity(
+    Label = "VeloeMonitorApp.Android",
+    Theme = "@style/MyTheme.NoActionBar",
+    Icon = "@drawable/icon",
+    MainLauncher = true,
+    ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
+public class MainActivity : AvaloniaMainActivity<App>
+{
+    protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
+    {
+        return base.CustomizeAppBuilder(builder)
+            .WithInterFont()
+            .UseReactiveUI();
+    }
+}

+ 5 - 0
VeloeMonitorApp.Android/Properties/AndroidManifest.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
+	<uses-permission android:name="android.permission.INTERNET" />
+	<application android:label="AvaloniaTest" android:icon="@drawable/Icon" />
+</manifest>

+ 13 - 0
VeloeMonitorApp.Android/Resources/drawable/splash_screen.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+  <item>
+    <color android:color="@color/splash_background"/>
+  </item>
+
+  <item android:drawable="@drawable/icon"
+        android:width="120dp"
+        android:height="120dp"
+        android:gravity="center" />
+
+</layer-list>

+ 4 - 0
VeloeMonitorApp.Android/Resources/values-night/colors.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <color name="splash_background">#212121</color>
+</resources>

+ 4 - 0
VeloeMonitorApp.Android/Resources/values/colors.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <color name="splash_background">#FFFFFF</color>
+</resources>

+ 12 - 0
VeloeMonitorApp.Android/Resources/values/styles.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<resources>
+
+  <style name="MyTheme">
+  </style>
+
+  <style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
+    <item name="android:windowActionBar">false</item>
+    <item name="android:windowBackground">@drawable/splash_screen</item>
+    <item name="android:windowNoTitle">true</item>
+  </style>
+</resources>

+ 28 - 0
VeloeMonitorApp.Android/VeloeMonitorApp.Android.csproj

@@ -0,0 +1,28 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net8.0-android</TargetFramework>
+    <SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
+    <Nullable>enable</Nullable>
+    <ApplicationId>com.CompanyName.AvaloniaTest</ApplicationId>
+    <ApplicationVersion>1</ApplicationVersion>
+    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
+    <AndroidPackageFormat>apk</AndroidPackageFormat>
+    <AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <AndroidResource Include="Icon.png">
+      <Link>Resources\drawable\Icon.png</Link>
+    </AndroidResource>
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Avalonia.Android" Version="11.2.3" />
+    <PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.13" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\VeloeMonitorApp\VeloeMonitorApp.csproj" />
+  </ItemGroup>
+</Project>

+ 24 - 0
VeloeMonitorApp.Desktop/Program.cs

@@ -0,0 +1,24 @@
+using System;
+
+using Avalonia;
+using Avalonia.ReactiveUI;
+
+namespace VeloeMonitorApp.Desktop;
+
+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()
+            .WithInterFont()
+            .LogToTrace()
+            .UseReactiveUI();
+}

+ 19 - 0
VeloeMonitorApp.Desktop/VeloeMonitorApp.Desktop.csproj

@@ -0,0 +1,19 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
+    One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
+    <TargetFramework>net8.0</TargetFramework>
+    <Nullable>enable</Nullable>
+    <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
+    <ApplicationManifest>app.manifest</ApplicationManifest>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Avalonia.Desktop" Version="11.2.3" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\VeloeMonitorApp\VeloeMonitorApp.csproj" />
+  </ItemGroup>
+</Project>

+ 18 - 0
VeloeMonitorApp.Desktop/app.manifest

@@ -0,0 +1,18 @@
+<?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 embeded controls.
+       For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
+  <assemblyIdentity version="1.0.0.0" name="AvaloniaTest.Desktop"/>
+
+  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+    <application>
+      <!-- A list of the Windows versions that this application has been tested on
+           and is designed to work with. Uncomment the appropriate elements
+           and Windows will automatically select the most compatible environment. -->
+
+      <!-- Windows 10 -->
+      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+    </application>
+  </compatibility>
+</assembly>

+ 39 - 0
VeloeMonitorApp.sln

@@ -0,0 +1,39 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34902.65
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VeloeMonitorApp", "VeloeMonitorApp\VeloeMonitorApp.csproj", "{66883D21-C84E-458A-A104-44F1640074AE}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VeloeMonitorApp.Android", "VeloeMonitorApp.Android\VeloeMonitorApp.Android.csproj", "{D7D4CF7E-E4BB-472C-B526-D8ACBC0DDE4A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VeloeMonitorApp.Desktop", "VeloeMonitorApp.Desktop\VeloeMonitorApp.Desktop.csproj", "{E2FB935D-F1C9-44D9-A3CC-0B140C2E614F}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{66883D21-C84E-458A-A104-44F1640074AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{66883D21-C84E-458A-A104-44F1640074AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{66883D21-C84E-458A-A104-44F1640074AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{66883D21-C84E-458A-A104-44F1640074AE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D7D4CF7E-E4BB-472C-B526-D8ACBC0DDE4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D7D4CF7E-E4BB-472C-B526-D8ACBC0DDE4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D7D4CF7E-E4BB-472C-B526-D8ACBC0DDE4A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{D7D4CF7E-E4BB-472C-B526-D8ACBC0DDE4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D7D4CF7E-E4BB-472C-B526-D8ACBC0DDE4A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D7D4CF7E-E4BB-472C-B526-D8ACBC0DDE4A}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{E2FB935D-F1C9-44D9-A3CC-0B140C2E614F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E2FB935D-F1C9-44D9-A3CC-0B140C2E614F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E2FB935D-F1C9-44D9-A3CC-0B140C2E614F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E2FB935D-F1C9-44D9-A3CC-0B140C2E614F}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {2A57C8AF-96F6-48CC-B6EC-5335E5DA9818}
+	EndGlobalSection
+EndGlobal

+ 11 - 0
VeloeMonitorApp/App.axaml

@@ -0,0 +1,11 @@
+<Application xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:themes="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"
+			 x:Class="VeloeMonitorApp.App"
+             RequestedThemeVariant="Default">
+             <!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
+
+    <Application.Styles>
+		<themes:MaterialTheme BaseTheme="Dark" PrimaryColor="Blue" SecondaryColor="LightBlue" />
+    </Application.Styles>
+</Application>

+ 36 - 0
VeloeMonitorApp/App.axaml.cs

@@ -0,0 +1,36 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+
+using VeloeMonitorApp.ViewModels;
+using VeloeMonitorApp.Views;
+
+namespace VeloeMonitorApp;
+
+public partial class App : Application
+{
+    public override void Initialize()
+    {
+        AvaloniaXamlLoader.Load(this);
+    }
+
+    public override void OnFrameworkInitializationCompleted()
+    {
+        if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+        {
+            desktop.MainWindow = new MainWindow
+            {
+                DataContext = new MainViewModel()
+            };
+        }
+        else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
+        {
+            singleViewPlatform.MainView = new MainView
+            {
+                DataContext = new MainViewModel()
+            };
+        }
+
+        base.OnFrameworkInitializationCompleted();
+    }
+}

二进制
VeloeMonitorApp/Assets/avalonia-logo.ico


+ 13 - 0
VeloeMonitorApp/Models/SimpleDataModel.cs

@@ -0,0 +1,13 @@
+using ReactiveUI;
+
+namespace VeloeMonitorApp.Models
+{
+    public class SimpleDataModel : ReactiveObject
+    {
+        private string _title;
+        private double _value;
+
+        public string Title { get => _title; set => this.RaiseAndSetIfChanged(ref _title, value); }
+        public double Value { get => _value; set => this.RaiseAndSetIfChanged(ref _value, value); }
+    }
+}

+ 12 - 0
VeloeMonitorApp/Services/DataService.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VeloeMonitorApp.Services
+{
+    public class DataService
+    {
+    }
+}

+ 27 - 0
VeloeMonitorApp/VeloeMonitorApp.csproj

@@ -0,0 +1,27 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <Nullable>enable</Nullable>
+    <LangVersion>latest</LangVersion>
+    <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
+  </PropertyGroup>
+
+  
+  <ItemGroup>
+    <AvaloniaResource Include="Assets\**" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Avalonia" Version="11.2.3" />
+    <PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.3" />
+    <PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.3" />
+    <PackageReference Include="Avalonia.ReactiveUI" Version="11.2.3" />
+    <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
+    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.2.3" />
+    <PackageReference Include="LiveChartsCore.SkiaSharpView.Avalonia" Version="2.0.0-rc4.5" />
+    <PackageReference Include="Material.Avalonia" Version="3.9.1" />
+    <PackageReference Include="Material.Icons.Avalonia" Version="2.1.10" />
+    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.0" />
+    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client.Core" Version="9.0.0" />
+  </ItemGroup>
+</Project>

+ 6 - 0
VeloeMonitorApp/ViewLocator.cs

@@ -0,0 +1,6 @@
+namespace VeloeMonitorApp
+{
+    internal class ViewLocator
+    {
+    }
+}

+ 67 - 0
VeloeMonitorApp/ViewModels/IndexViewModel.cs

@@ -0,0 +1,67 @@
+using Microsoft.AspNetCore.SignalR.Client;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+using VeloeMonitorApp.Models;
+
+namespace VeloeMonitorApp.ViewModels
+{
+    public class IndexViewModel : ViewModelBase
+    {
+        HubConnection hubConnection;
+        public IndexViewModel() 
+        {
+            HardwareData = new()
+            {
+                {"cpuload", new SimpleDataModel() {Title = "CPU"} },
+                {"ramload", new SimpleDataModel() {Title = "RAM"} },
+                {"ramavailable", new SimpleDataModel() {Title = "RAM Available"} },
+                {"ramused", new SimpleDataModel() {Title = "RAM Used"} },
+                {"root_directory", new SimpleDataModel() {Title = "SSD"} },
+                {"_mnt_nas", new SimpleDataModel() {Title = "HDD"} },
+            };
+
+            hubConnection = new HubConnectionBuilder()
+                .WithUrl("https://monitor.veloe.link/hubs/data")
+                .WithAutomaticReconnect()
+                .Build();
+
+            Func<Exception, Task> reconnecting = ex => Task.Run(() =>
+            {
+                //_logger.Warning("Reconnecting to WebCoket...");
+            });
+            Func<string, Task> reconnected = str => Task.Run(() =>
+            {
+                //_logger.Warning("Reconnected to WebCoket.");
+                //foreach (var server in serverInfo)
+                //{
+                //    _connection.InvokeAsync("ConnectToGroup", server.Key);
+                //}
+            });
+
+            hubConnection.Reconnecting += reconnecting;
+            hubConnection.Reconnected += reconnected;
+
+            hubConnection.On<string>("Update", (data) =>
+            {
+                //{"cpuload":5.239773,"ramavailable":11.503387,"ramused":10.2684555,"ramload":89.264626,"root_directory":0.23512806,"_mnt_nas":0.761549}
+                var dictionary = JsonSerializer.Deserialize<Dictionary<string, double>>(data);
+
+                if (dictionary == null) return;
+
+                double value;
+
+                foreach (var kvp in dictionary)
+                {
+                    value = kvp.Value;
+                    HardwareData[kvp.Key].Value = value;
+                }
+            });
+        }
+        public Dictionary<string,SimpleDataModel> HardwareData { get; set; }
+    }
+}

+ 9 - 0
VeloeMonitorApp/ViewModels/MainViewModel.cs

@@ -0,0 +1,9 @@
+using ReactiveUI;
+
+namespace VeloeMonitorApp.ViewModels;
+
+public class MainViewModel : ViewModelBase
+{
+    private ViewModelBase _selectedPage = new IndexViewModel();
+    public ViewModelBase SelectedPage { get => _selectedPage;set => this.RaiseAndSetIfChanged(ref _selectedPage, value); }
+}

+ 7 - 0
VeloeMonitorApp/ViewModels/ViewModelBase.cs

@@ -0,0 +1,7 @@
+using ReactiveUI;
+
+namespace VeloeMonitorApp.ViewModels;
+
+public class ViewModelBase : ReactiveObject
+{
+}

+ 29 - 0
VeloeMonitorApp/Views/IndexView.axaml

@@ -0,0 +1,29 @@
+<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"
+             xmlns:vm="clr-namespace:VeloeMonitorApp.ViewModels"
+             xmlns:mdl="clr-namespace:VeloeMonitorApp.Models"
+			 xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
+             xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
+			 mc:Ignorable="d" d:DesignWidth="607" d:DesignHeight="1080"
+             x:Class="VeloeMonitorApp.Views.IndexView"
+			 x:DataType="vm:IndexViewModel">
+	<Design.DataContext>
+		<vm:IndexViewModel/>
+	</Design.DataContext>
+	<StackPanel>
+		<ItemsControl ItemsSource="{Binding HardwareData.Values}">
+			<ItemsControl.DataTemplates>
+				<DataTemplate DataType="{x:Type mdl:SimpleDataModel}">
+					<controls:Card MinWidth="240" VerticalAlignment="Top" Margin="5 5 5 0">
+						<StackPanel Margin="0,4">
+							<TextBlock Classes="Headline6" Text="{Binding Title}" />
+							<ProgressBar Value="{Binding Value}" ShowProgressText="True" />
+						</StackPanel>
+					</controls:Card>
+				</DataTemplate>
+			</ItemsControl.DataTemplates>
+		</ItemsControl>
+	</StackPanel>
+</UserControl>

+ 12 - 0
VeloeMonitorApp/Views/IndexView.axaml.cs

@@ -0,0 +1,12 @@
+using Avalonia.Controls;
+
+namespace VeloeMonitorApp.Views
+{
+    public partial class IndexView : UserControl
+    {
+        public IndexView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 139 - 0
VeloeMonitorApp/Views/MainView.axaml

@@ -0,0 +1,139 @@
+<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"
+             xmlns:vm="clr-namespace:VeloeMonitorApp.ViewModels"
+             xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
+             xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
+             xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
+			 mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+             x:Class="VeloeMonitorApp.Views.MainView"
+             x:DataType="vm:MainViewModel">
+  <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:MainViewModel />
+  </Design.DataContext>
+	<UserControl.Styles>
+		<Style Selector="TextBlock.Subheadline">
+			<Setter Property="Margin" Value="0, 16" />
+		</Style>
+		<Style Selector="TextBlock.Subheadline2">
+			<Setter Property="Margin" Value="0, 8" />
+		</Style>
+		<Style Selector="TextBlock.Content">
+			<Setter Property="Margin" Value="0, 4" />
+			<Setter Property="HorizontalAlignment" Value="Left" />
+		</Style>
+	</UserControl.Styles>
+		<controls:SnackbarHost HostName="Root">
+			<controls:NavigationDrawer Name="LeftDrawer" Classes="permanent"
+									   LeftDrawerOpened="{Binding ElementName=NavDrawerSwitch, Path=IsChecked, Mode=TwoWay}">
+				<controls:NavigationDrawer.LeftDrawerContent>
+					<ScrollViewer>
+						<StackPanel>
+							<controls:ColorZone Mode="Accent" Height="180">
+								<StackPanel>
+									<Image Width="96" Height="120"
+										   HorizontalAlignment="Center" VerticalAlignment="Center"
+										   Margin="0,0,0,-8"
+										    />
+									<TextBlock Classes="Headline6" Text="Material Design" HorizontalAlignment="Center" />
+									<TextBlock Classes="Subtitle1" Text="with AvaloniaUI" HorizontalAlignment="Center" />
+								</StackPanel>
+							</controls:ColorZone>
+							<ListBox Classes="NoScroll" Name="DrawerList"
+									 Focusable="{Binding ElementName=LeftDrawer, Path=LeftDrawerOpened}">
+								<ListBox.Styles>
+									<Style Selector="ListBoxItem">
+										<Setter Property="Height" Value="48" />
+										<Setter Property="Padding" Value="16,0" />
+										<Setter Property="VerticalContentAlignment" Value="Center" />
+									</Style>
+								</ListBox.Styles>
+								<ListBoxItem Tag="Index">Home</ListBoxItem>
+								<ListBoxItem>Buttons</ListBoxItem>
+								<ListBoxItem>Card</ListBoxItem>
+								<ListBoxItem>ColorZones</ListBoxItem>
+								<ListBoxItem>Colors</ListBoxItem>
+								<ListBoxItem>ComboBoxes</ListBoxItem>
+								<ListBoxItem>Date/Time pickers</ListBoxItem>
+								<ListBoxItem>Dialogs</ListBoxItem>
+								<ListBoxItem>Expanders</ListBoxItem>
+								<ListBoxItem>Fields</ListBoxItem>
+								<ListBoxItem>Lists</ListBoxItem>
+								<ListBoxItem>Material Icons</ListBoxItem>
+								<ListBoxItem>Progress indicators</ListBoxItem>
+								<ListBoxItem>ScrollViewer</ListBoxItem>
+								<!-- <ListBoxItem>Shadows</ListBoxItem> -->
+								<ListBoxItem>SideSheet</ListBoxItem>
+								<ListBoxItem>Sliders</ListBoxItem>
+								<ListBoxItem>Snackbar</ListBoxItem>
+								<ListBoxItem>TabControls</ListBoxItem>
+								<ListBoxItem>Toggles</ListBoxItem>
+								<ListBoxItem>TreeViews</ListBoxItem>
+								<ListBoxItem>Typography</ListBoxItem>
+							</ListBox>
+						</StackPanel>
+					</ScrollViewer>
+				</controls:NavigationDrawer.LeftDrawerContent>
+				<DockPanel LastChildFill="true">
+					<controls:ColorZone Name="PART_AppBarContainer" VerticalAlignment="Top" HorizontalAlignment="Stretch"
+										DockPanel.Dock="Top"
+										Height="56" Mode="PrimaryMid" ZIndex="1">
+						<Grid Margin="16">
+							<Grid.ColumnDefinitions>
+								<ColumnDefinition Width="24" />
+								<ColumnDefinition Width="32" />
+								<ColumnDefinition Width="*" />
+								<ColumnDefinition Width="32" />
+								<ColumnDefinition Width="Auto" />
+							</Grid.ColumnDefinitions>
+							<ToggleButton Name="NavDrawerSwitch"
+										  Theme="{StaticResource MaterialFlatButton}"
+										  Width="32" Height="32" Padding="4">
+								<avalonia:MaterialIcon Kind="Menu" Width="24" Height="24" />
+							</ToggleButton>
+							<TextBlock Grid.Column="2" Classes="Headline6" Text="Veloe Monitor"
+									   VerticalAlignment="Center" />
+							<Menu Grid.Column="4" Height="32" Padding="0" Margin="0">
+								<MenuItem Height="32" Width="32" Header="{avalonia:MaterialIconExt DotsVertical, Size=24}">
+									<MenuItem Header="Hello!">
+										<MenuItem.Icon>
+											<avalonia:MaterialIcon Kind="Hand" Width="24" Height="24" />
+										</MenuItem.Icon>
+									</MenuItem>
+									<MenuItem Header="Connect to network">
+										<MenuItem.Icon>
+											<avalonia:MaterialIcon Kind="RocketLaunch" Width="24" Height="24" />
+										</MenuItem.Icon>
+									</MenuItem>
+									<Separator />
+									<MenuItem Header="Action 1" />
+									<MenuItem Header="Action 2" />
+									<MenuItem Header="Action 3" />
+									<Separator />
+									<MenuItem Header="Goodbye">
+										<MenuItem.Icon>
+											<avalonia:MaterialIcon Kind="ExitRun" Width="24" Height="24" />
+										</MenuItem.Icon>
+									</MenuItem>
+								</MenuItem>
+							</Menu>
+						</Grid>
+					</controls:ColorZone>
+					<ScrollViewer Name="mainScroller"
+								  DockPanel.Dock="Top"
+								  HorizontalContentAlignment="Stretch"
+								  HorizontalAlignment="Stretch"
+								  HorizontalScrollBarVisibility="Disabled">
+						<Border HorizontalAlignment="Stretch"
+								VerticalAlignment="Stretch">
+							<ContentControl Content="{Binding SelectedPage}" 
+											HorizontalAlignment="Stretch"/>
+						</Border>
+					</ScrollViewer>
+				</DockPanel>
+			</controls:NavigationDrawer>
+		</controls:SnackbarHost>
+</UserControl>

+ 11 - 0
VeloeMonitorApp/Views/MainView.axaml.cs

@@ -0,0 +1,11 @@
+using Avalonia.Controls;
+
+namespace VeloeMonitorApp.Views;
+
+public partial class MainView : UserControl
+{
+    public MainView()
+    {
+        InitializeComponent();
+    }
+}

+ 12 - 0
VeloeMonitorApp/Views/MainWindow.axaml

@@ -0,0 +1,12 @@
+<Window xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:vm="using:VeloeMonitorApp.ViewModels"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:views="clr-namespace:VeloeMonitorApp.Views"
+        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+        x:Class="VeloeMonitorApp.Views.MainWindow"
+        Icon="/Assets/avalonia-logo.ico"
+        Title="VeloeMonitorApp">
+        <views:MainView />
+</Window>

+ 11 - 0
VeloeMonitorApp/Views/MainWindow.axaml.cs

@@ -0,0 +1,11 @@
+using Avalonia.Controls;
+
+namespace VeloeMonitorApp.Views;
+
+public partial class MainWindow : Window
+{
+    public MainWindow()
+    {
+        InitializeComponent();
+    }
+}