private void fillComboboxFromTxtFile(ComboBox i_ComboBox, string i_TxtFilePath) { string[] linesOfFile = File.ReadAllLines(LastAppSession.LoadFilePath(i_TxtFilePath)); foreach (var line in linesOfFile) { i_ComboBox.Items.Add(line); } }
public void SaveLoginData() { m_LastSessionData = new LastAppSession(); m_LastSessionData.LastAccessToken = m_FacebookServices.AccessToken; m_LastSessionData.WriteToFile(); }
public static LastAppSession ReadFromFile(string i_FilePath)//The method has to get file path suffix to pass it to LoadfromFile { LastAppSession sessionParameters = new LastAppSession(); string file = LoadFilePath(i_FilePath); using (Stream stream = new FileStream(file, FileMode.Open)) { XmlSerializer serializer = new XmlSerializer(typeof(LastAppSession)); sessionParameters = serializer.Deserialize(stream) as LastAppSession; } return(sessionParameters); }
private bool TryToLoginViaCookies() { bool ifSucceed = false; string sessionPath = @"Resources\LastAppSession.xml"; if (File.Exists(LastAppSession.LoadFilePath(sessionPath))) { m_LastSessionData = LastAppSession.ReadFromFile(sessionPath); try { m_FacebookServices = FacebookService.Connect(m_LastSessionData.LastAccessToken); SignIn(); } catch (Exception ex) { MessageBox.Show(ex.Message); } ifSucceed = true; RunProgramMenu(); } return(ifSucceed); }