public void UpdateScreenData(TourLocation selectedTour)
        {
            lblTourName.Text        = selectedTour.location_name.ToUpper();
            lblTourDescription.Text = Regex.Replace(selectedTour.location_text, "<.*?>", string.Empty);

            sliderPositionAudio.Value = 0;

            imgMute.Source      = "route_volume_icon.png";
            imgPausePlay.Source = "play_icon.png";

            BufferingAudioStatus(true);
            AudioPlaying = false;


            stckDownload.BindingContext = selectedTour;
            imgPausePlay.BindingContext = selectedTour;
            Device.StartTimer(TimeSpan.FromSeconds(0.1), () =>
            {
                if (SelectTourIndex > 0)
                {
                    StackLayout c = lstPlaceNumber.Content as StackLayout;
                    lstPlaceNumber.ScrollToAsync(c.Children[SelectTourIndex - 1], ScrollToPosition.Start, false);
                    c.Children[SelectTourIndex - 1].Focus();
                }
                return(false);
            });
        }
        public void OnPlceNumberTap(object sender, EventArgs e)
        {
            var ojbPlceNumber = sender as Grid;
            var objData       = ojbPlceNumber.BindingContext as TourLocation;

            SelectedTour = objData;
            routeCoversListBindData(System.Int32.Parse(objData.placeNumberTitle) - 1);
            if (player != null)
            {
                player.Stop();
            }
            UpdateScreenData(objData);
            if (SelectedTour.location_audio == "")
            {
                timer.StopTimer();

                AudioPlayerGrid.IsVisible = false;
                stckDownload.IsVisible    = false;
            }
            else
            {
                AudioPlayerGrid.IsVisible = true;
                stckDownload.IsVisible    = true;

                if (timer != null)
                {
                    timer.StopTimer();
                    timer = null;
                    timer = DependencyService.Get <IAdvancedTimer>();
                    timer.InitTimer(3000, timerElapsed, false);
                    timer.StartTimer();
                }
            }
            SelectTourIndex = System.Convert.ToInt32(objData.placeNumberTitle);
        }
示例#3
0
        private void generatePath()
        {
            var count = coordinates.Count;
            var wp    = new Vector2d[count];

            for (int i = 0; i < count; i++)
            {
                wp[i] = (Vector2d)coordinates[i];
            }

            if (coordinates.Count > 1)
            {
                var _directionResource = new DirectionResource(wp, RoutingProfile.Cycling);
                _directionResource.Steps = true;
                _directions.Query(_directionResource, HandleDirectionsResponse);
            }

            if (!path)
            {
                for (int i = 0; i < count; i++)
                {
                    var prefab   = WayPoint;
                    var instance = Instantiate(WayPoint) as GameObject;
                    //Text wayPointNumber = instance.GetComponentInChildren<Text>();
                    //wayPointNumber.text = (i).ToString();
                    instance.layer = 9;
                    _instances.Add(instance);

                    DragTourWayPoint dragWayPoint = instance.GetComponentInChildren <DragTourWayPoint>();
                    dragWayPoint.location = (TourLocation)locations[i];
                }
            }

            for (int i = 1; i < count; i++)
            {
                var instance = _instances[i];

                DragTourWayPoint dragWayPoint = instance.GetComponentInChildren <DragTourWayPoint>();
                TourLocation     location     = dragWayPoint.location;

                if (!location.Drag)
                {
                    //instance.transform.SetParent(Mapholder);
                    //instance.transform.rotation = Mapholder.rotation;
                    instance.transform.position = Conversions.GeoToWorldPosition(wp[i].x, wp[i].y, _map.CenterMercator, _map.WorldRelativeScale).ToVector3xz() + new Vector3(0, 20, 0);
                    instance.SetActive(true);
                    instance.transform.SetAsLastSibling();
                }
            }

            path = true;
        }
示例#4
0
        void getCoordinates()
        {
            try
            {
                reference.GetValueAsync().ContinueWith(task =>
                {
                    if (task.IsFaulted)
                    {
                        throw new Exception("ERROR while fetching data from database!!! Please refresh scene(Click Tours)");
                    }
                    else if (task.IsCompleted)
                    {
                        DataSnapshot snapshot = task.Result.Child(dbDetails.getBuildingDBname());

                        string str           = snapshot.GetRawJsonValue();
                        JObject jsonLocation = JObject.Parse(str);

                        for (int i = 1; i < locations.Count; i++)
                        {
                            TourLocation location = (TourLocation)locations[i];

                            if (sharedLocations.ContainsKey(location.Name))
                            {
                                location.Latitute  = sharedLocations[location.Name].Latitude;
                                location.Longitude = sharedLocations[location.Name].Longitude;
                            }
                            else
                            {
                                location.Latitute  = (string)jsonLocation[location.Name]["Coordinates"]["Latitude"];
                                location.Longitude = (string)jsonLocation[location.Name]["Coordinates"]["Longitude"];
                            }
                            double lat = double.Parse(location.Latitute);
                            double lon = double.Parse(location.Longitude);
                            coordinates.Add(new Vector2d(lat, lon));
                        }
                    }
                });
            }
            catch (InvalidCastException e)
            {
                // Perform some action here, and then throw a new exception.
                ErrorMessage.text = e.Message;
                ErrorPanel.SetActive(true);
            }
            catch (Exception e)
            {
                // Perform some action here, and then throw a new exception.
                ErrorMessage.text = e.Message;
                ErrorPanel.SetActive(true);
            }
        }
        public void LoadAudioFile(TourLocation SelectedTourAudio)
        {
            if (AudioPlaying == false)
            {
                sliderPositionAudio.Value = 0;
                lblAudioDuration.Text     = "0:00";
                imgMute.Source            = "route_volume_icon.png";

                player = null;
                player = DependencyService.Get <ISimpleAudioPlayer>();
                player.Load(SelectedTourAudio.location_audio);
                AudioPlaying = true;
                // Device.StartTimer(TimeSpan.FromSeconds(1), UpdatePosition);
            }
        }
        protected override void OnAppearing()
        {
            imgHeader.Source = _tourPlaceURl;
            routeCoversListBindData(0);

            UpdateScreenData(_routeCovers[0]);
            SelectedTour = _routeCovers[0];
            timer        = DependencyService.Get <IAdvancedTimer>();

            timer.InitTimer(3000, timerElapsed, false);
            timer.StartTimer();

            if (Device.OS == TargetPlatform.Android)
            {
                MapBindpinsInMap(_responseMap);
            }
        }