Esempio n. 1
0
            private bool InteractiveLogin(out string userName, out string password)
            {
                _secureConnectionString = null;

                frmLogin dlg = new frmLogin();

                dlg.ConnectionName = Name;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    userName = dlg.UserName;
                    password = dlg.Password;
                    if (dlg.SavePassword)
                    {
                        SavedCredentials sc = new SavedCredentials()
                        {
                            UserName = userName, Password = password
                        };
                        sc.Save(SavedCredentialsFilename());
                    }
                    return(true);
                }

                userName = null;
                password = null;
                return(false);
            }
Esempio n. 2
0
        public static SavedCredentials Load(string fileName)
        {
            SavedCredentials result = null;
            XmlSerializer    xs     = new XmlSerializer(typeof(SavedCredentials));

            using (StreamReader reader = File.OpenText(fileName))
            {
                result = (SavedCredentials)xs.Deserialize(reader);
                reader.Close();
            }
            return(result);
        }
Esempio n. 3
0
            private bool GetSavedCredentials(out string userName, out string password)
            {
                userName = null;
                password = null;

                string fileName = SavedCredentialsFilename();

                if (File.Exists(fileName))
                {
                    SavedCredentials sc = SavedCredentials.Load(fileName);
                    userName = sc.UserName;
                    password = sc.Password;
                    return(true);
                }
                return(false);
            }