{"id":24788788,"url":"https://github.com/mrhodel/rpiapp","last_synced_at":"2026-05-09T00:37:45.466Z","repository":{"id":274653832,"uuid":"922349060","full_name":"mrhodel/rpiApp","owner":"mrhodel","description":"A cross-platform project template for Windows and Linux, using the MVVM design pattern for easier maintenance and testing.","archived":false,"fork":false,"pushed_at":"2025-01-28T15:52:51.000Z","size":7802,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-28T16:28:22.274Z","etag":null,"topics":["avalonia","dependency-injection","dialog-host","iot-device","live-charts","logging","message-box","property-grid","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrhodel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-26T00:29:19.000Z","updated_at":"2025-01-28T15:52:54.000Z","dependencies_parsed_at":"2025-01-28T16:28:48.880Z","dependency_job_id":"3ec0ebe9-425c-4822-9cde-f6c05a5d30cc","html_url":"https://github.com/mrhodel/rpiApp","commit_stats":null,"previous_names":["mrhodel/rpiapp"],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhodel%2FrpiApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhodel%2FrpiApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhodel%2FrpiApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhodel%2FrpiApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrhodel","download_url":"https://codeload.github.com/mrhodel/rpiApp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245267570,"owners_count":20587459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avalonia","dependency-injection","dialog-host","iot-device","live-charts","logging","message-box","property-grid","raspberry-pi"],"created_at":"2025-01-29T17:14:57.749Z","updated_at":"2026-05-09T00:37:45.425Z","avatar_url":"https://github.com/mrhodel.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rpiApp\n\nA cross-platform project template for Windows and Linux, using the MVVM design pattern for easier maintenance and testing.\n\n## Table of Contents\n- [Introduction](#introduction)\n- [Features](#features)\n- [Getting Started](#getting-started)\n- [Publishing](#publishing)\n- [How to Add a New Content Control](#how-to-add-a-new-content-control)]\n- [How to Show a Message Box](#how-to-show-a-message-box)]\n- [Debugging](#debugging)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Introduction\nrpiApp is a project template designed to facilitate the development of cross-platform applications for both Windows and Linux. It leverages the Model-View-ViewModel (MVVM) design pattern to ensure that the codebase is maintainable and testable. \n\n## Features\n- [Avalonia](https://avaloniaui.net/?utm_source=nuget\u0026utm_medium=referral\u0026utm_content=project_homepage_link) GUI Framework\n- Cross-platform support for Windows and Linux\n- [MVVM](https://github.com/CommunityToolkit/dotnet) design pattern\n- [Semantic versioning](https://semver.org/spec/v2.0.0-rc.2.html) for version management\n- Examples using the following NuGet Packages\n\t- [Serilog](https://github.com/serilog/serilog) logging\n\t- [IoT Device Bindings](https://github.com/dotnet/iot) for various IoT boards, chips, displays and PCBs including RPi.\n\t- [Property Grid](https://github.com/bodong1987/Avalonia.PropertyGrid) for easy editing of a class properties.\n\t- [MVVM Dialogs](https://github.com/mysteryx93/HanumanInstitute.MvvmDialogs)Library simplifying the concept of opening dialogs and message boxes from a view model when using MVVM\n\t- [LiveChart2](https://github.com/beto-rodriguez/LiveCharts2) Simple, flexible, interactive \u0026 powerful charts, maps and gauges for .Net\n\t- [Microsoft Extensions Dependency Injection](https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection/9.0.1#show-readme-container) Supports the dependency injection (DI) software design pattern which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies.\n\t- [Avalonia Edit](https://github.com/AvaloniaUI/AvaloniaEdit) Text editor with syntax highlighting, code completion, and tons of other features.\n## Getting Started\n\n### Prerequisites\n- .NET 9 SDK\n- Visual Studio 2022 or any other compatible IDE\n\n### Installation\nSelect [\u003cimg src=\"Pics/UseThisTemplate.png\" height=30\u003e]() from GitHub (https://github.com/mrhodel/rpiApp.git) to create a new repository\n\n## Publishing\nTo publish the application, you can use Visual Studio:\n\n1. Open the project in Visual Studio.\n2. Right-click the project in Solution Explorer and select **Publish**.\n3. Select a publish profile [\u003cimg src=\"Pics/PublishProfiles.png\" height=60\u003e]()  (Select linux-arm64 for Raspberry Pi)\n4. Click Publish.\n\nThe published files will be available in the specified folder. You can then distribute these files as needed.\nNote: For debugging on Linux do not check \"Produce Single File\" found in File Publish Options.\n\n## How to Add a New Content Control\n### Add the following files\n```c#\n/*\n * YOURViewModel.cs\n * 1/26/2025 YOU\n*/\nnamespace YOURApp.ViewModels;\n\npublic class YOURViewModel : ViewModelBase\n{\n}\n```\n\n```c#\n\u003c!--\n YOURView.axaml\n 1/26/2025 YOU\n--\u003e\n\u003cUserControl\n    x:Class=\"YOURAPP.Views.YOURView\"\n    xmlns=\"https://github.com/avaloniaui\"\n    xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n    xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n    xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n    xmlns:vm=\"using:YOURApp.ViewModels\"\n    d:DesignHeight=\"450\"\n    d:DesignWidth=\"800\"\n    x:DataType=\"vm:YOURViewModel\"\n    mc:Ignorable=\"d\"\u003e\n    \n    \u003cDesign.DataContext\u003e\n        \u003c!--\n            this only sets the datacontext for the previewer in an ide,\n            to set the actual datacontext for runtime, set the datacontext property in code (look at app.axaml.cs)\n        --\u003e\n        \u003cvm:YOURViewModel /\u003e\n    \u003c/Design.DataContext\u003e\n    \n    \u003cgrid/\u003e   \n\u003c/UserControl\u003e\n```\nInherit UserControl from your code behind file. Note: This file is created automatically when you add a control to your project.\n```c#\nusing Avalonia.Controls;\nnamespace YOURApp.Views;\n\npublic partial class YOURView : UserControl\n{\n    public YOURView()\n    {\n        InitializeComponent();\n    }\n}\n```\n### Register your ViewModel in ConfigureServices.cs\n```c#\n.AddTransient\u003cYOURViewModel\u003e()\n```\nIf you want to show your Content Control as a dialog, add an extension method to DialogExtensions.cs\n```c#\n    public static async Task\u003cbool?\u003e ShowYOURViewAsync(this IDialogService dialog, INotifyPropertyChanged? ownerViewModel)\n    {\n        var viewModel = dialog.CreateViewModel\u003cYOURViewModel\u003e();\n        var settings = new DialogHostSettings(viewModel)\n        {\n            DialogMargin = new Avalonia.Thickness(20),\n            DisableOpeningAnimation = false,\n            CloseOnClickAway = true\n        };\n        // If the calling view model is for a window then use that window as the owner, otherwise use the main view.\n        Guard.IsNotNull(_mainView);\n        await dialog.ShowDialogHostAsync((ownerViewModel is not null) ? ownerViewModel : _mainView, settings);\n        return viewModel.DialogResult;\n    }\n```\n### Add this code in your View Model to show the dialog:\n```c#\n        var result = await _dialogService.ShowCameraInfoViewAsync(null);\n        Debug.WriteLine($\"Dialog result: {result}\");\n```\n## How to Show a Message Box\n```c#\n        var result = await _dialogService!.ShowMessageBoxAsync(\n                null,\n                \"Not implemented\", \"\",\n                MessageBoxButton.Ok,\n                MessageBoxImage.Warning,\n                null);\n        Debug.WriteLine($\"Dialog result: {result}\");\n```\n\n\n## Debugging\n\n### Remote Debugging a Linux Target\n\n1. Copy the published files to the target system. I recommend [WinSCP](//winscp.net/) to sync your local publish folder with the remote device.\n2. Run the application on the remote device.\n3. Select **Attach to Process...** from the Visual Studio Debug menu.\n4. Enter the Connection type and connection target.\n5. Select the application from the list, and click connect.\n\n\n[\u003cimg src=\"Pics/AttachToProcess.png\" height=180\u003e]()\n\n### On Windows use Visual Studio as usual.\n\n## Contributing\nContributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that your code adheres to the existing coding style and includes appropriate tests.\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhodel%2Frpiapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrhodel%2Frpiapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhodel%2Frpiapp/lists"}