private void DeviceList_ItemsAdding(object sender, ItemsAddingEventArgs e) { if (DeviceList.Items.Count >= 8 && !ResizeDone) { olvColumn7.MaximumWidth = 83; olvColumn7.MinimumWidth = 83; olvColumn7.Width = 83; ResizeDone = true; } //Notifications are not suppressed if (WindowState == FormWindowState.Minimized && Properties.Settings.Default.SuppressNotifications == 2) { var Ad = e.ObjectsToAdd.Cast <Device>().ToList(); if (Ad.Count > 0) { Device Device = Ad[0]; ToastAPI.ShowPrompt(string.Format("{0}\nIP:{1}\nMAC:{2}", Properties.Resources.NewTargetNotificationPrompt, Device.IP, Device.MAC), NotificationPurpose.TargetDiscovery, Device.IP.ToString(), Device.MAC.ToString()); } } }
static void Main(string[] args) { //Allow only one instance of NetStalker to be running at a time using (Mutex AppMutex = new Mutex(true, "NetStalker", out bool createdNew)) { if (createdNew) { ToastAPI.AttachHandler(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Main(args)); } } }
/// <summary> /// Attach the OnExit event handler, to do some clean up before exiting /// </summary> public static void AttachOnExitEventHandler(IView view) { Application.ApplicationExit += (object sender, EventArgs e) => { //Terminate the Blocker/Redirector Blocker_Redirector.CLoseBR(); //Terminate the scanner Scanner.CloseAllCaptures(view); //Clean all notifications ToastAPI.ClearNotificationHistory(); //Toast notifications service cleanup ToastAPI.DestroyAPI(); }; }
public void Main_Resize(object sender, EventArgs e) { if (WindowState == FormWindowState.Minimized) { if (Properties.Settings.Default.Minimize == "Tray") { Hide(); TrayIcon.Visible = true; TrayIcon.ShowBalloonTip(2); } if (Properties.Settings.Default.SuppressNotifications == 0) { ToastAPI.ShowPrompt(Properties.Resources.NotificationsPrompt, NotificationPurpose.NotificationsSuppression); } } }
private void Main_Load(object sender, EventArgs e) { Controller.AttachOnExitEventHandler(this); ToastAPI.AttachHandler(); }