Esempio n. 1
0
        public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction ft)
        {
            switch (tab.Text)
            {
            case "Login":
                if (fragTab1 == null)
                {
                    fragTab1 = new LoginTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTab1);
                }
                else
                {
                    ft.Show(fragTab1);
                }

                break;

            case "Contacts":
                if (fragTabContacts == null)
                {
                    fragTabContacts = new ContactsTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTabContacts);
                }
                else
                {
                    ft.Show(fragTabContacts);
                }

                break;

            case "XML Log":
                if (fragTab2 == null)
                {
                    fragTab2 = new LogTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTab2);
                }
                else
                {
                    ft.Show(fragTab2);
                }

                break;

            case "Events":
                if (fragTab3 == null)
                {
                    fragTab3 = new EventsTabFragment(xmppClient);
                    ft.Add(Resource.Id.fragmentContainer, fragTab3);
                }
                else
                {
                    ft.Show(fragTab3);
                }

                break;
            }
        }
Esempio n. 2
0
        //单击事件
        public void onClick(View v)
        {
            FragmentTransaction fTransaction = FragmentManager.BeginTransaction();

            hideAllFragment(fTransaction);
            switch (v.Id)
            {
            case Resource.Id.tab_recharge:
                setSelected();
                tab_recharge.Selected = true;

                if (fg1 == null)
                {
                    fg1 = new MyFragment("开卡Fragment");
                    fTransaction.Add(Resource.Id.ly_content, fg1);
                }
                else
                {
                    fTransaction.Show(fg1);
                }
                break;

            case Resource.Id.tab_openccard:
                setSelected();
                tab_openccard.Selected = true;

                if (fg2 == null)
                {
                    fg2 = new OpenCardFragment();
                    fTransaction.Add(Resource.Id.ly_content, fg2);
                }
                else
                {
                    fTransaction.Show(fg2);
                }
                break;

            case Resource.Id.tab_personal:
                setSelected();
                tab_personal.Selected = true;

                if (personalFragment == null)
                {
                    personalFragment = new PersonalFragment();
                    fTransaction.Add(Resource.Id.ly_content, personalFragment);
                }
                else
                {
                    fTransaction.Show(personalFragment);
                }
                break;
            }
            fTransaction.Commit();
        }
Esempio n. 3
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            transaction = FragmentManager.BeginTransaction();
            hideAllFragment(transaction);
            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                if (f1 == null)
                {
                    f1 = new cityFragment();
                    transaction.Add(Resource.Id.myfragment, f1);
                }
                else
                {
                    transaction.Show(f1);
                }
                break;

            case Resource.Id.navigation_dashboard:
                if (f2 == null)
                {
                    f2 = new MyFragment();
                    transaction.Add(Resource.Id.myfragment, f2);
                }
                else
                {
                    transaction.Show(f2);
                }
                break;

            //textMessage.SetText(Resource.String.title_dashboard);
            //return true;
            case Resource.Id.navigation_notifications:
                // textMessage.SetText(Resource.String.title_notifications);
                // return true;
                if (f3 == null)
                {
                    f3 = new MyFragment();
                    transaction.Add(Resource.Id.myfragment, f3);
                }
                else
                {
                    transaction.Show(f3);
                }
                break;
            }
            transaction.Commit();
            return(false);
        }
Esempio n. 4
0
        private void ShowSignInDialog()
        {
            if (string.IsNullOrEmpty(CSISystemContext.CSIWebServerName))
            {
                ShowSettingsDialog();
                return;
            }
            try
            {
                FragmentTransaction ft = FragmentManager.BeginTransaction();

                SignInDialogFragment SignInDialog = (SignInDialogFragment)FragmentManager.FindFragmentByTag("SignIn");
                if (SignInDialog != null)
                {
                    ft.Show(SignInDialog);
                    //ft.AddToBackStack(null);
                }
                else
                {
                    // Create and show the dialog.
                    SignInDialog = new SignInDialogFragment(this);
                    //Add fragment
                    SignInDialog.Show(ft, "SignIn");
                }
            }
            catch (Exception Ex)
            {
                WriteErrorLog(Ex);
            }
        }
Esempio n. 5
0
        public void OnTabSelected(Android.Support.V7.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
        {
            switch (tab.Text)
            {
            case "Cauta produs":
            {
                if ((CautaMagazinFragment != null) && (CautaProdusFragment != null))
                {
                    FragmentTransaction transact = FragmentManager.BeginTransaction();
                    transact.SetCustomAnimations(
                        Resource.Animation.ScaleToMax,
                        Resource.Animation.ScaleToZero);
                    transact.Hide(CautaMagazinFragment);
                    transact.Show(CautaProdusFragment);
                    transact.AddToBackStack(null);
                    transact.Commit();
                }
            } break;

            case "Cauta magazin":
            {
                FragmentTransaction transact = FragmentManager.BeginTransaction();
                transact.SetCustomAnimations(
                    Resource.Animation.ScaleToMax,
                    Resource.Animation.ScaleToZero);
                transact.Hide(CautaProdusFragment);
                transact.Show(CautaMagazinFragment);
                transact.AddToBackStack(null);
                transact.Commit();
            } break;
            }
        }
Esempio n. 6
0
        public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back && e.Action == KeyEventActions.Down)
            {
                FragmentTransaction ft = FragmentManager.BeginTransaction();

                CSIMessageDialog SignOutDialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("Exit");

                if (SignOutDialog != null)
                {
                    ft.Show(SignOutDialog);
                }
                else
                {
                    SignOutDialog            = new CSIMessageDialog(GetString(Resource.String.app_name), string.Format(GetString(Resource.String.AskForExit), string.IsNullOrEmpty(CSISystemContext.UserDesc) ? CSISystemContext.User : CSISystemContext.UserDesc), DialogTypes.OKCancel, this);
                    SignOutDialog.OkHandler += (sender, args) =>
                    {
                        Finish();
                    };
                    SignOutDialog.Show(ft, "Exit");
                }
                return(true);
            }
            return(base.OnKeyDown(keyCode, e));
        }
Esempio n. 7
0
        public static void RunFragment(CSIBaseActivity activity)
        {
            try
            {
                FragmentTransaction ft = activity.FragmentManager.BeginTransaction();

                ItemListFragment ItemListFragmentDialog = (ItemListFragment)activity.FragmentManager.FindFragmentByTag("Items");
                if (ItemListFragmentDialog != null)
                {
                    ft.Show(ItemListFragmentDialog);
                    //ft.AddToBackStack(null);
                }
                else
                {
                    // Create and show the dialog.
                    ItemListFragmentDialog = new ItemListFragment(activity);
                    //Add fragment
                    ItemListFragmentDialog.Show(ft, "Items");
                }
            }
            catch (Exception Ex)
            {
                CSIErrorLog.WriteErrorLog(Ex);
            }
        }
Esempio n. 8
0
        public static SerialGenerator RunFragment(CSIBaseDialogFragment BaseDialogFragment)
        {
            try
            {
                FragmentTransaction ft = BaseDialogFragment.FragmentManager.BeginTransaction();

                SerialGenerator SerialGeneratorDialog = (SerialGenerator)BaseDialogFragment.FragmentManager.FindFragmentByTag("SerialGenerator");
                if (SerialGeneratorDialog != null)
                {
                    ft.Show(SerialGeneratorDialog);
                    //ft.AddToBackStack(null);
                }
                else
                {
                    // Create and show the dialog.
                    SerialGeneratorDialog = new SerialGenerator(BaseDialogFragment.GetBaseActivity())
                    {
                        ParentFragment = BaseDialogFragment
                    };
                    //Add fragment
                    SerialGeneratorDialog.Show(ft, "SerialGenerator");
                }
                return(SerialGeneratorDialog);
            }
            catch (Exception Ex)
            {
                CSIErrorLog.WriteErrorLog(Ex);
                return(null);
            }
        }
Esempio n. 9
0
        public static void RunFragment(CSIBaseActivity activity)
        {
            try
            {
                FragmentTransaction ft = activity.FragmentManager.BeginTransaction();

                DCJobRunFragment JobDialog = (DCJobRunFragment)activity.FragmentManager.FindFragmentByTag("JobReceipt");
                if (JobDialog != null)
                {
                    ft.Show(JobDialog);
                    //ft.AddToBackStack(null);
                }
                else
                {
                    // Create and show the dialog.
                    JobDialog = new DCJobRunFragment(activity);
                    //Add fragment
                    JobDialog.Show(ft, "JobReceipt");
                }
            }
            catch (Exception Ex)
            {
                CSIErrorLog.WriteErrorLog(Ex);
            }
        }
Esempio n. 10
0
        private void ShowLog()
        {
            try
            {
                FragmentTransaction ft = FragmentManager.BeginTransaction();

                LogDialogFragment LogDialog = (LogDialogFragment)FragmentManager.FindFragmentByTag("Settings");
                if (LogDialog != null)
                {
                    ft.Show(LogDialog);
                    //ft.AddToBackStack(null);
                }
                else
                {
                    // Create and show the dialog.
                    LogDialog = new LogDialogFragment(this);
                    //Add fragment
                    LogDialog.Show(ft, "Settings");
                }
            }
            catch (Exception Ex)
            {
                WriteErrorLog(Ex);
            }
        }
Esempio n. 11
0
        private ProgressFragment ShowProcess()
        {
            try
            {
                FragmentTransaction ft = FragmentManager.BeginTransaction();

                ProgressFragment progress = (ProgressFragment)FragmentManager.FindFragmentByTag("Progress");
                if (progress != null)
                {
                    ft.Show(progress);
                    //ft.AddToBackStack(null);
                }
                else
                {
                    // Create and show the dialog.
                    progress = new ProgressFragment(this);
                    //Add fragment
                    progress.Show(ft, "Progress");
                }
                return(progress);
            }
            catch (Exception Ex)
            {
                WriteErrorLog(Ex);
            }
            return(null);
        }
Esempio n. 12
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            bool result;
            FragmentTransaction fTransaction = FManager.BeginTransaction();

            HideAllFragment(fTransaction);
            switch (item.ItemId)
            {
            case Resource.Id.navigation_NearbyConnection:

                if (NearbyConnectionFrag == null)
                {
                    NearbyConnectionFrag = new NearbyConnection();
                    fTransaction.Add(Resource.Id.ly_content, NearbyConnectionFrag);
                }
                else
                {
                    ClearBetweenTaps("Connection");  fTransaction.Show(NearbyConnectionFrag);
                }
                result = true;

                break;

            case Resource.Id.navigation_WifiSharing:
                ClearBetweenTaps("WIFI");
                if (WifiSharingFrag == null)
                {
                    WifiSharingFrag = new WifiSharing();
                    fTransaction.Add(Resource.Id.ly_content, WifiSharingFrag);
                }
                else
                {
                    ClearBetweenTaps("WIFI"); fTransaction.Show(WifiSharingFrag);
                }
                result = true;
                break;

            default:
                result = false;
                break;
            }
            fTransaction.Commit();
            return(result);
        }
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            bool result;
            FragmentTransaction FTransaction = FManager.BeginTransaction();

            HideAllFragment(FTransaction);
            switch (item.ItemId)
            {
            case Resource.Id.navigation_publish:
                if (Publish == null)
                {
                    Publish = new PublishFragment();
                    FTransaction.Add(Resource.Id.ly_content, Publish);
                }
                else
                {
                    FTransaction.Show(Publish);
                }
                result = true;

                break;

            case Resource.Id.navigation_subscribe:
                if (Subscribe == null)
                {
                    Subscribe = new SubscribeFragment();
                    FTransaction.Add(Resource.Id.ly_content, Subscribe);
                }
                else
                {
                    FTransaction.Show(Subscribe);
                }
                result = true;
                break;

            default:
                result = false;
                break;
            }
            FTransaction.Commit();
            return(result);
        }
Esempio n. 14
0
        void ShowFragment(Fragment frag)
        {
            FragmentTransaction transact = FragmentManager.BeginTransaction();

            transact.Hide(AlarmsList);
            transact.Hide(NewAlarm);

            transact.Show(frag);

            transact.Commit();
        }
        void ShowFragment(Fragment frag)
        {
            FragmentTransaction transact = FragmentManager.BeginTransaction();

            transact.Hide(IntroducereIntrebare_Fragment);
            transact.Hide(SetareVariante_Fragment);
            transact.Hide(SetareDurata_Fragment);

            transact.Show(frag);

            transact.Commit();
        }
        // Update fragment visibility based on current check box state.
        void UpdateFragmentVisibility()
        {
            FragmentTransaction ft = GetChildFragmentManager().BeginTransaction();

            if (mCheckBox1.IsChecked())
            {
                ft.Show(mFragment1);
            }
            else
            {
                ft.Hide(mFragment1);
            }
            if (mCheckBox2.IsChecked())
            {
                ft.Show(mFragment2);
            }
            else
            {
                ft.Hide(mFragment2);
            }
            ft.Commit();
        }
Esempio n. 17
0
        void SwitchBarPage()
        {
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            if (barFragment == null)
            {
                barFragment = AppCompat.FragmentContainer.CreateInstance(barPage);
                transaction.Add(rootContainer.Id, barFragment).Commit();
            }
            else
            {
                transaction.Show(barFragment).Commit();
            }
        }
Esempio n. 18
0
        void SwitchSearchPage()
        {
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            if (searchFragment == null)
            {
                searchFragment = AppCompat.FragmentContainer.CreateInstance(searchPage);
                transaction.Add(rootContainer.Id, searchFragment).CommitAllowingStateLoss();
            }
            else
            {
                transaction.Show(searchFragment).CommitAllowingStateLoss();
            }
        }
        private void ShowDialog(Exception Ex)
        {
            FragmentTransaction ft     = FragmentManager.BeginTransaction();
            CSIMessageDialog    Dialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("Dialog");

            if (Dialog != null)
            {
                ft.Show(Dialog);
            }
            else
            {
                Dialog = new CSIMessageDialog(Application.Context.GetString(Resource.String.app_name), CSIBaseInvoker.TranslateError(Ex), DialogTypes.OK);
                Dialog.Show(ft, "Dialog");
            }
        }
Esempio n. 20
0
    //Show the corresponding fragment according to positon and hide the previous fragment
    private void setFragmentPosition(int position)
    {
        FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

        Android.Support.V4.App.Fragment currentFragment = mFragments[position];
        Android.Support.V4.App.Fragment lastFragment    = mFragments[lastIndex];
        lastIndex = position;
        ft.Hide(lastFragment);
        if (!currentFragment.IsAdded)
        {
            SupportFragmentManager.BeginTransaction().Remove(currentFragment).Commit();
            ft.Add(Resource.Id.ll_frameLayout, currentFragment);
        }
        ft.Show(currentFragment);
        ft.CommitAllowingStateLoss();
    }
Esempio n. 21
0
        private void ShowNoEmpMessage()
        {
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            CSIMessageDialog SignOutDialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("NoEmp");

            if (SignOutDialog != null)
            {
                ft.Show(SignOutDialog);
            }
            else
            {
                SignOutDialog = new CSIMessageDialog(GetString(Resource.String.app_name), GetString(Resource.String.NoEmployee), DialogTypes.OK, this);
                SignOutDialog.Show(ft, "NoEmp");
            }
        }
Esempio n. 22
0
        private void EnterSearchUi()
        {
            inSearchUI = true;
            if (mSearchFragment == null)
            {
                AddSearchFragment();
                return;
            }
            mSearchFragment.UserVisibleHint = true;
            FragmentTransaction transaction = ChildFragmentManager
                                              .BeginTransaction();

            transaction.Show(mSearchFragment);
            transaction.CommitAllowingStateLoss();
            ChildFragmentManager.ExecutePendingTransactions();
            SetupSearchUi();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Navigation);
            var                   boton_superiorderecho = FindViewById <ImageView>(Resource.Id.imgNotificacion);
            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.SetNavigationItemSelectedListener(this);
            var btnMenu = FindViewById <ImageView>(Resource.Id.imgMenu);

            btnMenu.Click += delegate {
                drawer.OpenDrawer(GravityCompat.Start);
            };

            _Fragment_Caballos = new Fragment_Caballos(this);
            transaccion        = FragmentManager.BeginTransaction();
            transaccion.Add(Resource.Id.FrameContent, fragment_perfil, "Perfil");
            transaccion.Add(Resource.Id.FrameContent, _Fragment_Caballos, "Horses");
            transaccion.Add(Resource.Id.FrameContent, fragment_Chat, "Chat");
            transaccion.Add(Resource.Id.FrameContent, fragment_ajustes, "Ajustes");
            transaccion.Add(Resource.Id.FrameContent, fragment_salud, "Salud");
            transaccion.Hide(_Fragment_Caballos);
            transaccion.Hide(fragment_Chat);
            transaccion.Hide(fragment_ajustes);
            transaccion.Hide(fragment_salud);
            transaccion.Show(fragment_perfil);
            transaccion.Commit();

            var headerView = navigationView.GetHeaderView(0);


            //var nombre = headerView.FindViewById<TextView>(Resource.Id.txtusuario);
            //nombre.Text = new ShareInside().Consultar_DatosUsuario().nombre;

            boton_superiorderecho.Click += delegate
            {
                StartActivity(typeof(Editar_Perfil));
            };
        }
Esempio n. 24
0
 /// <summary>
 /// 切换tabl
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 private void showTab(int idx)
 {
     for (int i = 0; i < fragments.Count; i++)
     {
         Fragment            fragment = fragments[i];
         FragmentTransaction ft       = obtainFragmentTransaction(idx);
         if (idx == i)
         {
             ft.Show(fragment);
         }
         else
         {
             ft.Hide(fragment);
         }
         ft.Commit();
     }
     currentTab = idx;
 }
Esempio n. 25
0
        private void TabSetting_Click(object sender, EventArgs e)
        {
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            HideAllFragment(transaction);
            Selected();
            tabSetting.Selected = true;
            if (f3 == null)
            {
                f3 = new Setting("第一个Fragment");
                transaction.Add(Resource.Id.fragment_container, f3);
            }
            else
            {
                transaction.Show(f3);
            }
            transaction.Commit();
        }
Esempio n. 26
0
        private void TabUser_Click(object sender, EventArgs e)
        {
            FragmentTransaction transaction = FragmentManager.BeginTransaction();

            HideAllFragment(transaction);
            Selected();
            tabDeal.Selected = true;
            if (f2 == null)
            {
                f2 = new Display("第一个Fragment");
                transaction.Add(Resource.Id.fragment_container, f2);
            }
            else
            {
                transaction.Show(f2);
            }
            transaction.Commit();
        }
Esempio n. 27
0
        private void DeleteLogFileButton_Click(object sender, EventArgs args)
        {
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            CSIMessageDialog DeleteLogFileDialog = (CSIMessageDialog)FragmentManager.FindFragmentByTag("DeleteLogFileDialog");

            if (DeleteLogFileDialog != null)
            {
                ft.Show(DeleteLogFileDialog);
            }
            else
            {
                DeleteLogFileDialog            = new CSIMessageDialog(GetString(Resource.String.app_name), GetString(Resource.String.DeleteLogFile), DialogTypes.OKCancel);
                DeleteLogFileDialog.OkHandler += (o, e) =>
                {
                    CSIErrorLog.DeleteErrorLogFile();
                    LogEdit.Text = CSIErrorLog.ReadLog();
                };
                DeleteLogFileDialog.Show(ft, "DeleteLogFileDialog");
            }
        }
        void AddShowHideListener(int buttonId, Fragment fragment)
        {
            Button button = (Button)FindViewById(buttonId);

            button.Click += (o, a) =>
            {
                FragmentTransaction ft = GetSupportFragmentManager().BeginTransaction();
                ft.SetCustomAnimations(global::Android.R.Anim.Fade_in,
                                       global::Android.R.Anim.Fade_out);
                if (fragment.IsHidden())
                {
                    ft.Show(fragment);
                    button.SetText("Hide");
                }
                else
                {
                    ft.Hide(fragment);
                    button.SetText("Show");
                }
                ft.Commit();
            };
        }
Esempio n. 29
0
        private void ShowChangeWarehouse()
        {
            try
            {
                FragmentTransaction ft = FragmentManager.BeginTransaction();

                ChangeWarehouseFragment ChangeWhseDialog = (ChangeWarehouseFragment)FragmentManager.FindFragmentByTag("ChangeWarehouse");
                if (ChangeWhseDialog != null)
                {
                    ft.Show(ChangeWhseDialog);
                }
                else
                {
                    // Create and show the dialog.
                    ChangeWhseDialog = new ChangeWarehouseFragment(this);
                    //Add fragment
                    ChangeWhseDialog.Show(ft, "ChangeWarehouse");
                }
            }
            catch (Exception Ex)
            {
                WriteErrorLog(Ex);
            }
        }
Esempio n. 30
0
        private void ShowAbout()
        {
            try
            {
                FragmentTransaction ft = FragmentManager.BeginTransaction();

                AboutDialogFragment AboutDialog = (AboutDialogFragment)FragmentManager.FindFragmentByTag("About");
                if (AboutDialog != null)
                {
                    ft.Show(AboutDialog);
                }
                else
                {
                    // Create and show the dialog.
                    AboutDialog = new AboutDialogFragment(this);
                    //Add fragment
                    AboutDialog.Show(ft, "About");
                }
            }
            catch (Exception Ex)
            {
                WriteErrorLog(Ex);
            }
        }