This commit is contained in:
2026-03-19 13:14:53 +02:00
parent 9ce8e190a2
commit 7fde404b5a
10 changed files with 167 additions and 8 deletions

40
ModuleWeather/Module.cs Normal file
View File

@@ -0,0 +1,40 @@
using Avalonia.Controls;
namespace ModuleWeather;
public class WeatherModule
{
public string Name => "Прогноз Погоды";
public string[] GetCommands() => new[] { "ShowWeather", "Ping" };
public object Execute(string command, object[] args)
{
switch (command)
{
case "ShowWeather":
// args[0] — это родительское окно из Ядра
var parentWindow = args != null && args.Length > 0 ? args[0] as Window : null;
var win = new Window
{
Title = "Окно Погоды",
Content = new WeatherView(), // Вставляем наш контрол
Width = 350,
Height = 250,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
if (parentWindow != null) win.Show(parentWindow);
else win.Show();
return "Окно открыто успешно";
case "Ping":
return "Pong! Модуль погоды активен.";
default:
return "Команда не найдена";
}
}
}