public PropertyCrossPresenter(PropertyCrossPersistentState state,
 PropertyDataSource dataSource, INavigationService navigationService, IGeoLocationService geolocationService)
   {
       _propertyDataSource = dataSource;
         _navigationService = navigationService;
         _state = state;
         _geolocationService = geolocationService;
   }
   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;
   }
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
      base.OnNavigatedTo(e);

      if (e.NavigationMode != NavigationMode.Back)
      {
        var source = new PropertyDataSource(new JsonWebPropertySearch(new MarshalInvokeService()));
        var geolocationService = new GeoLocationService();

        var statePersistence = new StatePersistenceService();
        PropertyCrossPersistentState state = statePersistence.LoadState();

        _presenter = new PropertyCrossPresenter(state, source,
          new NavigationService(NavigationService), geolocationService);
        _presenter.SetView(this);
      }
    }
예제 #4
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow (UIScreen.MainScreen.Bounds);

              navigationController = new UINavigationController ();

              var source = new PropertyDataSource (new JsonWebPropertySearch (new MarshalInvokeService()));
              var geolocationService = new GeoLocationService ();

              var statePersistence = new StatePersistenceService ();
              PropertyCrossPersistentState state = statePersistence.LoadState ();

              var presenter = new PropertyCrossPresenter (state, source,
              new NavigationService (navigationController), geolocationService);
              		var controller = new PropertyCrossViewController (presenter);

              navigationController.PushViewController(controller, false);
            window.RootViewController = navigationController;

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
예제 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            var app = PropertyCrossApplication.GetApplication(this);
            app.CurrentActivity = this;

            var uiMarshal = new MarshalInvokeService(app);
            var source = new PropertyDataSource(new JsonWebPropertySearch(uiMarshal));
            geoLocationService = new GeoLocationService(
                    (Android.Locations.LocationManager)GetSystemService(Context.LocationService), uiMarshal);
            var stateService = new StatePersistenceService(app);
            PropertyCrossPersistentState state = stateService.LoadState();

            SetContentView (Resource.Layout.PropertyCrossView);
            searchText = FindViewById<EditText>(Resource.Id.search);

            searchText.TextChanged += delegate(object sender, Android.Text.TextChangedEventArgs e) {
                String searchTerm = searchText.Text;
                if (searchTerm != null)
                {
                    searchTerm = searchTerm.Trim();
                    SearchTextChanged(this, new SearchTextChangedEventArgs(searchTerm));
                }
            };
            searchText.SetOnEditorActionListener(this);

            myLocationButton = FindViewById<Button>(Resource.Id.use_location);
            myLocationButton.Click += LocationButton_Clicked;

            startSearchButton = (Button) FindViewById(Resource.Id.do_search);
            startSearchButton.Click += StartSearchButton_Clicked;

            messageText = (TextView) FindViewById(Resource.Id.mainview_message);

            resultsHeader = (TextView) FindViewById(Resource.Id.results_header);
            resultsList = (ListView) FindViewById(Resource.Id.results_list);
            resultsList.ItemClick += ResultsListItem_Clicked;
            resultsList.Adapter = new RecentSearchAdapter(this, new List<RecentSearch>());

            loadingAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.loading_rotate);
            loadingAnimation.RepeatMode = RepeatMode.Restart;

            presenter =
                new PropertyCrossPresenter(state,
                                            source,
                                            new NavigationService(app),
                                            geoLocationService);
            presenter.SetView(this);

            app.Presenter = presenter;
        }
   /// <summary>
   /// Executes the search that this item represents.
   /// </summary>
   public abstract void FindProperties(PropertyDataSource dataSource,
 int pageNumber, Action<PropertyDataSourceResult> callback, Action<Exception> error);
   public override void FindProperties(PropertyDataSource dataSource,
 int pageNumber, Action<PropertyDataSourceResult> callback, Action<Exception> error)
   {
       dataSource.FindProperties(SearchText, pageNumber, callback, error);
   }
   public override void FindProperties(PropertyDataSource dataSource,
 int pageNumber, Action<PropertyDataSourceResult> callback, Action<Exception> error)
   {
       dataSource.FindProperties(Location.Latitude, Location.Longitude, pageNumber, callback, error);
   }