/// <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) => { if (Main.Devices == null) { return; } //Turn off the BR Blocker_Redirector.BRMainSwitch = false; foreach (var device in Main.Devices) { device.Value.Redirected = false; device.Value.Blocked = false; device.Value.Limited = false; } if (Blocker_Redirector.BRTask != null && Blocker_Redirector.BRTask.Status == System.Threading.Tasks.TaskStatus.Running) { //Wait for the BR task to finish Blocker_Redirector.BRTask.Wait(); //Dispose of the BR task Blocker_Redirector.BRTask.Dispose(); } //Terminate the scanner Scanner.CloseAllCaptures(view); //Clean all notifications NotificationAPI.ClearNotifications(); }; }
public void Main_Resize_1(object sender, EventArgs e) { if (WindowState == FormWindowState.Minimized && !PromptCalled) { if (string.IsNullOrEmpty(Properties.Settings.Default.SuppressN)) { NotificationAPI napi = new NotificationAPI(); napi.CreateAndShowPrompt("Do you want me to inform you of newly connected devices?\n\n(This option can be changed back in the Options menu)"); PromptCalled = true; } } }
public void AttachOnExitEventHandler() { Application.ApplicationExit += (object sender, EventArgs e) => { try { var devices = _view.ListView1.Objects.Cast <Device>().ToList(); foreach (var device in devices) { device.Redirected = false; device.Blocked = false; device.LimiterStarted = false; } GetClientList.CloseAllCaptures(_view); NotificationAPI.ClearNotifications(); } catch (Exception) { } }; }
private void FastObjectListView1_ItemsAdding(object sender, ItemsAddingEventArgs e) { if (fastObjectListView1.Items.Count >= 8 && !ResizeDone) { olvColumn7.MaximumWidth = 83; olvColumn7.MinimumWidth = 83; olvColumn7.Width = 83; ResizeDone = true; } if (WindowState == FormWindowState.Minimized && Properties.Settings.Default.SuppressN == "False") { var Ad = e.ObjectsToAdd.Cast <Device>().ToList(); if (Ad.Count > 0) { Device Device = Ad[0]; NotificationAPI Napi = new NotificationAPI(Device, this); Napi.CreateNotification(); Napi.AttachHandlers(); Napi.ShowToast(); } } }