我在页面的最后一行的值有错误。该程序所做的是计算您在屏幕上单击了多少次。
请帮我。
我尝试将值添加为整数和所有内容,但是在值存在 savecount 问题之前没有发生任何事情然后我通过添加一个女贞作为整数来修复它我认为我以这种方式解决了它。
你认为我必须在使用的东西中添加一些东西吗?
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;
}
}
}