
Untitled
By: a guest on
Apr 29th, 2012 | syntax:
C# | size: 2.06 KB | hits: 15 | expires: Never
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace PhoneApp1
{
public partial class celsius : PhoneApplicationPage
{
public celsius()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
NavigationService.GoBack();
}
private void OK_Click(object sender, RoutedEventArgs e)
{
double a = (((double.Parse(tempcelsius.Text) * 9) / 5) + 32);
double b = ((double.Parse(tempcelsius.Text)) + 273);
double c = ((double.Parse(tempcelsius.Text) * 33) / 100);
{
RFahrenheit.Text = a.ToString();
RKelvin.Text = b.ToString();
RNewton.Text = c.ToString();
}
}
private void negativo_Click(object sender, RoutedEventArgs e)
{
if (tempcelsius.Text.StartsWith("-"))
tempcelsius.Text = tempcelsius.Text.Substring(1);
else
tempcelsius.Text = "-" + tempcelsius.Text;
}
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
if (tempcelsius.Text != string.Empty)
{
var result = MessageBox.Show("Tem certeza que quer sair?",
"Aviso", MessageBoxButton.OKCancel);
if (result != MessageBoxResult.OK)
{
e.Cancel = true;
base.OnBackKeyPress(e);
}
}
}
private void tempcelsius_TextChanged(object sender, TextChangedEventArgs e)
{
}
}
}