예제 #1
0
        private bool TransitionProductTabs(TransitionTabDirection direction)
        {
            var currentIndex = MainTabControl.SelectedIndex;
            var tmpIndex     = currentIndex;

            if (direction == TransitionTabDirection.Forward)
            {
                if (MainTabControl.SelectedIndex < MainTabControl.Items.Count - 1)
                {
                    do
                    {
                        tmpIndex++;
                        if (tmpIndex < MainTabControl.Items.Count)
                        {
                            var item = (TabItem)MainTabControl.Items[tmpIndex];
                            if (item == null || item.IsVisible)
                            {
                                break;
                            }
                        }
                        else
                        {
                            return(true);
                        }
                    } while (true);
                    MainTabControl.SelectedIndex = tmpIndex;
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                if (MainTabControl.SelectedIndex > 0)
                {
                    do
                    {
                        tmpIndex--;
                        if (tmpIndex > 0)
                        {
                            var item = (TabItem)MainTabControl.Items[tmpIndex];
                            if (item == null || item.IsVisible)
                            {
                                break;
                            }
                        }
                        else
                        {
                            return(true);
                        }
                    } while (true);
                    MainTabControl.SelectedIndex = tmpIndex;
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }
        private bool TransitionProductTabs(TransitionTabDirection direction)
        {
            var currentIndex = MainTabControl.SelectedIndex;
            var tmpIndex = currentIndex;
            if (direction == TransitionTabDirection.Forward)
            {
                if (MainTabControl.SelectedIndex < MainTabControl.Items.Count - 1)
                {
                    do
                    {
                        tmpIndex++;
                        if (tmpIndex < MainTabControl.Items.Count)
                        {
                            var item = (TabItem)MainTabControl.Items[tmpIndex];
                            if (item == null || item.IsVisible) break;
                        }
                        else
                        {
                            return true;
                        }
                    } while (true);
                    MainTabControl.SelectedIndex = tmpIndex;
                }
                else
                {
                    return true;
                }
            }
            else
            {
                if (MainTabControl.SelectedIndex > 0)
                {
                    do
                    {
                        tmpIndex--;
                        if (tmpIndex > 0)
                        {
                            var item = (TabItem)MainTabControl.Items[tmpIndex];
                            if (item == null || item.IsVisible) break;
                        }
                        else
                        {
                            return true;
                        }
                    } while (true);
                    MainTabControl.SelectedIndex = tmpIndex;
                }
                else
                {
                    return true;
                }
            }

            return false;
        }