mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
feat.完善了时钟轻应用,为启动器提供了多语言支持
This commit is contained in:
@@ -3,6 +3,7 @@ using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using LanMountainDesktop.Launcher.Resources;
|
||||
using LanMountainDesktop.Launcher.Services;
|
||||
using LanMountainDesktop.Shared.Contracts.Launcher;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -57,7 +58,7 @@ public partial class LoadingDetailsWindow : Window
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鏇存柊鍔犺浇鐘舵€? /// </summary>
|
||||
/// 更新加载状<EFBFBD>? /// </summary>
|
||||
public void UpdateLoadingState(LoadingStateMessage state)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
@@ -120,7 +121,7 @@ public partial class LoadingDetailsWindow : Window
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鏇存柊褰撳墠娲诲姩椤? /// </summary>
|
||||
/// 更新当前活动<EFBFBD>? /// </summary>
|
||||
private void UpdateCurrentItem(LoadingStateMessage state)
|
||||
{
|
||||
var currentItem = state.ActiveItems.FirstOrDefault();
|
||||
@@ -181,7 +182,7 @@ public partial class LoadingDetailsWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
// 鎸夌姸鎬佹帓搴忥細杩涜<EFBFBD>涓?-> 绛夊緟涓?-> 宸插畬鎴?-> 澶辫触
|
||||
// 按状态排序:进行<EFBFBD>?-> 等待<E7AD89>?-> 已完<E5B7B2>?-> 失败
|
||||
var sortedItems = _items.OrderBy(i => GetStatePriority(i.State)).ToList();
|
||||
_items.Clear();
|
||||
foreach (var item in sortedItems)
|
||||
@@ -234,20 +235,20 @@ public partial class LoadingDetailsWindow : Window
|
||||
/// </summary>
|
||||
private static string GetStageDescription(StartupStage stage) => stage switch
|
||||
{
|
||||
StartupStage.Initializing => "正在初始化系统...",
|
||||
StartupStage.LoadingSettings => "正在加载设置...",
|
||||
StartupStage.LoadingPlugins => "正在加载插件...",
|
||||
StartupStage.InitializingUI => "正在初始化界面...",
|
||||
StartupStage.ShellInitialized => "桌面外壳已初始化",
|
||||
StartupStage.DesktopVisible => "桌面已经可见",
|
||||
StartupStage.ActivationRedirected => "已激活现有实例",
|
||||
StartupStage.ActivationFailed => "现有实例激活失败",
|
||||
StartupStage.Ready => "加载完成",
|
||||
_ => "正在加载..."
|
||||
StartupStage.Initializing => "正在初始化系统...",
|
||||
StartupStage.LoadingSettings => "正在加载设置...",
|
||||
StartupStage.LoadingPlugins => "正在加载插件...",
|
||||
StartupStage.InitializingUI => "正在初始化界面...",
|
||||
StartupStage.ShellInitialized => "桌面程序已初始化",
|
||||
StartupStage.DesktopVisible => "桌面已经可见",
|
||||
StartupStage.ActivationRedirected => "已激活到现有实例",
|
||||
StartupStage.ActivationFailed => "激活现有实例失败",
|
||||
StartupStage.Ready => Strings.Loading_StageReady,
|
||||
_ => "正在加载..."
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 鑾峰彇椤规弿杩? /// </summary>
|
||||
/// 获取项描<EFBFBD>? /// </summary>
|
||||
private static string GetItemDescription(LoadingItem item)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.Description))
|
||||
@@ -255,17 +256,17 @@ public partial class LoadingDetailsWindow : Window
|
||||
|
||||
return item.Type switch
|
||||
{
|
||||
LoadingItemType.Plugin => "姝e湪鍔犺浇鎻掍欢...",
|
||||
LoadingItemType.Component => "姝e湪鍔犺浇缁勪欢...",
|
||||
LoadingItemType.Resource => "姝e湪鍔犺浇璧勬簮...",
|
||||
LoadingItemType.Data => "姝e湪鍔犺浇鏁版嵁...",
|
||||
LoadingItemType.Network => "姝e湪涓嬭浇...",
|
||||
_ => "姝e湪澶勭悊..."
|
||||
LoadingItemType.Plugin => Strings.Loading_ItemPlugin,
|
||||
LoadingItemType.Component => Strings.Loading_ItemComponent,
|
||||
LoadingItemType.Resource => Strings.Loading_ItemResource,
|
||||
LoadingItemType.Data => Strings.Loading_ItemData,
|
||||
LoadingItemType.Network => Strings.Loading_ItemDownload,
|
||||
_ => Strings.Loading_ItemProcess
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鑾峰彇椤瑰浘鏍? /// </summary>
|
||||
/// 获取项图<EFBFBD>? /// </summary>
|
||||
private static string GetItemIcon(LoadingItemType type) => type switch
|
||||
{
|
||||
LoadingItemType.Plugin => "\uE768",
|
||||
@@ -294,7 +295,7 @@ public partial class LoadingDetailsWindow : Window
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鍔犺浇椤硅<EFBFBD>鍥炬ā鍨?/// </summary>
|
||||
/// 加载项视图模<EFBFBD>?/// </summary>
|
||||
public class LoadingItemViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public string Id { get; }
|
||||
@@ -306,7 +307,7 @@ public class LoadingItemViewModel : INotifyPropertyChanged
|
||||
|
||||
public string StatusIcon => GetStatusIcon(State);
|
||||
public IBrush StatusColor => GetStatusColor(State);
|
||||
public string ProgressText => State == LoadingState.Completed ? "瀹屾垚" : $"{ProgressPercent}%";
|
||||
public string ProgressText => State == LoadingState.Completed ? Strings.Loading_ItemComplete : $"{ProgressPercent}%";
|
||||
public string TypeLabel => GetTypeLabel(Type);
|
||||
public IBrush TypeBackground => GetTypeBackground(Type);
|
||||
public IBrush TypeForeground => GetTypeForeground(Type);
|
||||
@@ -359,14 +360,14 @@ public class LoadingItemViewModel : INotifyPropertyChanged
|
||||
|
||||
private static string GetTypeLabel(LoadingItemType type) => type switch
|
||||
{
|
||||
LoadingItemType.Plugin => "鎻掍欢",
|
||||
LoadingItemType.Component => "缁勪欢",
|
||||
LoadingItemType.Resource => "璧勬簮",
|
||||
LoadingItemType.Data => "鏁版嵁",
|
||||
LoadingItemType.Network => "缃戠粶",
|
||||
LoadingItemType.Settings => "璁剧疆",
|
||||
LoadingItemType.System => "绯荤粺",
|
||||
_ => "鍏朵粬"
|
||||
LoadingItemType.Plugin => Strings.Loading_TypePlugin,
|
||||
LoadingItemType.Component => Strings.Loading_TypeComponent,
|
||||
LoadingItemType.Resource => Strings.Loading_TypeResource,
|
||||
LoadingItemType.Data => Strings.Loading_TypeData,
|
||||
LoadingItemType.Network => Strings.Loading_TypeNetwork,
|
||||
LoadingItemType.Settings => Strings.Loading_TypeSettings,
|
||||
LoadingItemType.System => Strings.Loading_TypeSystem,
|
||||
_ => Strings.Loading_TypeOther
|
||||
};
|
||||
|
||||
private static IBrush GetTypeBackground(LoadingItemType type) => type switch
|
||||
|
||||
Reference in New Issue
Block a user