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 System.Xml; using TradeIdeas; using TradeIdeas.XML; using TradeIdeas.TIProData.Configuration; namespace TradeIdeas.TIProGUI { public partial class TopListHistoryRecords : Form { private List _phrases; private const float DEFAULT_FONT_SIZE = 8.25F; private FontManager _fontManager; public bool isOK = false; private int _maxRecords = 100; /// /// The server would catch this and do the same thing for you. /// We do it a little sooner here just to give the user feedback. /// Range should be 1 - 1000. /// /// /// private int ForceInRange(int initialValue) { if (initialValue < 1) return 1; if (initialValue > 1000) return 1000; return initialValue; } public TopListHistoryRecords(int recordCount) { InitializeComponent(); _fontManager = new FontManager(this, DEFAULT_FONT_SIZE); _fontManager.selectTheFont(); Font = GuiEnvironment.FontSettings; _maxRecords = ForceInRange(recordCount); textBoxMaxRecordCount.Text = _maxRecords.ToString(); this.StartPosition = FormStartPosition.CenterParent; Icon = GuiEnvironment.Icon; populateStrings(); } public void populateStrings() { _phrases = GuiEnvironment.XmlConfig.Node("CONFIG_WINDOW").Node("PHRASES"); lblMaxRecordCount.Text = _phrases.Node("MAX_RECORD_COUNT").PropertyForCulture("TEXT", "***"); } public int getMaxRecords() { return _maxRecords; } private void textBoxMaxRecordCount_TextChanged(object sender, EventArgs e) { btnOK.Enabled = (int.TryParse(textBoxMaxRecordCount.Text, out _maxRecords) && (_maxRecords == ForceInRange(_maxRecords))); } private void btnOK_Click(object sender, EventArgs e) { isOK = true; this.Close(); } private void btnCancel_Click(object sender, EventArgs e) { isOK = false; this.Close(); } } }