Timer 使用计时器更新Notifyicon文本的内容

Timer 使用计时器更新Notifyicon文本的内容,timer,refresh,auto-update,notifyicon,trayicon,Timer,Refresh,Auto Update,Notifyicon,Trayicon,我在更新系统托盘应用程序的工具提示中的文本时遇到问题。我有一个定时器更新几个字符串,但它不会更新notifyicon文本。这是我试过的 //This is in my main System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 50

我在更新系统托盘应用程序的工具提示中的文本时遇到问题。我有一个定时器更新几个字符串,但它不会更新notifyicon文本。这是我试过的

//This is in my main
    System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 5000;
            aTimer.Enabled = true;



        }

        private static void OnTimedEvent(object sender, ElapsedEventArgs e)
        {

            ProcessIcon.GetDNS();
            ProcessIcon.GetIP();
            ProcessIcon.getMAC();
                    ProcessIcon.showALL();
                    Fixes.SetNotifyIconText(ni, ProcessIcon.showALL()); //This one will not update, the others update fine. 


        }//End part of my main

//This part is in another class for the notifyicon part.


            public void Display()
        {



            // Put the icon in the system tray and allow it react to mouse clicks.          
            ni.MouseClick += new MouseEventHandler(ni_MouseClick1);
            ni.Icon = new Icon("WhoAmI.ico");
            Fixes.SetNotifyIconText(ni, showALL());
            ni.Visible = true;




            // Attach a context menu.
            ni.ContextMenuStrip = new ContextMenus().Create();

        }

我删除了计时器,现在当用户将鼠标悬停在图标上时调用每个函数