Example #1
0
        public static string GetPaymentIdFromConfirmationResponse(NSDictionary paypalConfirmation)
        {
            var paymentResponse = paypalConfirmation?.ValueForKeyPath(new NSString("response"));
            var paymentId       = paymentResponse?.ValueForKeyPath(new NSString("id"))?.ToString();

            return(paymentId);
        }
Example #2
0
        void RequestingReportStatus(NSDictionary n)
        {
            NSString key    = new NSString("userInfo.Status");
            var      status = n.ValueForKeyPath(key).ToString();

            InvokeOnMainThread(delegate {
                loadingTitle.Text = status;
            });
        }
Example #3
0
        void newPromptBackgroundRecieved(NSDictionary n)
        {
            UIView topView = this.NavigationController.TopViewController.View;

            //If we are already displaying a setmy mood then return
            if (topView.Tag == 1001)
            {
                return;
                //currentViewController.NavigationController.PopViewControllerAnimated(true);
            }
            Console.WriteLine("newPromptBackground {0}", n);
            //this.appAlert("New Prompt from notification");
            NSString pId = new NSString("userInfo.PromptId");
            var      id  = n.ValueForKeyPath(new NSString("userInfo.PromptId")) ?? n.ValueForKeyPath(new NSString("PromptId"));

            if (id != null)
            {
                this.NavigateToSetMyMood(MoodPrompt.List().FirstOrDefault(p => p.Id.Equals(id.ToString(), StringComparison.InvariantCultureIgnoreCase)));
            }
        }
        private void InitializeAnyline()
        {
            NSError error = null;

            if (_initialized)
            {
                return;
            }

            try
            {
                _frame = UIScreen.MainScreen.ApplicationFrame;
                _frame = new CGRect(_frame.X,
                                    _frame.Y + NavigationController.NavigationBar.Frame.Size.Height,
                                    _frame.Width,
                                    _frame.Height - NavigationController.NavigationBar.Frame.Size.Height);

                // Use the JSON file name that you want to load here
                var configPath = NSBundle.MainBundle.PathForResource(@"" + _jsonPath.Replace(".json", ""), @"json");
                // This is the main intialization method that will create our use case depending on the JSON configuration.
                //_scanView = ALScanView.ScanViewForFrame(_frame, configPath, LicenseKey, _resultDelegate, out error);
                _scanView = ALScanView.ScanViewForFrame(_frame, configPath, LicenseKey, Self, out error);

                if (error != null)
                {
                    throw new Exception(error.LocalizedDescription);
                }

                // KNOWN ISSUE (OCRScanPlugin only): the customCmdFile is not loading the file correctly. therefore, it has to be added via code:
                if (_scanView.ScanViewPlugin is ALOCRScanViewPlugin)
                {
                    var          file = File.ReadAllText(configPath);
                    NSData       data = NSData.FromString(file);
                    NSDictionary dict = NSJsonSerialization.Deserialize(data, 0, out error) as NSDictionary;

                    var customCmdFileName = dict.ValueForKeyPath(new NSString(@"viewPlugin.plugin.ocrPlugin.customCmdFile"));

                    if (customCmdFileName != null)
                    {
                        var name = customCmdFileName.ToString().Split('.');
                        if (name.Length == 2)
                        {
                            var config = (_scanView.ScanViewPlugin as ALOCRScanViewPlugin).OcrScanPlugin.OcrConfig;
                            config.CustomCmdFilePath = NSBundle.MainBundle.PathForResource(name[0], name[1]);

                            // explicitly call this method so everything is updated internally
                            (_scanView.ScanViewPlugin as ALOCRScanViewPlugin).OcrScanPlugin.SetOCRConfig(config, out error);

                            if (error != null)
                            {
                                ShowAlert("OCR Config Error", error.DebugDescription);
                            }
                        }
                    }
                }

                // KNOWN ISSUE: the result delegate has to be added specifically to the scan plugin.
                // this should be automatically done already with the ScanViewForFrame call.
                ConnectDelegateToScanPlugin();

                View.AddSubview(_scanView);
                _scanView.StartCamera();

                _initialized = true;
            }
            catch (Exception e)
            {
                ShowAlert("Init Error", e.Message);
            }
        }
Example #5
0
        void SyncWithServerComplete(NSDictionary n)
        {
            NSString key = new NSString("userInfo.SyncStatus");

            SyncSuccessLevel status = (SyncSuccessLevel)Enum.Parse(typeof(SyncSuccessLevel), n.ValueForKeyPath(key).ToString());

            this.syncStatusBtnView.ShowStatus(status);
        }
Example #6
0
 public User(NSDictionary attributes)
 {
     Username       = ((NSString)attributes["username"]).ToString();
     AvatarImageUrl = ((NSString)attributes.ValueForKeyPath(new NSString("avatar_image.url"))).ToString();
 }
 public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
 {
     switch (keyPath)
     {
         case "playbackLikelyToKeepUp":
             if (change.ValueForKeyPath(new NSString("new")).Description == "0")
             {
                 Debug.WriteLine("playbackLikelyToKeepUp == {0}", false);
                 Dictionary<string, string> playbackLikelyToKeepUpProperties = new Dictionary<string, string>();
                 playbackLikelyToKeepUpProperties.Add("DateTime.UtcNow", DateTime.UtcNow.ToString());
                 playbackLikelyToKeepUpProperties.Add("AVPlayer.Status", avPlayer.Status.ToString());
                 playbackLikelyToKeepUpProperties.Add("AVPlayerItem.Status",
                     avPlayer.CurrentItem.Status.ToString());
                 TelemetryManager.TrackEvent("PlaybackNotLikelyToKeepUp", playbackLikelyToKeepUpProperties);
             }
             break;
         case "status":
             if (avPlayer.Status == AVPlayerStatus.Failed)
             {
                 Dictionary<string, string> statusProperties = new Dictionary<string, string>();
                 statusProperties.Add("DateTime.UtcNow", DateTime.UtcNow.ToString());
                 statusProperties.Add("AVPlayer.Status", avPlayer.Status.ToString());
                 statusProperties.Add("AVPlayerItem.Status", avPlayer.CurrentItem.Status.ToString());
                 statusProperties.Add("AVPlayerItem.Error", avPlayer.CurrentItem.Error.ToString());
                 statusProperties.Add("AVPlayer.Error", avPlayer.Error.ToString());
                 statusProperties.Add("Context", context.ToString());
                 TelemetryManager.TrackEvent("AVPlayerStatus.Failed", statusProperties);
             }
             break;
         default:
             break;
     }
 }
Example #8
0
 public User(NSDictionary attributes)
 {
     Username = ((NSString)attributes["username"]).ToString();
     AvatarImageUrl = ((NSString)attributes.ValueForKeyPath(new NSString("avatar_image.url"))).ToString();
 }