One event tells the Program class to stop a timer. The Program class
assigns an event handler and provides the StopTimerEvent routine to
stop the timer:
Gps.StopTimerEvent += new Gps.StopTimerEventHandler(StopTimerEvent);
private static void StopTimerEvent()
{
// Stop a timer.
}
In the Gps class, a delegate stops the timer by calling StopTimerEvent
in the Program class:
internal delegate void StopTimerEventHandler();
internal static event StopTimerEventHandler StopTimerEvent;
if (null != StopTimerEvent)
{
StopTimerEvent();
}
An event that displays text on the touch panel uses the Dispatcher. In
the Program class, an UpdateText routine displays the text in
sentenceAsStringArray on a touch panel:
public static Program mainProgram;
internal void UpdateText(String[] sentenceAsStringArray)
{
// Display text on touch panel.
}
In the Gps class, the Dispatcher invokes the UpdateText routine to
display the information:
private delegate void UpdateTextDelegate(String[]
sentenceAsStringArray);
Program.mainProgram.Dispatcher.BeginInvoke(new UpdateTextDelegate
(Program.mainProgram.UpdateText), new object[1]
{ sentenceAsStringArray });
This works, but in the last statement above, the Gps class specifies
Program.mainProgram by name. Is there a way to accomplish the same
thing without having to name the class and instance of the UpdateText
routine? This way, the event code could be more generic, like
StopTimerEvent, and not tied to a specific external class and
instance.
Jan
"Jan Axelson" <jan...@gmail.com> wrote in message
news:631ff67b-a693-4ec2...@v25g2000yqk.googlegroups.com...
statusText.TextRuns.Clear();
I get:
System.InvalidOperationException
yet doing the same via the Dispatcher code works OK.
Jan
"Jan Axelson" <jan...@gmail.com> wrote in message
news:b6409bb9-93bb-4a22...@s31g2000yqs.googlegroups.com...
Jan