diff --git a/.idea/.idea.VisionAsist/.idea/.name b/.idea/.idea.VisionAsist/.idea/.name
new file mode 100644
index 0000000..9977108
--- /dev/null
+++ b/.idea/.idea.VisionAsist/.idea/.name
@@ -0,0 +1 @@
+VisionAsist
\ No newline at end of file
diff --git a/ModuleWeather/MainWindow.axaml b/ModuleWeather/MainWindow.axaml
index 059fcf7..6028a78 100644
--- a/ModuleWeather/MainWindow.axaml
+++ b/ModuleWeather/MainWindow.axaml
@@ -2,9 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ModuleWeather.WeatherView">
-
-
-
+
+
\ No newline at end of file
diff --git a/ModuleWeather/MainWindow.axaml.cs b/ModuleWeather/MainWindow.axaml.cs
index cd06c79..da0ba4c 100644
--- a/ModuleWeather/MainWindow.axaml.cs
+++ b/ModuleWeather/MainWindow.axaml.cs
@@ -1,6 +1,8 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media;
+using System.IO.Ports;
+using System.Reflection;
namespace ModuleWeather;
@@ -8,15 +10,15 @@ public partial class WeatherView : UserControl
{
public WeatherView() => InitializeComponent();
- private void GetWeatherButton_Click(object? sender, RoutedEventArgs e)
+ private void Update(object? sender, RoutedEventArgs e)
{
- var city = this.FindControl("CityInput")?.Text;
- var status = this.FindControl("StatusText");
+ var ports = SerialPort.GetPortNames();
+ PortComboBox.ItemsSource = ports; // Привязываем массив к списку
+
- if (string.IsNullOrWhiteSpace(city)) {
- status.Text = "Ошибка: введите город";
- return;
- }
- status.Text = $"В городе {city} сейчас +20°C"; // Тут могла быть логика API
+ }
+ private void OnPortChanged(object sender, SelectionChangedEventArgs e)
+ {
+ WeatherModule.port = PortComboBox.SelectedItem as string;
}
}
\ No newline at end of file
diff --git a/ModuleWeather/Module.cs b/ModuleWeather/Module.cs
index fd9160f..acab438 100644
--- a/ModuleWeather/Module.cs
+++ b/ModuleWeather/Module.cs
@@ -1,12 +1,20 @@
using Avalonia.Controls;
using VisionAsist.SDK;
+using System.IO.Ports;
namespace ModuleWeather;
public class WeatherModule : IModule
{
+ public SerialPort myPort = new ();
+ public static string port;
+ public WeatherModule()
+ {
+
+
+ }
public string Name => "Прогноз Погоды";
- public string[] GetCommands() => new[] { "Погода", "Пинг" };
+ public string[] GetCommands() => new[] { "погода", "поверни на *", "верни *" };
public void Settings(object[] args)
{
@@ -15,7 +23,7 @@ public class WeatherModule : IModule
var win = new Window
{
- Title = "Окно Погоды",
+ Title = "Настройки",
Content = new WeatherView(), // Вставляем наш контрол
Width = 350,
Height = 250,
@@ -26,18 +34,32 @@ public class WeatherModule : IModule
else win.Show();
}
-
+
public object Execute(string command)
{
+
+ myPort.Close();
+ myPort = new SerialPort(port, 9600);
+ myPort.Open();
+
+
+
+
+
switch (command)
{
- case "Погода":
+ case "погода":
- return "Окно открыто успешно";
+ return "Погода хорошая!";
- case "Пинг":
- return "Pong! Модуль погоды активен.";
+ case "поверни на *":
+ myPort.WriteLine("178");
+ return "Повернул на 180";
+ case "верни *":
+ myPort.WriteLine("0");
+
+ return "Вернул в 0";
default:
return "Команда не найдена";
}
diff --git a/ModuleWeather/ModuleWeather.csproj b/ModuleWeather/ModuleWeather.csproj
index 763c2f4..09fae81 100644
--- a/ModuleWeather/ModuleWeather.csproj
+++ b/ModuleWeather/ModuleWeather.csproj
@@ -6,29 +6,40 @@
enable
Module
+ true
+ linux-x64
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
\ No newline at end of file
diff --git a/VisionAsist/Models/Selector.cs b/VisionAsist/Models/Selector.cs
index 2b96407..032351c 100644
--- a/VisionAsist/Models/Selector.cs
+++ b/VisionAsist/Models/Selector.cs
@@ -8,7 +8,31 @@ public class Selector
{
if (text.Contains("вижен"))
{
- Console.WriteLine("dddddd");
+ string novision = text.Replace("вижен", "").Trim();
+ foreach (var module in Core.modulelist)
+ {
+ foreach (var command in module.commands)
+ {
+ if (command.Contains("*"))
+ {
+ string wopo = command.Replace("*", "").Trim();
+ if (novision.Contains(wopo))
+ {
+
+ Console.WriteLine(module.Module.Execute(command));
+ break;
+ }
+ }
+ else
+ {
+ if (command == novision)
+ {
+ Console.WriteLine(module.Module.Execute(novision));
+ break;
+ }
+ }
+ }
+ }
}
}
}
\ No newline at end of file
diff --git a/VisionAsist/Models/TrigerCore.cs b/VisionAsist/Models/TrigerCore.cs
index e6ca858..8ad2ed2 100644
--- a/VisionAsist/Models/TrigerCore.cs
+++ b/VisionAsist/Models/TrigerCore.cs
@@ -172,7 +172,7 @@ public class TrigerCore : IDisposable
string text = el.GetString() ?? "";
if (!string.IsNullOrWhiteSpace(text))
{
- RecognizedText += text + " ";
+ RecognizedText = text;
// Безопасный проброс в UI поток Avalonia
Dispatcher.UIThread.Post(() => OnRecognized?.Invoke(text));
}
diff --git a/VisionAsist/ViewModels/SettingsViewModel.cs b/VisionAsist/ViewModels/SettingsViewModel.cs
index d88080e..4850944 100644
--- a/VisionAsist/ViewModels/SettingsViewModel.cs
+++ b/VisionAsist/ViewModels/SettingsViewModel.cs
@@ -26,7 +26,6 @@ public class SettingsViewModel : ViewModelBase
foreach (var module in Core.modulelist)
{
-
AddModule(module.Name);
}