public PropertyCrossPresenter(PropertyCrossPersistentState state,
                               PropertyDataSource dataSource, INavigationService navigationService, IGeoLocationService geolocationService)
 {
     _propertyDataSource = dataSource;
     _navigationService  = navigationService;
     _state = state;
     _geolocationService = geolocationService;
 }
Ejemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds the TsString to the given cell.
        /// </summary>
        /// <param name="ws">The HVO of the writing system.</param>
        /// <param name="flid">The flid of the property to display.</param>
        /// <param name="iRow">The index of the row in which to place the control.</param>
        /// <param name="iCol">The index of the column in which to place the control.</param>
        /// ------------------------------------------------------------------------------------
        private void AddStringToCell(int ws, int flid, int iRow, int iCol)
        {
            FwTextBoxCell cell = Rows[iRow].Cells[iCol] as FwTextBoxCell;

            if (cell != null)
            {
                cell.Value = PropertyDataSource.GetMultiStringAlt(flid, ws);
            }
        }
 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...";
 }
Ejemplo n.º 4
0
 public SearchResultsPresenter(INavigationService navigationService, PropertyFinderPersistentState 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 SearchResultsViewModel(INavigationService navigationService, PropertyFinderPersistentState state,
                                      PropertyListingsResult results, SearchItemBase searchItem, PropertyDataSource dataSource)
        {
            _state             = state;
            _navigationService = navigationService;
            _searchItem        = searchItem;
            _dataSource        = dataSource;
            var propertyViewModels = results.Data.Select(p => new PropertyViewModel(this, state, p)).ToList();

            _properties  = new ObservableCollection <PropertyViewModel>(propertyViewModels);
            _totalResult = results.TotalResult;
            _totalPages  = results.TotalPages;
        }
Ejemplo n.º 6
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            var source             = new PropertyDataSource(new JsonWebPropertySearch());
            var geolocationService = new GeoLocationService();

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

            var viewModel = new PropertyFinderViewModel(state, source,
                                                        new NavigationService(null), geolocationService);

            RootFrame.DataContext = viewModel;
        }
        public PropertyFinderViewModel(PropertyFinderPersistentState state,
                                       PropertyDataSource dataSource, INavigationService navigationService, IGeoLocationService geolocationService)
        {
            _propertyDataSource = dataSource;
            _navigationService  = navigationService;
            _state = state;
            _geolocationService = geolocationService;
            _recentSearches     = state.RecentSearches;

            foreach (var search in _recentSearches)
            {
                search.Parent = this;
            }
        }
        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();
        }
        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();
                PropertyFinderPersistentState state = statePersistence.LoadState();

                _presenter = new PropertyFinderPresenter(state, source,
                                                         new NavigationService(NavigationService), geolocationService);
                _presenter.SetView(this);
            }
        }
        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              = (EditText)FindViewById(Resource.Id.search);
            searchText.TextChanged += SearchText_Changed;
            searchText.SetOnEditorActionListener(this);

            myLocationButton        = (Button)FindViewById(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;
        }
Ejemplo n.º 11
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Raises the visible changed event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event
        /// data.</param>
        /// ------------------------------------------------------------------------------------
        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);

            if (!Visible || Disposing)
            {
                return;
            }

            if (DesignMode)
            {
                return;
            }

            PropertyDataSource.CheckSettings();

            // Add column headers
            foreach (ColumnInfo colInfo in PropertyDataSource.FieldsToDisplay)
            {
                PropertyDataSource.AddColumn(colInfo.name, colInfo.widthPct);
            }

            int iRow = 0;

            foreach (int ws in PropertyDataSource.WritingSystemsToDisplay)
            {
                Rows.Add(new FwTextBoxRow(ws));
                var lgws = PropertyDataSource.WritingSystemManager.Get(ws);
                Rows[iRow].Cells[0].Value = lgws.Abbreviation;

                int iCol = 1;
                foreach (ColumnInfo colInfo in PropertyDataSource.FieldsToDisplay)
                {
                    AddStringToCell(ws, colInfo.flid, iRow, iCol++);
                }
                iRow++;
            }

            AutoResizeRows(DataGridViewAutoSizeRowsMode.AllCells);
            AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);

            // Now set the current cell to the second column so that we skip the (read-only)
            // language name.
            CurrentCell = CurrentRow.Cells[1];
        }
Ejemplo n.º 12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var app = (PropertyFinderApplication)Application;

            app.CurrentActivity = this;

            var uiMarshal = new MarshalInvokeService(app);
            var source    = new PropertyDataSource(new JsonWebPropertySearch(uiMarshal));

            geoLocationService = new GeoLocationService((LocationManager)GetSystemService(Context.LocationService), uiMarshal);
            var stateService = new StatePersistenceService(app);
            PropertyFinderPersistentState state = stateService.LoadState();

            SetContentView(Resource.Layout.PropertyFinderView);
            searchText              = (EditText)FindViewById(Resource.Id.search);
            searchText.TextChanged += SearchText_Changed;

            myLocationButton        = (Button)FindViewById(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);

            recentSearchList            = (ListView)FindViewById(Resource.Id.recentsearches_list);
            recentSearchList.ItemClick += RecentSearchItem_Clicked;
            adapter = new RecentSearchAdapter(this, new List <RecentSearch>());
            recentSearchList.Adapter = adapter;

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

            app.Presenter = presenter;
        }
Ejemplo n.º 13
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();
            PropertyFinderPersistentState state = statePersistence.LoadState();

            var presenter = new PropertyFinderPresenter(state, source,
                                                        new NavigationService(navigationController), geolocationService);
            var controller = new PropertyFinderViewController(presenter);

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

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

            return(true);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Executes the search that this item represents.
 /// </summary>
 public abstract void FindProperties(PropertyDataSource dataSource,
                                     int pageNumber, Action <PropertyDataSourceResult> callback, Action <Exception> error);
Ejemplo n.º 15
0
 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);
 }