Esempio n. 1
0
        string ReadSettings(IntPtr hParentWnd, string serviceUri, ref string userId)
        {
            INameValueStore storage = new CSharpTest.Net.Serialization.StorageClasses.RegistryStorage();

            try
            {
                string password;
                storage.Read(serviceUri, "UserName", out userId);
                if (storage.Read(serviceUri, "Password", out password))
                {
                    return(Encryption.CurrentUser.Decrypt(password));
                }
            }
            catch { }

            PasswordEntry pwdDlg = new PasswordEntry(userId, serviceUri);

            if (pwdDlg.ShowDialog(Win32Window.FromHandle(hParentWnd)) == DialogResult.OK)
            {
                userId = pwdDlg.UserName.Text;
                SaveSettings(userId, serviceUri, pwdDlg.Password.Text);
                return(pwdDlg.Password.Text);
            }

            return(null);
        }
Esempio n. 2
0
        string ReadSettings(IntPtr hParentWnd, string serviceUri, ref string userId)
        {
            INameValueStore storage = new CSharpTest.Net.Serialization.StorageClasses.RegistryStorage();
            try
            {
                string password;
                storage.Read(serviceUri, "UserName", out userId);
                if (storage.Read(serviceUri, "Password", out password))
                    return Encryption.CurrentUser.Decrypt(password);
            }
            catch { }

            PasswordEntry pwdDlg = new PasswordEntry(userId, serviceUri);
            if (pwdDlg.ShowDialog(Win32Window.FromHandle(hParentWnd)) == DialogResult.OK)
            {
                userId = pwdDlg.UserName.Text;
                SaveSettings(userId, serviceUri, pwdDlg.Password.Text);
                return pwdDlg.Password.Text;
            }

            return null;
        }