private void MainForm_Load(object sender, EventArgs e) { Startup startup = new Startup(Settings.Default.ApplicationName); string customerKey = startup.ReadRegistry(); string connectionString = startup.RetrieveConnectionString(customerKey); textBoxCustomerKey.Text = customerKey; textBoxConnectionString.Text = connectionString; }
static void OnInstall() { //MessageBox.Show("Is Network Deployed: " + ApplicationDeployment.IsNetworkDeployed + // "Is First Run: " + ApplicationDeployment.CurrentDeployment.IsFirstRun); Startup startup = new Startup(Settings.Default.ApplicationName); string customerKey = startup.ReadRegistry(); if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun) { if (string.IsNullOrEmpty(customerKey)) { customerKey = startup.RetrieveCustomerKey(); startup.WriteRegistry(customerKey); } Settings.Default.IsFirstRun = false; Settings.Default.Save(); } }