//Initiate the app while launching private void backgroundWorker1_DoWork_1(object sender, DoWorkEventArgs e) { for (int i = 1; i <= 1000; i++) { // Wait 100 milliseconds. if ((i < 350) | (i > 700)) { System.Threading.Thread.Sleep(1); } // Report progress. backgroundWorker1.ReportProgress(i); if (i == 899) { _started = true; } if (i == 900) { _app = new AppInterface(4568); } if (i == 901) { _app.NetworkStart(); } if (i == 902) { SetLocalIP(); } if (i == 903) { backgroundWorker2.RunWorkerAsync(); } if (i == 904) { _draw = true; } if (i == 905) { file = new System.IO.StreamWriter(@"C:\Users\Alexandros\Desktop\stats.txt", true); } } }
//Stop Stream Button private void metroTile4_Click(object sender, EventArgs e) { _app.Dispose(); _app = new AppInterface(4568); _app.NetworkStart(); }