public PropertyCrossPersistentState LoadState()
        {
            PropertyCrossPersistentState state = null;

              try
              {
            // load from isolated storage
            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            using (var stream = new IsolatedStorageFileStream("data.txt",
                                  FileMode.OpenOrCreate, FileAccess.Read, store))
            using (var reader = new StreamReader(stream))
            {
              if (!reader.EndOfStream)
              {
            var serializer = new XmlSerializer(typeof(PropertyCrossPersistentState));
            state = (PropertyCrossPersistentState)serializer.Deserialize(reader);

            // set the persistence service for the newly loaded state
            state.PersistenceService = this;
              }
            }
              }
              catch
              {
              }

              // if we cannot retrieve the state, create a new state object
              if (state == null)
              {
            state = new PropertyCrossPersistentState(this);
              }

              return state;
        }
        public PropertyCrossPersistentState LoadState()
        {
            PropertyCrossPersistentState state = null;

            try
            {
                using(var stream = application.CurrentActivity.OpenFileInput(FileName))
                using(var reader = new StreamReader(stream))
                {
                    if(!reader.EndOfStream)
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(PropertyCrossPersistentState));
                        state = (PropertyCrossPersistentState) serializer.Deserialize(reader);
                        state.PersistenceService = this;
                    }
                }
            }
            catch
            {
            }

            if(state == null)
                state = new PropertyCrossPersistentState(this);
            return state;
        }
 public void SaveState(PropertyCrossPersistentState state)
 {
     using (var writer = new StreamWriter(_filepath))
       {
     var serializer = new XmlSerializer(typeof(PropertyCrossPersistentState));
     serializer.Serialize(writer, state);
       }
 }
 public PropertyCrossPresenter(PropertyCrossPersistentState state,
                               PropertyDataSource dataSource, INavigationService navigationService, IGeoLocationService geolocationService)
 {
     _propertyDataSource = dataSource;
     _navigationService  = navigationService;
     _state = state;
     _geolocationService = geolocationService;
 }
 public void SaveState(PropertyCrossPersistentState state)
 {
     using(var stream = application.CurrentActivity.OpenFileOutput(FileName, FileCreationMode.Private))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(PropertyCrossPersistentState));
         serializer.Serialize(stream, state);
     }
 }
   public PropertyCrossPresenter(PropertyCrossPersistentState state,
 PropertyDataSource dataSource, INavigationService navigationService, IGeoLocationService geolocationService)
   {
       _propertyDataSource = dataSource;
         _navigationService = navigationService;
         _state = state;
         _geolocationService = geolocationService;
   }
Example #7
0
 public SearchResultsPresenter(INavigationService navigationService, PropertyCrossPersistentState state,
                               PropertyListingsResult results, SearchItemBase searchItem, PropertyDataSource dataSource)
 {
     _state             = state;
     _navigationService = navigationService;
     _searchItem        = searchItem;
     _dataSource        = dataSource;
     _properties        = results.Data;
     _totalResult       = results.TotalResult;
     _totalPages        = results.TotalPages;
 }
   public SearchResultsPresenter(INavigationService navigationService, PropertyCrossPersistentState state,
 PropertyListingsResult results, SearchItemBase searchItem, PropertyDataSource dataSource)
   {
       _state = state;
         _navigationService = navigationService;
         _searchItem = searchItem;
         _dataSource = dataSource;
         _properties = results.Data;
         _totalResult = results.TotalResult;
         _totalPages = results.TotalPages;
   }
 public void SaveState(PropertyCrossPersistentState state)
 {
     // persist the data using isolated storage
       using (var store = IsolatedStorageFile.GetUserStoreForApplication())
       using (var stream = new IsolatedStorageFileStream("data.txt",
                           FileMode.Create, FileAccess.Write, store))
       {
     var serializer = new XmlSerializer(typeof(PropertyCrossPersistentState));
     serializer.Serialize(stream, state);
       }
 }
        public PropertyCrossPersistentState LoadState()
        {
            PropertyCrossPersistentState state = null;

              try
              {
            using (var reader = new StreamReader(_filepath))
            {
              var serializer = new XmlSerializer(typeof(PropertyCrossPersistentState));
              state = (PropertyCrossPersistentState)serializer.Deserialize(reader);
              state.PersistenceService = this;
            }
              }
              catch
              {
              }

              if (state == null)
              {
            state = new PropertyCrossPersistentState(this);
              }

              return state;
        }
Example #11
0
 public PropertyPresenter(PropertyCrossPersistentState state, Property property)
 {
     _state    = state;
     _property = property;
 }
Example #12
0
 public FavouritesPresenter(INavigationService navigationService, PropertyCrossPersistentState state)
 {
     _state             = state;
     _navigationService = navigationService;
 }
 public PropertyPresenter(PropertyCrossPersistentState state, Property property)
 {
     _state = state;
       _property = property;
 }
 public FavouritesPresenter(INavigationService navigationService, PropertyCrossPersistentState state)
 {
     _state = state;
       _navigationService = navigationService;
 }