private void brtnGetData_Click(object sender, EventArgs e) { frmBackUpRange buRange = new frmBackUpRange(_dmConnectionInfo.LastBackupDateUser); if (buRange.ShowDialog() == DialogResult.OK) { grboxViews.Enabled = false; tsStatus.Text = "Backing Up User Info"; GetPersonalData(); tsStatus.Text = "Backing Up User Friends"; GetFriends(); tsStatus.Text = "Backing Up User Entries"; CollectDateRangeEntries(_aboutMe.Username, _dmEntriesInfoFilename, buRange.SinceDateTime, buRange.UntilDateTime); grboxViews.Enabled = true; tsStatus.Text = "Backing Up Complete"; _dmConnectionInfo.LastBackupDateUser = buRange.UntilDateTime.AddDays(-3); DailyMileConnectionInfo.SaveConnectionInfo(_ConfigFileName, _dmConnectionInfo); } }
private void btnBackUpFriends_Click(object sender, EventArgs e) { string dataPath; string fileName; _logger.EnQueueAppTraceMessage("btnBackUpFriends_Click Enter"); dataPath = HelperFunctions.GetAssemblyRunPath(); dataPath += "\\Data\\Friends"; if (Directory.Exists(dataPath) == false) Directory.CreateDirectory(dataPath); _logger.EnQueueAppTraceMessage("Backing Up Friends Entries"); frmBackUpRange buRange = new frmBackUpRange(_dmConnectionInfo.LastBackupDateFriends); if (buRange.ShowDialog() == DialogResult.OK) { try { DailyMileFriends friends = ReadFriendsData(); foreach (DailyMileFriend friend in friends.Friends) { fileName = string.Format("{0}\\Dailymile_{1}_Entries.dat", dataPath, friend.Username); tsStatus.Text = string.Format("Backing Up User {0} to File: {1}", friend.Username, fileName); _logger.EnQueueAppTraceMessage(tsStatus.Text); Application.DoEvents(); CollectDateRangeEntries(friend.Username, fileName, buRange.SinceDateTime, buRange.UntilDateTime); } _dmConnectionInfo.LastBackupDateFriends = buRange.UntilDateTime.AddDays(-3); DailyMileConnectionInfo.SaveConnectionInfo(_ConfigFileName, _dmConnectionInfo); } catch (VengSoft.DailyMileAPIWrapper.VSException vs) { string exceptionText = string.Format("btnBackUpFriends_Click() Exception ({0})", vs.Message); tsStatus.Text = exceptionText; _logger.EnQueueFatalMessage(exceptionText); } } tsStatus.Text = "Done Backing Up Friends Entries"; _logger.EnQueueAppTraceMessage("btnBackUpFriends_Click Leave"); }