Files
LanMountainDesktop/LanMountainDesktop.AirAppHost/AirAppWindowDescriptor.cs

152 lines
4.1 KiB
C#
Raw Normal View History

2026-05-14 19:44:01 +08:00
namespace LanMountainDesktop.AirAppHost;
public sealed record AirAppWindowDescriptor(
string WindowTitle,
string TitleBarTitle,
string TitleBarSubtitle,
AirAppWindowChromeMode ChromeMode,
bool CanResize,
bool ShowInTaskbar,
bool ShowAsDialog,
2026-05-14 19:44:01 +08:00
double Width,
double Height,
double MinWidth,
double MinHeight)
{
public string Title => WindowTitle;
public string TitleText => TitleBarTitle;
public string SubtitleText => TitleBarSubtitle;
public static AirAppWindowDescriptor Create(AirAppLaunchOptions options)
{
if (string.Equals(options.AppId, AirAppLaunchOptions.WorldClockAppId, StringComparison.OrdinalIgnoreCase))
{
return Standard(
"Clock - Air APP",
"Clock",
2026-05-18 08:30:40 +08:00
"Air APP",
width: 780,
height: 560,
minWidth: 680,
minHeight: 480,
canResize: true,
showAsDialog: false);
2026-05-14 19:44:01 +08:00
}
if (string.Equals(options.AppId, AirAppLaunchOptions.WhiteboardAppId, StringComparison.OrdinalIgnoreCase))
{
return FullScreen(
"Whiteboard - Air APP",
"Whiteboard",
"Air APP");
}
return Standard(
"Air APP",
"Air APP",
options.AppId);
}
public static AirAppWindowDescriptor Standard(
string windowTitle,
string titleBarTitle,
string titleBarSubtitle,
double width = 520,
double height = 360,
double minWidth = 360,
double minHeight = 260,
bool canResize = true,
bool showAsDialog = false)
2026-05-14 19:44:01 +08:00
{
return new AirAppWindowDescriptor(
windowTitle,
titleBarTitle,
titleBarSubtitle,
AirAppWindowChromeMode.Standard,
CanResize: canResize,
2026-05-14 19:44:01 +08:00
ShowInTaskbar: true,
ShowAsDialog: showAsDialog,
2026-05-14 19:44:01 +08:00
width,
height,
minWidth,
minHeight);
}
public static AirAppWindowDescriptor FullScreen(
string windowTitle,
string titleBarTitle,
string titleBarSubtitle)
{
return new AirAppWindowDescriptor(
windowTitle,
titleBarTitle,
titleBarSubtitle,
AirAppWindowChromeMode.FullScreen,
CanResize: false,
ShowInTaskbar: true,
ShowAsDialog: false,
2026-05-14 19:44:01 +08:00
Width: 1280,
Height: 720,
MinWidth: 360,
MinHeight: 260);
}
public static AirAppWindowDescriptor Borderless(
string windowTitle,
double width = 520,
double height = 360)
{
return new AirAppWindowDescriptor(
windowTitle,
string.Empty,
string.Empty,
AirAppWindowChromeMode.Borderless,
CanResize: true,
ShowInTaskbar: true,
ShowAsDialog: false,
2026-05-14 19:44:01 +08:00
width,
height,
MinWidth: 240,
MinHeight: 180);
}
public static AirAppWindowDescriptor Tool(
string windowTitle,
string titleBarTitle,
string titleBarSubtitle,
double width = 360,
double height = 260)
{
return new AirAppWindowDescriptor(
windowTitle,
titleBarTitle,
titleBarSubtitle,
AirAppWindowChromeMode.Tool,
CanResize: false,
ShowInTaskbar: false,
ShowAsDialog: true,
2026-05-14 19:44:01 +08:00
width,
height,
MinWidth: 240,
MinHeight: 180);
}
public static AirAppWindowDescriptor BackgroundOnly(string appId)
{
return new AirAppWindowDescriptor(
$"{appId} - Air APP",
string.Empty,
string.Empty,
AirAppWindowChromeMode.BackgroundOnly,
CanResize: false,
ShowInTaskbar: false,
ShowAsDialog: false,
2026-05-14 19:44:01 +08:00
Width: 1,
Height: 1,
MinWidth: 1,
MinHeight: 1);
}
}