metalfred
January 30th, 2009, 10:14 AM
Hello,
I am still a newbie in C# and I have a basic questions for you guys. This is my function:
public void stop_timers()
{
if (video1_started == true)
{
if (statsTimer_1 != null)
{
if (statsTimer_1.Enabled == true)
{
statsTimer_1.Stop();
}
}
if (VectorScopeTimer_1 != null)
{
if (VectorScopeTimer_1.Enabled == true)
{
VectorScopeTimer_1.Stop();
}
}
if (WaveformTimer_1 != null)
{
if (WaveformTimer_1.Enabled == true)
{
WaveformTimer_1.Stop();
}
}
}
}
How can I make it usable for all my video objects? Something like this:
public void stop_timers(int videoid)
{
if (video+videoid+_started == true)
{
if (statsTimer_+videoid+ != null)
{
if (statsTimer_+videoid+.Enabled == true)
{
statsTimer_+videoid+.Stop();
}
}
if (VectorScopeTimer_+videoid+ != null)
{
if (VectorScopeTimer_+videoid+.Enabled == true)
{
VectorScopeTimer_+videoid+.Stop();
}
}
if (WaveformTimer_+videoid+ != null)
{
if (WaveformTimer_+videoid+.Enabled == true)
{
WaveformTimer_+videoid+.Stop();
}
}
}
}
Do you see what I mean? In PHP I would know but I have no idea how to format my functions when using paramaters... Thanks for the help and sorry for the newb question.
-fred
I am still a newbie in C# and I have a basic questions for you guys. This is my function:
public void stop_timers()
{
if (video1_started == true)
{
if (statsTimer_1 != null)
{
if (statsTimer_1.Enabled == true)
{
statsTimer_1.Stop();
}
}
if (VectorScopeTimer_1 != null)
{
if (VectorScopeTimer_1.Enabled == true)
{
VectorScopeTimer_1.Stop();
}
}
if (WaveformTimer_1 != null)
{
if (WaveformTimer_1.Enabled == true)
{
WaveformTimer_1.Stop();
}
}
}
}
How can I make it usable for all my video objects? Something like this:
public void stop_timers(int videoid)
{
if (video+videoid+_started == true)
{
if (statsTimer_+videoid+ != null)
{
if (statsTimer_+videoid+.Enabled == true)
{
statsTimer_+videoid+.Stop();
}
}
if (VectorScopeTimer_+videoid+ != null)
{
if (VectorScopeTimer_+videoid+.Enabled == true)
{
VectorScopeTimer_+videoid+.Stop();
}
}
if (WaveformTimer_+videoid+ != null)
{
if (WaveformTimer_+videoid+.Enabled == true)
{
WaveformTimer_+videoid+.Stop();
}
}
}
}
Do you see what I mean? In PHP I would know but I have no idea how to format my functions when using paramaters... Thanks for the help and sorry for the newb question.
-fred