Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.ResultLayout);


            placeInformation = JsonConvert.DeserializeObject <PlaceInformation>(Intent.GetStringExtra("placeInformation"));

            btn        = FindViewById <Button>(Resource.Id.direction);
            btn.Click += delegate { GetDirections(); };

            textTitle      = FindViewById <TextView>(Resource.Id.textTitle);
            textTitle.Text = placeInformation.Title;

            textContent      = FindViewById <TextView>(Resource.Id.textContent);
            textContent.Text = placeInformation.Content;


            textRating      = FindViewById <TextView>(Resource.Id.ratingText);
            textRating.Text = placeInformation.Rating.ToString();

            textSentiment      = FindViewById <TextView>(Resource.Id.sentimentText);
            textSentiment.Text = GetTextSentiment();

            heartImage = FindViewById <ImageView>(Resource.Id.heart);
            heartImage.SetImageResource(GetHeartImagePath());
        }
Esempio n. 2
0
        private static void StartActivity(PlaceInformation placeInformation)
        {
            Intent intent = new Intent(context, typeof(PlaceInformationActivity));

            intent.PutExtra("placeInformation", JsonConvert.SerializeObject(placeInformation));

            context.StartActivity(intent);
        }
Esempio n. 3
0
 private static BusStop PlaceInformationToBusStop(PlaceInformation place)
 {
     return(new BusStop
     {
         PlaceId = place.PlaceId,
         Name = place.Name,
         Location = new Point(place.Geometry.Location.Latitude, place.Geometry.Location.Longitude)
         {
             SRID = 4326
         }
     });
 }
Esempio n. 4
0
        public static Answer StartConversation(string input)
        {
            input = input.ToLower();
            switch (State)
            {
            case 0:
                if (input.Equals(Constants.YES.ToLower()))
                {
                    State = 1;
                }
                else if (input.Equals(Constants.NO.ToLower()))
                {
                    State = 2;
                }
                return(GetResponse(input));

            case 1:
                if (RestAPICaller.CallCheckLocationAPI(input))
                {
                    State = 3;
                }
                else
                {
                    State = 4;
                }
                return(GetResponse(input));

            case 2: State = 0; return(GetResponse(input));

            case 3:
                if (input.Equals(Constants.OTHER.ToLower()))
                {
                    State = 8;
                }
                else if (input.Equals(Constants.ACTIVITIES.ToLower()))
                {
                    State = 10;
                }
                else if (input.Equals(Constants.ACCOMODATION.ToLower()))
                {
                    State = 12;
                }
                else if (input.Equals(Constants.RESTAURANTS.ToLower()))
                {
                    State = 11;
                }
                return(GetResponse(input));

            case 4:
                if (RestAPICaller.CallCheckLocationAPI(input))
                {
                    State = 3;
                }
                else if (input.Contains(Constants.NO.ToLower()))
                {
                    State = 7;
                }
                else
                {
                    State = 4;
                }
                return(GetResponse(input));

            case 5: State = 9; return(GetResponse(input));

            case 6: State = 9; return(GetResponse(input));

            case 7: State = 0; return(GetResponse(input));

            case 8:
                RestAPICaller.CallApiGetResponse(input, Constants.OTHER);
                return(GetResponse(input));

            case 9:
                if (input.Equals(Constants.YES.ToLower()))
                {
                    State = 3;
                }
                else if (input.Equals(Constants.NO.ToLower()))
                {
                    State = 7;
                }
                return(GetResponse(input));

            case 10:
                typeInput = Constants.ACTIVITIES;
                RestAPICaller.CallApiGetResponse(input, Constants.ACTIVITIES);
                return(GetResponse(input));

            case 11:
                typeInput = Constants.RESTAURANTS;
                RestAPICaller.CallApiGetResponse(input, Constants.RESTAURANTS);
                return(GetResponse(input));

            case 12:
                typeInput = Constants.ACCOMODATION;
                RestAPICaller.CallApiGetResponse(input, Constants.ACCOMODATION);
                return(GetResponse(input));

            case 13:
                if (input.Equals(Constants.NOTHING.ToLower()))
                {
                    State = 9;
                }
                else
                {
                    StartActivity(PlaceInformation.GetPlaceInformation(input, RestAPICaller.Location, typeInput));
                }

                return(GetResponse(input));
            }
            return(GetResponse(input));
        }