void StartMonitorProcess() { try { AVActions.TaskStartLoop(LoopMonitorProcess, vTask_MonitorProcess); Debug.WriteLine("Started monitoring processes."); } catch { } }
void StartMonitorTaskbar() { try { AVActions.TaskStartLoop(LoopMonitorTaskbar, vTask_MonitorTaskbar); Debug.WriteLine("Started monitoring taskbar."); } catch { } }
//Start all the background tasks void TasksBackgroundStart() { try { AVActions.TaskStartLoop(vTaskLoop_UpdateMediaInformation, vTask_UpdateMediaInformation); AVActions.TaskStartLoop(vTaskLoop_UpdateInterfaceInformation, vTask_UpdateInterfaceInformation); } catch { } }
void TaskStart_TimeMeWallpaper() { try { if (ConfigurationManager.AppSettings["TimeMeWallpaper"] == "True") { AVActions.TaskStartLoop(LoopCheckWallpaper, vTask_Wallpaper); } } catch { } }
void TaskStart_ShowHideMouseCursor() { try { if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "HideMouseCursor"))) { AVActions.TaskStartLoop(vTaskLoop_ShowHideMouse, vTask_ShowHideMouse); } } catch { } }
void StartMonitorFps() { try { vTraceEventSession = new TraceEventSession("FpsOverlayer"); vTraceEventSession.EnableProvider(vProvider_DxgKrnl.ToString()); vTraceEventSession.Source.AllEvents += ProcessEvents; AVActions.TaskStart(TaskTraceEventSource); AVActions.TaskStartLoop(LoopTraceEventOutput, vTask_TraceEventOutput); Debug.WriteLine("Started monitoring fps."); } catch { } }
//Start all the background tasks void TasksBackgroundStart() { try { AVActions.TaskStartLoop(vTaskLoop_UpdateClock, vTask_UpdateClock); AVActions.TaskStartLoop(vTaskLoop_UpdateWindowStatus, vTask_UpdateWindowStatus); AVActions.TaskStartLoop(vTaskLoop_ControllerConnected, vTask_ControllerConnected); AVActions.TaskStartLoop(vTaskLoop_UpdateProcesses, vTask_UpdateProcesses); AVActions.TaskStartLoop(vTaskLoop_UpdateLaunchers, vTask_UpdateLaunchers); AVActions.TaskStartLoop(vTaskLoop_UpdateShortcuts, vTask_UpdateShortcuts); AVActions.TaskStartLoop(vTaskLoop_UpdateListStatus, vTask_UpdateListStatus); AVActions.TaskStartLoop(vTaskLoop_UpdateAppRunningTime, vTask_UpdateAppRunningTime); AVActions.TaskStartLoop(vTaskLoop_UpdateMediaInformation, vTask_UpdateMediaInformation); TaskStart_ShowHideMouseCursor(); } catch { } }
void StartMonitorHardware() { try { vHardwareComputer = new Computer(); vHardwareComputer.IsCpuEnabled = true; vHardwareComputer.IsGpuEnabled = true; vHardwareComputer.IsMemoryEnabled = true; vHardwareComputer.IsNetworkEnabled = true; vHardwareComputer.IsMotherboardEnabled = true; vHardwareComputer.Open(); AVActions.TaskStartLoop(LoopMonitorHardware, vTask_MonitorHardware); Debug.WriteLine("Started monitoring hardware."); } catch { } }
//Enable the led updates private static void LedsEnable() { try { Debug.WriteLine("Enabling the led updates."); //Check led count if (setLedCountTotal <= 0) { ShowNoLedsSideCountSetup(); return; } //Start led update loop AVActions.TaskStartLoop(LoopUpdateLeds, vTask_UpdateLed); } catch (Exception ex) { Debug.WriteLine("Failed to enable the led updates: " + ex.Message); } }
//Start Monitoring Direct Input Controllers async Task <bool> StartControllerDirectInput(ControllerStatus Controller) { try { if (Controller.Connected()) { Debug.WriteLine("Initializing direct input for: " + Controller.Details.DisplayName); //Allow the controller in HidGuardian HidGuardianAllowController(Controller.Details); await Task.Delay(500); //Open the selected controller if (!await OpenController(Controller)) { Debug.WriteLine("Failed to initialize direct input for: " + Controller.Details.DisplayName); NotificationDetails notificationDetailsDisconnected = new NotificationDetails(); notificationDetailsDisconnected.Icon = "Controller"; notificationDetailsDisconnected.Text = "Controller disconnected"; App.vWindowOverlay.Notification_Show_Status(notificationDetailsDisconnected); AVActions.ActionDispatcherInvoke(delegate { txt_Controller_Information.Text = "The controller is no longer connected or supported."; }); await StopControllerAsync(Controller, "unsupported"); return(false); } //Unplug and plugin the virtual device vVirtualBusDevice.VirtualUnplug(Controller.NumberId); await Task.Delay(500); vVirtualBusDevice.VirtualPlugin(Controller.NumberId); //Set controller interface information string controllerNumberDisplay = (Controller.NumberId + 1).ToString(); NotificationDetails notificationDetailsConnected = new NotificationDetails(); notificationDetailsConnected.Icon = "Controller"; notificationDetailsConnected.Text = "Connected (" + controllerNumberDisplay + ")"; App.vWindowOverlay.Notification_Show_Status(notificationDetailsConnected); AVActions.ActionDispatcherInvoke(delegate { txt_Controller_Information.Text = "Connected controller " + controllerNumberDisplay + ": " + Controller.Details.DisplayName; }); //Update the controller interface settings ControllerUpdateSettingsInterface(Controller); //Update the controller last read time Controller.PrevInputTicks = Controller.LastInputTicks; Controller.LastInputTicks = GetSystemTicksMs(); //Update the controller last active time Controller.LastActiveTicks = GetSystemTicksMs(); //Set the controller supported profile Controller.SupportedCurrent = vDirectControllersSupported.Where(x => x.ProductIDs.Any(z => z.ToLower() == Controller.Details.Profile.ProductID.ToLower() && x.VendorID.ToLower() == Controller.Details.Profile.VendorID.ToLower())).FirstOrDefault(); if (Controller.SupportedCurrent == null) { Debug.WriteLine("Unsupported controller detected, using default profile."); Controller.SupportedCurrent = new ControllerSupported(); } //Start receiving and translating DirectInput if (Controller.Details.Type == "Win") { async Task TaskActionInput() { try { await LoopInputWinUsb(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionInput, Controller.InputControllerTask); } else { async Task TaskActionInput() { try { await LoopInputHidDevice(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionInput, Controller.InputControllerTask); } void TaskActionOutputVirtual() { try { LoopOutputVirtual(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionOutputVirtual, Controller.OutputVirtualTask); void TaskActionOutputController() { try { LoopOutputController(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionOutputController, Controller.OutputControllerTask); async Task TaskActionOutputGyro() { try { await LoopOutputGyro(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionOutputGyro, Controller.OutputGyroTask); return(true); } } catch { } return(false); }
//Start Monitoring Direct Input Controllers async Task <bool> StartControllerDirectInput(ControllerStatus Controller) { try { //Check if controller is connected if (!Controller.Connected()) { Debug.WriteLine("Direct input controller is not connected: " + Controller.Details.DisplayName); return(false); } Debug.WriteLine("Initializing direct input for: " + Controller.Details.DisplayName); //Allow controller in HidHide if (Controller.Details.Type == ControllerType.HidDevice) { await vHidHideDevice.ListDeviceAdd(Controller.Details.ModelId); } //Set controller interface information string controllerNumberDisplay = (Controller.NumberId + 1).ToString(); //Open the selected controller if (!OpenController(Controller)) { Debug.WriteLine("Failed to initialize direct input for: " + Controller.Details.DisplayName); StopControllerTask(Controller, "failed", "Controller " + controllerNumberDisplay + " is no longer connected or failed."); return(false); } //Unplug and plugin the virtual device vVirtualBusDevice.VirtualUnplug(Controller.NumberId); await Task.Delay(500); vVirtualBusDevice.VirtualPlugin(Controller.NumberId); NotificationDetails notificationDetailsConnected = new NotificationDetails(); notificationDetailsConnected.Icon = "Controller"; notificationDetailsConnected.Text = "Connected (" + controllerNumberDisplay + ")"; notificationDetailsConnected.Color = Controller.Color; await App.vWindowOverlay.Notification_Show_Status(notificationDetailsConnected); AVActions.ActionDispatcherInvoke(delegate { txt_Controller_Information.Text = "Connected controller " + controllerNumberDisplay + ": " + Controller.Details.DisplayName; }); //Update the controller interface settings ControllerUpdateSettingsInterface(Controller); //Update the controller last read time Controller.PrevInputTicks = GetSystemTicksMs(); Controller.LastInputTicks = GetSystemTicksMs(); //Update the controller last active time Controller.LastActiveTicks = GetSystemTicksMs(); //Set the controller supported profile Controller.SupportedCurrent = vDirectControllersSupported.Where(x => x.ProductIDs.Any(z => z.ToLower() == Controller.Details.Profile.ProductID.ToLower() && x.VendorID.ToLower() == Controller.Details.Profile.VendorID.ToLower())).FirstOrDefault(); if (Controller.SupportedCurrent == null) { Debug.WriteLine("Unsupported controller detected, using default profile."); Controller.SupportedCurrent = new ControllerSupported(); } //Start controller input task loop async Task TaskActionInput() { try { await LoopInputDirectInput(Controller, Controller.Details.Type); } catch { } } AVActions.TaskStartLoop(TaskActionInput, Controller.InputControllerTask); //Start virtual output task loop void TaskActionOutputVirtual() { try { LoopOutputVirtual(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionOutputVirtual, Controller.OutputVirtualTask); //Start controller output task loop async void TaskActionOutputController() { try { await LoopOutputController(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionOutputController, Controller.OutputControllerTask); //Start gyroscope task loop if (Controller.SupportedCurrent.HasGyroscope) { async Task TaskActionOutputGyro() { try { await LoopOutputGyro(Controller); } catch { } } AVActions.TaskStartLoop(TaskActionOutputGyro, Controller.OutputGyroTask); } return(true); } catch { Debug.WriteLine("Failed initializing direct input for: " + Controller.Details.DisplayName); return(false); } }