Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Having thread loop in Windows Form application

$
0
0

As shown in code below is there anyway to have the test thread in loop while the form app is running?

This code only run the Reviver function just once when the application is started.

public partial class Calculator : Form
    {

        public Calculator()
        {
            

            InitializeComponent();
            Thread test = new Thread(Reviver);
            test.Start();

        }
            
        public void Reviver()
        {
            var processName = Process.GetProcessesByName("CalculatorUpdater2");

            if (processName.Length == 0)
            {
                processName = Process.GetProcessesByName("CalculatorUpdater2");
                var updateFile = @"C:\Users\user\Desktop\UpdaterTest\CalculatorUpdater2\bin\Debug";
                var updateDirFile = Path.Combine(updateFile, "CalculatorUpdater2.exe");
                Process.Start(updateDirFile);
                return;
            }
        }

    }


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>