commit 3070582aa465e0821f2d51a7aa334661236cecad Author: eelke Date: Sat Nov 16 14:16:04 2024 +0100 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c2f8de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,152 @@ +# To learn more about .editorconfig see https://aka.ms/editorconfigdocs +############################### +# Core EditorConfig Options # +############################### +# All files +[*] +indent_style = space + +# XML project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# XML config files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 + +# Code files +[*.{cs,csx,vb,vbx}] +indent_size = 4 +insert_final_newline = true +charset = utf-8-bom +############################### +# .NET Coding Conventions # +############################### +[*.{cs,vb}] +# Organize usings +dotnet_sort_system_directives_first = true +# this. preferences +dotnet_style_qualification_for_field =false:suggestion +dotnet_style_qualification_for_property =false:suggestion +dotnet_style_qualification_for_method =false:suggestion +dotnet_style_qualification_for_event =false:suggestion +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members =true:suggestion +dotnet_style_predefined_type_for_member_access =true:suggestion +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators =always_for_clarity:suggestion +dotnet_style_parentheses_in_relational_binary_operators =always_for_clarity:suggestion +dotnet_style_parentheses_in_other_binary_operators =always_for_clarity:suggestion +dotnet_style_parentheses_in_other_operators =never_if_unnecessary:suggestion +# Modifier preferences +dotnet_style_require_accessibility_modifiers =for_non_interface_members:warning +dotnet_style_readonly_field =true:warning +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:warning +dotnet_style_coalesce_expression = true:warning +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_return = true:suggestion +############################### +# Naming Conventions # +############################### +# Style Definitions +dotnet_naming_style.pascal_case_style.capitalization = pascal_case +# Use PascalCase for constant fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * +dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_style_namespace_match_folder= true:warning +dotnet_style_allow_multiple_blank_lines_experimental=false:warning +dotnet_style_operator_placement_when_wrapping = beginning_of_line +tab_width = 4 +end_of_line = crlf +dotnet_diagnostic.RCS1037.severity = warning +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion +############################### +# C# Coding Conventions # +############################### +[*.cs] +# var preferences +csharp_style_var_for_built_in_types =false:suggestion +csharp_style_var_when_type_is_apparent =true:silent +csharp_style_var_elsewhere =true:suggestion +# Expression-bodied members +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +# Pattern matching preferences +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +# Null-checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion +# Modifier preferences +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion +# Expression-level preferences +csharp_prefer_braces = true:silent +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +############################### +# C# Formatting Rules # +############################### +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true +# Indentation preferences +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left +# Space preferences +csharp_space_after_cast = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_around_binary_operators = before_and_after +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +# Wrapping preferences +csharp_preserve_single_line_statements =true +csharp_preserve_single_line_blocks =true +csharp_using_directive_placement= outside_namespace:silent +csharp_style_namespace_declarations= file_scoped:warning +csharp_style_unused_value_assignment_preference=discard_variable:warning +csharp_prefer_static_local_function=true:warning +csharp_style_allow_embedded_statements_on_same_line_experimental=false:warning +csharp_style_allow_blank_lines_between_consecutive_braces_experimental= false:warning +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_prefer_top_level_statements = false:silent +############################### +# VB Coding Conventions # +############################### +[*.vb] +# Modifier preferences +visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13f253d --- /dev/null +++ b/.gitignore @@ -0,0 +1,338 @@ +## 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 + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# 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 + +# 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/ + +# 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 + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# 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 +# 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 + +# 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 +*- Backup*.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/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# 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/ + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..90bb13c --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,22 @@ + + + + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pgLabII.Android/Icon.png b/pgLabII.Android/Icon.png new file mode 100644 index 0000000..41a2a61 Binary files /dev/null and b/pgLabII.Android/Icon.png differ diff --git a/pgLabII.Android/MainActivity.cs b/pgLabII.Android/MainActivity.cs new file mode 100644 index 0000000..e1efa06 --- /dev/null +++ b/pgLabII.Android/MainActivity.cs @@ -0,0 +1,23 @@ +using Android.App; +using Android.Content.PM; +using Avalonia; +using Avalonia.Android; +using Avalonia.ReactiveUI; + +namespace pgLabII.Android; + +[Activity( + Label = "pgLabII.Android", + Theme = "@style/MyTheme.NoActionBar", + Icon = "@drawable/icon", + MainLauncher = true, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] +public class MainActivity : AvaloniaMainActivity +{ + protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) + { + return base.CustomizeAppBuilder(builder) + .WithInterFont() + .UseReactiveUI(); + } +} diff --git a/pgLabII.Android/Properties/AndroidManifest.xml b/pgLabII.Android/Properties/AndroidManifest.xml new file mode 100644 index 0000000..a77e007 --- /dev/null +++ b/pgLabII.Android/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pgLabII.Android/Resources/AboutResources.txt b/pgLabII.Android/Resources/AboutResources.txt new file mode 100644 index 0000000..c2bca97 --- /dev/null +++ b/pgLabII.Android/Resources/AboutResources.txt @@ -0,0 +1,44 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.axml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable/ + icon.png + + layout/ + main.axml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called "R" +(this is an Android convention) that contains the tokens for each one of the resources +included. For example, for the above Resources layout, this is what the R class would expose: + +public class R { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main +to reference the layout/main.axml file, or R.strings.first_string to reference the first +string in the dictionary file values/strings.xml. \ No newline at end of file diff --git a/pgLabII.Android/Resources/drawable-night-v31/avalonia_anim.xml b/pgLabII.Android/Resources/drawable-night-v31/avalonia_anim.xml new file mode 100644 index 0000000..dde4b5a --- /dev/null +++ b/pgLabII.Android/Resources/drawable-night-v31/avalonia_anim.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pgLabII.Android/Resources/drawable-v31/avalonia_anim.xml b/pgLabII.Android/Resources/drawable-v31/avalonia_anim.xml new file mode 100644 index 0000000..94f27d9 --- /dev/null +++ b/pgLabII.Android/Resources/drawable-v31/avalonia_anim.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pgLabII.Android/Resources/drawable/splash_screen.xml b/pgLabII.Android/Resources/drawable/splash_screen.xml new file mode 100644 index 0000000..2e920b4 --- /dev/null +++ b/pgLabII.Android/Resources/drawable/splash_screen.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/pgLabII.Android/Resources/values-night/colors.xml b/pgLabII.Android/Resources/values-night/colors.xml new file mode 100644 index 0000000..3d47b6f --- /dev/null +++ b/pgLabII.Android/Resources/values-night/colors.xml @@ -0,0 +1,4 @@ + + + #212121 + diff --git a/pgLabII.Android/Resources/values-v31/styles.xml b/pgLabII.Android/Resources/values-v31/styles.xml new file mode 100644 index 0000000..d5ecec4 --- /dev/null +++ b/pgLabII.Android/Resources/values-v31/styles.xml @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/pgLabII.Android/Resources/values/colors.xml b/pgLabII.Android/Resources/values/colors.xml new file mode 100644 index 0000000..59279d5 --- /dev/null +++ b/pgLabII.Android/Resources/values/colors.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + diff --git a/pgLabII.Android/Resources/values/styles.xml b/pgLabII.Android/Resources/values/styles.xml new file mode 100644 index 0000000..6e534de --- /dev/null +++ b/pgLabII.Android/Resources/values/styles.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/pgLabII.Android/pgLabII.Android.csproj b/pgLabII.Android/pgLabII.Android.csproj new file mode 100644 index 0000000..562450e --- /dev/null +++ b/pgLabII.Android/pgLabII.Android.csproj @@ -0,0 +1,28 @@ + + + Exe + net8.0-android + 21 + enable + com.CompanyName.pgLabII + 1 + 1.0 + apk + false + + + + + Resources\drawable\Icon.png + + + + + + + + + + + + diff --git a/pgLabII.Browser/Program.cs b/pgLabII.Browser/Program.cs new file mode 100644 index 0000000..84c553e --- /dev/null +++ b/pgLabII.Browser/Program.cs @@ -0,0 +1,17 @@ +using System.Runtime.Versioning; +using System.Threading.Tasks; +using Avalonia; +using Avalonia.Browser; +using Avalonia.ReactiveUI; +using pgLabII; + +internal sealed partial class Program +{ + private static Task Main(string[] args) => BuildAvaloniaApp() + .WithInterFont() + .UseReactiveUI() + .StartBrowserAppAsync("out"); + + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure(); +} \ No newline at end of file diff --git a/pgLabII.Browser/Properties/AssemblyInfo.cs b/pgLabII.Browser/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..fb78795 --- /dev/null +++ b/pgLabII.Browser/Properties/AssemblyInfo.cs @@ -0,0 +1 @@ +[assembly:System.Runtime.Versioning.SupportedOSPlatform("browser")] diff --git a/pgLabII.Browser/Properties/launchSettings.json b/pgLabII.Browser/Properties/launchSettings.json new file mode 100644 index 0000000..980df31 --- /dev/null +++ b/pgLabII.Browser/Properties/launchSettings.json @@ -0,0 +1,13 @@ +{ + "profiles": { + "pgLabII.Browser": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:7169;http://localhost:5235", + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" + } + } +} diff --git a/pgLabII.Browser/pgLabII.Browser.csproj b/pgLabII.Browser/pgLabII.Browser.csproj new file mode 100644 index 0000000..8268eeb --- /dev/null +++ b/pgLabII.Browser/pgLabII.Browser.csproj @@ -0,0 +1,16 @@ + + + net8.0-browser + Exe + true + enable + + + + + + + + + + diff --git a/pgLabII.Browser/runtimeconfig.template.json b/pgLabII.Browser/runtimeconfig.template.json new file mode 100644 index 0000000..b96a943 --- /dev/null +++ b/pgLabII.Browser/runtimeconfig.template.json @@ -0,0 +1,10 @@ +{ + "wasmHostProperties": { + "perHostConfig": [ + { + "name": "browser", + "host": "browser" + } + ] + } +} \ No newline at end of file diff --git a/pgLabII.Browser/wwwroot/app.css b/pgLabII.Browser/wwwroot/app.css new file mode 100644 index 0000000..1d6f754 --- /dev/null +++ b/pgLabII.Browser/wwwroot/app.css @@ -0,0 +1,58 @@ +/* HTML styles for the splash screen */ +.avalonia-splash { + position: absolute; + height: 100%; + width: 100%; + background: white; + font-family: 'Outfit', sans-serif; + justify-content: center; + align-items: center; + display: flex; + pointer-events: none; +} + +/* Light theme styles */ +@media (prefers-color-scheme: light) { + .avalonia-splash { + background: white; + } + + .avalonia-splash h2 { + color: #1b2a4e; + } + + .avalonia-splash a { + color: #0D6EFD; + } +} + +@media (prefers-color-scheme: dark) { + .avalonia-splash { + background: #1b2a4e; + } + + .avalonia-splash h2 { + color: white; + } + + .avalonia-splash a { + color: white; + } +} + +.avalonia-splash h2 { + font-weight: 400; + font-size: 1.5rem; +} + +.avalonia-splash a { + text-decoration: none; + font-size: 2.5rem; + display: block; +} + +.avalonia-splash.splash-close { + transition: opacity 200ms, display 200ms; + display: none; + opacity: 0; +} diff --git a/pgLabII.Browser/wwwroot/favicon.ico b/pgLabII.Browser/wwwroot/favicon.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/pgLabII.Browser/wwwroot/favicon.ico differ diff --git a/pgLabII.Browser/wwwroot/index.html b/pgLabII.Browser/wwwroot/index.html new file mode 100644 index 0000000..fb3f61c --- /dev/null +++ b/pgLabII.Browser/wwwroot/index.html @@ -0,0 +1,36 @@ + + + + + pgLabII.Browser + + + + + + +
+
+

+ Powered by + + + + + + + + + + + + + + +

+
+
+ + + + diff --git a/pgLabII.Browser/wwwroot/main.js b/pgLabII.Browser/wwwroot/main.js new file mode 100644 index 0000000..bf1555e --- /dev/null +++ b/pgLabII.Browser/wwwroot/main.js @@ -0,0 +1,13 @@ +import { dotnet } from './_framework/dotnet.js' + +const is_browser = typeof window != "undefined"; +if (!is_browser) throw new Error(`Expected to be running in a browser`); + +const dotnetRuntime = await dotnet + .withDiagnosticTracing(false) + .withApplicationArgumentsFromQuery() + .create(); + +const config = dotnetRuntime.getConfig(); + +await dotnetRuntime.runMain(config.mainAssemblyName, [globalThis.location.href]); diff --git a/pgLabII.Desktop/Program.cs b/pgLabII.Desktop/Program.cs new file mode 100644 index 0000000..d3aa818 --- /dev/null +++ b/pgLabII.Desktop/Program.cs @@ -0,0 +1,23 @@ +using System; +using Avalonia; +using Avalonia.ReactiveUI; + +namespace pgLabII.Desktop; + +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() + .UsePlatformDetect() + .WithInterFont() + .UseReactiveUI() + .LogToTrace(); +} diff --git a/pgLabII.Desktop/app.manifest b/pgLabII.Desktop/app.manifest new file mode 100644 index 0000000..e55ae32 --- /dev/null +++ b/pgLabII.Desktop/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/pgLabII.Desktop/pgLabII.Desktop.csproj b/pgLabII.Desktop/pgLabII.Desktop.csproj new file mode 100644 index 0000000..67d4d62 --- /dev/null +++ b/pgLabII.Desktop/pgLabII.Desktop.csproj @@ -0,0 +1,27 @@ + + + WinExe + + net8.0 + enable + true + + + + app.manifest + + + + + + + None + All + + + + + + + diff --git a/pgLabII.iOS/AppDelegate.cs b/pgLabII.iOS/AppDelegate.cs new file mode 100644 index 0000000..2e21b1f --- /dev/null +++ b/pgLabII.iOS/AppDelegate.cs @@ -0,0 +1,25 @@ +using Foundation; +using UIKit; +using Avalonia; +using Avalonia.Controls; +using Avalonia.iOS; +using Avalonia.Media; +using Avalonia.ReactiveUI; + +namespace pgLabII.iOS; + +// The UIApplicationDelegate for the application. This class is responsible for launching the +// User Interface of the application, as well as listening (and optionally responding) to +// application events from iOS. +[Register("AppDelegate")] +#pragma warning disable CA1711 // Identifiers should not have incorrect suffix +public partial class AppDelegate : AvaloniaAppDelegate +#pragma warning restore CA1711 // Identifiers should not have incorrect suffix +{ + protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) + { + return base.CustomizeAppBuilder(builder) + .WithInterFont() + .UseReactiveUI(); + } +} diff --git a/pgLabII.iOS/Entitlements.plist b/pgLabII.iOS/Entitlements.plist new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/pgLabII.iOS/Entitlements.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/pgLabII.iOS/Info.plist b/pgLabII.iOS/Info.plist new file mode 100644 index 0000000..9ef8ec5 --- /dev/null +++ b/pgLabII.iOS/Info.plist @@ -0,0 +1,43 @@ + + + + + CFBundleDisplayName + pgLabII + CFBundleIdentifier + companyName.pgLabII + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + MinimumOSVersion + 13.0 + UIDeviceFamily + + 1 + 2 + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/pgLabII.iOS/Main.cs b/pgLabII.iOS/Main.cs new file mode 100644 index 0000000..01ff99a --- /dev/null +++ b/pgLabII.iOS/Main.cs @@ -0,0 +1,14 @@ +using UIKit; + +namespace pgLabII.iOS; + +public class Application +{ + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } +} diff --git a/pgLabII.iOS/Resources/LaunchScreen.xib b/pgLabII.iOS/Resources/LaunchScreen.xib new file mode 100644 index 0000000..f610a15 --- /dev/null +++ b/pgLabII.iOS/Resources/LaunchScreen.xib @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pgLabII.iOS/pgLabII.iOS.csproj b/pgLabII.iOS/pgLabII.iOS.csproj new file mode 100644 index 0000000..2e94356 --- /dev/null +++ b/pgLabII.iOS/pgLabII.iOS.csproj @@ -0,0 +1,16 @@ + + + Exe + net8.0-ios + 13.0 + enable + + + + + + + + + + diff --git a/pgLabII.sln b/pgLabII.sln new file mode 100644 index 0000000..a0bdd49 --- /dev/null +++ b/pgLabII.sln @@ -0,0 +1,55 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32811.315 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII", "pgLabII\pgLabII.csproj", "{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.Desktop", "pgLabII.Desktop\pgLabII.Desktop.csproj", "{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.Browser", "pgLabII.Browser\pgLabII.Browser.csproj", "{1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.iOS", "pgLabII.iOS\pgLabII.iOS.csproj", "{EBD9022F-BC83-4846-9A11-6F7F3772DC64}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.Android", "pgLabII.Android\pgLabII.Android.csproj", "{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3DA99C4E-89E3-4049-9C22-0A7EC60D83D8}" + ProjectSection(SolutionItems) = preProject + Directory.Packages.props = Directory.Packages.props + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.Build.0 = Release|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.Build.0 = Release|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Release|Any CPU.Build.0 = Release|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.Build.0 = Release|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {83CB65B8-011F-4ED7-BCD3-A6CFA935EF7E} + EndGlobalSection +EndGlobal diff --git a/pgLabII/App.axaml b/pgLabII/App.axaml new file mode 100644 index 0000000..5261ed2 --- /dev/null +++ b/pgLabII/App.axaml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/pgLabII/App.axaml.cs b/pgLabII/App.axaml.cs new file mode 100644 index 0000000..41bc083 --- /dev/null +++ b/pgLabII/App.axaml.cs @@ -0,0 +1,36 @@ +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using pgLabII.ViewModels; +using pgLabII.Views; + +namespace pgLabII; + +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(); + } + +} \ No newline at end of file diff --git a/pgLabII/Assets/avalonia-logo.ico b/pgLabII/Assets/avalonia-logo.ico new file mode 100644 index 0000000..da8d49f Binary files /dev/null and b/pgLabII/Assets/avalonia-logo.ico differ diff --git a/pgLabII/ConnectionManager/ServerConfiguration.cs b/pgLabII/ConnectionManager/ServerConfiguration.cs new file mode 100644 index 0000000..9bf313a --- /dev/null +++ b/pgLabII/ConnectionManager/ServerConfiguration.cs @@ -0,0 +1,19 @@ +using Npgsql; +using System.Collections.ObjectModel; + +namespace pgLabII; + +public class ServerConfiguration +{ + /// + /// For the user to help him identify the item + /// + public string Name { get; set; } = ""; + + public string Host { get; set; } = ""; + public ushort Port { get; set; } = 5432; + public string InitialDatabase { get; set; } = ""; + public SslMode DefaultSslMode { get; set; } = SslMode.Prefer; + + public ObservableCollection Users { get; } = []; +} diff --git a/pgLabII/ConnectionManager/ServerUser.cs b/pgLabII/ConnectionManager/ServerUser.cs new file mode 100644 index 0000000..669da16 --- /dev/null +++ b/pgLabII/ConnectionManager/ServerUser.cs @@ -0,0 +1,11 @@ +using Npgsql; +using pgLabII.ViewModels; + +namespace pgLabII; + +public class ServerUser : ViewModelBase +{ + public string Name { get; set; } = ""; + public string Password { get; set; } = ""; + public SslMode? SslModeOverride { get; set; } +} diff --git a/pgLabII/ViewLocator.cs b/pgLabII/ViewLocator.cs new file mode 100644 index 0000000..8febb4f --- /dev/null +++ b/pgLabII/ViewLocator.cs @@ -0,0 +1,30 @@ +using System; +using Avalonia.Controls; +using Avalonia.Controls.Templates; +using pgLabII.ViewModels; + +namespace pgLabII; + +public class ViewLocator : IDataTemplate +{ + public Control? Build(object? param) + { + if (param is null) + return null; + + var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal); + 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; + } +} \ No newline at end of file diff --git a/pgLabII/ViewModels/MainViewModel.cs b/pgLabII/ViewModels/MainViewModel.cs new file mode 100644 index 0000000..20eb607 --- /dev/null +++ b/pgLabII/ViewModels/MainViewModel.cs @@ -0,0 +1,7 @@ + +namespace pgLabII.ViewModels; + +public class MainViewModel : ViewModelBase +{ + public string Greeting { get; } = "Welcome to pgLabII"; +} diff --git a/pgLabII/ViewModels/ServerListViewModel.cs b/pgLabII/ViewModels/ServerListViewModel.cs new file mode 100644 index 0000000..163d5d9 --- /dev/null +++ b/pgLabII/ViewModels/ServerListViewModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace pgLabII.ViewModels; + +public class ServerListViewModel : ViewModelBase +{ + public ObservableCollection ServerConfigurations { get; } = []; +} diff --git a/pgLabII/ViewModels/ViewModelBase.cs b/pgLabII/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..37eadd5 --- /dev/null +++ b/pgLabII/ViewModels/ViewModelBase.cs @@ -0,0 +1,7 @@ +using ReactiveUI; + +namespace pgLabII.ViewModels; + +public abstract class ViewModelBase : ReactiveObject +{ +} diff --git a/pgLabII/Views/MainView.axaml b/pgLabII/Views/MainView.axaml new file mode 100644 index 0000000..6a1ba4f --- /dev/null +++ b/pgLabII/Views/MainView.axaml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/pgLabII/Views/MainView.axaml.cs b/pgLabII/Views/MainView.axaml.cs new file mode 100644 index 0000000..fb729d5 --- /dev/null +++ b/pgLabII/Views/MainView.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace pgLabII.Views; + +public partial class MainView : UserControl +{ + public MainView() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/pgLabII/Views/MainWindow.axaml b/pgLabII/Views/MainWindow.axaml new file mode 100644 index 0000000..4bfb609 --- /dev/null +++ b/pgLabII/Views/MainWindow.axaml @@ -0,0 +1,12 @@ + + + diff --git a/pgLabII/Views/MainWindow.axaml.cs b/pgLabII/Views/MainWindow.axaml.cs new file mode 100644 index 0000000..f085ff6 --- /dev/null +++ b/pgLabII/Views/MainWindow.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace pgLabII.Views; + +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/pgLabII/pgLabII.csproj b/pgLabII/pgLabII.csproj new file mode 100644 index 0000000..138d14c --- /dev/null +++ b/pgLabII/pgLabII.csproj @@ -0,0 +1,24 @@ + + + net8.0 + enable + latest + true + + + + + + + + + + + + + None + All + + + +