Major production merge: GTK support, context menus, and dispatcher fixes
Core Infrastructure: - Add Dispatching folder with LinuxDispatcher, LinuxDispatcherProvider, LinuxDispatcherTimer - Add Native folder with P/Invoke wrappers (GTK, GLib, GDK, Cairo, WebKit) - Add GTK host window system with GtkHostWindow and GtkSkiaSurfaceWidget - Update LinuxApplication with GTK mode, theme handling, and icon support - Fix duplicate LinuxDispatcher in LinuxMauiContext Handlers: - Add GtkWebViewManager and GtkWebViewPlatformView for GTK WebView - Add FlexLayoutHandler and GestureManager - Update multiple handlers with ToViewHandler fix and missing mappers - Add MauiHandlerExtensions with ToViewHandler extension method Views: - Add SkiaContextMenu with hover, keyboard, and dark theme support - Add LinuxDialogService with context menu management - Add SkiaFlexLayout for flex container support - Update SkiaShell with RefreshTheme, MauiShell, ContentRenderer - Update SkiaWebView with SetMainWindow, ProcessGtkEvents - Update SkiaImage with LoadFromBitmap method Services: - Add AppInfoService, ConnectivityService, DeviceDisplayService, DeviceInfoService - Add GtkHostService, GtkContextMenuService, MauiIconGenerator Window: - Add CursorType enum and GtkHostWindow - Update X11Window with SetIcon, SetCursor methods Build: SUCCESS (0 errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
93
Services/DeviceInfoService.cs
Normal file
93
Services/DeviceInfoService.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Maui.Devices;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Services;
|
||||
|
||||
public class DeviceInfoService : IDeviceInfo
|
||||
{
|
||||
private static readonly Lazy<DeviceInfoService> _instance = new Lazy<DeviceInfoService>(() => new DeviceInfoService());
|
||||
|
||||
private string? _model;
|
||||
|
||||
private string? _manufacturer;
|
||||
|
||||
private string? _name;
|
||||
|
||||
private string? _versionString;
|
||||
|
||||
public static DeviceInfoService Instance => _instance.Value;
|
||||
|
||||
public string Model => _model ?? "Linux Desktop";
|
||||
|
||||
public string Manufacturer => _manufacturer ?? "Unknown";
|
||||
|
||||
public string Name => _name ?? Environment.MachineName;
|
||||
|
||||
public string VersionString => _versionString ?? Environment.OSVersion.VersionString;
|
||||
|
||||
public Version Version
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
if (System.Version.TryParse(Environment.OSVersion.Version.ToString(), out Version? result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return new Version(1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public DevicePlatform Platform => DevicePlatform.Create("Linux");
|
||||
|
||||
public DeviceIdiom Idiom => DeviceIdiom.Desktop;
|
||||
|
||||
public DeviceType DeviceType => DeviceType.Physical;
|
||||
|
||||
public DeviceInfoService()
|
||||
{
|
||||
LoadDeviceInfo();
|
||||
}
|
||||
|
||||
private void LoadDeviceInfo()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists("/sys/class/dmi/id/product_name"))
|
||||
{
|
||||
_model = File.ReadAllText("/sys/class/dmi/id/product_name").Trim();
|
||||
}
|
||||
if (File.Exists("/sys/class/dmi/id/sys_vendor"))
|
||||
{
|
||||
_manufacturer = File.ReadAllText("/sys/class/dmi/id/sys_vendor").Trim();
|
||||
}
|
||||
_name = Environment.MachineName;
|
||||
_versionString = Environment.OSVersion.VersionString;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (_model == null)
|
||||
{
|
||||
_model = "Linux Desktop";
|
||||
}
|
||||
if (_manufacturer == null)
|
||||
{
|
||||
_manufacturer = "Unknown";
|
||||
}
|
||||
if (_name == null)
|
||||
{
|
||||
_name = "localhost";
|
||||
}
|
||||
if (_versionString == null)
|
||||
{
|
||||
_versionString = "Linux";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user