Dispose() protected méthode

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
Résultat void
Exemple #1
0
		internal static MainDialogResult ShowMainDialog(MainDialogResult initial) {
			formMain Dialog = new formMain();
			Dialog.Result = initial;
			Dialog.ShowDialog();
			MainDialogResult result = Dialog.Result;
			Dialog.Dispose();
			return result;
		}
Exemple #2
0
		internal static MainDialogResult ShowMainDialog(MainDialogResult initial)
		{
			using (formMain Dialog = new formMain())
			{
				Dialog.Result = initial;
				Dialog.ShowDialog();
				MainDialogResult result = Dialog.Result;
				//Dispose of the worker thread when closing the form
				//If it's still running, it attempts to update a non-existant form and crashes nastily
				Dialog.routeWorkerThread.Dispose();
				Dialog.trainWatcher.Dispose();
				Dialog.routeWatcher.Dispose();
				Dialog.Dispose();
				return result;
			}
		}