public void WPFLoginLoadSavedInfo(bindingsFile bindingFile) { projInfoFile = bindingFile; if (projInfoFile.Exists()) { projInfoFile.readInfofile(); var dict = (Dictionary <string, object>)projInfoFile.getInfo("Cred"); url = (string)dict["URL"]; username = (string)dict["User"]; password = (string)dict["Password"]; url_textbox.Text = url; username_textbox.Text = username; try { passwordBox.Password = Unprotect(password); } catch { } //Unprotect(password); } //} else { projInfoFile.Create(); } }
public Login(bindingsFile bindingFile) { InitializeComponent(); projInfoFile = bindingFile; if (projInfoFile.Exists()) { projInfoFile.readInfofile(); var dict = (Dictionary <string, object>)projInfoFile.getInfo("Cred"); url = (string)dict["URL"]; username = (string)dict["User"]; password = (string)dict["Password"]; //string fileName = @"C:\Temp\temp_valicred.txt"; //if (File.Exists(fileName)) //{ // // Open the stream and read it back. // using (StreamReader sr = File.OpenText(fileName)) // { // string s = ""; // while ((s = sr.ReadLine()) != null) // { // string[] lines = s.Split(':'); // url = lines[0]; // username = lines[1]; // password = lines[2]; // } // } url_textbox.Text = url; username_textbox.Text = username; try { passwordBox.Password = Unprotect(password); } catch { } //Unprotect(password); } //} else { projInfoFile.Create(); } this.Show(); }