public void SaveState(PropertyFinderPersistentState state) { _fileStore.WriteFile(FileName, stream => { XmlSerializer serializer = new XmlSerializer(typeof (PropertyFinderPersistentState)); serializer.Serialize(stream, state); }); }
public SearchResultsViewModel(PropertyFinderPersistentState stateFactory, PropertyDataSource dataSource) { _stateFactory = stateFactory; _dataSource = dataSource; Properties= new ObservableCollection<PropertyViewModel>(); PropertiesSelectedCommand = new MvxCommand<PropertyViewModel>(DoPropertiesSelected); LoadMoreCommand = new MvxCommand(DoLoadMore); Title = "Loading..."; }
public FavouritesViewModel(PropertyFinderPersistentState state) { Properties = new ObservableCollection<PropertyViewModel>(); foreach (var property in state.Favourites) { Properties.Add(new PropertyViewModel(state,property)); } FavouritesSelectedCommand = new MvxCommand<PropertyViewModel>(DoFavouritesSelected); }
public PropertyFinderViewModel(PropertyFinderPersistentState stateFactory, PropertyDataSource dataSource, IGeoLocationService geolocationService) { _state = stateFactory; _dataSource = dataSource; _geolocationService = geolocationService; SearchCommand = new MvxCommand(DoSearch); UseLocationCommand = new MvxCommand(DoUseLocation); ShowFavouritesCommand = new MvxCommand(DoShowFavourites); RecentSearchSelectedCommand = new MvxCommand<RecentSearch>(DoRecentSearchSelected); LocationSelectedCommand = new MvxCommand<Location>(DoLocationSelected); SuggestedLocations = new ObservableCollection<Location>(); RecentSearches = new ObservableCollection<RecentSearch>(); LoadRecentSearches(); }
public PropertyFinderPersistentState LoadState() { PropertyFinderPersistentState state = null; try { string data; if (_fileStore.TryReadTextFile(FileName, out data)) { XmlSerializer serializer = new XmlSerializer(typeof(PropertyFinderPersistentState)); TextReader reader = new StringReader(data); state = (PropertyFinderPersistentState)serializer.Deserialize(reader); state.PersistenceService = this; } } catch { } if(state == null) state = new PropertyFinderPersistentState(this); return state; }
public PropertyViewModel(PropertyFinderPersistentState state, Property property) { _state = state; Init(property); }
public PropertyViewModel(PropertyFinderPersistentState state) { _state = state; }