public PropertyFinderPersistentState(IStatePersistenceService persistenceService)
     : this()
 {
     _persistenceService = persistenceService;
       Favourites = new List<Property>();
     RecentSearches = new List<RecentSearch>();
 }
示例#2
0
 public PropertyFinderPersistentState(IStatePersistenceService persistenceService)
     : this()
 {
     _persistenceService = persistenceService;
     Favourites          = new List <Property>();
     RecentSearches      = new List <RecentSearch>();
 }
示例#3
0
        /// <summary>
        /// Deletes the saved state of the <see cref="WorkItem"/>. The local copy of the state is not changed.
        /// </summary>
        /// <exception cref="ServiceMissingException">Thrown if the IStatePersistenceService is not
        /// registered in the WorkItem.</exception>
        public void DeleteState()
        {
            IStatePersistenceService service = Services.Get <IStatePersistenceService>();

            if (service == null)
            {
                throw new ServiceMissingException(typeof(IStatePersistenceService), this);
            }

            service.Remove(ID);
        }
示例#4
0
        /// <summary>
        /// Saves the state of this work item.
        /// </summary>
        public void Save()
        {
            IStatePersistenceService service = Services.Get <IStatePersistenceService>();

            if (service == null)
            {
                throw new ServiceMissingException(typeof(IStatePersistenceService), this);
            }

            using (new WriterLock(state.syncRoot))
            {
                service.Save(state);
                state.AcceptChanges();
            }
        }
示例#5
0
        /// <summary>
        /// Loads the work item.
        /// </summary>
        public void Load()
        {
            IStatePersistenceService service = Services.Get <IStatePersistenceService>();

            if (service == null)
            {
                throw new ServiceMissingException(typeof(IStatePersistenceService), this);
            }

            using (new WriterLock(state.syncRoot))
            {
                State newState = service.Load(ID);
                newState.syncRoot = ReleaseState();
                AttachState(newState);
            }
        }
示例#6
0
        public override void Initialize()
        {
            CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            Mvx.RegisterType <PropertyDataSource, PropertyDataSource>();
            Mvx.RegisterType <IStatePersistenceService, StatePersistenceService>();

            Mvx.RegisterType <IJsonPropertySearch, JsonWebPropertySearch>();
            Mvx.RegisterSingleton(() =>
            {
                IStatePersistenceService state = Mvx.Resolve <IStatePersistenceService>();
                return(state.LoadState());
            });

            RegisterAppStart <ViewModels.PropertyFinderViewModel>();
        }
示例#7
0
 public PropertyFinderPersistentState(IStatePersistenceService persistenceService)
     : this()
 {
     _persistenceService = persistenceService;
 }
 public PropertyFinderPersistentState(IStatePersistenceService persistenceService)
     : this()
 {
     _persistenceService = persistenceService;
 }
示例#9
0
 public PropertyCrossPersistentState(IStatePersistenceService persistenceService)
     : this()
 {
     _persistenceService = persistenceService;
 }
 public PropertyCrossPersistentState(IStatePersistenceService persistenceService)
     : this()
 {
     _persistenceService = persistenceService;
 }