Advertisement
Guest User

Transformar Temperatura

a guest
Apr 29th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Animation;
  11. using System.Windows.Shapes;
  12. using Microsoft.Phone.Controls;
  13.  
  14. namespace PhoneApp1
  15. {
  16.     public partial class Newton : PhoneApplicationPage
  17.     {
  18.         public Newton()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.  
  23.         private void OK_Click(object sender, RoutedEventArgs e)
  24.         {
  25.             double a = 0, b = 0, c = 0;
  26.             a = (((double.Parse(TempNewton.Text) * 60) / 11) + 32);
  27.             b = (((double.Parse(TempNewton.Text)) * 100)/ 33);
  28.             c = (((double.Parse(TempNewton.Text) * 100) / 33) + 273.15);
  29.  
  30.  
  31.             {
  32.                 RFahrenheit.Text = a.ToString();
  33.                 RCelsius.Text = b.ToString();
  34.                 RNewton.Text = c.ToString();
  35.             }
  36.         }
  37.  
  38.         private void negativo_Click(object sender, RoutedEventArgs e)
  39.         {
  40.             if (TempNewton.Text.StartsWith("-"))
  41.                 TempNewton.Text = TempNewton.Text.Substring(1);
  42.             else
  43.                 TempNewton.Text = "-" + TempNewton.Text;
  44.         }
  45.  
  46.         private void button1_Click(object sender, RoutedEventArgs e)
  47.         {
  48.         NavigationService.GoBack();
  49.         }
  50.         protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
  51.         {
  52.             base.OnBackKeyPress(e);
  53.             if (TempNewton.Text != string.Empty)
  54.             {
  55.                 var result = MessageBox.Show("Tem certeza que quer sair?",
  56.                 "Aviso", MessageBoxButton.OKCancel);
  57.                 if (result != MessageBoxResult.OK)
  58.                 {
  59.                     e.Cancel = true;
  60.                 }
  61.             }
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement