Windows phone 7 windows phone应用程序中的值错误
我在页面最后一行的值中有错误。程序所做的是计算您在屏幕上单击了多少次 请帮帮我 我尝试将值添加为整数,但在值之前什么都没有发生savecount出现问题,然后我通过添加女贞子作为整数来修复它,我认为我可以这样解决它 你觉得我必须在使用的东西上加些什么吗Windows phone 7 windows phone应用程序中的值错误,windows-phone-7,Windows Phone 7,我在页面最后一行的值中有错误。程序所做的是计算您在屏幕上单击了多少次 请帮帮我 我尝试将值添加为整数,但在值之前什么都没有发生savecount出现问题,然后我通过添加女贞子作为整数来修复它,我认为我可以这样解决它 你觉得我必须在使用的东西上加些什么吗 using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Win
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;
using System.Windows.Navigation;
using System.Windows.Threading;
namespace TapToCount
{
public partial class MainPage : PhoneApplicationPage
{
private int count;
private int savedCount;
// Constructor
public MainPage()
{
InitializeComponent();
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
this.count++;
this.CountTextBlock.Text = this.count.ToString("N0");
}
private void ResetButton_Click(object sender, RoutedEventArgs e)
{
this.count = 0;
this.CountTextBlock.Text = this.count.ToString("N0");
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
// Persist state when leaving for any reason (Deactivated or Closing):
this.savedCount.value= this.count;
}
}
}
savedCount
是一个int
。它没有值
属性或字段。只用
this.savedCount = this.count
尽管我怀疑这会给你带来你想要的结果。您可能希望将
savedCount
设置为静态的,那么您会遇到什么异常?如何保存savedCount字段?savedCount有任何名为value的属性?我只想计算一下在应用程序中单击屏幕的次数。我得到的错误是:“int”不包含“value”的定义,并且找不到接受第一个“int”类型参数的扩展方法“value”(是否缺少using指令或程序集引用?)