Esempio n. 1
0
 
 public void Update()
 {
     
 var title = SelectedCard.Outlets.Any(c => !c.Omitted) ? Strings.Sharing.tap_to_share : Strings.Sharing.select_at_least_one; 
 SharingButton.SetTitle(title, new UIControlState()); 

 }
Esempio n. 2
0
 async public override void LocationManager_AuthorizationChanged(object sender, CLAuthorizationChangedEventArgs e)
 {
     base.LocationManager_AuthorizationChanged(sender, e);
     
            if (DisplayPurposeOnly)
     {
         
            {
             
 SharingButton.SetTitle("", new UIControlState()); 
                return; 

         }
     }
     

            if (e.Status == CLAuthorizationStatus.NotDetermined)
     {
         
            {
             
 ServiceRunner.SharedInstance.StartService <GeolocatorService>(); 
 var service = ServiceRunner.SharedInstance.FetchService <GeolocatorService>(); 
 await service.AskPermissionIfNecessary(new Permission[] { Permission.Location }); 
                return; 

         }
     }
     
            else if (e.Status == CLAuthorizationStatus.Denied)
     {
         SharingButton.SetTitle(Strings.Sharing.location_permission_necessary, new UIControlState());
     }
     
            else
     {
         
            {
             StopSharing(); 

         }
     }
 }
Esempio n. 3
0
                                                                                                                     
 public void StopSharing() 

                                                                                                                     {
                                                                                                                         
 Sharing = false; 

            if (shape != null)

                                                                                                                         {
                                                                                                                             
            {
                                                                                                                                 
 shape.RemoveAllAnimations(); 
 shape.RemoveFromSuperLayer(); 

                                                                                                                             }
                                                                                                                         }

                                                                                                                         

            if (DisplayPurposeOnly)
                                                                                                                         {
                                                                                                                             
            {
                                                                                                                                 
 SharingButton.SetTitle("", new UIControlState()); 

                                                                                                                             }
                                                                                                                         }
                                                                                                                         else if (!IsSufficentPermissionGranted())
                                                                                                                         {
                                                                                                                             SharingButton.SetTitle(Strings.Sharing.location_permission_necessary, new UIControlState());
                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             
 SharingButton.SetTitle(Strings.Sharing.tap_to_share, new UIControlState()); 

                if (String.IsNullOrEmpty(SessionUUID))
                                                                                                                             {
                                                                                                                                 return;
                                                                                                                             }
                                                                                                                             

                                                                                                                             Task.Run(async() =>
                                                                                                                                      { 
                    if (String.IsNullOrEmpty(SessionUUID))
                                                                                                                                        {
                                                                                                                                            return;
                                                                                                                                        }
                                                                                                                                        
 await WebServices.TransactionsController.TerminateTransaction(SessionUUID); 
 });
                                                                                                                         } 

 ButtonLocked = false; 

 Timer.Stop();
                                                                                                                     }
Esempio n. 4
0
                                                                                                                     
 void ApplyAnimation()
                                                                                                                     {
                                                                                                                         
 //already started
            if (PhoneButton.Layer.Sublayers.Count() > 2) return;

                                                                                                                             shape = new CAShapeLayer();

                                                                                                                         shape.Bounds      = new CGRect(0, 0, PhoneButton.Frame.Width, PhoneButton.Frame.Height);
                                                                                                                         shape.Position    = new CGPoint(PhoneButton.Frame.Width / 2, PhoneButton.Frame.Height / 2);
                                                                                                                         shape.Path        = UIBezierPath.FromOval(PhoneButton.Bounds).CGPath;
                                                                                                                         shape.StrokeColor = UIColor.White.CGColor;
                                                                                                                         shape.LineWidth   = (nfloat).5;
                                                                                                                         shape.FillColor   = UIColor.Clear.CGColor;
                                                                                                                         PhoneButton.Layer.AddSublayer(shape);

                                                                                                                         CABasicAnimation grow = CABasicAnimation.FromKeyPath("transform.scale");

                                                                                                                         grow.From                = NSObject.FromObject(0);
                                                                                                                         grow.Duration            = 2;
                                                                                                                         grow.To                  = NSObject.FromObject(3);
                                                                                                                         grow.FillMode            = CAFillMode.Forwards;
                                                                                                                         grow.RepeatCount         = 10000;
                                                                                                                         grow.RemovedOnCompletion = false;
                                                                                                                         shape.AddAnimation(grow, "grow"); 

 SharingButton.SetTitle("Sharing", new UIControlState()); 

                                                                                                                     }
Esempio n. 5
0
                                                                                                                         

                                                                                                                                                                                                               //make sure at least one outlet is selected
            if (!SelectedCard.Outlets.Any(c => !c.Omitted)) return;


            if (ButtonLocked) return;
            ButtonLocked = true;

            if (Sharing)
                StopSharing();
            else
                StartSharing();
        }
        async public void StartSharing()
        {
            if (DisplayPurposeOnly) return;
                                                                                                                         if (SelectedCard == null)
                                                                                                                         {
                                                                                                                             return;
                                                                                                                         }
                                                                                                                         
            if (!IsSufficentPermissionGranted())
                                                                                                                         {
                                                                                                                             return;
                                                                                                                         }
                                                                                                                         

 SharingButton.SetTitle(Strings.Sharing.authenticating, new UIControlState());

                                                                                                                         
            try
                                                                                                                         {
                                                                                                                             SessionUUID = await RealmServices.BoardcastCard(SelectedCard, SessionUUID); 
 Sharing = !String.IsNullOrEmpty(SessionUUID); 

                                                                                                                         }
                                                                                                                         catch (Exception e)
                                                                                                                         {
                                                                                                                             Sharing = false; 
 AppCenterManager.Report(e);
                                                                                                                         } 

            if (Sharing)
                                                                                                                         {
                                                                                                                             
 Timer.Start();

                                                                                                                             ApplyAnimation(); 

                                                                                                                         }
                                                                                                                         else
                                                                                                                         {
                                                                                                                             SharingButton.SetTitle(Strings.Sharing.could_not_share_card, new UIControlState());
                                                                                                                         } 

 ButtonLocked = false;
                                                                                                                     }