static void Main() { if (mutex.WaitOne(TimeSpan.Zero, true)) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); formMain mainform = new formMain(false); string password = mainform.XmlConfigGet("password"); if (password.Trim() != "") { popupPassword passwordopup = new popupPassword(password); Application.Run(passwordopup); if (!passwordopup.auth) return; } Application.Run(new formMain(true)); } else { // send our Win32 message to make the currently running instance // jump on top of all the other windows NativeMethods.PostMessage((IntPtr) NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero); } }
public formOptions(formMain form) { mainform = form; InitializeComponent(); importpopup = new popupImport(this); recryptpopup = new popupRecrypt(this); Settings.Default.ocryptkey = Settings.Default.cryptkey; if (File.Exists(Settings.Default.cfgpath)) { tbPuTTYPath.Text = Settings.Default.puttypath; cbPuTTYExecute.Checked = Settings.Default.puttyexecute; tbPuTTYExecute.Text = Settings.Default.puttycommand; cbPuTTYKey.Checked = Settings.Default.puttykey; tbPuTTYKey.Text = Settings.Default.puttykeyfile; cbPuTTYForward.Checked = Settings.Default.puttyforward; tbRDPath.Text = Settings.Default.rdpath; tbRDKeep.Text = Settings.Default.rdfilespath; cbRDAdmin.Checked = Settings.Default.rdadmin; cbRDDrives.Checked = Settings.Default.rddrives; cbRDSpan.Checked = Settings.Default.rdspan; cbRDSize.Text = Settings.Default.rdsize; tbVNCPath.Text = Settings.Default.vncpath; tbVNCKeep.Text = Settings.Default.vncfilespath; cbVNCFullscreen.Checked = Settings.Default.vncfullscreen; cbVNCViewonly.Checked = Settings.Default.vncviewonly; tbWSCPPath.Text = Settings.Default.winscppath; cbWSCPKey.Checked = Settings.Default.winscpkey; tbWSCPKey.Text = Settings.Default.winscpkeyfile; slGMulti.Value = Convert.ToInt32(Settings.Default.multicolumnwidth); cbGMulti.Checked = Settings.Default.multicolumn; cbGMinimize.Checked = Settings.Default.minimize; if (Settings.Default.password.Trim() != "") { Settings.Default.password = mainform.Decrypt(Settings.Default.password, Settings.Default.pcryptkey); tbGPassword.Text = Settings.Default.password; tbGConfirm.Text = Settings.Default.password; Settings.Default.cryptkey = Settings.Default.password; cbGPassword.Checked = true; } } bGPassword.Enabled = false; firstread = false; }