المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Making a CONTAINER



C# Programming
11-03-2009, 10:00 AM
I have this little code I wrote:
(and with the help from some nice persons from this forum.)

using System;
using System.Windows.Forms;
using System.IO.Ports;

namespace serialport
{
public partial class Form1 : Form
{
private SerialPort port = new SerialPort("COM3", 9600, Parity.Odd, 8, StopBits.One);

public Form1()
{
InitializeComponent(); port.Open();
}


private void buttonSS_Click(object sender, EventArgs e)
{
timer1.Enabled = !timer1.Enabled; //on/off event
}



private void timer1_Tick(object sender, EventArgs e)
{
port.DtrEnable = !port.DtrEnable;

if (port.DtrEnable)
{
timer1.Interval = (int)numericUpDown1.Value;//1 val
}
else
{
timer1.Interval = (int)numericUpDown2.Value;//2 val
}
}

Now, What I want is a little complicated because I want to store the values from inside timer1_Tick event handrler into some sort of container. I want to make 10 (or more) containers that can hold different values I choose from those timer.intervals(or numUpDown). Then, to be able to play them in order, one container after another. When first container finish its doings, then the second container with his custom values enter and start to run, then the third,etc.
The program is an application for a led who is connected to serial port(rs232) and it flashes from what values I send from here.
Thanks
~Teodor~