using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using GZTW.AyaNova.BLL;
using Infragistics.Win;
using log4net;
namespace AyaNova
{
///
/// Summary description for LocaleNewSelector.
///
public class LocaleNewSelector : System.Windows.Forms.Form
{
// Create a logger for use in this class
//case 1039 private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private System.Windows.Forms.Panel LocaleNewSelector_Fill_Panel;
private GZTW.WinForm.Controls.GZUltraComboEditor cbLocaleID;
private System.Windows.Forms.Button btnOK;
private Infragistics.Win.UltraWinEditors.UltraTextEditor edNewLocaleName;
private Infragistics.Win.Misc.UltraLabel lblName;
private Infragistics.Win.Misc.UltraLabel ultraLabel1;
private System.Windows.Forms.Button btnCancel;
//private System.ComponentModel.IContainer components;
public LocaleNewSelector()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
//
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
// if(components != null)
// {
// components.Dispose();
// }
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocaleNewSelector));
this.LocaleNewSelector_Fill_Panel = new System.Windows.Forms.Panel();
this.ultraLabel1 = new Infragistics.Win.Misc.UltraLabel();
this.lblName = new Infragistics.Win.Misc.UltraLabel();
this.edNewLocaleName = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.cbLocaleID = new GZTW.WinForm.Controls.GZUltraComboEditor();
this.LocaleNewSelector_Fill_Panel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.edNewLocaleName)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cbLocaleID)).BeginInit();
this.SuspendLayout();
//
// LocaleNewSelector_Fill_Panel
//
this.LocaleNewSelector_Fill_Panel.Controls.Add(this.ultraLabel1);
this.LocaleNewSelector_Fill_Panel.Controls.Add(this.lblName);
this.LocaleNewSelector_Fill_Panel.Controls.Add(this.edNewLocaleName);
this.LocaleNewSelector_Fill_Panel.Controls.Add(this.btnCancel);
this.LocaleNewSelector_Fill_Panel.Controls.Add(this.btnOK);
this.LocaleNewSelector_Fill_Panel.Controls.Add(this.cbLocaleID);
this.LocaleNewSelector_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default;
this.LocaleNewSelector_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill;
this.LocaleNewSelector_Fill_Panel.Location = new System.Drawing.Point(0, 0);
this.LocaleNewSelector_Fill_Panel.Name = "LocaleNewSelector_Fill_Panel";
this.LocaleNewSelector_Fill_Panel.Size = new System.Drawing.Size(498, 153);
this.LocaleNewSelector_Fill_Panel.TabIndex = 0;
//
// ultraLabel1
//
this.ultraLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ultraLabel1.BorderStyleOuter = Infragistics.Win.UIElementBorderStyle.None;
this.ultraLabel1.Location = new System.Drawing.Point(0, 55);
this.ultraLabel1.Name = "ultraLabel1";
this.ultraLabel1.Size = new System.Drawing.Size(489, 19);
this.ultraLabel1.TabIndex = 94;
this.ultraLabel1.Tag = "";
this.ultraLabel1.Text = "LT:Locale.Label.UI.DestLocale";
this.ultraLabel1.WrapText = false;
//
// lblName
//
this.lblName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblName.BorderStyleOuter = Infragistics.Win.UIElementBorderStyle.None;
this.lblName.Location = new System.Drawing.Point(0, 0);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(479, 18);
this.lblName.TabIndex = 93;
this.lblName.Tag = "";
this.lblName.Text = "LT:Locale.Label.UI.SourceLocale";
this.lblName.WrapText = false;
//
// edNewLocaleName
//
this.edNewLocaleName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.edNewLocaleName.Location = new System.Drawing.Point(0, 74);
this.edNewLocaleName.MaxLength = 15;
this.edNewLocaleName.Name = "edNewLocaleName";
this.edNewLocaleName.Size = new System.Drawing.Size(498, 24);
this.edNewLocaleName.TabIndex = 29;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Image = ((System.Drawing.Image)(resources.GetObject("btnCancel.Image")));
this.btnCancel.Location = new System.Drawing.Point(0, 111);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(90, 40);
this.btnCancel.TabIndex = 28;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Image = ((System.Drawing.Image)(resources.GetObject("btnOK.Image")));
this.btnOK.Location = new System.Drawing.Point(403, 111);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(90, 40);
this.btnOK.TabIndex = 27;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// cbLocaleID
//
this.cbLocaleID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbLocaleID.Location = new System.Drawing.Point(0, 28);
this.cbLocaleID.Name = "cbLocaleID";
this.cbLocaleID.Size = new System.Drawing.Size(498, 24);
this.cbLocaleID.TabIndex = 0;
this.cbLocaleID.SelectionChanged += new System.EventHandler(this.cbLocaleID_SelectionChanged);
//
// LocaleNewSelector
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(498, 153);
this.Controls.Add(this.LocaleNewSelector_Fill_Panel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LocaleNewSelector";
this.ShowInTaskbar = false;
this.Closing += new System.ComponentModel.CancelEventHandler(this.LocaleNewSelector_Closing);
this.Load += new System.EventHandler(this.LocaleNewSelector_Load);
this.LocaleNewSelector_Fill_Panel.ResumeLayout(false);
this.LocaleNewSelector_Fill_Panel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.edNewLocaleName)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbLocaleID)).EndInit();
this.ResumeLayout(false);
}
#endregion
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
//
#region Global vars / Properties
private string mSelectedLocale="";
public string SelectedLocale
{
get{ return mSelectedLocale;}
}
private string mNewLocale="";
public string NewLocale
{
get{ return mNewLocale;}
}
#endregion
private LocaleList CurrentLocales;
#region Load / close events
private void LocaleNewSelector_Load(object sender, System.EventArgs e)
{
//case 1039 //log.Debug("LocaleNewSelector_Load");
CurrentLocales = LocaleList.GetList();
Util.Localize(this);
LoadCombo();
Application.Idle+= new EventHandler(Application_Idle);
}
private void LocaleNewSelector_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//case 1039 //log.Debug("LocaleNewSelector_Closing");
Application.Idle-= new EventHandler(Application_Idle);
if(mSelectedLocale=="")
this.DialogResult=DialogResult.Cancel;
}
#endregion
#region Idle processing
private void Application_Idle(object sender, EventArgs e)
{
mNewLocale=this.edNewLocaleName.Text;
if(CurrentLocales.Contains(mNewLocale)) mNewLocale="";
this.btnOK.Enabled = mSelectedLocale!="" && mNewLocale!="";
}
#endregion
#region Combo box intialization / events
private void LoadCombo()
{
//case 1039 //log.Debug("LoadCombo");
cbLocaleID.Items.Clear();
foreach(LocaleList.LocaleListInfo lif in CurrentLocales)
{
cbLocaleID.Items.Add(lif.Locale);
}
cbLocaleID.SelectedIndex=0;
}
private void cbLocaleID_SelectionChanged(object sender, System.EventArgs e)
{
mSelectedLocale=cbLocaleID.SelectedItem.DataValue.ToString();
}
#endregion
private void btnCancel_Click(object sender, System.EventArgs e)
{
mSelectedLocale="";
mNewLocale="";
this.DialogResult=DialogResult.Cancel;
this.Close();
}
private void btnOK_Click(object sender, System.EventArgs e)
{
this.DialogResult=DialogResult.OK;
this.Close();
}
private void btnRefresh_Click(object sender, System.EventArgs e)
{
LoadCombo();
}
//--------------------------------------------------------
}
}