private void BW_NPipe_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { if (work && !BW_NPipe.IsBusy) { Task.Delay(1000); BW_NPipe.RunWorkerAsync(); } }
protected override void OnStart(string[] args) { work = true; server?.Dispose(); cts = new CancellationTokenSource(); ct = cts.Token; NewServer(); if (!BW_NPipe.IsBusy) { BW_NPipe.RunWorkerAsync(); } }