public FormInfluencerToolkit() { CurrentAppSettings = AppSettings.LoadFromFileOrInit(); InitializeComponent(); this.Size = CurrentAppSettings.LastWindowSize; this.Location = CurrentAppSettings.LastWindowLocation; this.checkBoxRememberUser.Checked = CurrentAppSettings.RememberUser; UIDataPopulator = new UIPopulator(this); }
private void loginButton_Click(object sender, EventArgs e) { var loginThread = new Thread(loginUser); loginThread.SetApartmentState(ApartmentState.STA); loginThread.Start(); loginThread.Join(); UIDataPopulator = new UIPopulator(this); var UIpopulatorThread = new Thread(this.UIDataPopulator.PopulateUI); UIpopulatorThread.SetApartmentState(ApartmentState.STA); UIpopulatorThread.Start(); }
protected override void OnShown(EventArgs e) { base.OnShown(e); if (!string.IsNullOrEmpty(CurrentAppSettings.LastAccesToken) && CurrentAppSettings.RememberUser) { try { getAndAdaptLoginResultAndThenPopulateCache(FacebookService.Connect(CurrentAppSettings.LastAccesToken)); } catch (Exception exception) { DisplayErrorDialog(string.Format("Something went wrong when trying to connect to Facebook{0} Check your internet connection - meanwhile we you can work with you cached usef profile. {0} PAY ATTAENTION - the data may not be up to date!!!{0}Advanced:{1}", Environment.NewLine, exception.Message)); this.LoginResult = new CachedLoginResultAdapter(); } finally { UIDataPopulator = new UIPopulator(this); UIDataPopulator.PopulateUI(); } } }