Files
Vision/ModuleWeather/MainWindow.axaml.cs
2026-03-19 13:14:53 +02:00

22 lines
696 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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<TextBox>("CityInput")?.Text;
var status = this.FindControl<TextBlock>("StatusText");
if (string.IsNullOrWhiteSpace(city)) {
status.Text = "Ошибка: введите город";
return;
}
status.Text = $"В городе {city} сейчас +20°C"; // Тут могла быть логика API
}
}