Esempio n. 1
0
 private void RectifyFocus()
 {
     if (_isViewPreferencesOpen && _previousFocus != "DisplayPreferencesButton")
     {
         DisplayPreferencesButton.Focus();
     }
     else if (_isSortPreferencesOpen && _previousFocus != "SortButton")
     {
         SortButton.Focus();
     }
     else
     {
         CloseViewGrid(DisplayPreferencesButton);
         CloseSortGrid(SortButton);
     }
 }
Esempio n. 2
0
        // Make sure focusing is restricted when pop out menu is activated and call the correct animations
        private void Button_IsKeyboardFocusedChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var listItem = sender as FrameworkElement;

            if (listItem == null)
            {
                return;
            }
            var name = listItem.Name;

            if ((bool)e.NewValue)
            {
                if (name == "DisplayPreferencesButton")
                {
                    if (_isSortPreferencesOpen && _previousFocus != "SortButton")
                    {
                        SortButton.Focus();
                    }
                    else
                    {
                        if (!_isViewPreferencesOpen)
                        {
                            CloseSortGrid(SortButton);
                            OpenViewGrid(DisplayPreferencesButton);
                        }
                    }
                }
                else if (name == "SortButton")
                {
                    if (_isViewPreferencesOpen && _previousFocus != "DisplayPreferencesButton")
                    {
                        DisplayPreferencesButton.Focus();
                    }
                    else
                    {
                        if (!_isSortPreferencesOpen)
                        {
                            CloseViewGrid(DisplayPreferencesButton);
                            OpenSortGrid(SortButton);
                        }
                    }
                }
                else if (name == "BtnClose")
                {
                    RectifyFocus();
                }
                else if (name == "HomeButton")
                {
                    RectifyFocus();
                }
                else if (name == "LogoutButton")
                {
                    RectifyFocus();
                }
                else if (name == "SettingsButton")
                {
                    RectifyFocus();
                }
                else if (Name == "ShutdownAppButton")
                {
                    RectifyFocus();
                }
                else if (name == "SleepButton")
                {
                    RectifyFocus();
                }
                else if (name == "RestartButton")
                {
                    RectifyFocus();
                }
                else if (name == "ShutdownButton")
                {
                    RectifyFocus();
                }
            }
            else if (!(bool)e.NewValue)
            {
                _previousFocus = name;
            }
        }