| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 8130 人关注过本帖
标题:vs 2013 windowsphone 编程discount calculator错误提示
只看楼主 加入收藏
eveline1994
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2016-4-16
收藏
 问题点数:0 回复次数:0 
vs 2013 windowsphone 编程discount calculator错误提示
要编写一个discount calculator的windows phone应用程序,相应程序编写如下:
using System;
using System.Collections.Generic;
using
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// “空白页”项模板在 http://go. 上有介绍

namespace App1
{
    /// <summary>
    /// 可用于自身或导航至 Frame 内部的空白页。
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;
        }
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。
        /// 此参数通常用于配置页。</param>
        private void amountTextBox_LostFocus(object sender, RoutedEventArgs e)
  {
          billAmountTextBox.Text = tip.BillAmount;
  }
        private void billAmountTextBox_TextChanged(object sender, TextChangedEventArgs e)
  {
          performCalculation();
  }


        private void performCalculation()
  {
          var selectedRadio = myStackPanel.Children.OfType<RadioButton>().FirstOrDefault(r => r.IsChecked == true);

          tip.CalculateTip(billAmountTextBox.Text, double.Parse(selectedRadio.Tag.ToString()));

          amountToTipTextBlock.Text = tip.TipAmount;
          totalTextBlock.Text = tip.TotalAmount;
      }
   public class Tip
  {
    public string BillAmount { get; set; }
    public string TipAmount { get; set; }
    public string TotalAmount { get; set; }

    public Tip()
    {
      this.BillAmount = String.Empty;
      this.TipAmount = String.Empty;
      this.TotalAmount = String.Empty;
    }

    public void CalculateTip(string originalAmount, double tipPercentage)
    {
      double billAmount = 0.0;
      double tipAmount = 0.0;
      double totalAmount = 0.0;

      if (double.TryParse(originalAmount.Replace('$', ' '), out billAmount))
      {
        tipAmount = billAmount * tipPercentage;
        totalAmount = billAmount - tipAmount;
      }

      this.BillAmount = String.Format("{0:C}", billAmount);
      this.TipAmount = String.Format("{0:C}", tipAmount);
      this.TotalAmount = String.Format("{0:C}", totalAmount);
    }
  }

   protected override void OnNavigatedTo(NavigationEventArgs e)
   {
       // TODO: 准备此处显示的页面。

       // TODO: 如果您的应用程序包含多个页面,请确保
       // 通过注册以下事件来处理硬件“后退”按钮:
       // Windows.Phone.UI.Input.HardwareButtons.BackPressed 事件。
       // 如果使用由某些模板提供的 NavigationHelper,
       // 则系统会为您处理该事件。
   }
    }

}
然后提示错误:
图片附件: 游客没有浏览图片的权限,请 登录注册

老师要求得到像这样的结果:
图片附件: 游客没有浏览图片的权限,请 登录注册

求助大神这到底是怎么回事啊。。。。单纯的菜鸟,不是学计算机的但是作死选了嵌入式的选修课,希望大神们能就一命,马上就要交作业了哭

[此贴子已经被作者于2016-4-16 12:13编辑过]

搜索更多相关主题的帖子: 应用程序 程序编写 windows discount calculator 
2016-04-16 12:12
快速回复:vs 2013 windowsphone 编程discount calculator错误提示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016299 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved