【发布时间】:2011-12-21 19:42:48
【问题描述】:
我有一个有 6 个倒计时计时器的应用程序。我希望应用程序存储当前的结束时间,以便在计算机关闭的情况下保存日期并且不会丢失任何内容。
我的问题是应用程序正在保存日期,但是当再次启动应用程序时,它会重新加载默认设置而不是保存的设置。
这就是我所拥有的
public MainWindow()
{
InitializeComponent();
SetupTimer(timer0, watch0_0Time, watch0_0Border);
SetupTimer(timer1, watch0_1Time, watch0_1Border);
SetupTimer(timer2, watch0_2Time, watch0_2Border);
SetupTimer(timer3, watch1_0Time, watch1_0Border);
SetupTimer(timer4, watch1_1Time, watch1_1Border);
SetupTimer(timer5, watch1_2Time, watch1_2Border);
timer0.countTo = Properties.Settings.Default.Timer0Date;
timer1.countTo = Properties.Settings.Default.Timer1Date;
timer2.countTo = Properties.Settings.Default.Timer2Date;
timer3.countTo = Properties.Settings.Default.Timer3Date;
timer4.countTo = Properties.Settings.Default.Timer4Date;
timer5.countTo = Properties.Settings.Default.Timer5Date;
}
....
我稍后会通过此调用保存
Properties.Settings.Default.Timer0Date = timer.countTo;
希望你能帮忙:D
【问题讨论】:
标签: c# wpf timer settings save