I have a block of code on the start page of my application that checks the users settings file and performs some tasks. I then want to set a couple of those setting values to a variable that I can get the value of during the data service portion of my application. I can't seem to call them out of this class later on in the app. Am I not setting the session and userID values correctly? How can I be sure I can call those variables at anytime during my app? Here's the code.
public void isTrackingEnabled()
{
Properties.Settings settings = new Imsms.Zeus.WinClient.Properties.Settings();
if (settings.TrackingEnabled == "")
{
string message = "Do you want to enable Click Tracking? Your information will remain anonymous and be used only to improve the software functionality";
string caption = "Enable Click Tracking";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
MessageBoxIcon icon = MessageBoxIcon.Exclamation;
DialogResult result;
result = MessageBox.Show(message, caption, buttons, icon);
if (result == DialogResult.Yes)
{
settings.TrackingEnabled = "Yes";
settings.UserID = System.Guid.NewGuid().ToString();
settings.Session = 1;
settings.Save();
}
else
{
settings.TrackingEnabled = "No";
settings.Save();
}
}
else if (settings.TrackingEnabled == "Yes")
{
String userID = settings.UserID;
Int32 session = settings.Session + 1;
}
}
public void isTrackingEnabled()
{
Properties.Settings settings = new Imsms.Zeus.WinClient.Properties.Settings();
if (settings.TrackingEnabled == "")
{
string message = "Do you want to enable Click Tracking? Your information will remain anonymous and be used only to improve the software functionality";
string caption = "Enable Click Tracking";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
MessageBoxIcon icon = MessageBoxIcon.Exclamation;
DialogResult result;
result = MessageBox.Show(message, caption, buttons, icon);
if (result == DialogResult.Yes)
{
settings.TrackingEnabled = "Yes";
settings.UserID = System.Guid.NewGuid().ToString();
settings.Session = 1;
settings.Save();
}
else
{
settings.TrackingEnabled = "No";
settings.Save();
}
}
else if (settings.TrackingEnabled == "Yes")
{
String userID = settings.UserID;
Int32 session = settings.Session + 1;
}
}