private void HookModel()
        {
            if (_model == null)
            {
                return;
            }
            _model.LoadCompleted             += (sender, e) => _loadProgressDialogDecorator.Hide();
            _model.EnumratePedestriansFailed += (sender, e) =>
            {
                using (Toast errorToast = Toast.MakeText(Application.BaseContext, Resources.GetString(Resource.String.FailedToEnumratePedestrians), ToastLength.Short))
                    errorToast.Show();
                _loadProgressDialogDecorator.Hide();
            };
            //LinearLayout mapLayout = FindViewById<LinearLayout>(Resource.Id.mapLayout);
            //((IAndroidMapService)_model.Map.MapService).VisualizeMap(this, mapLayout);
            View map = FindViewById <View>(Resource.Id.map);

            ((IAndroidMapService)_model.Map.MapService).HookMap(map);
            CanvasView           driverProfileView    = FindViewById <CanvasView>(Resource.Id.driverProfileView);
            DriverProfileAdapter driverProfileAdapter = new DriverProfileAdapter(this, _model);

            driverProfileView.LayoutChange += (sender, e) => driverProfileAdapter.UpdatePedestrianInfoPopups();
            driverProfileView.Adapter       = driverProfileAdapter;
            _loadProgressDialogDecorator.Show();
            _model.BeginLoad();
        }
 private void InteractionModel_CurrentProfileChanged(object sender, EventArgs e)
 {
     RunOnUiThread(() =>
     {
         ActivateProfile();
         _authorizationProgressDialogDecorator.Hide();
     });
 }
Пример #3
0
 private void Model_EnumrateCitiesFailed(object sender, Toolkit.Events.ActionResultEventArgs e)
 {
     RunOnUiThread(() =>
     {
         _connectionProgressDialogDecorator.Hide();
         using (Toast errorToast = Toast.MakeText(Application.BaseContext, Resources.GetString(Resource.String.ConnectToServerFailed), ToastLength.Short))
             errorToast.Show();
     });
 }
        private void HookModel()
        {
            if (_model == null)
            {
                return;
            }
            _model.RequestsCollectionChanged          += Model_RequestsCollectionChanged;
            _model.AcceptedResponsesChanged           += Model_AcceptedResponsesChanged;
            _model.AcceptedResponsesCollectionChanged += Model_AcceptedResponsesCollectionChanged;
            _model.LoadCompleted         += (sender, e) => _loadProgressDialogDecorator.Hide();
            _model.EnumrateDriversFailed += (sender, e) =>
            {
                using (Toast errorToast = Toast.MakeText(Application.BaseContext, Resources.GetString(Resource.String.FailedToEnumrateDrivers), ToastLength.Short))
                    errorToast.Show();
                _loadProgressDialogDecorator.Hide();
            };
            _model.EnumrateRequestsFailed += (sender, e) =>
            {
                using (Toast errorToast = Toast.MakeText(Application.BaseContext, Resource.String.FailedToEnumrateRequests, ToastLength.Short))
                    errorToast.Show();
                _loadProgressDialogDecorator.Hide();
            };
            _model.EnumrateAcceptedResponsesFailed += (sender, e) =>
            {
                using (Toast errorToast = Toast.MakeText(Application.BaseContext, Resource.String.FailedToEnumrateAcceptedResponses, ToastLength.Short))
                    errorToast.Show();
                _loadProgressDialogDecorator.Hide();
            };
            //_model.CheckCurrentRequestFailed += (sender, e) =>
            //{
            //    using (Toast errorToast = Toast.MakeText(Application.BaseContext, Resources.GetString(Resource.String.FailedToCheckCurrentRequest), ToastLength.Short))
            //        errorToast.Show();
            //    _loadProgressDialogDecorator.Hide();
            //};
            _loadProgressDialogDecorator.Show();
            _model.BeginLoad();
            //LinearLayout mapLayout = FindViewById<LinearLayout>(Resource.Id.mapLayout);
            //((IAndroidMapService)_model.Map.MapService).VisualizeMap(this, mapLayout);
            View map = FindViewById <View>(Resource.Id.map);

            ((IAndroidMapService)_model.Map.MapService).HookMap(map);
            CanvasView pedestrianProfileView = FindViewById <CanvasView>(Resource.Id.pedestrianProfileView);

            pedestrianProfileView.Adapter = new PedestrianProfileAdapter(this, _model);
            //mapLayout.Clickable = true;
            map.Click += (sender, e) => _model.CheckedDriver = null;
        }