更新时间:2022-12-26 13:18:16
看来你的问题其实是,如果你移动执行
到另一个位置/文件夹的同一 PC,它失去了某种程度上的事实,它已经至少运行一次的信息。
Seems that your problem is actually that if you move executable
to another location/folder on the same pc, it loses somehow the information about the fact that it was already run at least once.
使用 UserSettings
,在 Properties.Settings.Default.FirstRun
应该解决您的问题。
Using UserSettings
, on Properties.Settings.Default.FirstRun
should resolve your problem.
这样的事情,一个的伪code 的:
Something like this, a pseudocode:
if(Properties.Settings.Default.FirstRun == true)
{ lblGreetings.Text = "Welcome New User";
//Change the value since the program has run once now
Properties.Settings.Default.FirstRun = false;
Properties.Settings.Default.Save(); }
else
{ lblGreetings.Text = "Welcome Back User"; }
旁观这样品如何实现,在更详细方法。
Look on this sample how to achieve that in more detailed way.