//Show the notification overlay public void Notification_Show_Status(NotificationDetails notificationDetails) { try { //Update notification position UpdateNotificationPosition(); //Show the notification AVActions.ActionDispatcherInvoke(delegate { try { grid_Message_Status_Image.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/" + notificationDetails.Icon + ".png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); grid_Message_Status_Text.Text = notificationDetails.Text; grid_Message_Status.Visibility = Visibility.Visible; } catch { } }); //Start notification timer vDispatcherTimerOverlay.Interval = TimeSpan.FromMilliseconds(3000); vDispatcherTimerOverlay.Tick += delegate { try { //Hide the notification grid_Message_Status.Visibility = Visibility.Collapsed; } catch { } }; AVFunctions.TimerReset(vDispatcherTimerOverlay); } catch { } }
//Close the application async Task Application_Exit() { try { Debug.WriteLine("Exiting application."); AVActions.ActionDispatcherInvoke(delegate { this.Opacity = 0.80; this.IsEnabled = false; }); //Stop monitoring the hardware vHardwareComputer.Close(); //Stop the background tasks await TasksBackgroundStop(); //Disable the socket server if (vArnoldVinkSockets != null) { await vArnoldVinkSockets.SocketServerDisable(); } //Hide the visible tray icon TrayNotifyIcon.Visible = false; //Close the application Environment.Exit(0); } catch { } }
//Update the keyboard mode void UpdateKeyboardMode() { try { if (Convert.ToInt32(Setting_Load(vConfigurationDirectXInput, "KeyboardMode")) == 0) { AVActions.ActionDispatcherInvoke(delegate { textblock_ThumbRightOff.Text = "Move"; image_ScrollMove.Source = vImagePreloadIconKeyboardScroll; //ToolTip newTooltip = new ToolTip() { Content = "Switch to mouse wheel mode" }; //key_ScrollMove.ToolTip = newTooltip; }); } else { AVActions.ActionDispatcherInvoke(delegate { textblock_ThumbRightOff.Text = "Scroll"; image_ScrollMove.Source = vImagePreloadIconKeyboardMove; //ToolTip newTooltip = new ToolTip() { Content = "Switch to window move mode" }; //key_ScrollMove.ToolTip = newTooltip; }); } } catch { } }
//Hide the popup void Popup_Hide_Element(FrameworkElement elementTarget) { try { AVActions.ActionDispatcherInvoke(delegate { //Hide the popup elementTarget.Visibility = Visibility.Collapsed; elementTarget.IsEnabled = false; //Show the background if (!Popup_Any_Open()) { double backgroundBrightness = (double)Convert.ToInt32(Setting_Load(vConfigurationCtrlUI, "BackgroundBrightness")) / 100; grid_Video_Background.Opacity = backgroundBrightness; grid_Main.Opacity = 1.00; grid_Main.IsEnabled = true; return; } //Show other popups if (vTextInputOpen) { grid_Popup_TextInput.Opacity = 1.00; grid_Popup_TextInput.IsEnabled = true; } else if (vMessageBoxOpen) { grid_Popup_MessageBox.Opacity = 1.00; grid_Popup_MessageBox.IsEnabled = true; } else if (vFilePickerOpen) { grid_Popup_FilePicker.Opacity = 1.00; grid_Popup_FilePicker.IsEnabled = true; } else if (vPopupOpen) { vPopupElementTarget.Opacity = 1.00; vPopupElementTarget.IsEnabled = true; } else if (vColorPickerOpen) { grid_Popup_ColorPicker.Opacity = 1.00; grid_Popup_ColorPicker.IsEnabled = true; } else if (vSearchOpen) { grid_Popup_Search.Opacity = 1.00; grid_Popup_Search.IsEnabled = true; } else if (vMainMenuOpen) { grid_Popup_MainMenu.Opacity = 1.00; grid_Popup_MainMenu.IsEnabled = true; } }); } catch { } }
//Close all open popups (xaml order) async Task Popup_Close_All() { try { if (vTextInputOpen) { await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Close_TextInput(); }); } if (vMessageBoxOpen) { await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Close_MessageBox(); }); } if (vFilePickerOpen) { await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Close_FilePicker(false, false); }); } if (vColorPickerOpen) { await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Close_ColorPicker(); }); } if (vPopupOpen) { await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Close(); }); } if (vSearchOpen) { await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Close_Search(); }); } if (vMainMenuOpen) { await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Close_MainMenu(); }); } } catch { } }
private void CheckAndSetWallpaper(string wallpaperLocation) { try { //Set and check current wallpaper file size long WallpaperFilesizeOld = vWallpaperFilesize; vWallpaperFilesize = new FileInfo(wallpaperLocation).Length; if (WallpaperFilesizeOld != vWallpaperFilesize) { //Set Registery to Stretch RegistryKey WallRegistryKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true); WallRegistryKey.SetValue("WallpaperStyle", "2"); WallRegistryKey.SetValue("TileWallpaper", "0"); //Set current TimeMe Wallpaper SystemParametersInfo(SPI.SPI_SETDESKWALLPAPER, 0, wallpaperLocation, SPIF.SPIF_UPDATEINIFILE); //Update wallpaper preview AVActions.ActionDispatcherInvoke(delegate { //Show wallpaper preview sp_TimeMeWallpaper.Visibility = Visibility.Visible; //Load the wallpaper as bitmapimage BitmapImage ImageToBitmapImage = new BitmapImage(); ImageToBitmapImage.BeginInit(); ImageToBitmapImage.CacheOption = BitmapCacheOption.OnLoad; ImageToBitmapImage.UriSource = new Uri(wallpaperLocation, UriKind.RelativeOrAbsolute); ImageToBitmapImage.EndInit(); image_TimeMeWallpaper.Source = ImageToBitmapImage; }); } } catch { } }
//Check if there are files or folders void FilePicker_CheckFilesAndFoldersCount() { try { int totalFileCount = List_FilePicker.Count - 1; //Filter out GoUp if (totalFileCount > 0) { //Enable or disable file and folder availability AVActions.ActionDispatcherInvoke(delegate { grid_Popup_FilePicker_textblock_NoFilesAvailable.Visibility = Visibility.Collapsed; }); Debug.WriteLine("There are files and folders in the list."); } else { //Enable or disable file and folder availability AVActions.ActionDispatcherInvoke(delegate { grid_Popup_FilePicker_textblock_NoFilesAvailable.Visibility = Visibility.Visible; }); Debug.WriteLine("No files and folders in the list."); } } catch { } }
//Show monitor screen message private static void ShowFailedCaptureMessage() { try { AVActions.ActionDispatcherInvoke(async delegate { List <string> MsgBoxAnswers = new List <string>(); MsgBoxAnswers.Add("Change monitor setting"); MsgBoxAnswers.Add("Change the led mode"); MsgBoxAnswers.Add("Retry to capture screen"); MsgBoxAnswers.Add("Close application"); string MsgBoxResult = await new AVMessageBox().Popup(null, "Failed to start capturing your monitor screen", "Please make sure the correct monitor screen is selected, Microsoft Visual C++ 2019 Redistributable is installed on your PC, that you have a 64bit Windows installation and that you have a DirectX 12 or higher capable graphics adapter installed.", MsgBoxAnswers); if (MsgBoxResult == "Change monitor setting") { await LedSwitch(LedSwitches.Disable); ShowSettings(); } else if (MsgBoxResult == "Change the led mode") { await LedSwitch(LedSwitches.Disable); ShowSettings(); } else if (MsgBoxResult == "Retry to capture screen") { await LedSwitch(LedSwitches.Restart); } else if (MsgBoxResult == "Close application") { await AppStartup.Application_Exit(); } }); } catch { } }
//Remove listbox item from a listbox async Task ListBoxRemoveItem <T>(ListBox listBox, Collection <T> listCollection, T removeItem, bool selectItem) { try { await AVActions.ActionDispatcherInvokeAsync(async delegate { //Store the current listbox items count int listBoxItemCount = listBox.Items.Count; //Store the currently selected index int listBoxSelectedIndex = listBox.SelectedIndex; //Remove the listbox item from list listCollection.Remove(removeItem); //Check if there is a listbox item removed if (listBoxItemCount != listBox.Items.Count) { Debug.WriteLine(listBox.Name + " listbox item has been removed."); if (selectItem) { await ListBoxFocusOrSelectIndex(listBox, false, false, listBoxSelectedIndex, vProcessCurrent.MainWindowHandle); } } }); } catch (Exception ex) { Debug.WriteLine("Failed removing item from the listbox: " + ex.Message); } }
//Show the character overlay public void ShowCharacterOverlay(string currentChar, string nextChar, string prevChar) { try { //Show the overlay AVActions.ActionDispatcherInvoke(delegate { try { grid_SelectCharacterNextText.Text = nextChar; grid_SelectCharacterCurrentText.Text = currentChar; grid_SelectCharacterPreviousText.Text = prevChar; grid_SelectCharacter.Visibility = Visibility.Visible; } catch { } }); //Start overlay timer vDispatcherTimerOverlay.Interval = TimeSpan.FromMilliseconds(2000); vDispatcherTimerOverlay.Tick += delegate { try { //Hide the overlay grid_SelectCharacter.Visibility = Visibility.Collapsed; } catch { } }; AVFunctions.TimerReset(vDispatcherTimerOverlay); } catch { } }
//Update the notification position public void UpdateNotificationPosition() { try { //Check current fps overlay position OverlayPosition fpsTextPosition = (OverlayPosition)Convert.ToInt32(Setting_Load(vConfigurationFpsOverlayer, "TextPosition")); //Debug.WriteLine("Fps overlayer text position: " + fpsTextPosition); //Move the notification position AVActions.ActionDispatcherInvoke(delegate { if (vProcessFpsOverlayer == null || (vProcessFpsOverlayer != null && fpsTextPosition != OverlayPosition.TopLeft)) { grid_Message_Status.HorizontalAlignment = HorizontalAlignment.Left; grid_Message_Status_Grid.SetValue(Grid.ColumnProperty, 0); grid_Message_Status_Border.SetValue(Grid.ColumnProperty, 1); grid_Message_Status_Border.SetValue(Border.CornerRadiusProperty, new CornerRadius(0, 2, 2, 0)); } else { grid_Message_Status.HorizontalAlignment = HorizontalAlignment.Right; grid_Message_Status_Grid.SetValue(Grid.ColumnProperty, 1); grid_Message_Status_Border.SetValue(Grid.ColumnProperty, 0); grid_Message_Status_Border.SetValue(Border.CornerRadiusProperty, new CornerRadius(2, 0, 0, 2)); } }); } catch { } }
//Update the search results count void UpdateSearchResults() { try { AVActions.ActionDispatcherInvoke(delegate { string searchString = grid_Popup_Search_textbox.Text; string placeholderString = (string)grid_Popup_Search_textbox.GetValue(TextboxPlaceholder.PlaceholderProperty); if (string.IsNullOrWhiteSpace(searchString) || searchString == placeholderString) { grid_Popup_Search_Count_TextBlock.Text = string.Empty; grid_Popup_Search_textblock_Result.Text = "Please enter a search term above."; grid_Popup_Search_textblock_Result.Visibility = Visibility.Visible; } else if (List_Search.Count == 0) { grid_Popup_Search_Count_TextBlock.Text = string.Empty; grid_Popup_Search_textblock_Result.Text = "No search results found."; grid_Popup_Search_textblock_Result.Visibility = Visibility.Visible; } else { grid_Popup_Search_Count_TextBlock.Text = " " + List_Search.Count.ToString(); grid_Popup_Search_textblock_Result.Visibility = Visibility.Collapsed; } }); } catch { } }
//Remove all matching items from a listbox async Task ListBoxRemoveAll <T>(ListBox listBox, Collection <T> listCollection, Func <T, bool> removeCondition) { try { await AVActions.ActionDispatcherInvokeAsync(async delegate { //Store the current listbox items count int listBoxItemCount = listBox.Items.Count; //Store the currently selected index int listBoxSelectedIndex = listBox.SelectedIndex; //Remove the listbox items from list listCollection.ListRemoveAll(removeCondition); //Check if there is a listbox item removed if (listBoxItemCount != listBox.Items.Count) { Debug.WriteLine(listBox.Name + " " + (listBoxItemCount - listBox.Items.Count) + " items have been removed."); await ListBoxFocusOrSelectIndex(listBox, false, false, listBoxSelectedIndex, vProcessCurrent.MainWindowHandle); } }); } catch { Debug.WriteLine("Failed removing all from the listbox."); } }
//Listbox focus or select an index public static async Task ListBoxFocusOrSelectIndex(ListBox focusListBox, bool firstIndex, bool lastIndex, int indexNumber, IntPtr windowHandle) { try { await AVActions.ActionDispatcherInvokeAsync(async delegate { //Get the currently focused element FrameworkElement frameworkElement = (FrameworkElement)Keyboard.FocusedElement; //Check if focused element is disconnected bool disconnectedSource = frameworkElement == null || frameworkElement.DataContext == BindingOperations.DisconnectedSource; //Focus on the listbox or select index if (disconnectedSource || frameworkElement == focusListBox) { await ListboxFocusIndex(focusListBox, firstIndex, lastIndex, indexNumber, windowHandle); } else { ListBoxSelectIndex(focusListBox, firstIndex, lastIndex, indexNumber); } }); } catch { } }
//Update the keypad size public double UpdateKeypadSize() { double keypadHeight = 0; try { AVActions.ActionDispatcherInvoke(delegate { try { int targetPercentage = vKeypadMappingProfile.KeypadDisplaySize; Debug.WriteLine("Changing keypad size to: " + targetPercentage); double keypadTextSize = 25; double keypadImageSize = 75; double newImageSize = (keypadImageSize / 100) * targetPercentage; keypadHeight = newImageSize * 2; Application.Current.Resources["KeypadTextSize"] = (keypadTextSize / 100) * targetPercentage; Application.Current.Resources["KeypadImageSize"] = newImageSize; } catch { } }); } catch { } return(keypadHeight); }
//Show device connection message private static void ShowFailedConnectionMessage() { try { AVActions.ActionDispatcherInvoke(async delegate { List <string> MsgBoxAnswers = new List <string>(); MsgBoxAnswers.Add("Change com port"); MsgBoxAnswers.Add("Retry to connect"); MsgBoxAnswers.Add("Close application"); string MsgBoxResult = await new AVMessageBox().Popup(null, "Failed to connect to your com port device", "Please make sure the device is not in use by another application, the correct com port is selected and that the required drivers are installed on your system.", MsgBoxAnswers); if (MsgBoxResult == "Change com port") { await LedSwitch(LedSwitches.Disable); ShowSettings(); } else if (MsgBoxResult == "Retry to connect") { await LedSwitch(LedSwitches.Restart); } else if (MsgBoxResult == "Close application") { await AppStartup.Application_Exit(); } }); } catch { } }
//Update the application name void UpdateApplicationName(string processTitle) { try { AVActions.ActionDispatcherInvoke(delegate { if (Convert.ToBoolean(Setting_Load(vConfigurationFpsOverlayer, "AppShowName"))) { if (!string.IsNullOrWhiteSpace(processTitle) && processTitle != "Unknown") { textblock_CurrentApp.Text = processTitle; stackpanel_CurrentApp.Visibility = Visibility.Visible; } else { stackpanel_CurrentApp.Visibility = Visibility.Collapsed; } } else { stackpanel_CurrentApp.Visibility = Visibility.Collapsed; } }); } catch { } }
//Close the application async Task Application_Exit(string ExitMessage) { try { Debug.WriteLine("Exiting application."); AVActions.ActionDispatcherInvoke(delegate { this.Opacity = 0.80; this.IsEnabled = false; }); //Delete the update installation zip file File_Delete("Resources/AppUpdate.zip"); //Set the exit reason text message TextBlockUpdate(ExitMessage); ProgressBarUpdate(100, false); //Close the application after x seconds await Task.Delay(2000); Environment.Exit(0); } catch { } }
//Update the list items count void ListsUpdateCount() { try { //Debug.WriteLine("Updating the lists count."); string List_Games_Count = List_Games.Count.ToString(); string List_Apps_Count = List_Apps.Count.ToString(); string List_Emulators_Count = List_Emulators.Count.ToString(); string List_Launchers_Count = List_Launchers.Count.ToString(); string List_Shortcuts_Count = List_Shortcuts.Count.ToString(); string List_Processes_Count = List_Processes.Count.ToString(); AVActions.ActionDispatcherInvoke(delegate { tb_Games_Count.Text = List_Games_Count; tb_Apps_Count.Text = List_Apps_Count; tb_Emulators_Count.Text = List_Emulators_Count; tb_Launchers_Count.Text = List_Launchers_Count; tb_Shortcuts_Count.Text = List_Shortcuts_Count; tb_Processes_Count.Text = List_Processes_Count; }); } catch { } }
//Update controller debug information void UpdateControllerDebugInformation(ControllerStatus Controller) { try { AVActions.ActionDispatcherInvoke(delegate { //Set basic information textblock_LiveDebugInformation.Text = GenerateControllerDebugString(false); //Set controller input listbox_LiveDebugInput.Visibility = Visibility.Visible; byte[] controllerRawInput = Controller.InputReport; if (controllerRawInput.Length > 180) { controllerRawInput = controllerRawInput.Take(180).ToArray(); } for (int packetId = 0; packetId < controllerRawInput.Length; packetId++) { ProfileShared profileShared = new ProfileShared(); profileShared.String1 = packetId.ToString(); profileShared.String2 = controllerRawInput[packetId].ToString(); vControllerDebugInput[packetId] = profileShared; } }); } catch { } }
//Update the controller color void UpdateControllerColor() { try { string ControllerColor0 = Setting_Load(vConfigurationDirectXInput, "ControllerColor0").ToString(); string ControllerColor1 = Setting_Load(vConfigurationDirectXInput, "ControllerColor1").ToString(); string ControllerColor2 = Setting_Load(vConfigurationDirectXInput, "ControllerColor2").ToString(); string ControllerColor3 = Setting_Load(vConfigurationDirectXInput, "ControllerColor3").ToString(); AVActions.ActionDispatcherInvoke(delegate { SolidColorBrush ControllerColor0Brush = new BrushConverter().ConvertFrom(ControllerColor0) as SolidColorBrush; border_Menu_Controller0.Background = ControllerColor0Brush; SolidColorBrush ControllerColor1Brush = new BrushConverter().ConvertFrom(ControllerColor1) as SolidColorBrush; border_Menu_Controller1.Background = ControllerColor1Brush; SolidColorBrush ControllerColor2Brush = new BrushConverter().ConvertFrom(ControllerColor2) as SolidColorBrush; border_Menu_Controller2.Background = ControllerColor2Brush; SolidColorBrush ControllerColor3Brush = new BrushConverter().ConvertFrom(ControllerColor3) as SolidColorBrush; border_Menu_Controller3.Background = ControllerColor3Brush; }); } catch { } }
//Stop all the controllers async Task StopAllControllers(bool disconnectVirtualBus) { try { await StopControllerAsync(vController0, "all"); await StopControllerAsync(vController1, "all"); await StopControllerAsync(vController2, "all"); await StopControllerAsync(vController3, "all"); if (disconnectVirtualBus) { vVirtualBusDevice.CloseDevice(); vVirtualBusDevice = null; } Debug.WriteLine("Stopped all the controllers direct input."); AVActions.ActionDispatcherInvoke(delegate { txt_Controller_Information.Text = "Disconnected all the connected controllers."; }); } catch { Debug.WriteLine("Failed stopping all controller direct input."); } }
//Close the application async Task Application_Exit(string exitMessage, bool runDirectXInput) { try { Debug.WriteLine("Exiting application."); AVActions.ActionDispatcherInvoke(delegate { this.IsEnabled = false; }); //Disable the buttons ElementEnableDisable(button_Driver_Install, false); ElementEnableDisable(button_Driver_Uninstall, false); ElementEnableDisable(button_Driver_Cleanup, false); ElementEnableDisable(button_Driver_Close, false); //Run DirectXInput after the drivers installed if (runDirectXInput) { TextBoxAppend("Running the DirectXInput application."); await ProcessLauncherWin32Async("DirectXInput-Launcher.exe", "", "", true, false); } //Set the exit reason text message TextBoxAppend(exitMessage); ProgressBarUpdate(100, false); //Close the application after x seconds await Task.Delay(3000); Environment.Exit(0); } catch { } }
//Update the user interface clock time void UpdateClockTime() { try { AVActions.ActionDispatcherInvoke(delegate { //Rotate the clock images int clockSecond = DateTime.Now.Second; int clockMinute = DateTime.Now.Minute; int clockHour = DateTime.Now.Hour; img_Main_Time_Minute.LayoutTransform = new RotateTransform((clockMinute * 360 / 60) + (clockSecond / 60 * 6)); img_Main_Time_Hour.LayoutTransform = new RotateTransform((clockHour * 360 / 12) + (clockMinute / 2)); //Change the time format if (vMainMenuOpen) { txt_Main_Date.Text = DateTime.Now.ToString("d MMMM"); txt_Main_Time.Text = DateTime.Now.ToShortTimeString(); } else { txt_Main_Date.Text = string.Empty; txt_Main_Time.Text = DateTime.Now.ToShortTimeString(); } }); } catch { } }
//Update the window style async Task UpdateWindowStyleHidden() { try { await AVActions.ActionDispatcherInvokeAsync(async delegate { //Set the window style IntPtr updatedStyle = new IntPtr((uint)WindowStyles.WS_NONE); await SetWindowLongAuto(vInteropWindowHandle, (int)WindowLongFlags.GWL_STYLE, updatedStyle); //Move window to force style WindowRectangle positionRect = new WindowRectangle(); GetWindowRect(vInteropWindowHandle, ref positionRect); if (vHideAdded) { WindowMove(vInteropWindowHandle, positionRect.Left + 1, positionRect.Top + 1); vHideAdded = false; } else { WindowMove(vInteropWindowHandle, positionRect.Left - 1, positionRect.Top - 1); vHideAdded = true; } }); } catch { } }
//Set a controller as the active controller async Task ActivateController(int controllerId) { try { if (controllerId == 0) { vControllerActiveId = controllerId; await Notification_Send_Status("Controller", "Activated (1)"); AVActions.ActionDispatcherInvoke(delegate { img_Menu_Controller0.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller-Accent.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller1.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller2.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller3.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); }); } else if (controllerId == 1) { vControllerActiveId = controllerId; await Notification_Send_Status("Controller", "Activated (2)"); AVActions.ActionDispatcherInvoke(delegate { img_Menu_Controller0.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller1.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller-Accent.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller2.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller3.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); }); } else if (controllerId == 2) { vControllerActiveId = controllerId; await Notification_Send_Status("Controller", "Activated (3)"); AVActions.ActionDispatcherInvoke(delegate { img_Menu_Controller0.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller1.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller2.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller-Accent.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller3.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); }); } else if (controllerId == 3) { vControllerActiveId = controllerId; await Notification_Send_Status("Controller", "Activated (4)"); AVActions.ActionDispatcherInvoke(delegate { img_Menu_Controller0.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller1.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller2.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); img_Menu_Controller3.Source = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller-Accent.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0); }); } } catch { } }
//Stop all the background tasks public static async Task TasksBackgroundStop() { try { await AVActions.TaskStopLoop(vTask_Wallpaper); } catch { } }
//Update the keyboard mode async Task UpdateKeyboardMode() { try { await AVActions.ActionDispatcherInvokeAsync(async delegate { //Check keyboard mode KeyboardMode keyboardMode = (KeyboardMode)Convert.ToInt32(Setting_Load(vConfigurationDirectXInput, "KeyboardMode")); if (keyboardMode == KeyboardMode.Media) { //Update help bar stackpanel_DPad.Visibility = Visibility.Visible; textblock_ButtonLeft.Text = "Media Prev"; textblock_ButtonRight.Text = "Media Next"; textblock_ButtonUp.Text = "Play/Pause"; textblock_ThumbRightOff.Text = "Move"; textblock_LeftTriggerOff.Text = string.Empty; textblock_RightTriggerOff.Text = "Volume"; textblock_ThumbPress.Text = "Mute"; textblock_BackOff.Text = "Fullscreen"; image_Mode.Source = vImagePreloadIconKeyboardMedia; //Play sound PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false); //Show notification NotificationDetails notificationDetails = new NotificationDetails(); notificationDetails.Icon = "Keyboard"; notificationDetails.Text = "Switched to media mode"; await App.vWindowOverlay.Notification_Show_Status(notificationDetails); } else if (keyboardMode == KeyboardMode.Scroll) { //Update help bar stackpanel_DPad.Visibility = Visibility.Collapsed; textblock_ButtonLeft.Text = "Backspace"; textblock_ButtonRight.Text = "Enter"; textblock_ButtonUp.Text = "Space"; textblock_ThumbRightOff.Text = "Scroll"; textblock_LeftTriggerOff.Text = "Caps"; textblock_RightTriggerOff.Text = "Tab"; textblock_ThumbPress.Text = "Arrows"; textblock_BackOff.Text = "Emoji/Text"; image_Mode.Source = vImagePreloadIconKeyboardScroll; //Play sound PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false); //Show notification NotificationDetails notificationDetails = new NotificationDetails(); notificationDetails.Icon = "Keyboard"; notificationDetails.Text = "Switched to scroll mode"; await App.vWindowOverlay.Notification_Show_Status(notificationDetails); } }); } catch { } }
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 { } }