Exemple #1
0
        public override void OnItemSelected(int index)
        {
            Section selectedSection = getSection(index);

            _Communicator.SetTriggerEvent(index);
            // Only replace the fragment if the section is changing.
            if (selectedSection == mCurrentSection)
            {
                return;
            }
            mCurrentSection = selectedSection;
            #region //url https://docs.microsoft.com/en-us/xamarin/android/platform/fragments/managing-fragments
            SectionFragment f = new SectionFragment();
            SectionFragment sectionFragment = f.GetSection(selectedSection);
            GetFragmentManager().BeginTransaction()
            .Replace(Resource.Id.fragment_container, sectionFragment)
            .Commit();
            #endregion


            // No actions are available for the settings specific fragment, so the drawer
            // is locked closed. For all other SelectionFragments, it is unlocked.
            if (selectedSection == Section.Settings)
            {
                mWearableActionDrawer.LockDrawerClosed();
            }
            else
            {
                mWearableActionDrawer.UnlockDrawer();
            }
        }
Exemple #2
0
        public SectionFragment GetSection(Section section)
        {
            SectionFragment newSection = new SectionFragment();
            Bundle          arguments  = new Bundle();
            //   var serializedobje = ObjectToByteArray(section);
            var cvc = (ISerializable)section;

            arguments.PutSerializable(EXTRA_SECTION, cvc);
            newSection.Arguments = arguments;

            return(newSection);
        }