Beispiel #1
0
 public static Manager GetInstance(ISQLitePlatform plataform, IServiceClient client, string path)
 {
     if (_instance == null)
     {
         lock (_mutex)
         {
             if (_instance == null)
             {
                 _instance = new Manager(plataform, client, path);
             }
         }
     }
     return _instance;
 }
Beispiel #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            client = new JsvServiceClient("http://prodactive.co/api");

            manager = Manager.GetInstance(
                new SQLitePlatformAndroid(),
                client,
                System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),"prodactive.db"));
            // Get our button from the layout resource,
            // and attach an event to it
            Button btnLogin = FindViewById<Button>(Resource.Id.btnLogin);
             txtUser = FindViewById<EditText>(Resource.Id.txtUser);
             txtPass = FindViewById<EditText>(Resource.Id.txtPass);
            //Anadir Servicio

            btnLogin.Click += btnLogin_Click;
        }
Beispiel #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var t=Task.Factory.StartNew(() =>
            {
                manager = Manager.GetInstance(new SQLitePlatformAndroid(),
                new JsvServiceClient("http://prodactive.co/api"),
                System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                    "prodactive.db"));
            });
            lr = JsonSerializer.DeserializeFromString<LoginResponse>(Intent.GetStringExtra("UserData"));

            var estatura = lr.Persona.Estatura*100;
            GetStepLength(lr, estatura);
            BodyWeight = lr.Persona.Peso;

            string s = "UserData";
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Reto);

            //// Get our button from the layout resource,
            //// and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.btnIniciarReto);
            //Button Cerrar = FindViewById<Button>(Resource.Id.button1);
            tv            = FindViewById<TextView>(Resource.Id.txtPasos);
            tcalorias     = FindViewById<TextView>(Resource.Id.txtCalorias);

            //verificar si ya acepte el reto....
            button.Click += delegate
            {
                if (swButton)
                {
                    OnDestroy();
                    //button.Text = "Iniciar Reto";
                    swButton = false;
                }
                else
                {
                    if (lr.Reto.IsActivo)
                    {

                        StartStepService();
                        Toast.MakeText(this, "El reto ha comenzado. La aplicación iniciará el conteo de pasos", ToastLength.Long);
                        Reporte.Start();
                        //button.Enabled = false;
                        button.Text = "Cerrar App";
                        swButton = true;

                    }
                }

            };
            //Cerrar.Click += (sender, e) =>
            //{
            //    Finish();

            //};
            handler = new Handler();
            t.Wait();

            Reporte = new System.Timers.Timer(60000);
            Reporte.Elapsed += EnviarReportePasos;
        }