24 lines
647 B
C#
24 lines
647 B
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Media;
|
|
using System.IO.Ports;
|
|
using System.Reflection;
|
|
|
|
namespace ModuleWeather;
|
|
|
|
public partial class WeatherView : UserControl
|
|
{
|
|
public WeatherView() => InitializeComponent();
|
|
|
|
private void Update(object? sender, RoutedEventArgs e)
|
|
{
|
|
var ports = SerialPort.GetPortNames();
|
|
PortComboBox.ItemsSource = ports; // Привязываем массив к списку
|
|
|
|
|
|
}
|
|
private void OnPortChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
WeatherModule.port = PortComboBox.SelectedItem as string;
|
|
}
|
|
} |