diff --git a/ModuleWeather/MainWindow.axaml b/ModuleWeather/MainWindow.axaml
new file mode 100644
index 0000000..059fcf7
--- /dev/null
+++ b/ModuleWeather/MainWindow.axaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ModuleWeather/MainWindow.axaml.cs b/ModuleWeather/MainWindow.axaml.cs
new file mode 100644
index 0000000..cd06c79
--- /dev/null
+++ b/ModuleWeather/MainWindow.axaml.cs
@@ -0,0 +1,22 @@
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Media;
+
+namespace ModuleWeather;
+
+public partial class WeatherView : UserControl
+{
+ public WeatherView() => InitializeComponent();
+
+ private void GetWeatherButton_Click(object? sender, RoutedEventArgs e)
+ {
+ var city = this.FindControl("CityInput")?.Text;
+ var status = this.FindControl("StatusText");
+
+ if (string.IsNullOrWhiteSpace(city)) {
+ status.Text = "Ошибка: введите город";
+ return;
+ }
+ status.Text = $"В городе {city} сейчас +20°C"; // Тут могла быть логика API
+ }
+}
\ No newline at end of file
diff --git a/ModuleWeather/Module.cs b/ModuleWeather/Module.cs
new file mode 100644
index 0000000..775153c
--- /dev/null
+++ b/ModuleWeather/Module.cs
@@ -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 "Команда не найдена";
+ }
+ }
+}
\ No newline at end of file
diff --git a/ModuleWeather/ModuleWeather.csproj b/ModuleWeather/ModuleWeather.csproj
new file mode 100644
index 0000000..3a4f7bf
--- /dev/null
+++ b/ModuleWeather/ModuleWeather.csproj
@@ -0,0 +1,24 @@
+
+
+
+ net10.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+ MainWindow.axaml
+
+
+
+
+
+
+
+
+
diff --git a/VisionAsist.SDK/IModule.cs b/VisionAsist.SDK/IModule.cs
new file mode 100644
index 0000000..45d5ed0
--- /dev/null
+++ b/VisionAsist.SDK/IModule.cs
@@ -0,0 +1,8 @@
+namespace VisionAsist.SDK;
+
+public interface IModule
+{
+ string Name { get; }
+ string[] GetCommands();
+ object Execute(string command, object[] args);
+}
\ No newline at end of file
diff --git a/VisionAsist.SDK/VisionAsist.SDK.csproj b/VisionAsist.SDK/VisionAsist.SDK.csproj
new file mode 100644
index 0000000..237d661
--- /dev/null
+++ b/VisionAsist.SDK/VisionAsist.SDK.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net10.0
+ enable
+ enable
+
+
+
diff --git a/VisionAsist.sln b/VisionAsist.sln
index cdf00ec..7ecdea2 100644
--- a/VisionAsist.sln
+++ b/VisionAsist.sln
@@ -2,6 +2,10 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisionAsist", "VisionAsist\VisionAsist.csproj", "{C5BD9C58-AE7A-4BBA-8700-1E71F48DBCA0}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisionAsist.SDK", "VisionAsist.SDK\VisionAsist.SDK.csproj", "{9E547157-DA01-40FB-9DB1-67A1C310E3F1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModuleWeather", "ModuleWeather\ModuleWeather.csproj", "{5103146A-34FD-4431-856E-AB78EF523C03}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -12,5 +16,13 @@ Global
{C5BD9C58-AE7A-4BBA-8700-1E71F48DBCA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5BD9C58-AE7A-4BBA-8700-1E71F48DBCA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5BD9C58-AE7A-4BBA-8700-1E71F48DBCA0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9E547157-DA01-40FB-9DB1-67A1C310E3F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E547157-DA01-40FB-9DB1-67A1C310E3F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E547157-DA01-40FB-9DB1-67A1C310E3F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E547157-DA01-40FB-9DB1-67A1C310E3F1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5103146A-34FD-4431-856E-AB78EF523C03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5103146A-34FD-4431-856E-AB78EF523C03}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5103146A-34FD-4431-856E-AB78EF523C03}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5103146A-34FD-4431-856E-AB78EF523C03}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/VisionAsist/Models/Core.cs b/VisionAsist/Models/Core.cs
index ff50500..cbde75a 100644
--- a/VisionAsist/Models/Core.cs
+++ b/VisionAsist/Models/Core.cs
@@ -1,7 +1,11 @@
using System;
+using Avalonia.Controls;
+using VisionAsist.SDK;
using System.Threading.Tasks;
namespace VisionAsist.Models;
+
+
public class Core
{
public static TrigerCore triger = new();
@@ -17,8 +21,7 @@ public class Core
// Подписываемся на событие новых слов
triger.OnRecognized += word =>
{
- Console.OutputEncoding = System.Text.Encoding.UTF8;
- Console.InputEncoding = System.Text.Encoding.UTF8;
+
Console.WriteLine(word); // печатаем сразу, как распознано
TextAsist = triger.RecognizedText;
};
diff --git a/VisionAsist/ViewModels/SettingsViewModel.cs b/VisionAsist/ViewModels/SettingsViewModel.cs
index 8d16234..967822d 100644
--- a/VisionAsist/ViewModels/SettingsViewModel.cs
+++ b/VisionAsist/ViewModels/SettingsViewModel.cs
@@ -1,7 +1,11 @@
using System;
+using System.Reflection;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System.Collections.ObjectModel;
+using VisionAsist.Models;
+using VisionAsist.SDK;
+
namespace VisionAsist.ViewModels;
using System.IO;
using System.Linq;
@@ -39,6 +43,29 @@ public class SettingsViewModel : ViewModelBase
private void OpenSettings(string moduleName)
{
- Console.WriteLine($"Нажата кнопка модуля: {moduleName}");
+ string dllPath = Path.Combine(AppContext.BaseDirectory, "Modules", moduleName, "Module.dll");
+ if (File.Exists(dllPath))
+ {
+ Console.OutputEncoding = System.Text.Encoding.UTF8;
+ Console.InputEncoding = System.Text.Encoding.UTF8;
+ Assembly assembly = Assembly.LoadFrom(dllPath);
+ var type = assembly.GetTypes().FirstOrDefault(t =>
+ typeof(IModule).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract);
+ if (type != null)
+ {
+ // 4. Создаем экземпляр класса (WeatherModule)
+ var module = (IModule)Activator.CreateInstance(type)!;
+ Console.WriteLine($"Успешно загружен модуль: {module.Name}");
+
+ // 5. Запускаем команду и передаем текущее окно (this) в качестве родителя
+ var result = module.Execute("ShowWeather", new object[] { this });
+ Console.WriteLine($"Ответ модуля: {result}");
+ }
+ else
+ {
+ Console.WriteLine("В DLL не найден класс, реализующий VisionAsist.SDK.IModule!");
+ }
+ }
+
}
}
\ No newline at end of file
diff --git a/VisionAsist/VisionAsist.csproj b/VisionAsist/VisionAsist.csproj
index 52b9391..d3498af 100644
--- a/VisionAsist/VisionAsist.csproj
+++ b/VisionAsist/VisionAsist.csproj
@@ -12,12 +12,12 @@
-
-
-
-
+
+
+
+
-
+
None
All
@@ -25,4 +25,8 @@
+
+
+
+