Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: C#  |  size: 2.07 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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 celsius : PhoneApplicationPage
  17.     {
  18.         public celsius()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.  
  23.         private void button1_Click(object sender, RoutedEventArgs e)
  24.         {
  25.             NavigationService.GoBack();
  26.         }
  27.  
  28.         private void OK_Click(object sender, RoutedEventArgs e)
  29.         {
  30.                 double a = 0, b = 0, c = 0;
  31.                 a = (((double.Parse(tempcelsius.Text) * 9) / 5) + 32);
  32.                 b = ((double.Parse(tempcelsius.Text)) + 273);
  33.                 c = ((double.Parse(tempcelsius.Text) * 33) / 100);
  34.  
  35.  
  36.                 {
  37.                     RFahrenheit.Text = a.ToString();
  38.                     RKelvin.Text = b.ToString();
  39.                     RNewton.Text = c.ToString();
  40.                 }
  41.  
  42.         }
  43.         private void negativo_Click(object sender, RoutedEventArgs e)
  44.         {
  45.             if (tempcelsius.Text.StartsWith("-"))
  46.                 tempcelsius.Text = tempcelsius.Text.Substring(1);
  47.             else
  48.                 tempcelsius.Text = "-" + tempcelsius.Text;
  49.            
  50.         }
  51.  
  52.         protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
  53.         {
  54.            
  55.             if (tempcelsius.Text != string.Empty)
  56.             {
  57.                 var result = MessageBox.Show("Tem certeza que quer sair?",
  58.                 "Aviso", MessageBoxButton.OKCancel);
  59.                 if (result != MessageBoxResult.OK)
  60.                 {
  61.                     e.Cancel = true;
  62.                     base.OnBackKeyPress(e);
  63.                 }
  64.             }
  65.         }
  66.  
  67.         private void tempcelsius_TextChanged(object sender, TextChangedEventArgs e)
  68.         {
  69.  
  70.  
  71.         }
  72.  
  73.     }
  74. }