Exemple #1
0
        private async void Navigation()
        {
            TokenRegistration token = new TokenRegistration();

            iniciarSesionButton.Enabled = false;
            AfiliadosSeguroPopular afiliado = new AfiliadosSeguroPopular();
            var afiliadoSP = await afiliado.GetDataFromAPi(polizaTextField.Text, numeroConsecutivoTextField.Text);

            if (afiliadoSP.folio != null)
            {
                ConfiguracionApp config = new ConfiguracionApp();

                config.GuardarConfiguracion(afiliadoSP);

                var plist = NSUserDefaults.StandardUserDefaults;
                try
                {
                    Hub = new SBNotificationHub(Constants.ConnectionString, Constants.NotificationHubPath);

                    Hub.UnregisterAllAsync(token.Token, (error) =>
                    {
                        if (error != null)
                        {
                            return;
                        }

                        NSSet tags = new NSSet(plist.StringForKey("userFolio"), plist.StringForKey("userTag"));                         // create tags if you want
                        Hub.RegisterNativeAsync(token.Token, tags, (errorCallback) =>
                        {
                            if (errorCallback != null)
                            {
                            }
                        });
                    });
                }
                catch (Exception ex)
                {
                }


                this.PerformSegue("loginUserSeguroPopular", this);
            }
            else
            {
                iniciarSesionButton.Enabled = true;
                UIAlertView alert = new UIAlertView()
                {
                    Message = "Usted no esta afiliado en nuestro sistema.",
                    Title   = "Seguro Popular Hidalgo"
                };

                alert.AddButton("Ok");
                alert.Show();
            }
        }
Exemple #2
0
        private void CerrarSesionButton_TouchUpInside(object sender, EventArgs e)
        {
            ConfiguracionApp configuration = new ConfiguracionApp();

            configuration.LimpiarConfiguracion();

            NavigationAppController loginViewController = this.Storyboard.InstantiateViewController("NavigationApp") as NavigationAppController;

            if (loginViewController != null)
            {
                TokenRegistration token = new TokenRegistration();

                Hub = new SBNotificationHub(Constants.ConnectionString, Constants.NotificationHubPath);

                Hub.UnregisterAllAsync(token.Token, (error) =>
                {
                    if (error != null)
                    {
                        return;
                    }
                });
                this.NavigationController.ShowDetailViewController(loginViewController, null);
            }
        }
Exemple #3
0
        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            TokenRegistration token = new TokenRegistration();

            token.Token = deviceToken;
        }