예제 #1
0
        public async override Task <SynchroManager.Status> Synchronize(SynchroHandle _syncHandle)
        {
            SynchroManager.Status _syncStatus = SynchroManager.Status.ErrorOrNotConnected;

            if (LoggedIn != WebAccountState.Connected)
            {
                await SyncMngr.Login(SynchroManager.ServerName.GooglePlus);
            }

            if (!Connection.InternetAccess())
            {
                return(_syncStatus);
            }

            ProgressUpdate(Res.GetString("SynchroStart"), 0);

            HttpResponseMessage _response = await(new HttpClient()).GetAsync(new Uri(MAIN + "?access_token=" + Token));

            if ((_response != null) && (_response.StatusCode == HttpStatusCode.OK))
            {
                ResponseFeed _feed = await Serialization.DeserializeHttpToXml <ResponseFeed>(_response.Content, "feed", "http://www.w3.org/2005/Atom") as ResponseFeed;
            }

            Trip _trip = await Trip.LoadFromSummary(_syncHandle.TripSummary);

            return(SynchroManager.Status.Synchronized);
        }
예제 #2
0
        public async override Task <SynchroManager.Status> Synchronize(SynchroHandle _syncHandle)
        {
            SynchroManager.Status _syncStatus = SynchroManager.Status.ErrorOrNotConnected;

            if (!Connection.InternetAccess())
            {
                return(_syncStatus);
            }

            if (LoggedIn != WebAccountState.Connected)
            {
                await SyncMngr.Login(SynchroManager.ServerName.Facebook);
            }

            ProgressUpdate(Res.GetString("SynchroStart"), 0);

            Trip _trip = await Trip.LoadFromSummary(_syncHandle.TripSummary);

            return(SynchroManager.Status.Synchronized);
        }
예제 #3
0
        public async override Task <SynchroManager.Status> Synchronize(SynchroHandle _syncHandle)
        {
            Boolean _status = true;

            SynchroManager.Status _syncStatus = SynchroManager.Status.NoRequest;

            if (LoggedIn != WebAccountState.Connected)
            {
                _syncHandleSav = _syncHandle;
                _status        = await SyncMngr.Login(SynchroManager.ServerName.Usb);
            }
            if (_status)
            {
                Trip _trip = await Trip.LoadFromSummary(_syncHandle.TripSummary);

                _status &= await SynchronizeTrip(_trip);

                ProgressFinished("");

                // check error status
                if (CancelInProgress())
                {
                    _syncStatus = SynchroManager.Status.NoRequest;
                }
                else if (!_status)
                {
                    _syncStatus = SynchroManager.Status.ErrorOrNotConnected;
                }
                else
                {
                    _syncStatus = SynchroManager.Status.Synchronized;
                }
            }
            else
            {
                _syncStatus = SynchroManager.Status.ErrorOrNotConnected;
            }

            _syncHandle.SetSynchroStatus(_syncStatus);
            return(_syncStatus);
        }