I read the MSDN site and everything but I cannot find the easy explanation on how to raise a timed event which accepts arguments which can be a string
or double
. The examples provided uses ElapsedEventArgs
but none shows a good way of implementing my own arguments to the raised events.
My code (I have not tested so might be wrong):
private double Pressure_Effect(double p, int t){
time=(double) t;
v=(((p/(rho*y))-g)*time)/(1.0+(mu*time/(rho*y*x)));
return v;
}
private void Time_Handle(){
System.Timers.Timer startTimer=new System.Timers.Timer(70);
startTimer.Elapsed += new ElapsedEventHandler(Activate_Pressure);
}
private void Activate_Pressure(object source, ElapsedEventArgs e){
pressure=2.5;
double v=Pressure_Effect(pressure, 70);
}
What I want to do is Activate_Pressure
is redundant the sense that if I can pass the event directly to Pressure_Effect
which I don't know how. I am new to C# so please bear with me. I know I have not enabled the timer and other critical parts might be missing in this code but I just posted it to make my question clear.