using System;
using System.Drawing;
using System.Windows.Forms;

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

namespace Cosmos.Win
{
    public partial class frmNoticeInfo : Form
    {

        #region Variable

        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 DeviceStatus m_cDevStatus = new DeviceStatus();                     // 디바이스 관리
        private IDataServiceUs m_cPosNoticeCom = null;                              // 공지사항 공통                               

        private PosOLEDevice.DelegateOlePos delegatePos;
        
        private DataTable m_dtItemInit;                                             // 조회 상품 리스트

        private string m_sPosMenuKeIn;
        public string PosMenuKeyIn { set { m_sPosMenuKeIn = value; } get { return m_sPosMenuKeIn; } }

        #endregion
        
        #region 생성자 & 소멸자
        public frmNoticeInfo()
        {
            InitializeComponent();

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

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

            delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
            m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
            m_cPosNoticeCom = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.POS_NOTICE_COM); 

        }
        /// <summary>
        /// 폼로드
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmNoticeInfo_Load(object sender, EventArgs e)
        {
            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");

            InitControl();

            if (m_sPosMenuKeIn != "")
                SelectParamList();
            else
                txtPrtData.Text = "";
        }
        /// <summary>
        /// 폼클로즈
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmNoticeInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            vScrollbar.Attach(null);
            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
        }
        /// <summary>
        /// 폼엑티브
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmNoticeInfo_Activated(object sender, EventArgs e)
        {
            PosOLEDevice.SetEventHandle(delegatePos);
        }
        /// <summary>
        /// 폼디엑티브
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmNoticeInfo_Deactivate(object sender, EventArgs e)
        {
            PosOLEDevice.SetEventHandle(null);
        }

        #endregion 생성자 & 소멸자
        
        #region 폼 컨트롤 초기화
        /// <summary>
        /// 폼 컨트롤 초기화
        /// </summary>
        private void InitControl()
        {
            try
            {
                // 이미지 로딩 처리
                picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
                //this.Size = new Size(800, 544);

                btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
                if (btnExit.Image != null) btnExit.Text = "";

                btnWeb.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);

                //네이게이션 버튼 이미지 적용!
                btnUp.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP1_BASIC);
                btnUp.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP1_PRESS);
                btnUp2.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP2_BASIC);
                btnUp2.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_UP2_PRESS);

                btnDw.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN1_BASIC);
                btnDw.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN1_PRESS);
                btnDw2.DefaultImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN2_BASIC);
                btnDw2.ClickImage = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_105X48_DOWN2_PRESS);

                FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
                FormManager.SetTextBoxGlobalInfo(this, m_cPosStatus.Global.m_stCultureMaster.nGroupingDigits, m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol
                    , m_cPosStatus.Global.m_stCultureMaster.nDecimalDigits, m_cPosStatus.Global.m_stCultureMaster.strDecimalSymbol);

                lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0393);

                lblMsgType.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0223);

                lblWebmsg.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0584);

                InitializeGrid();

                ComboBoxInit();

                vScrollbar.Attach(txtPrtData);

                SearchDataList();

                btnWeb.Tag = "";

                btnWeb.Visible = false;

                this.Select();

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


        /// <summary>
        /// 그리드 초기화
        /// </summary>
        private void InitializeGrid()
        {
            try
            {
                // 상품권 등록정보 표시 그리드
                grdSearchItem.CsmGridColumnHeadersVisible = true;           //DataGridView 자체의 컬럼 헤더 Visible 여부
                grdSearchItem.CsmGridColumnHeadersHeight = 43;              //DataGridView 자체의 컬럼 헤더 높이
                grdSearchItem.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12, FontStyle.Bold);  //DataGridView 자체의 컬럼 헤더 폰트
                grdSearchItem.Font = new Font(m_cPosStatus.Base.FONT, 12);
                grdSearchItem.CsmGridRowsHeight = 38;
                grdSearchItem.CsmGridColumnCount = 9;                                               //그리드의 컬럼수
                grdSearchItem.CsmGridShowPageRowsCount = 11;                                         //그리드의 한 화면에 보이는 로우수
                grdSearchItem.CsmGridSetHeaderBackColor(236, 238, 239);                             //그리드 헤더 배경색
                grdSearchItem.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255);           //그리드 홀수(Default)행의 배경색 지정
                grdSearchItem.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255);         //그리드 짝수(Alternate)행의 배경색 지정
                grdSearchItem.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255);               //기본 백그라운드 컬러
                grdSearchItem.CsmGridHighlightColor = Color.FromArgb(255, 251, 211);                //그리드 선택 백 컬러
                grdSearchItem.CsmGridHighlightTextColor = Color.Black;                              //그리드 선택 글자 컬러
                grdSearchItem.CsmGridSetColumnWidth(new int[] { 50, 100, 267, 0, 0, 0, 0, 0, 0 });  //컬럼넓이 지정(417)
                grdSearchItem.CsmGridAlignment(new int[] { 2, 1, 0, 0, 0, 0, 0, 0, 0 });            //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽



                //각 컬럼별 이름 지정
                grdSearchItem.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0014));
                grdSearchItem.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0532));
                grdSearchItem.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0152));
                grdSearchItem.CsmGridColumnName(3, "MSG_CONTENTS");
                grdSearchItem.CsmGridColumnName(4, "MSG_TYPE");
                grdSearchItem.CsmGridColumnName(5, "MSG_CODE");
                grdSearchItem.CsmGridColumnName(6, "MSG_DIV");
                grdSearchItem.CsmGridColumnName(7, "READ_YN");
                grdSearchItem.CsmGridColumnName(8, "START_DT");
                

                //그리드 초기화 테이블
                m_dtItemInit = new DataTable("INIT");
                m_dtItemInit.Columns.Add(new DataColumn("NO", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("MSG_ETC", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("MSG_TITLE", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("MSG_CONTENTS", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("MSG_TYPE", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("MSG_CODE", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("MSG_DIV", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("READ_YN", typeof(string)));
                m_dtItemInit.Columns.Add(new DataColumn("START_DT", typeof(string)));

                m_dtItemInit.Clear();

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


        /// <summary>
        /// 콤보박스 초기화
        /// </summary>
        private void ComboBoxInit()
        {

            try
            {
                cbMsgType.Items.Clear();

                //메세지 유형 셋팅
                cbMsgType.Items.Add(string.Format("{0}-{1}", ItemConst.NOTE_MSG_DIV.EMG, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0581)));
                cbMsgType.Items.Add(string.Format("{0}-{1}", ItemConst.NOTE_MSG_DIV.NRL, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0393)));
                cbMsgType.Items.Add(string.Format("{0}-{1}", ItemConst.NOTE_MSG_DIV.BIZ, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0540)));
                cbMsgType.Items.Add(string.Format("{0}-{1}", ItemConst.NOTE_MSG_DIV.ALL, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0226)));
                cbMsgType.SelectedIndex = 3;


                cbMsgType.DropDownStyle = ComboBoxStyle.DropDownList;

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

        }


        #endregion
        
        #region Control Event
                        
        /// <summary>
        /// 조회 그리드 업/다운 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSelProc_Click(object sender, EventArgs e)
        {
            try
            {
                if ((UI.CsmButton)sender == btnUp2)
                {
                    grdSearchItem.CsmGridScroll("PAGE UP");
                }
                else if ((UI.CsmButton)sender == btnUp)
                {
                    grdSearchItem.CsmGridScroll("UP");
                }
                else if ((UI.CsmButton)sender == btnDw)
                {
                    grdSearchItem.CsmGridScroll("DOWN");
                }
                else if ((UI.CsmButton)sender == btnDw2)
                {
                    grdSearchItem.CsmGridScroll("PAGE DOWN");
                }
                else if ((UI.CsmButton)sender == btnWeb)
                {
                    if (btnWeb.Tag.ToString() != "")
                    {
                        WinBasic.ShowWebPos(PosKey.MENU_KEY.WEB_EMG_NOTE, btnWeb.Tag.ToString());
                    }
                    
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 그리드 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="rowIndex"></param>
        private void grdSearchItem_GridClickEvent(object sender, string rowIndex)
        {
            try
            {

                if (grdSearchItem.CsmGridRowsCount == 0)
                {
                    return;
                }

                txtPrtData.Text = "";


                string sMsgDiv = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 6);
                string sDspData = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 3);
                string sMsgCd = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 5);
                string sReadYn = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 7);
                string sStartDt = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 8);
                                    
                //화면 표시
                DetailDsp(sMsgDiv, sDspData, sMsgCd);

                //읽은 업데이트
                if (sReadYn == "0")
                {
                    //업데이트 처리
                    string sRet = m_cPosNoticeCom.Execute(new string[] { sStartDt, sMsgDiv, sMsgCd, PosConst.MST_EMG_NOTE_READ_FLAG.FINSH });
                }

            }
            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 cbMsgType_TextChanged(object sender, EventArgs e)
        {
            try
            {
                SearchDataList();
            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 텍스트 박스 드래그 막기!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtPrtData_Enter(object sender, EventArgs e)
        {
            try
            {
                this.btnUp.Focus();
            }
            catch (Exception) { }

        }

        #endregion

        #region User Method
        /// <summary>
        /// 데이터 조회
        /// </summary>
        private void SearchDataList()
        {
            try
            {
                DataTable dt = null;
                DataTable dtList = m_dtItemInit.Clone();
                
                btnWeb.Visible = false;
                txtPrtData.Visible = false;
                vScrollbar.Visible = false;
                lblWebmsg.Visible = false;

                string sMsgSrhType = cbMsgType.Text.Substring(0, 2);

                dt = (DataTable)m_cPosNoticeCom.GetData(new string[] { PosMst.MST_EMG_NOTE.TABLE_NAME, sMsgSrhType, "", "" });

                if(dt == null || dt.Rows.Count == 0)
                {
                    //데이터 없음!
                    grdSearchItem.CsmGridDataSource = m_dtItemInit;
                    txtPrtData.Text = "";
                    txtPrtData.Tag = "";
                }
                else
                {

                    int iRowNo = 1;

                    foreach (DataRow dr in dt.Rows)
                    {
                        DataRow drNewRows = dtList.NewRow();

                        drNewRows["NO"] = iRowNo++;
                        drNewRows["MSG_TITLE"] = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_TITLE);
                        drNewRows["MSG_CONTENTS"] = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CONTENTS);
                        drNewRows["MSG_TYPE"] = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_TYPE);
                        drNewRows["MSG_CODE"] = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE);
                        drNewRows["MSG_DIV"] = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV);
                        drNewRows["READ_YN"] = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.READ_YN);
                        drNewRows["START_DT"] = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.START_DT);

                        if (drNewRows["MSG_DIV"].ToString() == ItemConst.NOTE_MSG_DIV.EMG)
                        {
                            //긴급
                            drNewRows["MSG_ETC"] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0581);
                        }
                        else if (drNewRows["MSG_DIV"].ToString() == ItemConst.NOTE_MSG_DIV.BIZ)
                        {
                            //영업
                            drNewRows["MSG_ETC"] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0540);
                        }
                        else
                        {
                            //그외 일반
                            drNewRows["MSG_ETC"] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0393);
                        }

                        dtList.Rows.Add(drNewRows);
                    }

                    //그리드 적용!
                    grdSearchItem.CsmGridDataSource = dtList;
                    //grdSearchItem_GridClickEvent(null, null);
                }


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


        }
        
        /// <summary>
        /// 화면 표시
        /// </summary>
        /// <param name="sMsgDiv"></param>
        /// <param name="sDspData"></param>
        /// <returns></returns>
        private void DetailDsp(string sMsgDiv, string sDspData,string sMsgCd)
        {
            try
            {

                btnWeb.Visible = false;
                btnWeb.Tag = "";
                txtPrtData.Visible = false;
                vScrollbar.Visible = false;
                lblWebmsg.Visible = false;

                if (sMsgDiv == ItemConst.NOTE_MSG_DIV.NRL)
                {
                    //WEB 화면 호출

                    //WinBasic.ShowWebPos(new string[] { FormManager.FORM_WEB_EMGNCY_LIST, PosKey.MENU_KEY.WEB_EMG_NOTE, "!@#$SCRN=POSNOTICE001!@#$NOTICE_YN=Y!@#$POS_ARTCL_NO=" + sMsgCd });
                    //WinBasic.ShowWebPos(PosKey.MENU_KEY.WEB_EMG_NOTE, sMsgCd);

                    if(sMsgCd != "")
                    {
                        btnWeb.Tag = sMsgCd;
                        btnWeb.Visible = true;
                        lblWebmsg.Visible = true;
                    }

                }
                if (sMsgDiv == ItemConst.NOTE_MSG_DIV.BIZ)
                {
                    //영업 공지 사항 자르기

                    if (sDspData.Trim() == "") return;

                    txtPrtData.Visible = true;
                    vScrollbar.Visible = true;

                    string[] aParam = sDspData.Split(new string[] { "#~" }, StringSplitOptions.None);

                    for (int iRow = 0; iRow < aParam.Length; iRow++)
                    {
                        txtPrtData.Text += aParam[iRow] + Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString();
                    }

                }
                else
                {
                    if (sDspData.Trim() == "") return;

                    txtPrtData.Visible = true;
                    vScrollbar.Visible = true;

                    //긴급 공지 일반 표시
                    txtPrtData.Text = sDspData;
                }



            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }

        }
        /// <summary>
        /// 외부 선택 화면 표시
        /// </summary>
        private void SelectParamList()
        {
            try
            {

                if (grdSearchItem.CsmGridRowsCount == 0)
                {
                    return;
                }

                string[] aParam = m_sPosMenuKeIn.Split(new string[] { "^" }, StringSplitOptions.None);

                for (int iRow = 0; grdSearchItem.CsmGridRowsCount > iRow; iRow++)
                {
                    if (aParam[0] == grdSearchItem.CsmGridGetCell(iRow, 5) && aParam[1] == grdSearchItem.CsmGridGetCell(iRow, 6))
                    {
                        grdSearchItem.CsmGridSelectRow(iRow);
                        break;
                    }
                }
                
            }
            catch (Exception ex)
            {
                
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

             
        #endregion
               
        #region DeviceEvent 관련
        /// <summary>
        /// DeviceEvent 관련
        /// </summary>
        /// <param name="sDevice"></param>
        /// <param name="sData1"></param>
        /// <param name="sData2"></param>
        /// <param name="sData3"></param>
        public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
        {
            try
            {
                switch (sDevice)
                {
                    case PosConst.OPOS_DEVICE.MSR:
                        this.Invoke(new EventHandler(OnMSREvent));
                        break;
                }
            }
            catch (Exception ex)
            {
               WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        #region MSR Event
        /// <summary>
        /// MSR Event
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void OnMSREvent(object source, EventArgs e)
        {
            try
            {
                
            }
            catch (Exception ex)
            {
               WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }
        #endregion MSR Event


        private void btnExit_Click(object sender, EventArgs e)
        {
            try
            {
                this.DialogResult = DialogResult.Cancel;
                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);
                
            }

            
        }
        
        #endregion DeviceEvent 관련








    }
}
