>Ops.. hai ragione scusa!
>
>public void DataReceivedHandler(object sender, SerialDataReceivedEventArgs
>e)
> {
> SerialPort sp = (SerialPort)sender;
> string indata = sp.ReadExisting();
> this.Dispatcher.Invoke(() =>
> {
> this.Box_distanza.Text = "Ciao Mondo!";
> });
> }
>
>comunque ho questo errore:
>Errore 1 Impossibile convertire espressione lambda nel tipo 'System.Delegate'
>perché non è un tipo delegato
ok perchè stai compilando in 4, e non in 4.5, allora devi semplicemente dichiarare il delegato così se non sbaglio:
public void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
{
SerialPort sp = (SerialPort)sender;
string indata = sp.ReadExisting();
this.Dispatcher.Invoke(new Action(() =>
{
this.Box_distanza.Text = "Ciao Mondo!";
}));
}
Michael Denny | Visual C# MVP
http://blogs.dotnethell.it/Regulator/
http://dennymichael.wordpress.com
http://mvp.microsoft.com/mvp/Michael%20Denny-5000735
Twitter: @dennymic