3. Rhea has designeed an app that should convet the temperature specified in Celsius to the
corresponding temperature in Fahrenheit and vice versa. The interface of the app is shown in the
following figure.
Ans:= (XAML Code)
<Viewbox>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Height="900" Width="1600">
<TextBlock Text="Celsius" FontSize="100" margin="122,122,1002,668"></Textbox>
<TextBox X:Name="txtDegreeCelsius" FontSize="70" Margin="122,257,121,654" KeyUp="tetDegreeCelsius_KeyUp"></TextBox>
<TextBlock Text="Fahreenheit" FontSize="100" margin="122,463,931,326"/>
<TextBox X:Name="txtDegreeFahreenheit" FontSize="70" Margin="122,257,121,209"KeyUp="tetDegreeFahrenheit_KeyUp"/>
</Grid>
(CCS Code)
Privete void txtDegreeCelsius_KeyUp(object sender, KeyRoutedEventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txtDegreeCelsius.Text.Trim()))
txtDegreeFahreheit.Text = (Convert.Todouble(txtDegreeCelsius.Text.Trim()))
else
txtDegreeFahrenheit.Text = "";
}
catch (Exception ex)
{
txtDegreeFahrenheit.Text = "Invalid input";
}
}
Privete void txtDegreeCelsius_KeyUp(object sender, KeyRoutedEventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txtDegreeCelsius.Text.Trim()))
txtDegreeFahreheit.Text = (Convert.Todouble(txtDegreeCelsius.Text.Trim()))
else
txtDegreeFahrenheit.Text = "";
}
catch (Exception ex)
{
txtDegreeFahrenheit.Text = "Invalid input";
}
}
corresponding temperature in Fahrenheit and vice versa. The interface of the app is shown in the
following figure.
Ans:= (XAML Code)
<Viewbox>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Height="900" Width="1600">
<TextBlock Text="Celsius" FontSize="100" margin="122,122,1002,668"></Textbox>
<TextBox X:Name="txtDegreeCelsius" FontSize="70" Margin="122,257,121,654" KeyUp="tetDegreeCelsius_KeyUp"></TextBox>
<TextBlock Text="Fahreenheit" FontSize="100" margin="122,463,931,326"/>
<TextBox X:Name="txtDegreeFahreenheit" FontSize="70" Margin="122,257,121,209"KeyUp="tetDegreeFahrenheit_KeyUp"/>
</Grid>
(CCS Code)
Privete void txtDegreeCelsius_KeyUp(object sender, KeyRoutedEventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txtDegreeCelsius.Text.Trim()))
txtDegreeFahreheit.Text = (Convert.Todouble(txtDegreeCelsius.Text.Trim()))
else
txtDegreeFahrenheit.Text = "";
}
catch (Exception ex)
{
txtDegreeFahrenheit.Text = "Invalid input";
}
}
Privete void txtDegreeCelsius_KeyUp(object sender, KeyRoutedEventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txtDegreeCelsius.Text.Trim()))
txtDegreeFahreheit.Text = (Convert.Todouble(txtDegreeCelsius.Text.Trim()))
else
txtDegreeFahrenheit.Text = "";
}
catch (Exception ex)
{
txtDegreeFahrenheit.Text = "Invalid input";
}
}
No comments:
Post a Comment