/// <summary> /// Cleans up either unmanaged resources or managed and unmanaged resources. /// </summary> /// <remarks> /// <para> /// If disposing equals true, the method has been called directly or indirectly by a user's /// code. Managed and unmanaged resources can be disposed. /// </para> /// <para> /// If disposing equals false, the method has been called by the runtime from inside the /// finalizer and you should not reference other objects. Only unmanaged resources can /// be disposed. /// </para> /// </remarks> /// <param name="disposing">Was Dispose called manually?</param> private static void Dispose(bool disposing) { if (!isDisposed) // Check To See If Dispose Has Already Been Called { if (disposing) // If disposing Equals true, Dispose All Managed And Unmanaged Resources { if (timer != null) { timer.Dispose(); } if (form != null) { form.Close(); } if (view != null) { view.Dispose(); } if (model != null) { model.Dispose(); } } // Release Any Unmanaged Resources Here, If disposing Was false, Only The Following Code Is Executed isRunning = false; timer = null; form = null; view = null; model = null; } isDisposed = true; // Mark As disposed }
/// <summary> /// Cleans up either unmanaged resources or managed and unmanaged resources. /// </summary> /// <remarks> /// <para> /// If disposing equals true, the method has been called directly or indirectly by a user's /// code. Managed and unmanaged resources can be disposed. /// </para> /// <para> /// If disposing equals false, the method has been called by the runtime from inside the /// finalizer and you should not reference other objects. Only unmanaged resources can /// be disposed. /// </para> /// </remarks> /// <param name="disposing">Was Dispose called manually?</param> private static void Dispose(bool disposing) { if(!isDisposed) { // Check To See If Dispose Has Already Been Called if(disposing) { // If disposing Equals true, Dispose All Managed And Unmanaged Resources if(timer != null) { timer.Dispose(); } if(form != null) { form.Close(); } if(view != null) { view.Dispose(); } if(model != null) { model.Dispose(); } } // Release Any Unmanaged Resources Here, If disposing Was false, Only The Following Code Is Executed isRunning = false; timer = null; form = null; view = null; model = null; } isDisposed = true; // Mark As disposed }