protected override void Dispose(bool disposing) { if (disposing) { if (msTz0WmiInstance != null) { msTz0WmiInstance.Dispose(); } clevoWmiInstance.Dispose(); timerFan.Dispose(); timerUI.Stop(); timerUI.Dispose(); notifyIcon.Visible = false; notifyIcon.Dispose(); canvas.Dispose(); icon.Dispose(); iconBitmap.Dispose(); font.Dispose(); brushBg.Dispose(); brushFg.Dispose(); brushText.Dispose(); brushDrop.Dispose(); penLine.Dispose(); } base.Dispose(disposing); }
private void frmWaitMessage_FormClosing(object sender, FormClosingEventArgs e) { updateTimer.Stop(); if (connectionexception != null) { MessageBox.Show("Connection Exception:" + connectionexception.Message); Application.Exit(); } }
// I have no idea why just calling BringToFront does not work, but it does not. Go figure private void bringDialogToFront() { try { TopMost = true; System.Windows.Forms.Timer t = new System.Windows.Forms.Timer { Interval = 100 }; t.Tick += (s, e) => { TopMost = false; t.Stop(); }; t.Start(); } catch (Exception e) { // in case somebody closes the dialog before the timer fires up Debug.WriteLine("CreateIssue.bringDialogToFront() - exception: " + e.Message); } }
private void SsTimerOnTick(object sender, EventArgs eventArgs) { var active = 1; SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, ref active, 0); if (active != 0) { return; } _ssTimer.Stop(); this.WriteLog("Screensaver off. Start timer..."); StartTimer(); }
static void SomeFuncForTimerWF(Object source, EventArgs e) { Console.WriteLine("Timer TimerWF is working!"); TimerWF.Stop(); TimerWF.Dispose(); }