temporary
This commit is contained in:
		
							
								
								
									
										32
									
								
								Stars Assistant/Views/MainWindow.axaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Stars Assistant/Views/MainWindow.axaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
<Window xmlns="https://github.com/avaloniaui"
 | 
			
		||||
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
			
		||||
        xmlns:vm="using:net.nehmer.sa.ViewModels"
 | 
			
		||||
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 | 
			
		||||
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 | 
			
		||||
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
 | 
			
		||||
        x:Class="net.nehmer.sa.Views.MainWindow"
 | 
			
		||||
        x:DataType="vm:MainWindowViewModel"
 | 
			
		||||
        Title="GetStartedApp">
 | 
			
		||||
 | 
			
		||||
        <!-- Icon="/Assets/avalonia-logo.ico" -->
 | 
			
		||||
 | 
			
		||||
    <Design.DataContext>
 | 
			
		||||
        <!-- This only sets the DataContext for the previewer in an IDE,
 | 
			
		||||
             to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
 | 
			
		||||
        <vm:MainWindowViewModel/>
 | 
			
		||||
    </Design.DataContext>
 | 
			
		||||
 | 
			
		||||
    <StackPanel>
 | 
			
		||||
        <Border Margin="5" CornerRadius="10" Background="LightBlue">
 | 
			
		||||
            <TextBlock Margin="5" FontSize="24" HorizontalAlignment="Center" Text="{Binding Greeting}"></TextBlock>
 | 
			
		||||
        </Border>
 | 
			
		||||
        <Grid ShowGridLines="True" Margin="5" ColumnDefinitions="120, 100" RowDefinitions="Auto, Auto, Auto">  
 | 
			
		||||
            <Label Grid.Row="0" Grid.Column="0" Margin="10">Celsius</Label>
 | 
			
		||||
            <TextBox Grid.Row="0" Grid.Column="1" Margin="0 5" Text="0" Name="celsius"/>
 | 
			
		||||
            <Label Grid.Row="1" Grid.Column="0" Margin="10">Fahrenheit</Label>
 | 
			
		||||
            <TextBox Grid.Row="1"  Grid.Column="1" Margin="0 5" Text="0" Name="fahrenheit"/>
 | 
			
		||||
            <Button Grid.Row="2" Grid.Column="1" Margin="0 5" Click="ButtonClicked">Calculate</Button>
 | 
			
		||||
        </Grid>
 | 
			
		||||
  </StackPanel>
 | 
			
		||||
 | 
			
		||||
</Window>
 | 
			
		||||
							
								
								
									
										28
									
								
								Stars Assistant/Views/MainWindow.axaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Stars Assistant/Views/MainWindow.axaml.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
using Avalonia.Controls;
 | 
			
		||||
using Avalonia.Interactivity;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace net.nehmer.sa.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";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user