Jak wywołać metodę w zdarzeniu

0

Napisałem kod i w miejscu gdzie umieściłem komentarz chciałbym wywołać metodę odswiez, jednak nie wiem jak to zrobić

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Timers;

namespace odswiezanieStrony
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }
        private static System.Timers.Timer aTimer;
        public static void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            //Tu chciałbym wywyłać metodę odswież lub wywołać webBrowser1.Refresh();
        }
        public void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

            aTimer = new System.Timers.Timer(10000);
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 10000;
            aTimer.Enabled = true;
            
        }
       
        public void odswiez()
        {
            
                webBrowser1.Refresh();
            
        }
    }
}
1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

//using System.Timers;

namespace odswiezanieStrony
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Timer aTimer;

        void aTimer_Tick(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
        }

        public void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            aTimer = new Timer();
            aTimer.Tick += aTimer_Tick;
            aTimer.Interval = 10000;
            aTimer.Enabled = true;
        }
    }
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1