示例#1
0
        private void Toolbar_MenuItemClick(object sender, Android.Support.V7.Widget.Toolbar.MenuItemClickEventArgs e)
        {
            switch (e.Item.ItemId)
            {
            case Resource.Id.action_filtrar:
                Intent intent0 = new Intent(this, typeof(Activity_FiltrarEntregas));
                StartActivityForResult(intent0, 0);
                break;

            case Resource.Id.action_adicionar:
                Intent intent = new Intent(this, typeof(Activity_InformaEntrega));
                StartActivityForResult(intent, 0);
                break;

            case Resource.Id.action_ajuda:
                Intent intent2 = new Intent(this, typeof(Activity_WebView));
                StartActivityForResult(intent2, 0);
                break;


            case Resource.Id.action_sobre:
                Intent intent3 = new Intent(this, typeof(Activity_Sobre));
                StartActivityForResult(intent3, 0);
                break;


            case Resource.Id.action_contato:
                Intent intent4 = new Intent(this, typeof(Activity_Contato));
                StartActivityForResult(intent4, 0);
                break;

            case Resource.Id.action_sair:
                Finish();
                break;

            case Resource.Id.action_sincronizar:

                var progressDialog = ProgressDialog.Show(this, "Por favor aguarde...", "Verificando os dados...", true);
                new Thread(new ThreadStart(delegate
                {
                    System.Threading.Thread.Sleep(1000);
                    RunOnUiThread(() => SincronizarTeste());
                    //LOAD METHOD TO GET ACCOUNT INFO
                    RunOnUiThread(() => Toast.MakeText(this, "Sincronizado com sucesso!", ToastLength.Short).Show());

                    //HIDE PROGRESS DIALOG
                    RunOnUiThread(() => progressDialog.Hide());
                })).Start();
                break;

            case Resource.Id.action_legenda:
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                Fragment_Legendas   dialog      = new Fragment_Legendas();
                dialog.Show(transaction, "dialog");
                break;
            }
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_adicionar:
                Intent intent = new Intent();
                intent.SetClass(this, typeof(Activity_EditarPedido));
                StartActivityForResult(intent, 0);
                break;

            case Resource.Id.action_legenda:
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                Fragment_Legendas   dialog      = new Fragment_Legendas();
                dialog.Show(transaction, "dialog");
                break;

            case Resource.Id.action_filtrar:    //TESTE
                Intent intent2 = new Intent();
                intent2.SetClass(this, typeof(Activity_FiltrarPedidos));
                StartActivityForResult(intent2, 0);
                break;
            }
            return(base.OnOptionsItemSelected(item));
        }