Exemplo n.º 1
0
        public override void SetContentView(int layoutResId)
        {
            base.SetContentView(layoutResId);

            LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.ActionBar);

            if (LegacyBar != null)
            {
                LegacyBar.Title = Title;
                LegacyBar.Theme = LegacyBarTheme.HoloBlack;

                LegacyBar.SetHomeAction(new ActionLegacyBarAction(this,
                                                                  () => _slidingMenu.Toggle(true),
                                                                  Resource.Drawable.Menu));

                if (RefreshCommand != null)
                {
                    LegacyBar.AddAction(new ActionLegacyBarAction(this, () => RefreshCommand.Execute(null), Resource.Drawable.Refresh));
                }

                _slidingMenu = new SlidingMenu(this)
                {
                    Mode                       = MenuMode.Left,
                    TouchModeAbove             = DisableMenuSwipe ? TouchMode.None : TouchMode.Fullscreen,
                    BehindOffset               = 50,
                    BehindWidth                = 400,
                    ShadowWidth                = 20,
                    ShadowDrawableRes          = Resource.Drawable.SlidingMenuShadow,
                    SecondaryShadowDrawableRes = Resource.Drawable.SlidingMenuShadowRight
                };

                _slidingMenu.SetBackgroundColor(Color.Black);
                _slidingMenu.AttachToActivity(this, SlideStyle.Content);
                _slidingMenu.SetMenu(Resource.Layout.MenuFrame);

                var menuFragment = new MenuFragment();
                menuFragment.ViewModel = new MenuViewModel(((ViewModelBase)ViewModel).Messenger);

                SupportFragmentManager.BeginTransaction()
                .Replace(Resource.Id.MenuFrame, menuFragment).Commit();
            }
        }