protected override void OnClosing(CancelEventArgs e) { for (int i = 0; i < ListClients.work_collection.Count(); i++) { if (ListClients.work_collection[i] != null) { if (ListClients.work_collection[i].BackgroundWorker5.IsBusy) { ListClients.work_collection[i].BackgroundWorker5.CancelAsync(); } } } if (FormatText.Timer_1_State()) { FormatText.Stop(); } tbi.Dispose(); this.Width = 640; Nirvana.Properties.Settings.Default.Save(); base.OnClosing(e); Application.Current.Shutdown(); }