using System.Windows.Controls;
using Ab2d.Controls;

namespace Valg.EVA.Skanning.UserInterfaceElements.BallotPaperImage
{
    
    
    
    public partial class ImageView : UserControl
    {
        public ImageView()
        {
            InitializeComponent();
            UpdateButtonState(ImageZoomPanel.ZoomMode);
            ImageZoomPanel.ZoomModeChanged += ImageZoomPanel_ZoomModeChanged;
        }

        void UpdateButtonState(ZoomPanel.ZoomModeType zoomMode)
        {
            switch (zoomMode)
            {
                    case ZoomPanel.ZoomModeType.Move:
                    MoveButton.IsChecked = true;
                    break;
                    case ZoomPanel.ZoomModeType.Rectangle:
                    RectangleButton.IsChecked = true;
                    break;
                    case ZoomPanel.ZoomModeType.ZoomIn:
                    ZoomInButton.IsChecked = true;
                    break;
                    case ZoomPanel.ZoomModeType.ZoomOut:
                    ZoomInButton.IsChecked = true;
                    break;
            }
        }

        void ImageZoomPanel_ZoomModeChanged(object sender, ZoomModeChangedRoutedEventArgs e)
        {
            switch (e.OldZoomMode)
            {
                    case ZoomPanel.ZoomModeType.Rectangle:
                    RectangleButton.IsChecked = false;
                    break;
                    case ZoomPanel.ZoomModeType.Move:
                    MoveButton.IsChecked = false;
                    break;
                    case ZoomPanel.ZoomModeType.ZoomOut:
                    ZoomOutButton.IsChecked = false;
                    break;
                    case ZoomPanel.ZoomModeType.ZoomIn:
                    ZoomInButton.IsChecked = false;
                    break;
            }
        }
    }
}

