#眉標=特別報導
#副標=新一代智慧型手機平台Windows Phone 7開發專欄(1)
#大標= 輕鬆建立第一個Windows Phone應用程式
#作者=文/圖 董大偉
==========反灰=========================
==============End===============
==============反灰===============
程式一:
private void button1_Click(object sender, RoutedEventArgs e)
{
double height, weight, bmi;
//取得輸入數字
double.TryParse(this.textBox1.Text, out height);
double.TryParse(this.textBox2.Text, out weight);
//計算BMI = 體重(公斤) / 身高(公尺)平方
height = height / 100;
bmi = weight / (height * height);
MessageBox.Show("BMI:" + bmi);
}
==============End===============
=========<反灰>==========
private void ApplicationBarIconButton_Click(object sender, EventArgs e)
{
//取得點選的icon文字
string item = (sender as Microsoft.Phone.Shell.ApplicationBarIconButton).Text;
switch (item)
{
case "設定":
///要進行的工作
break;
case "儲存":
///要進行的工作
break;
default:
break;
}
}
===================
=========<反灰>==========
NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
===================