0

After I changed the line timer.Tick += new EventHandler(timer_Tick); to timer.Tick += timer_Tick; it still gives an error which is No overload for 'timer_Tick' matches delegate 'System.EventHandler'namespace App3

{

public sealed partial class MainPage : Page
{
    public MainPage()
    {

        this.InitializeComponent();

    }
    private int myCount;
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        DispatcherTimer timer = new DispatcherTimer();
        timer.Tick += timer_Tick;
        timer.Interval = TimeSpan.FromSeconds(5);
        timer.Start();

    }


    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        base.OnNavigatedFrom(e);
    }

    private void Btm_Click(object sender, RoutedEventArgs e)
    {
        App3.timer.Start();
    }

          private void timer_Tick(object sender, EventArgs e)
    {
        myCount++;
        Label.Text = myCount.ToString();
    }

The reason you keep getting the inner nodes is because you incorrectly iterate over the outer list twice. The inner loop should iterate only over tag:

doc = new XmlSlurper().parse("things.xml")
doc.thing.each { thing ->
  println "thing index: ${thing.@indexNum}"
  thing.children().each { tag ->
    println "  ${tag.name()}: ${tag.text()}"
  }
}

Output:

thing index: 1
  a: 123
  b: 456
  c: 789
thing index: 2
  a: 123
  b: 456
  c: 789
4

0 回答 0