Exemple #1
0
        public async Task <List <SpotObject> > GetNearSpotListAsync(Geoposition currentGeoposition)
        {
            // Get current coordinate
            double currentLatitude   = currentGeoposition.Coordinate.Point.Position.Latitude;
            double currentLongtitude = currentGeoposition.Coordinate.Point.Position.Longitude;

            // Get spots formed JArray
            // If loading spot doesn't occur error, Convert jarray spots to spot list
            List <SpotObject> list   = new List <SpotObject>();
            JArray            jSpots = await this.GetNearSpotsAsync(currentLatitude, currentLongtitude);

            foreach (JObject jSpot in jSpots)
            {
                // Set new spot view item
                string spotId         = (string)jSpot["id"];
                string spotName       = (string)jSpot["spot_name"];
                double spotLatitude   = (double)jSpot["spot_latitude"];
                double spotLongtitude = (double)jSpot["spot_longtitude"];
                string accountId      = (string)jSpot["ptcaccount_id"];
                string accountName    = (string)jSpot["ptcaccount_name"];
                double spotDistance   = (double)jSpot["spot_distance"];
                bool   isPrivate      = (bool)jSpot["is_private"];
                string spot_password  = (string)jSpot["spot_password"];
                string create_at      = (string)jSpot["create_at"];

                SpotObject spot = new SpotObject(spotName, spotLatitude, spotLongtitude, accountId, accountName, spotDistance, isPrivate, spot_password, create_at);
                spot.Id = spotId;
                list.Add(spot);
            }
            this.SpotList = list;
            return(list);
        }
Exemple #2
0
        public async Task <List <SpotObject> > GetMySpotList()
        {
            // Get signed in my spots formed JArray
            // If loading spot doesn't occur error, Convert jarray spots to spot list
            List <SpotObject> spots  = new List <SpotObject>();
            JArray            jSpots = await this.GetMySpotsAsync(App.AccountManager.GetPtcId());

            foreach (JObject jSpot in jSpots)
            {
                // Set new spot view item
                string spotId         = (string)jSpot["id"];
                string spotName       = (string)jSpot["spot_name"];
                double spotLatitude   = (double)jSpot["spot_latitude"];
                double spotLongtitude = (double)jSpot["spot_longtitude"];
                string accountId      = (string)jSpot["ptcaccount_id"];
                string accountName    = (string)jSpot["ptcaccount_name"];
                double spotDistance   = (double)jSpot["spot_distance"];
                bool   isPrivate      = (bool)jSpot["is_private"];
                string spot_password  = (string)jSpot["spot_password"];
                string create_at      = (string)jSpot["create_at"];

                SpotObject spot = new SpotObject(spotName, spotLatitude, spotLongtitude, accountId, accountName,
                                                 spotDistance, isPrivate, spot_password, create_at);
                spot.Id = spotId;
                spots.Add(spot);
            }
            this.MySpotList = spots;
            return(spots);
        }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     detect = GetComponentInChildren <SpotObject>();
     //emote = GameObject.Find("Emote").GetComponent<SpriteRenderer>();
     emote         = detect.GetComponentInChildren <SpriteRenderer>();
     bucketable    = GetComponent <BucketOnTouch>();
     emote.enabled = false;
 }
        private async void MakeNewSpot(string spotName, bool isPrivate, string spotPassword = NULL_PASSWORD)
        {
            if (NetworkInterface.GetIsNetworkAvailable())
            {
                // Check whether GPS is on or not
                if (GeoHelper.GetLocationStatus() != PositionStatus.Disabled)  // GPS is on
                {
                    // Show Pining message and Progress Indicator
                    base.SetProgressRing(uiSpotListProgressRing, true);
                    await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        uiSpotGridView.Visibility    = Visibility.Collapsed;
                        uiSpotGridMessage.Text       = AppResources.PiningSpot;
                        uiSpotGridMessage.Visibility = Visibility.Visible;
                    });

                    try
                    {
                        // Wait sign in tastk
                        // Get this Ptc account to make a new spot
                        await TaskHelper.WaitTask(App.AccountManager.GetPtcId());

                        PtcAccount account = await App.AccountManager.GetPtcAccountAsync();

                        // Make a new spot around position where the user is.
                        Geoposition geo = await GeoHelper.GetGeopositionAsync();

                        SpotObject spotObject = new SpotObject(spotName, geo.Coordinate.Point.Position.Latitude, geo.Coordinate.Point.Position.Longitude, account.Email, account.Name, 0, isPrivate, spotPassword, DateTime.Now.ToString());
                        await App.SpotManager.CreateSpotAsync(spotObject);

                        this.NearSpotViewModel.IsDataLoaded = false;
                        this.Frame.Navigate(typeof(ExplorerPage), new SpotViewItem(spotObject));
                    }
                    catch
                    {
                        // Show Pining message and Progress Indicator
                        uiSpotGridMessage.Text = AppResources.BadCreateSpotMessage;
                    }

                    // Hide Progress ring.
                    base.SetProgressRing(uiSpotListProgressRing, false);
                }
                else  // GPS is not on
                {
                    await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        uiSpotGridMessage.Text = base.GeolocatorStatusMessage();
                    });
                }
            }
            else
            {
                await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    uiSpotGridMessage.Text = AppResources.InternetUnavailableMessage;
                });
            }
        }
Exemple #5
0
        public async Task <bool> CreateSpotAsync(SpotObject so)
        {
            MSSpotObject spot = SpotObject.ConvertToMSSpotObject(so);
            await App.MobileService.GetTable <MSSpotObject>().InsertAsync(spot);

            so.Id        = spot.id;
            this.NewSpot = so;
            return(true);
        }
        /// 이 섹션에서 제공되는 메서드는 NavigationHelper에서
        /// 페이지의 탐색 메서드에 응답하기 위해 사용됩니다.
        ///
        /// 페이지별 논리는 다음에 대한 이벤트 처리기에 있어야 합니다.
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// 및 <see cref="GridCS.Common.NavigationHelper.SaveState"/>입니다.
        /// 탐색 매개 변수는 LoadState 메서드
        /// 및 이전 세션 동안 유지된 페이지 상태에서 사용할 수 있습니다.

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.NavigationHelper.OnNavigatedTo(e);
            SpotViewItem spotViewItem = e.Parameter as SpotViewItem;

            this.CurrentSpot = App.SpotManager.GetSpotObject(spotViewItem.SpotId);
            this.SetPinPage(AppResources.Loading);

            // TODO Wait signin and change cloud mode combobox name
        }
        /// 이 섹션에서 제공되는 메서드는 NavigationHelper에서
        /// 페이지의 탐색 메서드에 응답하기 위해 사용됩니다.
        ///
        /// 페이지별 논리는 다음에 대한 이벤트 처리기에 있어야 합니다.
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// 및 <see cref="GridCS.Common.NavigationHelper.SaveState"/>입니다.
        /// 탐색 매개 변수는 LoadState 메서드
        /// 및 이전 세션 동안 유지된 페이지 상태에서 사용할 수 있습니다.

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.NavigationHelper.OnNavigatedTo(e);

            // Get Parameter.
            SpotViewItem spotViewItem = e.Parameter as SpotViewItem;

            this.CurrentSpot = App.SpotManager.GetSpotObject(spotViewItem.SpotId);

            // Set this pick page.
            this.SetPickPage(AppResources.Loading);
        }
Exemple #8
0
 public SpotViewItem(SpotObject spot)
 {
     this.SpotName             = spot.SpotName;
     this.AccountId            = spot.PtcAccountId;
     this.AccountName          = spot.PtcAccountName;
     this.SpotId               = spot.Id;
     this.SpotDistance         = spot.SpotDistance;
     this.DeleteImage          = FileObjectViewModel.DELETE_IMAGE_URI;
     this.DeleteImagePress     = true;
     this.SpotNameInitialImage = this.SpotName.Substring(0, 1);
     this.SpotPassword         = spot.Password;
     this.CreateAt             = spot.CreateAt;
 }
        /// 이 섹션에서 제공되는 메서드는 NavigationHelper에서
        /// 페이지의 탐색 메서드에 응답하기 위해 사용됩니다.
        ///
        /// 페이지별 논리는 다음에 대한 이벤트 처리기에 있어야 합니다.
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// 및 <see cref="GridCS.Common.NavigationHelper.SaveState"/>입니다.
        /// 탐색 매개 변수는 LoadState 메서드
        /// 및 이전 세션 동안 유지된 페이지 상태에서 사용할 수 있습니다.

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.NavigationHelper.OnNavigatedTo(e);

            // Get Parameter
            this.CurrentSpotViewItem = e.Parameter as SpotViewItem;

            // Set this explorer page.
            uiSpotNameText.Text    = this.CurrentSpotViewItem.SpotName;
            uiAccountNameText.Text = this.CurrentSpotViewItem.AccountName;
            Switcher.SetStorageTo(Switcher.GetMainStorage().GetStorageName());
            this.CurrentSpot = App.SpotManager.GetSpotObject(this.CurrentSpotViewItem.SpotId);

            uiExplorerList.SelectedIndex = EventHelper.PICK_PIVOT;
            this.SetPickPivot(AppResources.Loading);
            this.SetPinPivot(AppResources.Loading);
        }
Exemple #10
0
    void Start()
    {
        foreach (Transform t in waypoints)
        {
            points.Add(t.transform.position);
        }

        agent             = GetComponent <NavMeshAgent>();
        agent.autoBraking = false;
        detecter          = GetComponentInChildren <SpotObject>();

        if (!reports)
        {
            Reports [] rep = FindObjectsOfType <Reports>();
            reports = rep[0];
        }

        GotoNextPoint();
    }