using System;
using System.Data;
using System.IO;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using Microsoft.Win32;

using Cosmos.UserFrame;
using Cosmos.BaseFrame;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.ServiceProvider;

namespace Cosmos.Win
{
    public partial class frmHpSaveMsg : Form
    {
        private SManager sManager = new SManager();                                 // 이 객체를 통해 업무 Service 호출
        private StateServer StateObject = (StateServer)StateServer.GetInstance();   // StateObject : StateServer Object (객체)
        private PosStatus m_cPosStatus = new PosStatus();                           // 기본정보 참조
        private TranStatus m_cTrnStatus = new TranStatus();                         // 거래정보

        private string m_sPopUpTitle= "";
        public string PopUpTitle
        {
            get { return this.m_sPopUpTitle; }
            set { this.m_sPopUpTitle = value; }
        }
        private string m_sPopUpMessage = "";
        public string PopUpMessage
        {
            get { return this.m_sPopUpMessage; }
            set { this.m_sPopUpMessage = value; }
        }

        #region 생성자
        /// <summary>
        /// 생성자
        /// </summary>
        public frmHpSaveMsg()
        {
            InitializeComponent();

            base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
            //this.UpdateStyles();

            m_cPosStatus = (PosStatus)StateObject.POS;      // POS 기본정보
            m_cTrnStatus = (TranStatus)StateObject.TRAN;    // POS 거래정보
        }

        private void frmHpSaveMsg_Load(object sender, EventArgs e)
        {
            try
            {
                UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");

                FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
                FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);

                picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_MSGBOX);
                // picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.SCH_MESSAGE_BOX);

                lblTitle.Text = m_sPopUpTitle;
                lblMessage.Text = m_sPopUpMessage;

                tmrFormClose.Enabled = true;
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        private void frmHpSaveMsg_Activated(object sender, EventArgs e)
        {

        }

        private void frmHpSaveMsg_FormClosing(object sender, FormClosingEventArgs e)
        {
            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
        }
        #endregion 

        private void tmrFormClose_Tick(object sender, EventArgs e)
        {
            //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 start
            //로그 추가
            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
            //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 end
            Form_Close();
        }

        private void lblMessage_Click(object sender, EventArgs e)
        {
            //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 start
            //로그 추가
            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
            //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 end
            Form_Close();
        }

        private void picBack_Click(object sender, EventArgs e)
        {
            //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 start
            //로그 추가
            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");

            //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 end
            Form_Close();
        }

        private void Form_Close()
        {
            try
            {
                //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 start
                //로그 추가
                UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                        System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
                //#17155 PB 신림사거리 - 결제완료 후 포스 다운된 증상 end

                tmrFormClose.Enabled = false;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
                this.Close();
            }
        }

        
    }
}
