Пример #1
0
        private void FireSymbolSelected(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;

            symbolButton.Text = tsmi.Text;

            this.SuspendLayout();
            instrumentButtonDropDown.SuspendLayout();
            instrumentButton.SuspendLayout();

            instrumentButtonDropDown.Items.Clear();
            instrumentButton.Text = "Instrument...";

            foreach (Instrument instrument in controller.Cache.Instruments)
            {
                if (tsmi.Tag.Equals(instrument[DatabaseObject.SYMBOL]))
                {
                    ToolStripMenuItem instrument_tsmi = new ToolStripMenuItem();
                    instrument_tsmi.Name   = instrument[DatabaseObject.INSTRUMENT_ID];
                    instrument_tsmi.Text   = instrument[DatabaseObject.NAME];
                    instrument_tsmi.Size   = new System.Drawing.Size(188, 22);
                    instrument_tsmi.Click += new EventHandler(FireInstrumentSelected);
                    instrument_tsmi.Tag    = instrument;
                    instrumentButtonDropDown.Items.Add(instrument_tsmi);
                }
            }

            instrumentButtonDropDown.ResumeLayout();
            instrumentButton.ResumeLayout();
            this.ResumeLayout();
        }