/// <summary>
        /// Uses the technique from TcNo Account Switcher to change the loginUsers.vdf and
        /// some registry values so on next start steam is starting with the defined user
        /// only works if the user already logged in once with this account and chose "remember password"!
        /// </summary>
        /// <param name="selectedAccount">the account to start with</param>
        public void startCachedAccount(SteamAccount selectedAccount)
        {
            _steamInstallation.KillSteam();
            dynamic loginUsersVdf = VdfConvert.Deserialize(File.ReadAllText(loginUsersVDFPath));

            try
            {
                foreach (var account in loginUsersVdf.Value)
                {
                    if (account.Key.ToString() == selectedAccount.SteamId)
                    {
                        account.Value.MostRecent.Value = "1";
                        if (account.Value.RememberPassword.Value == "0")
                        {
                            // Steam does not remember this accounts password!
                            if (!string.IsNullOrEmpty(selectedAccount.Password))
                            {
                                // If the user has a password, we use that to log in the old way
                                resetActiveAccount();
                                _steamInstallation.StartSteamAccount(selectedAccount);
                            }
                            else
                            {
                                // Else we notify the user and let him log in
                                MessageBox.Show(
                                    "This account does not have a password associated with it and can only be started if it has already logged in once and 'Remember Password' has been checked. Log in and select 'Remember Password' now or add a password in SteamAccountSwitcher.",
                                    "Cannot start with account", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                                break;
                            }
                        }
                    }
                    else
                    {
                        account.Value.MostRecent.Value = "0";
                    }
                }

                //MessageBox.Show(loginUsersVdf.ToString());
                File.WriteAllText(loginUsersVDFPath, loginUsersVdf.ToString());

                using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Valve\Steam"))
                {
                    key.SetValue("AutoLoginUser", selectedAccount.AccountName);
                    key.SetValue("RememberPassword", 1);
                }
                _steamInstallation.Start();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
 private void listBoxAccounts_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         SteamAccount selectedAcc = (SteamAccount)listBoxAccounts.SelectedItem;
         if (Properties.Settings.Default.safemode)
         {
             steam.StartSteamAccountSafe(selectedAcc);
             Mouse.OverrideCursor = Cursors.Wait;
         }
         else
         {
             steam.StartSteamAccount(selectedAcc);
         }
     }
     finally
     {
         Mouse.OverrideCursor = null;
     }
 }