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;
using Mesnac.Basic;
using Mesnac.Gui.Run.Global;
namespace Mesnac.Gui.Run.Dialog
{
public partial class FrmSetLocale : Form
{
private string caption = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_Caption")); //提示
public FrmSetLocale()
{
InitializeComponent();
this.InitUIMethod();
this.InitData();
}
#region 属性定义
///
/// 选中的区域列表
///
public List SelectedLocales
{
get
{
List lst = new List();
foreach(object item in this.clbLocales.CheckedItems)
{
lst.Add(item as LocaleItem);
}
return lst;
}
}
#endregion
#region 初始化界面元素
///
/// 初始化界面元素
///
private void InitUIMethod()
{
this.Text = StringParser.Parse(ResourceService.GetString("Dialog_FrmSetLocale_Text")); //设置区域;
this.groupBox1.Text = this.Text;
this.btnOK.Text = StringParser.Parse(ResourceService.GetString("Dialog_Button_OK")); //确定
this.btnCancel.Text = StringParser.Parse(ResourceService.GetString("Dialog_Button_Cancel")); //取消
}
#endregion
#region 初始化区域数据
///
/// 初始化区域数据
///
private void InitData()
{
foreach (Mesnac.Basic.LocaleItem item in Mesnac.Basic.LocaleHelper.AllLocales.Values)
{
this.clbLocales.Items.Add(item);
if (AppConfigHandler.Instance.SysMessages.LocaleCodes.Contains(item.Code))
{
this.clbLocales.SetItemChecked(this.clbLocales.Items.Count - 1, true);
}
}
}
#endregion
#region 确定按钮
private void btnOK_Click(object sender, EventArgs e)
{
string msg1 = StringParser.Parse(ResourceService.GetString("Dialog_FrmSetLocale_Msg_btnOK1")); //确定要使此区域设置生效吗!
DialogResult result = MessageBox.Show(msg1, this.caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (result == System.Windows.Forms.DialogResult.Yes)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
else if (result == System.Windows.Forms.DialogResult.No)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
else
{
return;
}
}
#endregion
#region 取消按钮
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
#endregion
}
}