Basically it is
T.T ick +=(sender, args)=& gt; T_Tick (sender, args, I, end);
Public static void t_Tick (object o, EventArgs e,
Neo. ApplicationFramework. Tools. OpcClient. GlobalDataItem I, int the end)
{
ImgChange (I, end);
}
Public static void imgChange (Neo. ApplicationFramework. View OpcClient. GlobalDataItem I, int the end)
{
Int SRC=https://bbs.csdn.net/topics/i.Value;
SRC=https://bbs.csdn.net/topics/srcI.V alue=https://bbs.csdn.net/topics/src;
}
But this event how close?
Public static void timerOff (Neo. ApplicationFramework. View OpcClient. GlobalDataItem I, int the end)
{
T.T ick -=(sender, args)=& gt; T_Tick (sender, args, I, end);
T.E nabled=false;
}
Such complains is not applied to the instance? What reason?
CodePudding user response:
Because you are using the relationship between anonymous functions,The method assigned to the event, and then directly + - event,
System. Windows. Forms. The Timer t=new System. Windows. The Forms, the Timer ();
Public EventHandler eve;
Private void Form1_Load (object sender, EventArgs e)
{
Eve=new System. EventHandler (aa, ee)=& gt; Tick (aa, ee, "111"));
T.I nterval=3000;
T.T ick +=eve;
t.Start();//3 seconds to pop up a 111
}
Private void Tick (object sender, EventArgs e, string STR)
{
MessageBox. Show (STR);
}
Private async void button1_Click (object sender, EventArgs e)
{
T.S top ();
T.T ick -=eve;
t.Start();//check if still pops up 111
}
CodePudding user response:
Because two anonymous functions, though a Yang two peas in a pod, but the actual reference is not the same,Like
The model m1=new model ();
M1=new model ();
The two new model (); Is a different object,
CodePudding user response:
the Timer has been tried in the past, get lost, don't use FluentScheduler it sweet