using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using TradeIdeas.XML; using System.Xml; namespace TradeIdeas.TIProGUI { /// /// Class for configuring ones social networking. Does the exact same thing /// as the social network tab of the Options window, but for Scott trade (Since /// they won't have the Options tab. /// public partial class ConfigureSocial : Form,ICultureListener { private List _phrases; private SocialSettings _socialSettings = new SocialSettings(); private FontManager _fontManager; private const float DEFAULT_FONT_SIZE = 8.25F; public ConfigureSocial() { _phrases = GuiEnvironment.XmlConfig.Node("OPTIONS").Node("PHRASES"); InitializeComponent(); CultureChanged(); Icon = GuiEnvironment.Icon; _fontManager = new FontManager(this, DEFAULT_FONT_SIZE); selectTheFont(); pictureBox1.Size = btnLinkedInConfig.Size; Image newImage = CollaborateForm.resizeImage(pictureBox1.Image, btnLinkedInConfig.Size); pictureBox1.Image = newImage; newImage = CollaborateForm.resizeImage(btnLinkedInConfig.Image, btnLinkedInConfig.Size); btnLinkedInConfig.Image = newImage; newImage = CollaborateForm.resizeImage(btnTwitterConfig.Image, btnLinkedInConfig.Size); btnTwitterConfig.Image = newImage; //Set checkboxes for StockTwit messaging options.. chkTwitter.Checked = _socialSettings.StockTwitConnectTwitter; GuiEnvironment.stTwitter = _socialSettings.StockTwitConnectTwitter; chkFaceBook.Checked = _socialSettings.StockTwitConnectFaceBook; GuiEnvironment.stFacebook = _socialSettings.StockTwitConnectFaceBook; chkLinkeIn.Checked = _socialSettings.StockTwitConnectLinkedIn; GuiEnvironment.stLinkedIn = _socialSettings.StockTwitConnectLinkedIn; } /// /// Responsible for language changes /// public void CultureChanged() { //Social Networks lblConfigure.Text = _phrases.Node("SOCIAL_NETWORKS_LABEL").PropertyForCulture("TEXT", "***"); textBox1.Text = _phrases.Node("TWITTER_CONFIG_INSTRUCTIONS").PropertyForCulture("TEXT", "***"); textBox2.Text = _phrases.Node("LINKED_IN_CONFIG").PropertyForCulture("TEXT", "***"); chkTwitter.Text = _phrases.Node("ST_TWITTER").PropertyForCulture("TEXT", "***"); chkFaceBook.Text = _phrases.Node("ST_FACEBOOK").PropertyForCulture("TEXT", "***"); chkLinkeIn.Text = _phrases.Node("ST_LINKEDIN").PropertyForCulture("TEXT", "***"); } private void btnOK_Click(object sender, EventArgs e) { //StockTwitsSettings.... GuiEnvironment.stTwitter = chkTwitter.Checked; _socialSettings.StockTwitConnectTwitter = chkTwitter.Checked; GuiEnvironment.stFacebook = chkFaceBook.Checked; _socialSettings.StockTwitConnectFaceBook = chkFaceBook.Checked; GuiEnvironment.stLinkedIn = chkLinkeIn.Checked; _socialSettings.StockTwitConnectLinkedIn = chkLinkeIn.Checked; _socialSettings.Save(); } /// /// Adjusts the font /// public void selectTheFont() { this.Font = GuiEnvironment.FontSettings; foreach (Control control in this.Controls) { _fontManager.selectTheFont(); } } private void btnTwitterConfig_Click(object sender, EventArgs e) { //When pressing this button, the user is able to bring up the login box //to login to a different twitter account if he so chooses. So, we //must reset the _socialSettings parameter to empty in order to bring up the //login screen. oAuthTwitter oAuth = new oAuthTwitter(); _socialSettings.oAuthTokenTwitter = ""; _socialSettings.oAuthTokenSecretTwitter = ""; TwitterForm tf = new TwitterForm(oAuth, _socialSettings); tf.ShowDialog(); } private void btnLinkedInConfig_Click(object sender, EventArgs e) { //here, the user is able to change LinkedIn acounts if desired. oAuthLinkedIn oAuth = new oAuthLinkedIn(); oAuth.authorizeToken(); oAuth.getAccessToken(); } } }