コード例 #1
0
 public void SaveState(PropertyFinderPersistentState state)
 {
     _fileStore.WriteFile(FileName, stream =>
     {
         XmlSerializer serializer = new XmlSerializer(typeof (PropertyFinderPersistentState));
         serializer.Serialize(stream, state);
     });
 }
コード例 #2
0
   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...";
   }
コード例 #3
0
        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);
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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;
        }
コード例 #6
0
 public PropertyViewModel(PropertyFinderPersistentState state, Property property)
 {
     _state = state;
     Init(property);
 }
コード例 #7
0
 public PropertyViewModel(PropertyFinderPersistentState state)
 {
     _state = state;
 }