using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Cosmos.UserFrame;
using Cosmos.BaseFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using Cosmos.UI;
namespace Cosmos.Win
{
///
/// 선택박스
///
public partial class frmChoiceBox : Form
{
private SManager sManager = new SManager(); //이 객체를 통해 업무 Service 호출
private StateServer StateObject = (StateServer)StateServer.GetInstance(); //StateObject : StateServer Object(객체)
private PosStatus m_cPosStatus; //기본정보 참조
///
/// 선택한 버튼 번호 (1 또는 2, 0이면 취소버튼 입력 )
///
public string ChoiceButtonNo { private set; get; }
///
/// 타이틀
///
public string TitleText { set; private get; }
///
/// 메시지
///
public string MessageText { set; private get; }
///
/// 선택버튼 01 텍스트
///
public string ChoiceButtonText01 { set; private get; }
///
/// 선택버튼 02 텍스트
///
public string ChoiceButtonText02 { set; private get; }
///
/// 화면 위치
///
///
///
public void SetLocation(int x = -1, int y = -1)
{
this.m_x = x;
this.m_y = y;
}
public int m_x = -1;
public int m_y = -1;
///
/// 종료버튼 사용 유무
///
public string ExitBtnUse { set; private get; }
public frmChoiceBox()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보
}
private void Form_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 + "()", "");
this.picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
this.picBack.Location = new Point(0, 0);
this.picBack.SendToBack();
this.Size = this.picBack.Size = this.picBack.Image.Size;
// Location
if (this.m_x < 0 || this.m_y < 0)
{
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
}
else
{
this.Location = new Point(this.m_x, this.m_y);
}
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);
btnExit.Visible = true;
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
btnExit.Text = btnExit.Image == null ? "X" : "";
// 닫기 버튼 비활성화 처리
if (ExitBtnUse == "1")
btnExit.Visible = false;
this.lblTitle.Text = this.TitleText.Trim();
this.lblMessage.Text = this.MessageText.Trim();
this.btnChoice1.Text = this.ChoiceButtonText01.Trim();
this.btnChoice2.Text = this.ChoiceButtonText02.Trim();
this.ChoiceButtonNo = "0";
}
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 Form_Activated(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
private void Form_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
private void Form_Closing(object sender, FormClosingEventArgs e)
{
try
{
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
}
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 Button_Click(object sender, EventArgs e)
{
try
{
if (sender == btnExit)
{
this.ChoiceButtonNo = "0";
}
else if (sender == btnChoice1)
{
this.ChoiceButtonNo = "1";
}
else if (sender == btnChoice2)
{
this.ChoiceButtonNo = "2";
}
this.DialogResult = System.Windows.Forms.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);
}
}
}
}