コード例 #1
0
        private void Next_Click(object sender, EventArgs e)
        {
            int     Range      = 1;
            decimal cumulative = 0;
            Server  current    = new Server();

            current.ID = Program.Servers.Count + 1;
            for (int rows = 0; rows < ServerGrid.RowCount - 1; rows++)
            {
                TimeDistribution tmp = new TimeDistribution();
                tmp.Time            = Int32.Parse(ServerGrid.Rows[rows].Cells[0].Value.ToString());
                tmp.Probability     = Decimal.Parse(ServerGrid.Rows[rows].Cells[1].Value.ToString());
                tmp.CummProbability = tmp.Probability + cumulative;
                cumulative          = tmp.CummProbability;
                tmp.MinRange        = Range + 1;
                tmp.MaxRange        = Convert.ToInt32(cumulative * 100);
                Range = tmp.MaxRange;
                current.TimeDistribution.Add(tmp);
            }
            Program.Servers.Add(current);
            if (Count == 0)
            {
                Results form = new Results(ref Program);
                form.Show();
                this.Close();
            }
            else
            {
                ServerForm form = new ServerForm(ref Program, Count - 1);
                form.Show();
                this.Close();
            }
        }
コード例 #2
0
        private void Next_Click(object sender, EventArgs e)
        {
            int     Range      = 1;
            decimal cumulative = 0;

            for (int rows = 0; rows < ClientGrid.RowCount - 1; rows++)
            {
                TimeDistribution tmp = new TimeDistribution();
                tmp.Time            = Int32.Parse(ClientGrid.Rows[rows].Cells[0].Value.ToString());
                tmp.Probability     = Decimal.Parse(ClientGrid.Rows[rows].Cells[1].Value.ToString());
                cumulative         += tmp.Probability;
                tmp.MinRange        = Range;
                tmp.MaxRange        = (int)(cumulative * 100);
                tmp.CummProbability = cumulative;
                Range = tmp.MaxRange + 1;
                Program.InterarrivalDistribution.Add(tmp);
            }
            int Count = Int32.Parse(ServersCount.Text);

            Program.NumberOfServers = Count;
            ServerForm form = new ServerForm(ref Program, Count - 1);

            form.Show();
        }