private void On(object sender, EventArgs e) { MenuItem it = sender as MenuItem; it.Checked = !it.Checked; KeyListenercs.OnOff(it.Checked); }
public Tray() { trayMenu = new ContextMenu(); TeeMenu(); KeyListenercs.Start(); DataBase.Connect(); trayIcon = new NotifyIcon(); trayIcon.Text = "Avain"; if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Avain\\Key.ico")) { trayIcon.Icon = new Icon(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Avain\\Key.ico"); } else { trayIcon.Icon = new Icon("Resources\\Key.ico"); } KeyListenercs.NI = trayIcon; trayIcon.ContextMenu = trayMenu; trayIcon.Visible = true; }
private void OnExit(object sender, EventArgs e) { AccessSQL.AccessHandler.SuljeYhteys(); KeyListenercs.Unsubscribe(); Application.Exit(); }