53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using Avalonia.Controls;
|
|
using VisionAsist.SDK;
|
|
namespace ModuleWeather;
|
|
|
|
public class WeatherModule : IModule
|
|
{
|
|
|
|
public static string port;
|
|
public WeatherModule()
|
|
{
|
|
|
|
|
|
}
|
|
public string Name => "Модуль компиляции ардуино";
|
|
|
|
public string[] GetCommands() => new[] { "погода", "поверни на *", "верни *" };
|
|
|
|
public void Settings(object[] args)
|
|
{
|
|
// 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();
|
|
|
|
}
|
|
|
|
public object Execute(string command)
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
switch (command)
|
|
{
|
|
case "погода":
|
|
|
|
return "Погода хорошая!";
|
|
default:
|
|
return "Команда не найдена";
|
|
}
|
|
}
|
|
} |