mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-08-19 11:03:25 +08:00
feat.RSS阅读器
This commit is contained in:
@@ -7,10 +7,12 @@ public sealed record AirAppLaunchOptions(
|
||||
string? SourcePlacementId,
|
||||
string? LauncherPipeName,
|
||||
string? InstanceKey,
|
||||
string? DataRoot)
|
||||
string? DataRoot,
|
||||
string? TargetEntryId)
|
||||
{
|
||||
public const string WorldClockAppId = "world-clock";
|
||||
public const string WhiteboardAppId = "whiteboard";
|
||||
public const string RssReaderAppId = "rss-reader";
|
||||
|
||||
public static AirAppLaunchOptions Parse(IReadOnlyList<string> args)
|
||||
{
|
||||
@@ -60,7 +62,8 @@ public sealed record AirAppLaunchOptions(
|
||||
GetOptionalValue(values, "source-placement-id"),
|
||||
GetOptionalValue(values, "launcher-pipe"),
|
||||
GetOptionalValue(values, "instance-key"),
|
||||
GetOptionalValue(values, "data-root"));
|
||||
GetOptionalValue(values, "data-root"),
|
||||
GetOptionalValue(values, "target-entry-id"));
|
||||
}
|
||||
|
||||
private static string GetValue(IReadOnlyDictionary<string, string> values, string key, string fallback)
|
||||
|
||||
@@ -4,6 +4,7 @@ using Avalonia.Threading;
|
||||
using FluentAvalonia.UI.Windowing;
|
||||
using LanMountainDesktop.ComponentSystem;
|
||||
using LanMountainDesktop.Services;
|
||||
using LanMountainDesktop.Services.Settings;
|
||||
using LanMountainDesktop.Shared.IPC;
|
||||
using LanMountainDesktop.Shared.IPC.Abstractions.Services;
|
||||
using LanMountainDesktop.Views.Components;
|
||||
@@ -25,11 +26,39 @@ public sealed partial class AirAppWindow : FAAppWindow
|
||||
public AirAppWindow(AirAppLaunchOptions options)
|
||||
{
|
||||
_options = options;
|
||||
_descriptor = AirAppWindowDescriptor.Create(options);
|
||||
_descriptor = LocalizeDescriptor(AirAppWindowDescriptor.Create(options), options);
|
||||
InitializeComponent();
|
||||
ConfigureWindow();
|
||||
}
|
||||
|
||||
private static AirAppWindowDescriptor LocalizeDescriptor(
|
||||
AirAppWindowDescriptor descriptor,
|
||||
AirAppLaunchOptions options)
|
||||
{
|
||||
if (!string.Equals(options.AppId, AirAppLaunchOptions.RssReaderAppId, StringComparison.OrdinalIgnoreCase))
|
||||
return descriptor;
|
||||
|
||||
var localization = new LocalizationService();
|
||||
string languageCode;
|
||||
try
|
||||
{
|
||||
languageCode = localization.NormalizeLanguageCode(new AppSettingsService().Load().LanguageCode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
languageCode = "zh-CN";
|
||||
}
|
||||
|
||||
var title = localization.GetString(languageCode, "component.rss_reader", "RSS Reader");
|
||||
var airApp = localization.GetString(languageCode, "rss.air_app", "Air APP");
|
||||
return descriptor with
|
||||
{
|
||||
WindowTitle = $"{title} - {airApp}",
|
||||
TitleBarTitle = title,
|
||||
TitleBarSubtitle = airApp
|
||||
};
|
||||
}
|
||||
|
||||
private void ConfigureWindow()
|
||||
{
|
||||
ApplyWindowDescriptor(_descriptor);
|
||||
@@ -46,6 +75,12 @@ public sealed partial class AirAppWindow : FAAppWindow
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(_options.AppId, AirAppLaunchOptions.RssReaderAppId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ContentHost.Content = new RssReaderAirAppView(_options);
|
||||
return;
|
||||
}
|
||||
|
||||
ContentHost.Content = new TextBlock
|
||||
{
|
||||
Text = $"Unsupported Air APP: {_options.AppId}",
|
||||
@@ -263,6 +298,11 @@ public sealed partial class AirAppWindow : FAAppWindow
|
||||
return $"{AirAppLaunchOptions.WorldClockAppId}:clock-suite:global";
|
||||
}
|
||||
|
||||
if (string.Equals(_options.AppId, AirAppLaunchOptions.RssReaderAppId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return $"{AirAppLaunchOptions.RssReaderAppId}:global";
|
||||
}
|
||||
|
||||
var componentId = string.IsNullOrWhiteSpace(_options.SourceComponentId)
|
||||
? "none"
|
||||
: _options.SourceComponentId.Trim();
|
||||
|
||||
@@ -43,6 +43,20 @@ public sealed record AirAppWindowDescriptor(
|
||||
"Air APP");
|
||||
}
|
||||
|
||||
if (string.Equals(options.AppId, AirAppLaunchOptions.RssReaderAppId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return Standard(
|
||||
"RSS Reader - Air APP",
|
||||
"RSS Reader",
|
||||
"Air APP",
|
||||
width: 1100,
|
||||
height: 720,
|
||||
minWidth: 760,
|
||||
minHeight: 520,
|
||||
canResize: true,
|
||||
showAsDialog: false);
|
||||
}
|
||||
|
||||
return Standard(
|
||||
"Air APP",
|
||||
"Air APP",
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" />
|
||||
<PackageReference Include="Avalonia.Controls.WebView" />
|
||||
<PackageReference Include="Avalonia.Desktop" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||
|
||||
Reference in New Issue
Block a user