示例#1
0
        private void SetSelected(HamburgerButtonInfo previous, HamburgerButtonInfo value)
        {
            IsOpen = false;

            // undo previous
            if (previous != null && previous != value)
            {
                previous.RaiseUnselected();
            }

            // reset all
            var values = _navButtons.Select(x => x.Value);

            foreach (var item in values.Where(x => x != value))
            {
                item.IsChecked = false;
            }

            // that's it if null
            if (value == null)
            {
                return;
            }
            else
            {
                value.IsChecked = (value.ButtonType == HamburgerButtonInfo.ButtonTypes.Toggle);
                if (previous != value)
                {
                    value.RaiseSelected();
                }
            }

            // navigate only to new pages
            if (value.PageType == null)
            {
                return;
            }
            if (value.PageType.Equals(NavigationService.CurrentPageType) && (value.PageParameter?.Equals(NavigationService.CurrentPageParam) ?? false))
            {
                return;
            }
            NavigationService.Navigate(value.PageType, value.PageParameter);
        }
示例#2
0
 void ExecuteNav(HamburgerButtonInfo commandInfo)
 {
     if (commandInfo == null)
     {
         throw new NullReferenceException("CommandParameter is not set");
     }
     try
     {
         if (commandInfo.PageType != null)
         {
             Selected = commandInfo;
         }
     }
     finally
     {
         if (commandInfo.ClearHistory)
         {
             NavigationService.ClearHistory();
         }
     }
 }
示例#3
0
        private void SetSelected(HamburgerButtonInfo previous, HamburgerButtonInfo value)
        {
            IsOpen = false;

            // undo previous
            if (previous != null && previous != value)
            {
                previous.RaiseUnselected();
            }

            // reset all
            var values = _navButtons.Select(x => x.Value);
            foreach (var item in values.Where(x => x != value))
            {
                item.IsChecked = false;
            }

            // that's it if null
            if (value == null)
            {
                return;
            }
            else
            {
                value.IsChecked = (value.ButtonType == HamburgerButtonInfo.ButtonTypes.Toggle);
                if (previous != value)
                {
                    value.RaiseSelected();
                }
            }

            // navigate only to new pages
            if (value.PageType == null) return;
            if (value.PageType.Equals(NavigationService.CurrentPageType) && (value.PageParameter?.Equals(NavigationService.CurrentPageParam) ?? false)) return;
            NavigationService.Navigate(value.PageType, value.PageParameter);
        }
示例#4
0
 void ExecuteNav(HamburgerButtonInfo commandInfo)
 {
     if (commandInfo == null)
         throw new NullReferenceException("CommandParameter is not set");
     try
     {
         if (commandInfo.PageType != null)
             Selected = commandInfo;
     }
     finally
     {
         if (commandInfo.ClearHistory)
             NavigationService.ClearHistory();
     }
 }