예제 #1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Conexion SQLite
            scon = new SQLite();

            // Localizacion
            loc = new Location();

            // Compruebo usuario
            if (string.IsNullOrWhiteSpace(UserDataDefaults.GetToken()))
            {
                // View login
                Sesion.Sesion_ViewController sesionViewController = GetViewController(MainStoryboard, "SesionViewController") as Sesion.Sesion_ViewController;
                sesionViewController.OnLoginSuccess += SesionViewController_OnLoginSuccess;
                Window.RootViewController            = sesionViewController;
            }
            else
            {
                // Muestro Tab View
                TabViewController tabViewController = GetViewController(MainStoryboard, "TabViewController") as TabViewController;
                Window.RootViewController = tabViewController;
            }

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Touch boton orden.
        /// </summary>
        /// <param name="sender"></param>
        partial void orden_touch(UIButton sender)
        {
            // Cambio
            p.Orden = p.Orden == 1 ? 0 : 1;

            // Guardo
            UserDataDefaults.SetPreferences(p.Orden, p.Mostrar, p.Tipo);

            // Actualizo
            SetOrden();
        }
예제 #3
0
        /// <summary>
        /// Touch boton desconectar.
        /// </summary>
        /// <param name="sender"></param>
        partial void btnDesconectar_touch(UIButton sender)
        {
            // Elimino base de datos
            SQLiteManager.Connection().Eliminar();

            // Elimino datos usuario
            UserDataDefaults.Eliminar();

            // Desconecto
            (UIApplication.SharedApplication.Delegate as AppDelegate).Desconectar();
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Obtengo preferencias
            p = UserDataDefaults.GetPreferences();

            // Cargo botones
            SetOrden();
            SetMostrar();
            SetTipo();
        }
예제 #5
0
        /// <summary>
        /// Touch boton mostrar.
        /// </summary>
        /// <param name="sender"></param>
        partial void mostrar_touch(UIButton sender)
        {
            // Cambio
            p.Mostrar++;

            // Restauro
            if (p.Mostrar > 2)
            {
                p.Mostrar = 0;
            }

            // Guardo
            UserDataDefaults.SetPreferences(p.Orden, p.Mostrar, p.Tipo);

            // Actualizo
            SetMostrar();
        }
        /// <summary>
        /// Login correcto.
        /// </summary>
        /// <param name="id">ID usuario.</param>
        private void LoginOk(string id)
        {
            InvokeOnMainThread(() =>
            {
                // Guardo login data
                UserDataDefaults.SetLoginData(txtUser.Text.Trim(), txtPass.Text.Trim());

                // Guardo ID usuario
                UserDataDefaults.SetUserID(id);

                // Inicializo preferencias
                UserDataDefaults.SetPreferences(0, 0, 0);

                // Obtiene token
                RestManager.Connection().GetTokenFromServer();

                // Login OK
                OnLoginSuccess(true, new EventArgs());
            });
        }
예제 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Obtengo nombre usuario
            RestManager.Connection().GetData((int)URIS.UserName, new string[] { UserDataDefaults.GetUserID().ToString() }, null, (arg) =>
            {
                // Compruebo datos
                if (!string.IsNullOrWhiteSpace(arg))
                {
                    InvokeOnMainThread(() =>
                    {
                        // Actualizo nombre
                        lblName.Text = arg;
                    });
                }
            });

            // Version
            lblVersion.Text = (NSString)NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"];
        }