Ejemplo n.º 1
0
        private void clockTimer_Tick(object sender, EventArgs e)
        {
            simulationTime += updateFrequency;
            SimulationEvent tick = SimulationEventFactory.BuildEvent(ref simModel, "TimeTick");

            ((IntegerValue)tick["Time"]).value = simulationTime;
            netClient.PutEvent(tick);

            EventListBoxItem lbi = null;

            if (!manualCheckBox.Checked)
            {
                while (eventsListBox.Items.Count > 0)
                {
                    lbi = (EventListBoxItem)eventsListBox.Items[0];
                    if (((IntegerValue)lbi.simEvent["Time"]).value >= simulationTime &&
                        ((IntegerValue)lbi.simEvent["Time"]).value < (simulationTime + updateFrequency))
                    {
                        eventsListBox.Items.Remove(lbi);
                        netClient.PutEvent(lbi.simEvent);
                    }
                    else
                    {
                        break;
                    }
                }
            }



            FormUpdate();
        }
Ejemplo n.º 2
0
        private void sendEventButton_Click(object sender, EventArgs e)
        {
            EventListBoxItem lbi = (EventListBoxItem)eventsListBox.Items[eventsListBox.SelectedIndex];

            ((IntegerValue)lbi.simEvent["Time"]).value = simulationTime;
            netClient.PutEvent(lbi.simEvent);
            eventsListBox.Items.Remove(lbi);
        }