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 ICSharpCode.Core;
using Mesnac.Core;

namespace Mesnac.Gui.Run.Dialog
{
    public partial class FrmNewMessage : Form
    {
        private string caption = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_Caption")); //提示

        public FrmNewMessage()
        {
            InitializeComponent();
            this.InitUIMethod();
        }

        #region 属性定义
        /// <summary>
        /// 资源ID
        /// </summary>
        public string MsgId
        {
            get
            {
                return this.txtMsgId.Text;
            }
        }

        #endregion

        #region 初始化界面元素

        public void InitUIMethod()
        {
            this.Text = StringParser.Parse(ResourceService.GetString("Dialog_FrmNewMessage_Text"));  //添加资源项;
            this.groupBox1.Text = this.Text;
            this.label1.Text = StringParser.Parse(ResourceService.GetString("Dialog_FrmNewMessage_label1_Text"));   //资源ID
            this.btnOK.Text = StringParser.Parse(ResourceService.GetString("Dialog_Button_OK"));    //确定
            this.btnCancel.Text = StringParser.Parse(ResourceService.GetString("Dialog_Button_Cancel"));    //取消
        }

        #endregion

        #region 确定按钮

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.txtMsgId.Text))
            {
                string msg1 = StringParser.Parse(ResourceService.GetString("Dialog_FrmNewMessage_Msg_btnOK1"));    //请输入资源ID!
                MessageBox.Show(msg1, this.caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        #endregion


        #region 取消按钮

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }

        #endregion

    }
}