Пример #1
0
        public void TestFunction()
        {
            DailyMileMe profile;
            string jsonResults;

            profile = new DailyMileMe();

            if (LogonDailyMile() == true)
            {
                string getAuth = string.Format("{0}/people/{1}/events/all.json?oauth_token={2}", _connectionInfo.DailyMileURL, "", _connectionInfo.ServerKey);
                Uri reqToken = new Uri(getAuth);

                try
                {

                    jsonResults = RequestData(getAuth);
                }
                catch (VSException ve)
                {

                }
                catch (System.Exception ex)
                {

                }
            }
        }
Пример #2
0
        private void ReadPersonalData()
        {
            _logger.EnQueueAppTraceMessage("ReadPersonalData() Enter");

            //save file
            tsStatus.Text = "Reading Stored Daily Mile User Data";

            try
            {

                using (FileStream fs = new FileStream(_dmUserinfoFilename, FileMode.OpenOrCreate, FileAccess.Read, FileShare.None))
                {
                    if (fs.Length > 0)
                    {
                        using (BinaryReader binReader = new BinaryReader(fs))
                        {

                            _aboutMe = VengSoft.DailyMileAPIWrapper.SerializersJSON.Deserialise<DailyMileMe>(binReader.ReadBytes((int)fs.Length));
                            pbUserImage.ImageLocation = _aboutMe.Photo_url;
                        }
                    }
                    else
                    {
                        _aboutMe = new DailyMileMe();
                    }
                }

                dailyMileMeBindingSource.DataSource = _aboutMe;
            }
            catch (System.Exception ex)
            {
                _logger.EnQueueFatalMessage("ReadPersonalData() Exception: " + ex.Message);
            }

            _logger.EnQueueAppTraceMessage("ReadPersonalData() Leave");
        }
Пример #3
0
        public DailyMileMe GetLoggedOnUsersProfileData()
        {
            DailyMileMe profile;
            string jsonResults;

            profile = new DailyMileMe();

            if (LogonDailyMile() == true)
            {
                try
                {

                    string getAuth = string.Format("{0}/people/me.json?oauth_token={1}", _connectionInfo.DailyMileURL, _connectionInfo.ServerKey);
                    jsonResults = RequestData(getAuth);

                    profile = SerializersJSON.Deserialise<DailyMileMe>(jsonResults);
                }
                catch (VSException ve)
                {
                    throw ve;
                }
                catch (System.Exception ex)
                {
                    throw new VSException(string.Format("GetLoggedOnUsersProfileData Exception {0}", ex.Message));
                }
            }

            return profile;
        }
Пример #4
0
        private void GetPersonalData()
        {
            _logger.EnQueueAppTraceMessage("GetPersonalData() Enter");
            tsStatus.Text = "Requesting Your user Information";

            try
            {
                _aboutMe = _APIWrapper.GetLoggedOnUsersProfileData();

                tsStatus.Text = "I have your user info";
                dailyMileMeBindingSource.DataSource = _aboutMe;
                SavePersonalData();
            }
            catch (System.Exception ex)
            {
                _logger.EnQueueFatalMessage("GetPersonalData() Exception: " + ex.Message);
            }

            _logger.EnQueueAppTraceMessage("GetPersonalData() Leave");
        }