public void Dispose() { ControlItem.Dispose(); AltItem.Dispose(); mExit.Dispose(); cMenu.Dispose(); TrayIcon.Dispose(); }
//Functions related with IconTray protected override void OnClosing(CancelEventArgs e) { if (!fInstClose) { e.Cancel = true; this.Hide(); if (!fOneShot) { AppNotifyIcon.ShowBalloonTip(3000); fOneShot = true; } } else { NotifyMenu.Dispose(); AppNotifyIcon.Dispose(); } base.OnClosing(e); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _contextMenu.Dispose(); } disposedValue = true; } }
/// <summary> /// 释放资源方法 /// </summary> /// <param name="disposing">true值表示用户直接或间接调用了这个方法,释放托管和非托管资源;false值表示垃圾回收器调用该方法,仅释放非托管资源</param> protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!_disposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if (disposing) { _niMain.Dispose(); _contextMenu.Dispose(); _autoUpdateTimer?.Dispose(); _updater?.Dispose(); } // Call the appropriate methods to clean up // unmanaged resources here. // Note disposing has been done. _disposed = true; } }
public void Dispose(bool isTrue) { KuromojiTokenizer.Dispose(); JapEngDictionary.Dispose(); if (KanjiDictionary != null) { KanjiDictionary.Dispose(); } if (ExampleDictionary != null) { ExampleDictionary.Dispose(); } if (synth != null) { synth.Dispose(); } if (UserPrefs != null) { GeneralPreference.Close(); } if (isTrue) { if (notifyIcon != null) { notifyIcon.Dispose(); } if (notifyIconContextMenu != null) { notifyIconContextMenu.Dispose(); } } }