コード例 #1
0
ファイル: Globals.cs プロジェクト: weddingjuma/Guardian
 /// <summary>
 /// If user doesnt move, but app is open, then keep his session Live with the last available position
 /// </summary>
 public static void KeepLive()
 {
     if ((CurrentProfile.IsSOSOn || CurrentProfile.IsTrackingOn) && RecentLocation.CapturedTime.AddMinutes(5) < DateTime.Now)
     {
         //RecentLocation.CapturedTime = DateTime.Now;
         LocationServiceWrapper.PostMyLocationAsync(RecentLocation.Coordinate, null);
     }
 }
コード例 #2
0
        protected async void InitiateSosEventsAsync()
        {
            bool initiateSMS = false;

            if (!Globals.IsRegisteredUser || !Globals.IsDataNetworkAvailable)
            {
                initiateSMS = true;
            }
            else
            {
                try
                {
                    LocationServiceWrapper.PostMyLocationAsync(await Utility.GetLocationQuick(), null);
                }
                catch
                {
                    initiateSMS = true;
                }
            }
            if (initiateSMS)
            {
                await SendOfflineMessagesAsync();
            }

            try
            {
                if (App.MyBuddies.Buddies != null && App.MyBuddies.Buddies.Count > 0)
                {
                    Callee           defaultCallee = new Callee();
                    BuddyTableEntity buddyEntity   = App.MyBuddies.GetPrimeBuddy(Globals.CurrentProfile.ProfileId);
                    if (buddyEntity != null)
                    {
                        defaultCallee.PhoneNumber = buddyEntity.PhoneNumber;
                        defaultCallee.DisplayName = buddyEntity.Name;
                        Utility.InitiateCall(defaultCallee);
                    }
                }
            }
            catch
            {
                //Ignore if exception raised while calling the default caller
            }
        }
コード例 #3
0
        private async void EvidenceCameraCaptureTask_Completed(object sender, PhotoResult e)
        {
            if (e.TaskResult == TaskResult.OK)
            {
                try
                {
                    if (Globals.CurrentProfile.IsSOSOn || Globals.CurrentProfile.IsTrackingOn)
                    {
                        GeoCoordinate gc = await Utility.GetLocationQuick();

                        await LocationServiceWrapper.PostMyLocationAsync(gc, e.ChosenPhoto);
                    }
                    else
                    {
                        Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.InvalidPhotoCapture, "basicWrap", "Evidence upload failed!"));
                    }
                }
                catch (Exception ex)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.EvidenceUploadFailText, "basicWrap", "Evidence upload failed!"));
                }
            }
        }