My program sets its display based on if the program is running for the first time or not. In order to determine if the program is running for the first time I am currently using a
//this boolean exists within my programs settings
Setting boolean FirstRun = True;
When the program runs it calls a method that checks the state of that bool value and acts accordingly:
if(Properties.Settings.FirstRun == true)
{ lblGreetings.Text = "Welcome New User";
//Change the value since the program has run once now
Properties.Settings.FirstRun = false;
Properties.Settings.Save(); }
else
{ lblGreetings.Text = "Welcome Back User"; }
It seems to work pretty effectively, however if the .exe file is moved and launched from a new location it considers it a first run, and I'm concerned that I'm doing this in a messy fashion and perhaps there exists a more efficient manner to test for the programs first run. Is there a better way to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…