using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Windows;

namespace Valg.EVA.Skanning.UserInterfaceElements.BallotPaperImage
{
    [ExcludeFromCodeCoverage]
    public partial class BallotPaperImageWindow : IBallotPaperImageWindow
    {
        public BallotPaperImageWindow()
        {
            InitializeComponent();
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            if (CloseRequested)
            {
                base.OnClosing(e);
            }
            else
            {
                e.Cancel = true;
                Hide();
                
            }
        }

        public void SetBallotPaperImageViewModel(IBallotPaperImageViewModel ballotPaperImageViewModel)
        {
            DataContext = ballotPaperImageViewModel;
        }

        public bool CloseRequested { get; set; }

        public void RestoreFromMinimized()
        {
            if (WindowState == WindowState.Minimized)
                WindowState = WindowState.Normal;
        }
    }
}

