Esempio n. 1
0
        private void SelectOverlay(FlagOverlayType?overlayType, int which)
        {
            // Figure out which one to change
            UniformGrid panel;

            switch (which)
            {
            case 1:
                panel = panelOverlays1;
                chkOverlay1.IsChecked = overlayType != null;
                _overlayType1         = overlayType ?? _overlayType1;
                break;

            case 2:
                panel = panelOverlays2;
                chkOverlay2.IsChecked = overlayType != null;
                _overlayType2         = overlayType ?? _overlayType2;
                break;

            default:
                throw new ApplicationException("Unknown overlay: " + which.ToString());
            }

            // Set the effect
            foreach (Grid button in panel.Children)
            {
                foreach (UIElement buttonChild in button.Children)
                {
                    if (buttonChild is Rectangle)
                    {
                        if (overlayType != null && (FlagOverlayType)((Rectangle)buttonChild).Tag == overlayType.Value)
                        {
                            button.Effect = _selectEffect;
                        }
                        else
                        {
                            button.Effect = null;
                        }

                        break;
                    }
                }
            }

            RedrawFlag();
        }
        private void SelectOverlay(FlagOverlayType? overlayType, int which)
        {
            // Figure out which one to change
            UniformGrid panel;
            switch (which)
            {
                case 1:
                    panel = panelOverlays1;
                    chkOverlay1.IsChecked = overlayType != null;
                    _overlayType1 = overlayType ?? _overlayType1;
                    break;

                case 2:
                    panel = panelOverlays2;
                    chkOverlay2.IsChecked = overlayType != null;
                    _overlayType2 = overlayType ?? _overlayType2;
                    break;

                default:
                    throw new ApplicationException("Unknown overlay: " + which.ToString());
            }

            // Set the effect
            foreach (Grid button in panel.Children)
            {
                foreach (UIElement buttonChild in button.Children)
                {
                    if (buttonChild is Rectangle)
                    {
                        if (overlayType != null && (FlagOverlayType)((Rectangle)buttonChild).Tag == overlayType.Value)
                        {
                            button.Effect = _selectEffect;
                        }
                        else
                        {
                            button.Effect = null;
                        }

                        break;
                    }
                }
            }

            RedrawFlag();
        }