private void button1_Click(object sender, EventArgs e) { Settings.Default.Username = txtUsername.Text; Settings.Default.Password = JabberManager.EncryptString(JabberManager.ToSecureString(txtPassword.Text)); Settings.Default.Server = getServer(); Settings.Default.Save(); Connect(); }
private void frmContactList_Load(object sender, EventArgs e) { Settings.Default.Reload(); if (Settings.Default.Top > 0) { Location = new Point(Settings.Default.Left, Settings.Default.Top); } Started = true; string champResFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources", "Champions"); string iconResFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources", "Icons"); foreach (string file in Directory.GetFiles(champResFolder, "*.png")) { imgChamps.Images.Add(extractChampionNameFromFile(file), Image.FromFile(file)); } // Load icons foreach (string file in Directory.GetFiles(iconResFolder, "*.png")) { imgChamps.Images.Add(Path.GetFileNameWithoutExtension(file).ToLower(), Image.FromFile(file)); } lstBuddies.Columns.Add("Nickname"); lstBuddies.Columns.Add("duration"); lstBuddies.Columns.Add("rankedRating"); lstBuddies.Columns.Add("State"); jm.UserChanged += new JabberManager.UserChangedHandler(jm_UserChanged); jm.OnMessage += new JabberManager.MsgHandler(jm_OnMessage); jm.OnConnect += new JabberManager.ConnectedHandler(jm_OnConnect); jm.OnDisconnect += new JabberManager.ConnectedHandler(jm_OnDisconnect); jm.OnError += new JabberManager.ErrorHandler(jm_OnError); txtUsername.Text = Settings.Default.Username; txtPassword.Text = JabberManager.ToInsecureString(JabberManager.DecryptString(Settings.Default.Password)); setServer(Settings.Default.Server); if ((Settings.Default.Username != "") && (Settings.Default.Password != "")) { Connect(); } else { pblConnect.Visible = true; btnDisconnect.Text = "Connect"; } }