コード例 #1
0
        protected override void OnStart()
        {
            editText1.Text = string.Empty;

            var conn = new ConnectivityService();

            if (conn.IsConnected)
            {
                Task.Run(async() => { await ListaContenedor(); });  //ContenedorServ.GetContenedor().Result;
            }
            else
            {
                Alerta("Advertencia?", "Verifique su conexion a la red wifi");
            }

            Log.Debug("OnStart", "OnStart called, app is ready to interact with the user");
            base.OnResume();
        }
コード例 #2
0
ファイル: Width.cs プロジェクト: pgarcia03/contenedor
        private async void BtbguardarWidth_Click(object sender, EventArgs e)
        {
            var progress = new ProgressDialog(this)
            {
                Indeterminate = true
            };

            progress.SetProgressStyle(ProgressDialogStyle.Spinner);
            progress.SetMessage("Loading... Please wait...");
            progress.SetCancelable(false);

            try
            {
                if (Validartxt(txtWidth) && idrolloWidth != 0)
                {
                    var culture = new CultureInfo("en-US");

                    var obj = new RolloModel()
                    {
                        Idrollo = idrolloWidth,
                        Ancho   = double.Parse(txtWidth.Text, culture.NumberFormat)
                    };

                    var conection = new ConnectivityService();

                    if (conection.IsConnected)
                    {
                        progress.Show();

                        var resp = await Task.Run(() => { return(RolloServ.UpdateRollo(obj).Result); });


                        if (resp.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            ListarollosWidth.RemoveAt(ListarollosWidth.FindIndex(x => x.Idrollo == idrolloWidth));
                            txtsecuenciaRolloWidth.Text = string.Empty;
                            lblnombrerolloWidth.Text    = "";
                            Toast.MakeText(this, "Ingreso Correcto", ToastLength.Long).Show();
                            idrolloWidth = 0;
                            Limpiartext();
                            Enabled(false);

                            var countItem = ListarollosWidth.Count;
                            lbltotalrollos.Text = string.Concat("Total de rollos por medir: ", countItem.ToString());
                            txtsecuenciaRolloWidth.RequestFocus();

                            progress.Dismiss();
                        }
                        else
                        {
                            progress.Dismiss();
                            Alerta("Advertencia?", "Ha ocurrido un error, no se efectuaron los cambios!!!");
                        }
                    }
                    else
                    {
                        progress.Dismiss();
                        Alerta("Advertencia?", "Verifique su conexion a la red wifi");
                    }
                }
                else
                {
                    progress.Dismiss();
                    Toast.MakeText(this, "llenar correctamente", ToastLength.Long).Show();
                }
            }
            catch (Exception ex)
            {
                progress.Dismiss();
                Alerta("Advertencia?", ex.Message);
            }
        }
コード例 #3
0
ファイル: Swatch.cs プロジェクト: pgarcia03/contenedor
        private async void BtbguardarSwatch_Click(object sender, EventArgs e)
        {
            var progress = new ProgressDialog(this)
            {
                Indeterminate = true
            };

            progress.SetProgressStyle(ProgressDialogStyle.Spinner);
            progress.SetMessage("Loading... Please wait...");
            progress.SetCancelable(false);

            try
            {
                if (Validartxt(txtx1) && Validartxt(txtx2) && Validartxt(txtx3) &&
                    Validartxt(txty1) && Validartxt(txty2) && Validartxt(txty2) &&
                    ValidarDiagonaltxt(txtp1) && ValidarDiagonaltxt(txtp2) && idrollo != 0)
                {
                    var culture = new CultureInfo("en-US");

                    var obj = new SwatchModel()
                    {
                        Idrollo = idrollo,
                        X1      = Double.Parse(txtx1.Text, culture.NumberFormat),
                        X2      = Double.Parse(txtx2.Text, culture.NumberFormat),
                        X3      = Double.Parse(txtx3.Text, culture.NumberFormat),
                        Y1      = Double.Parse(txty1.Text, culture.NumberFormat),
                        Y2      = Double.Parse(txty2.Text, culture.NumberFormat),
                        Y3      = Double.Parse(txty3.Text, culture.NumberFormat),
                        P1      = Double.Parse(txtp1.Text, culture.NumberFormat),
                        P2      = Double.Parse(txtp2.Text, culture.NumberFormat),
                        Usuario = "MOD5",
                        Fecha   = DateTimeOffset.Now
                    };

                    var conection = new ConnectivityService();

                    if (conection.IsConnected)
                    {
                        progress.Show();
                        var resp = await Task.Run(() => { return(SwatchServ.SaveSwatch(obj).Result); });

                        if (resp.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            Listarollos.RemoveAt(Listarollos.FindIndex(x => x.Idrollo == idrollo));
                            txtsecuenciaRollo.Text = string.Empty;
                            lblnombrerollo.Text    = "";
                            Toast.MakeText(this, "Ingreso Correcto", ToastLength.Long).Show();
                            idrollo = 0;
                            Limpiartext();
                            Enabled(false);

                            var countItem = Listarollos.Count;
                            lbltotalrollos.Text = string.Concat("Total de rollos por medir: ", countItem.ToString());
                            progress.Dismiss();
                            txtsecuenciaRollo.RequestFocus();
                        }
                    }
                    else
                    {
                        progress.Dismiss();
                        Alerta("Advertencia?", "Verifique su conexion a la red wifi");
                    }
                }
                else
                {
                    progress.Dismiss();
                    Toast.MakeText(this, "llenar correctamente", ToastLength.Long).Show();
                }
            }
            catch (Exception ex)
            {
                progress.Dismiss();
                Alerta("Advertencia?", ex.Message);
            }
        }