Hi,
I am facing a kind of problem, and I would like some help.
I would like to display a real time value (statistic) from a server. There s already a dll to implente to manipulate the server (connection, getting values,...)
The dll is generally:
public Class ServerClass{
// attributs
// constructor
// methods
public event EventHandler Received;
}
I try this code on windows form, and it works perfectly. I get the values instantly.
using dll_name;
private void BtnGet_Click(object sender, RoutedEventArgs e){
// class instantiation
ServerClass c=new ServerClass() // with parameters
// set attributs
c.Received+=OnReceivedResponse;
}
private void OnReceivedResponse(object sender, EventArgs e){
listBox.Items.Add(e.toSteing());
}
Now I want to do the same in asp.net mvc, but I can't get the values.
What I have tried:
// global.asax
public class WebAppli: HttpApplication{
public static ServerClass c;
protected void Application_Start(object sender, EventArgs e){
c= new serverClass() // with params
}
}
// controller
public void Result(){
Response.ContentType="text/stream";
// codes
WebAppli.c.Received+=(sender,ev)=>
{
// All code inside this function doesn t work
Response.Write("data:{0}\n\n, ev.toString())
Response.flush
}
}
Is there something I should set in global.asax (asp.net life cycle)
Thank you.