using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace SPC.Kiosk.Common
{
    public sealed class WaitWindow : IDisposable
    {
        private static WaitWindow instance = null;
        private static readonly object padlock = new object();
        /// <summary>
        /// This Class Instance
        /// </summary>
        public static WaitWindow GetInstance
        {
            get
            {
                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new WaitWindow();
                    }
                    return instance;
                }
            }
        }
        private WaitForm WaitWindowForm = null;


        /// <summary>
        /// Is Show Wait  Window
        /// </summary>
        public bool IsShowWindow { get; set; }
        public WaitWindow()
        {
            WaitWindowForm = new WaitForm();
        }
        /// <summary>
        /// Show Process Wait Window
        /// </summary>
        /// <param name="_screenNo"></param>
        /// <param name="_size"></param>
        public void ShowWaitWindow()
        {
            if (WaitWindowForm == null || !IsShowWindow)
            {
                WaitWindowForm = new WaitForm();
            }
            WaitWindowForm.Show();
            IsShowWindow=true;
        }
        /// <summary>
        /// Close Process Wait Window
        /// </summary>
        public void CloseWaitWindow()
        {
            if (WaitWindowForm != null && IsShowWindow)
            {
                IsShowWindow = false;
                WaitWindowForm.Close();
                //WaitWindowForm = null;
            }
        }
        /// <summary>
        /// Dispose Process Wait Window
        /// </summary>
        public void Dispose()
        {
            if (WaitWindowForm != null)
            {
                WaitWindowForm.Close();
                WaitWindowForm = null;
            }
        }
    }
}
