Automatak.Simulator.DNP3.Components.TemplateControl.numericUpDownCount_ValueChanged C# (CSharp) Method

numericUpDownCount_ValueChanged() private method

private numericUpDownCount_ValueChanged ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void numericUpDownCount_ValueChanged(object sender, EventArgs e)
        {
            if (this.numericUpDownCount.Value > this.listViewMeas.Items.Count)
            {
                int number = Decimal.ToInt32(this.numericUpDownCount.Value) - this.listViewMeas.Items.Count;
                int start = this.listViewMeas.Items.Count;
                listViewMeas.SuspendLayout();
                for (int i = 0; i < number; ++i)
                {
                    listViewMeas.Items.Add(CreateItem(start, PointClass.Class1));
                    ++start;
                }
                listViewMeas.ResumeLayout();
            }
            else
            {
                listViewMeas.SuspendLayout();
                while (this.numericUpDownCount.Value < this.listViewMeas.Items.Count)
                {
                    this.listViewMeas.Items.RemoveAt(listViewMeas.Items.Count - 1);
                }
                listViewMeas.ResumeLayout();
            }
        }