28 lines
612 B
C#
28 lines
612 B
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using System.Diagnostics;
|
|
using System;
|
|
|
|
namespace GetStartedApp.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";
|
|
}
|
|
}
|
|
} |