Modules
This commit is contained in:
22
ModuleWeather/MainWindow.axaml.cs
Normal file
22
ModuleWeather/MainWindow.axaml.cs
Normal file
@@ -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<TextBox>("CityInput")?.Text;
|
||||
var status = this.FindControl<TextBlock>("StatusText");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(city)) {
|
||||
status.Text = "Ошибка: введите город";
|
||||
return;
|
||||
}
|
||||
status.Text = $"В городе {city} сейчас +20°C"; // Тут могла быть логика API
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user