sa/Stars Assistant/Views/MainWindow.axaml.cs

28 lines
613 B
C#

using Avalonia.Controls;
using Avalonia.Interactivity;
using System.Diagnostics;
using System;
namespace StarsAssistant.Views;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public void ButtonClicked(object source, RoutedEventArgs args)
{
if (Double.TryParse(celsius.Text, out double C))
{
var F = C * (9d / 5d) + 32;
fahrenheit.Text = F.ToString("0.0");
}
else
{
celsius.Text = "0";
fahrenheit.Text = "0";
}
}
}