Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            //SETA O LAYOUT INICIAL PARA VISUALIZAÇÃO
            SetContentView(Resource.Layout.Main);
            //INSTANCIA O BOTÃO E PEGA SUA ID
            Button btnLogin = FindViewById <Button>(Resource.Id.BtnLogin);

            //EFEITO APÓS O CLICK DO BOTÃO
            btnLogin.Click += delegate {
                Aguarde.MostraAguarde(true, this);

                var task = Task.Factory.StartNew(() =>
                {
                    resultado = Logar();
                });
                task.ContinueWith(
                    t =>
                {
                    Aguarde.MostraAguarde(false, this);
                    switch (resultado)
                    {
                    case 1: resultado = 5;
                        //PASSAGEM PARA PROXIMO LAYOUT
                        var activity2 = new Intent(this, typeof(InicioActivity));
                        //activity2.PutExtra("parametro1", edt.Text);   // PARAMETROS ENTRE TELAS
                        StartActivity(activity2);

                        break;

                    case 2:
                        Toast.MakeText(this, "Usuário ou senha Inválida", ToastLength.Long).Show();
                        break;

                    case 3:
                        Toast.MakeText(this, "Usuário ou senha Inválida", ToastLength.Long).Show();
                        break;

                    case 4:
                        Toast.MakeText(this, "Usuário ou senha Inválida", ToastLength.Long).Show();
                        break;

                    default:
                        Toast.MakeText(this, "FALHA AO LOGAR", ToastLength.Long).Show();
                        break;
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());


                //MostraAguarde(false, this);
            }; // FINAL DA AÇÃO DO BOTÃO

            //METODO DE ABAIXAR O TECLADO DEPOIS DE LOGAR
            imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            //INICIO DA TELA CHECKLIST
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);



            Button button = new Button(this);

            SetContentView(Resource.Layout.CheckList);


            RadioButton Vtr1  = FindViewById <RadioButton>(Resource.Id.VTR1);
            RadioButton Vtr2  = FindViewById <RadioButton>(Resource.Id.VTR2);
            RadioButton Vtr3  = FindViewById <RadioButton>(Resource.Id.VTR3);
            RadioButton Area1 = FindViewById <RadioButton>(Resource.Id.Area1);
            RadioButton Area2 = FindViewById <RadioButton>(Resource.Id.Area2);

            //AO CLICAR NOS SELETORES ELE ABAIXA O TECLADO
            Area1.Click += delegate { HideKeybord(); };
            Area2.Click += delegate { HideKeybord(); };
            Vtr1.Click  += delegate { HideKeybord(); };
            Vtr2.Click  += delegate { HideKeybord(); };
            Vtr3.Click  += delegate { HideKeybord(); };

            OleoBLL BLL = new OleoBLL();

            veiculos = BLL.ListaVeiculos();
            if (veiculos != null)
            {
                foreach (Veiculo p in veiculos)
                {
                    if (p.Situacao == 0)
                    {
                        //comboPlaca.Items.Add(p.Placa);
                        veiculosB.Add(p);
                        if (p.Id.Equals("1"))
                        {
                            Vtr1.Visibility = ViewStates.Visible;
                        }
                        else if (p.Id.Equals("2"))
                        {
                            Vtr2.Visibility = ViewStates.Visible;
                        }
                        else if (p.Id.Equals("3"))
                        {
                            Vtr3.Visibility = ViewStates.Visible;
                        }
                    }
                }
            }


            TextView tatico = FindViewById <TextView>(Resource.Id.Tatico);

            tatico.Text = "TÁTICO   " + Autenticacao.GetApelido();

            //TELA TO ENTITY


            Button btnProximo = FindViewById <Button>(Resource.Id.btnPro);

            btnProximo.Click += delegate {
                Aguarde.MostraAguarde(true, this);


                var task = Task.Factory.StartNew(() =>
                {
                    result = CheckChaves();
                });
                task.ContinueWith(
                    t =>
                {
                    Aguarde.MostraAguarde(false, this);
                    if (result)
                    {
                        var activity = new Intent(this, typeof(CheckChavesActivity));
                        StartActivity(activity);
                    }
                    else
                    {
                        Toast.MakeText(this, "VERIFIQUE OS CAMPOS OBRIGATÓRIOS", ToastLength.Long).Show();
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());


                //Toast.MakeText(this, "IR PARA TELA DE CHECKCHAVES", ToastLength.Long).Show();
            };
        }
Пример #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //PARAMETROS PARA OS INTENS
            LayoutParams lp     = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            LayoutParams lpL    = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            LayoutParams person = new LayoutParams(LayoutParams.MatchParent, 240);

            lp.Height = 200;

            //LAYOUT PRINCIPAL QUE IRÀ DENTRO DO SCROLL
            LinearLayout layout = new LinearLayout(this);

            layout.Orientation      = Orientation.Vertical;
            layout.LayoutParameters = lpL;
            //SCROLL DE ROLAGEM
            ScrollView scroll = new ScrollView(this);

            scroll.LayoutParameters = lpL;
            this.SetContentView(scroll);
            scroll.AddView(layout);


            TextView lblChaves = new TextView(this);

            lblChaves.Text = "Encerre seu CHECKLIST  Sr. " + Autenticacao.GetApelido() + "\n Digite o KM Final";
            lblChaves.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);


            Button botao = new Button(this);

            botao.Text = "CONCLUIR";


            EditText km = new EditText(this);

            km.SetMaxLines(1);
            km.InputType = Android.Text.InputTypes.ClassNumber;
            km.SetTextSize(Android.Util.ComplexUnitType.Sp, 60);
            //MAX LENGHT
            km.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(5) });



            TextView lblObs = new TextView(this);

            lblObs.Text = "Observações Finais";
            lblObs.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);


            EditText obs2 = new EditText(this);

            obs2.SetMaxLines(4);
            obs2.SetTextSize(Android.Util.ComplexUnitType.Sp, 40);
            obs2.Text = "Plantão S.A.";
            obs2.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(999) });

            Switch problema = new Switch(this);

            problema.Text = "Transformar em Problema";
            problema.SetTextColor(Android.Graphics.Color.Red);
            problema.SetTextSize(Android.Util.ComplexUnitType.Sp, 24);


            layout.AddView(lblChaves, lp);
            layout.AddView(km, lp);
            layout.AddView(lblObs, lp);
            layout.AddView(obs2, lp);
            layout.AddView(problema, lp);
            layout.AddView(botao, person);


            botao.Click += delegate {
                //
                Aguarde.MostraAguarde(true, this);
                var task = Task.Factory.StartNew(() =>
                {
                    certo = BLL.Cadastra_Finaliza(km.Text, obs2.Text, problema.Checked);
                });
                task.ContinueWith(
                    t =>
                {
                    if (certo)
                    {
                        Toast.MakeText(this, "CHECKLIST FINALIZADO", ToastLength.Long).Show();
                        this.FinishAffinity();
                    }
                    else
                    {
                        Toast.MakeText(this, "VERIFIQUE OS CAMPOS OBRIGATÓRIOS", ToastLength.Long).Show();
                    }
                    Aguarde.MostraAguarde(false, this);
                }, TaskScheduler.FromCurrentSynchronizationContext());

                //
            };
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            //PARAMETROS PARA OS INTENS
            LayoutParams lp     = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            LayoutParams lpL    = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            LayoutParams person = new LayoutParams(LayoutParams.MatchParent, 240);


            LayoutParams TitulosLP   = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            LayoutParams PlacasLP    = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            LayoutParams ProblemasLP = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            LayoutParams BotoesLP    = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            LayoutParams SwitchsLP   = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            BotoesLP.Height = 200;


            //LAYOUT PRINCIPAL QUE IRÀ DENTRO DO SCROLL
            LinearLayout layout = new LinearLayout(this);

            layout.Orientation      = Orientation.Vertical;
            layout.LayoutParameters = lpL;
            //SCROLL DE ROLAGEM
            ScrollView scroll = new ScrollView(this);

            scroll.LayoutParameters = lpL;
            this.SetContentView(scroll);
            scroll.AddView(layout);

            TextView lblTexto = new TextView(this);

            lblTexto.Text = "Problemas Relatados \n";
            lblTexto.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);

            layout.AddView(lblTexto, lp);

            Button botao = new Button(this);

            botao.Text = "Aplicar Alterações";


            Aguarde.MostraAguarde(true, this);


            var task = Task.Factory.StartNew(() =>
            {
                ok = Buscar();
            });

            task.ContinueWith(
                t =>
            {
                if (ok)
                {
                    foreach (var v  in Problemas)
                    {
                        int cont       = 0;
                        TextView placa = new TextView(this);
                        placa.Text     = v.Placa + "\n Próxima Troca de Óleo.: \n KM...: " + v.VTR.ProxTroca;
                        placa.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);
                        layout.AddView(placa, PlacasLP);
                        foreach (var p in v.Problemas)
                        {
                            TextView desc = new TextView(this);
                            desc.Text     = p.Descricao + " \n      Por..: " + p.Usuario + " \n      Em..: " + p.DataInsert.ToString();
                            desc.SetTextSize(Android.Util.ComplexUnitType.Sp, 20);

                            Switch s = new Switch(this);
                            s.Text   = "Resolvi este Problema";
                            s.Id     = p.Id;
                            s.SetTextSize(Android.Util.ComplexUnitType.Sp, 16);
                            s.SetTextColor(Android.Graphics.Color.Red);
                            if ((cont % 2) == 1)
                            {
                                desc.SetBackgroundColor(Android.Graphics.Color.Gray);
                                s.SetBackgroundColor(Android.Graphics.Color.Gray);
                            }
                            else
                            {
                                desc.SetBackgroundColor(Android.Graphics.Color.DarkGray);
                                s.SetBackgroundColor(Android.Graphics.Color.DarkGray);
                            }
                            cont++;
                            layout.AddView(desc, ProblemasLP);
                            layout.AddView(s, SwitchsLP);
                            switches.Add(s);
                        }
                    }

                    layout.AddView(botao, BotoesLP);
                }
                else
                {
                    Toast.MakeText(this, "OPS... ESTAMOS COM PROBLEMAS EM BUSCAROS PROBLEMAS", ToastLength.Long).Show();
                }



                Aguarde.MostraAguarde(false, this);
            }, TaskScheduler.FromCurrentSynchronizationContext());



            botao.Click += delegate
            {
                Aguarde.MostraAguarde(true, this);

                var task2 = Task.Factory.StartNew(() =>
                {
                    sucesso = false;
                });
                task.ContinueWith(
                    t =>
                {
                    foreach (var sw in switches)
                    {
                        if (sw.Checked)
                        {
                            if (!ResolveProblema(sw.Id))
                            {
                                sucesso = false;
                                Toast.MakeText(this, "FALHA AO ATUALIZAR PROBLEMAS", ToastLength.Long).Show();
                            }
                            else
                            {
                                sucesso = true;
                            }
                        }
                    }



                    Aguarde.MostraAguarde(false, this);
                    //CHAMAR TELA NOVAMENTE
                    if (sucesso)
                    {
                        Toast.MakeText(this, "Tudo Certo, Você Resolveu o Problema!", ToastLength.Long).Show();
                        var activity2 = new Intent(this, typeof(InicioActivity));
                        StartActivity(activity2);
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            };//FINAL DO BOTAO
        }
Пример #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            check = Shared.Get();
            Shared.Clean();

            CheckListBLL BLL = new CheckListBLL();

            chaves = BLL.ListaChaves();
            //int count = 0;
            if (chaves != null)
            {
                foreach (Chave p in chaves)
                {
                    if (p.Area.Equals(check.Area) && !p.Area.Equals("2"))
                    {
                        chavesA.Add(p);
                    }
                    if (p.Area.Equals("2"))
                    {
                        chavesA.Add(p);
                    }
                }

                //PARAMETROS PARA OS INTENS
                LayoutParams lp  = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                LayoutParams lpL = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);

                lp.Height = 120;

                //LAYOUT PRINCIPAL QUE IRÀ DENTRO DO SCROLL
                LinearLayout layout = new LinearLayout(this);
                layout.Orientation      = Orientation.Vertical;
                layout.LayoutParameters = lpL;
                //SCROLL DE ROLAGEM
                ScrollView scroll = new ScrollView(this);
                scroll.LayoutParameters = lpL;
                this.SetContentView(scroll);
                scroll.AddView(layout);



                TextView lblChaves = new TextView(this);
                lblChaves.Text = "Confira as Chaves!!!! =)";
                lblChaves.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);

                //ADICIONAR TUDO AO LAYOUT
                layout.AddView(lblChaves, lp);


                Button botao = new Button(this);
                botao.Text = "CONCLUIR";



                if (chavesA != null)
                {
                    foreach (Chave a in chavesA)
                    {
                        Switch s = new Switch(this);
                        s.Text = a.Nome;
                        //try { s.Id = Convert.ToInt32(a.Id); } catch { }
                        s.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);
                        switches.Add(s);
                    }
                }
                //for (int i = 0; i < 60; i++)
                //{
                //    Switch s = new Switch(this);
                //    s.Text = "Texto do Switch..:  " + i;
                //    s.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);
                //    switches.Add(s);

                //}

                foreach (var s in switches)
                {
                    layout.AddView(s, lp);
                }


                layout.AddView(botao, lp);


                botao.Click += delegate {
                    Aguarde.MostraAguarde(true, this);
                    var task = Task.Factory.StartNew(() =>
                    {
                        certo = Cadastrar();
                    });
                    task.ContinueWith(
                        t =>
                    {
                        if (certo)
                        {
                            Toast.MakeText(this, "CHECKLIST FINALIZADO", ToastLength.Long).Show();
                            this.FinishAffinity();
                        }
                        else
                        {
                            Toast.MakeText(this, "VERIFIQUE OS CAMPOS OBRIGATÓRIOS", ToastLength.Long).Show();
                        }
                        Aguarde.MostraAguarde(false, this);
                    }, TaskScheduler.FromCurrentSynchronizationContext());

                    //
                };
            }
        }