Exemple #1
0
        //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.");
            }
        }
Exemple #2
0
        //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 { }
        }
Exemple #3
0
        //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);
            }
        }
Exemple #4
0
 //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 { }
 }
Exemple #5
0
        //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 { }
        }
Exemple #6
0
        //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 { }
        }
Exemple #7
0
        async Task ReceivedSocketHandlerThread(TcpClient tcpClient, byte[] receivedBytes)
        {
            try
            {
                //Deserialize the received bytes
                if (!DeserializeBytesToObject(receivedBytes, out SocketSendContainer deserializedBytes))
                {
                    return;
                }

                //Get the source server ip and port
                //Debug.WriteLine("Received socket from (C): " + DeserializedBytes.SourceIp + ":" + DeserializedBytes.SourcePort + "/" + DeserializedBytes.Object);

                //Check what kind of object was received
                if (deserializedBytes.Object is ControllerInput)
                {
                    if (!vControllerBusy)
                    {
                        vControllerBusy = true;

                        ControllerInput receivedControllerInput = (ControllerInput)deserializedBytes.Object;
                        await ControllerInteraction(receivedControllerInput);

                        vControllerBusy = false;
                    }
                }
                else if (deserializedBytes.Object is List <ControllerStatusDetails> )
                {
                    List <ControllerStatusDetails> controllerStatusSummaryList = (List <ControllerStatusDetails>)deserializedBytes.Object;
                    await UpdateControllerStatus(controllerStatusSummaryList);
                }
                else if (deserializedBytes.Object is string)
                {
                    string receivedString = (string)deserializedBytes.Object;
                    //Debug.WriteLine("Received string: " + receivedString);
                    if (receivedString == "SettingChangedShortcut")
                    {
                        vConfigurationDirectXInput = Settings_Load_DirectXInput();
                        UpdateControllerHelp();
                    }
                    else if (receivedString == "SettingChangedControllerColor")
                    {
                        vConfigurationDirectXInput = Settings_Load_DirectXInput();
                        UpdateControllerColor();
                    }
                    else if (receivedString == "AppWindowHideShow")
                    {
                        await AVActions.ActionDispatcherInvokeAsync(async delegate { await AppWindow_HideShow(); });
                    }
                }
            }
            catch { }
        }
Exemple #8
0
 //Hide all opened popups
 async Task HideOpenPopups()
 {
     try
     {
         await AVActions.ActionDispatcherInvokeAsync(async delegate
         {
             await App.vWindowKeyboard.Hide();
             await App.vWindowKeypad.Hide();
         });
     }
     catch { }
 }
Exemple #9
0
 //Disable hardware capslock
 public async Task DisableHardwareCapsLock()
 {
     try
     {
         await AVActions.ActionDispatcherInvokeAsync(async delegate
         {
             if (System.Windows.Input.Keyboard.GetKeyStates(Key.CapsLock) == KeyStates.Toggled)
             {
                 await KeyPressSingleAuto(KeysVirtual.CapsLock);
             }
         });
     }
     catch { }
 }
        //Show the notification overlay
        public async Task Notification_Show_Status(NotificationDetails notificationDetails)
        {
            try
            {
                //Update notification position
                UpdateNotificationPosition();

                //Update the notification
                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    try
                    {
                        //Set notification text
                        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;
                        if (notificationDetails.Color != null)
                        {
                            grid_Message_Status_Border.Background = new SolidColorBrush((Color)notificationDetails.Color);
                        }
                        else
                        {
                            grid_Message_Status_Border.Background = (SolidColorBrush)Application.Current.Resources["ApplicationAccentLightBrush"];
                        }

                        //Show the notification
                        await this.Show();
                    }
                    catch { }
                });

                //Start notification timer
                vDispatcherTimerOverlay.Interval = TimeSpan.FromMilliseconds(3000);
                vDispatcherTimerOverlay.Tick    += async delegate
                {
                    try
                    {
                        //Hide the notification
                        await this.Hide();

                        //Renew the timer
                        AVFunctions.TimerRenew(ref vDispatcherTimerOverlay);
                    }
                    catch { }
                };
                AVFunctions.TimerReset(vDispatcherTimerOverlay);
            }
            catch { }
        }
Exemple #11
0
 //Hide or show the media controller
 async Task MediaControllerHideShow(bool forceShow)
 {
     try
     {
         Debug.WriteLine("Shortcut media has been pressed.");
         await AVActions.ActionDispatcherInvokeAsync(async delegate
         {
             if (!App.vWindowMedia.vWindowVisible)
             {
                 await App.vWindowMedia.Show();
             }
             else if (!forceShow)
             {
                 await App.vWindowMedia.Hide();
             }
         });
     }
     catch { }
 }
Exemple #12
0
 //Hide or show the keyboard controller
 async Task KeyboardControllerHideShow(bool forceShow)
 {
     try
     {
         Debug.WriteLine("Shortcut keyboard has been pressed.");
         await AVActions.ActionDispatcherInvokeAsync(async delegate
         {
             if (!App.vWindowKeyboard.vWindowVisible && !App.vWindowKeypad.vWindowVisible)
             {
                 await App.vWindowKeyboard.Show();
             }
             else if (!forceShow)
             {
                 App.vWindowKeyboard.Hide();
                 await App.vWindowKeypad.Hide();
             }
         });
     }
     catch { }
 }
Exemple #13
0
        //Update the window style
        async Task UpdateWindowStyleVisible()
        {
            try
            {
                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    //Set the window style
                    IntPtr updatedStyle = new IntPtr((uint)WindowStyles.WS_VISIBLE);
                    await SetWindowLongAuto(vInteropWindowHandle, (int)WindowLongFlags.GWL_STYLE, updatedStyle);

                    //Set the window style ex
                    IntPtr updatedExStyle = new IntPtr((uint)(WindowStylesEx.WS_EX_TOPMOST | WindowStylesEx.WS_EX_NOACTIVATE));
                    await SetWindowLongAuto(vInteropWindowHandle, (int)WindowLongFlags.GWL_EXSTYLE, updatedExStyle);

                    //Set the window as top most (focus workaround)
                    SetWindowPos(vInteropWindowHandle, (IntPtr)WindowPosition.TopMost, 0, 0, 0, 0, (int)(WindowSWP.NOMOVE | WindowSWP.NOSIZE | WindowSWP.FRAMECHANGED | WindowSWP.NOCOPYBITS));
                });
            }
            catch { }
        }
Exemple #14
0
        //Update the current window status
        async Task UpdateWindowStatus()
        {
            try
            {
                vProcessDirectXInput = GetProcessByNameOrTitle("DirectXInput", false);
                int focusedAppId = GetProcessMultiFromWindowHandle(GetForegroundWindow()).Identifier;

                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    try
                    {
                        if (WindowState == WindowState.Maximized)
                        {
                            vAppMaximized = true;
                        }
                        else
                        {
                            vAppMaximized = false;
                        }
                        if (WindowState == WindowState.Minimized)
                        {
                            vAppMinimized = true;
                        }
                        else
                        {
                            vAppMinimized = false;
                        }
                        if (vProcessCurrent.Id == focusedAppId)
                        {
                            await AppWindowActivated();
                        }
                        else
                        {
                            AppWindowDeactivated();
                        }
                    }
                    catch { }
                });
            }
            catch { }
        }
Exemple #15
0
 //Switch between keyboard and keypad
 async Task KeyboardKeypadSwitch()
 {
     try
     {
         Debug.WriteLine("Switching between keyboard and keypad");
         await AVActions.ActionDispatcherInvokeAsync(async delegate
         {
             if (App.vWindowKeyboard.vWindowVisible)
             {
                 App.vWindowKeyboard.Hide();
                 await App.vWindowKeypad.Show();
             }
             else
             {
                 await App.vWindowKeypad.Hide();
                 await App.vWindowKeyboard.Show();
             }
         });
     }
     catch { }
 }
Exemple #16
0
        //Add listbox item to a list
        async Task ListBoxAddItem <T>(ListBox listBox, Collection <T> listCollection, T addItem, bool insertItem, bool selectItem)
        {
            try
            {
                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    //Debug.WriteLine("Adding item to list collection: " + listCollection);

                    //Add or insert the item to the list
                    if (insertItem)
                    {
                        //Debug.WriteLine(listCollection + " listbox item has been inserted.");
                        listCollection.Insert(0, addItem);
                    }
                    else
                    {
                        //Debug.WriteLine(listCollection + " listbox item has been added.");
                        listCollection.Add(addItem);
                    }

                    //Select the item in the listbox
                    if (listBox != null && selectItem)
                    {
                        if (insertItem)
                        {
                            await ListBoxFocusOrSelectIndex(listBox, true, false, -1, vProcessCurrent.MainWindowHandle);
                        }
                        else
                        {
                            await ListBoxFocusOrSelectIndex(listBox, false, true, -1, vProcessCurrent.MainWindowHandle);
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed adding listbox item: " + ex.Message);
            }
        }
Exemple #17
0
        //Add process to the search list
        async Task AddSearchProcess(DataBindApp dataBindApp)
        {
            try
            {
                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    string searchString      = grid_Popup_Search_textbox.Text;
                    string placeholderString = (string)grid_Popup_Search_textbox.GetValue(TextboxPlaceholder.PlaceholderProperty);
                    if (searchString != placeholderString && dataBindApp.Name.ToLower().Contains(searchString.ToLower()))
                    {
                        //Add search process
                        await ListBoxAddItem(lb_Search, List_Search, dataBindApp, false, false);

                        //Update the search results count
                        UpdateSearchResults();

                        Debug.WriteLine("Added search process: " + searchString);
                    }
                });
            }
            catch { }
        }
Exemple #18
0
 //Hide or show the keyboard
 async Task KeyboardPopupHideShow(bool forceShow)
 {
     try
     {
         Debug.WriteLine("Shortcut keyboard has been pressed.");
         await AVActions.ActionDispatcherInvokeAsync(async delegate
         {
             if (!App.vWindowKeyboard.vWindowVisible && !App.vWindowKeypad.vWindowVisible)
             {
                 if (forceShow || Convert.ToBoolean(Setting_Load(vConfigurationDirectXInput, "ShortcutKeyboardPopup")))
                 {
                     await App.vWindowKeyboard.Show();
                 }
             }
             else if (!forceShow)
             {
                 await App.vWindowKeyboard.Hide();
                 await App.vWindowKeypad.Hide();
             }
         });
     }
     catch { }
 }
Exemple #19
0
        //Update the window visibility
        public async Task UpdateWindowVisibility(bool visible)
        {
            try
            {
                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    if (visible)
                    {
                        if (!vWindowVisible)
                        {
                            //Create and show the window
                            base.Show();

                            //Update the window style
                            await UpdateWindowStyleVisible();

                            this.Title     = "Fps Overlayer (Visible)";
                            vWindowVisible = true;
                            Debug.WriteLine("Showing the window.");
                        }
                    }
                    else
                    {
                        if (vWindowVisible)
                        {
                            //Update the window style
                            await UpdateWindowStyleHidden();

                            this.Title     = "Fps Overlayer (Hidden)";
                            vWindowVisible = false;
                            Debug.WriteLine("Hiding the window.");
                        }
                    }
                });
            }
            catch { }
        }
Exemple #20
0
 //Listbox move to near character
 async Task ListBoxSelectNearCharacter(bool selectNextCharacter)
 {
     try
     {
         await AVActions.ActionDispatcherInvokeAsync(async delegate
         {
             FrameworkElement frameworkElement = (FrameworkElement)Keyboard.FocusedElement;
             if (frameworkElement != null && frameworkElement.GetType() == typeof(ListBoxItem))
             {
                 ListBox parentListbox = AVFunctions.FindVisualParent <ListBox>(frameworkElement);
                 if (vSelectTargetLists.Contains(parentListbox.Name))
                 {
                     if (parentListbox.Name == "lb_FilePicker")
                     {
                         await SelectNearCharacterFiles(selectNextCharacter, parentListbox);
                     }
                     else
                     {
                         await SelectNearCharacterApps(selectNextCharacter, parentListbox);
                     }
                 }
                 else
                 {
                     if (selectNextCharacter)
                     {
                         await KeySendSingle(KeysVirtual.Next, vProcessCurrent.MainWindowHandle);
                     }
                     else
                     {
                         await KeySendSingle(KeysVirtual.Prior, vProcessCurrent.MainWindowHandle);
                     }
                 }
             }
         });
     }
     catch { }
 }
Exemple #21
0
        //Focus framework focus element
        public static async Task FrameworkElementFocusFocus(FrameworkElementFocus focusElement, IntPtr windowHandle)
        {
            try
            {
                await AVActions.ActionDispatcherInvokeAsync(async delegate
                {
                    //Check if focus element is disconnected
                    bool disconnectedSource = false;
                    if (focusElement.FocusElement != null)
                    {
                        disconnectedSource = focusElement.FocusElement.DataContext == BindingOperations.DisconnectedSource;
                    }

                    //Force focus on element
                    if (focusElement.FocusElement != null && !disconnectedSource)
                    {
                        Debug.WriteLine("Focusing on previous element: " + focusElement.FocusElement);
                        await FrameworkElementFocus(focusElement.FocusElement, false, windowHandle);
                    }
                    else if (focusElement.FocusListBox != null && !disconnectedSource)
                    {
                        Debug.WriteLine("Focusing on previous listbox: " + focusElement.FocusListBox);
                        await ListboxFocusIndex(focusElement.FocusListBox, false, false, focusElement.FocusIndex, windowHandle);
                    }
                    else
                    {
                        Debug.WriteLine("No previous focus element, pressing tab key.");
                        await KeySendSingle(KeysVirtual.Tab, windowHandle);
                    }

                    //Reset the previous focus
                    focusElement.Reset();
                });
            }
            catch { }
        }
Exemple #22
0
        //Process active XInput controller buttons
        async Task <bool> Controller_ButtonPress(ControllerInput ControllerInput)
        {
            bool ControllerUsed        = false;
            bool ControllerDelayShort  = false;
            bool ControllerDelayMedium = false;
            bool ControllerDelayLonger = false;

            try
            {
                if (GetSystemTicksMs() >= vControllerDelay_Button)
                {
                    if (ControllerInput.ButtonA.PressedRaw)
                    {
                        Debug.WriteLine("Button: APressed");

                        await AVActions.ActionDispatcherInvokeAsync(async delegate
                        {
                            FrameworkElement frameworkElement = (FrameworkElement)Keyboard.FocusedElement;
                            if (frameworkElement != null && frameworkElement.GetType() == typeof(TextBox))
                            {
                                //Launch the keyboard controller
                                if (vAppActivated && vControllerAnyConnected())
                                {
                                    await KeyboardControllerHideShow(true);
                                }
                            }
                            else
                            {
                                //Press on the space bar
                                await KeySendSingle(KeysVirtual.Space, vProcessCurrent.MainWindowHandle);
                            }
                        });

                        ControllerUsed        = true;
                        ControllerDelayMedium = true;
                    }
                    else if (ControllerInput.ButtonB.PressedRaw)
                    {
                        Debug.WriteLine("Button: BPressed");

                        if (Popup_Any_Open())
                        {
                            await KeySendSingle(KeysVirtual.Escape, vProcessCurrent.MainWindowHandle);
                        }
                        else
                        {
                            await SortAppListsSwitch(false);
                        }

                        ControllerUsed        = true;
                        ControllerDelayMedium = true;
                    }
                    else if (ControllerInput.ButtonY.PressedRaw)
                    {
                        Debug.WriteLine("Button: YPressed");

                        if (vTextInputOpen)
                        {
                            Debug.WriteLine("Resetting the text input popup.");
                            await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Reset_TextInput(true, string.Empty); });
                        }
                        else if (vSearchOpen)
                        {
                            Debug.WriteLine("Resetting the search popup.");
                            await AVActions.ActionDispatcherInvokeAsync(async delegate { await Popup_Reset_Search(true); });
                        }
                        else if (vFilePickerOpen)
                        {
                            await KeySendSingle(KeysVirtual.BackSpace, vProcessCurrent.MainWindowHandle);
                        }
                        else
                        {
                            await AVActions.ActionDispatcherInvokeAsync(async delegate { await QuickActionPrompt(); });
                        }

                        ControllerUsed        = true;
                        ControllerDelayMedium = true;
                    }
                    else if (ControllerInput.ButtonX.PressedRaw)
                    {
                        Debug.WriteLine("Button: XPressed");

                        await KeySendSingle(KeysVirtual.Delete, vProcessCurrent.MainWindowHandle);

                        ControllerUsed        = true;
                        ControllerDelayMedium = true;
                    }
                    else if (ControllerInput.ButtonShoulderLeft.PressedRaw)
                    {
                        Debug.WriteLine("Button: ShoulderLeftPressed");
                        await AVActions.ActionDispatcherInvokeAsync(async delegate
                        {
                            if (grid_Popup_Settings.Visibility == Visibility.Visible)
                            {
                                await SettingsChangeTab(true);
                                await KeySendSingle(KeysVirtual.F13, vProcessCurrent.MainWindowHandle);
                            }
                            else
                            {
                                await KeyPressComboAuto(KeysVirtual.Shift, KeysVirtual.Tab);
                            }
                        });

                        ControllerUsed       = true;
                        ControllerDelayShort = true;
                    }
                    else if (ControllerInput.ButtonShoulderRight.PressedRaw)
                    {
                        Debug.WriteLine("Button: ShoulderRightPressed");
                        await AVActions.ActionDispatcherInvokeAsync(async delegate
                        {
                            if (grid_Popup_Settings.Visibility == Visibility.Visible)
                            {
                                await SettingsChangeTab(false);
                                await KeySendSingle(KeysVirtual.F13, vProcessCurrent.MainWindowHandle);
                            }
                            else
                            {
                                await KeySendSingle(KeysVirtual.Tab, vProcessCurrent.MainWindowHandle);
                            }
                        });

                        ControllerUsed       = true;
                        ControllerDelayShort = true;
                    }
                    else if (ControllerInput.ButtonBack.PressedRaw)
                    {
                        Debug.WriteLine("Button: BackPressed / Show hide menu");
                        await AVActions.ActionDispatcherInvokeAsync(async delegate
                        {
                            await Popup_ShowHide_Search(false);
                        });

                        ControllerUsed        = true;
                        ControllerDelayLonger = true;
                    }
                    else if (ControllerInput.ButtonStart.PressedRaw)
                    {
                        Debug.WriteLine("Button: StartPressed / Show hide search");
                        if (vFilePickerOpen)
                        {
                            AVActions.ActionDispatcherInvoke(delegate
                            {
                                FilePicker_CheckItem();
                            });
                        }
                        else
                        {
                            await AVActions.ActionDispatcherInvokeAsync(async delegate
                            {
                                await Popup_ShowHide_MainMenu(false);
                            });
                        }

                        ControllerUsed        = true;
                        ControllerDelayLonger = true;
                    }
                    else if (ControllerInput.ButtonThumbLeft.PressedRaw)
                    {
                        Debug.WriteLine("Button: ThumbLeftPressed");
                        await KeySendSingle(KeysVirtual.Home, vProcessCurrent.MainWindowHandle);

                        ControllerUsed       = true;
                        ControllerDelayShort = true;
                    }
                    else if (ControllerInput.ButtonThumbRight.PressedRaw)
                    {
                        Debug.WriteLine("Button: ThumbRightPressed");
                        await KeySendSingle(KeysVirtual.End, vProcessCurrent.MainWindowHandle);

                        ControllerUsed       = true;
                        ControllerDelayShort = true;
                    }

                    if (ControllerDelayShort)
                    {
                        vControllerDelay_Button = GetSystemTicksMs() + vControllerDelayShortTicks;
                    }
                    else if (ControllerDelayMedium)
                    {
                        vControllerDelay_Button = GetSystemTicksMs() + vControllerDelayMediumTicks;
                    }
                    else if (ControllerDelayLonger)
                    {
                        vControllerDelay_Button = GetSystemTicksMs() + vControllerDelayLongerTicks;
                    }
                }
            }
            catch { }
            return(ControllerUsed);
        }
Exemple #23
0
        //Update the currently playing media
        async Task UpdateCurrentMediaInformation()
        {
            try
            {
                //Check if volume is currently muted
                bool currentOutputVolumeMuted = AudioMuteGetStatus(false);
                bool currentInputVolumeMuted  = AudioMuteGetStatus(true);
                await AVActions.ActionDispatcherInvokeAsync(delegate
                {
                    img_Main_VolumeMute.Visibility     = currentOutputVolumeMuted ? Visibility.Visible : Visibility.Collapsed;
                    img_Main_MicrophoneMute.Visibility = currentInputVolumeMuted ? Visibility.Visible : Visibility.Collapsed;
                });

                //Check if the application window is activated
                if (!vAppActivated)
                {
                    //Debug.WriteLine("Not updating media information, not activated.");
                    return;
                }

                //Check if the media popup is opened or setting is enabled
                bool mediaUpdateSetting = Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "ShowMediaMain"));

                await AVActions.ActionDispatcherInvokeAsync(delegate
                {
                    if (!mediaUpdateSetting)
                    {
                        main_Media_Information.Visibility = Visibility.Collapsed;
                        //Debug.WriteLine("Not updating media information, disabled.");
                        return;
                    }
                    else
                    {
                        //Update the media information margin
                        double widthTopButtons        = stackpanel_TopButtons.ActualWidth + 10;
                        double widthClockBattery      = grid_ClockBattery.ActualWidth + grid_ClockBattery.Margin.Right + 10;
                        main_Media_Information.Margin = new Thickness(widthTopButtons, 10, widthClockBattery, 0);
                    }
                });

                //Get the media session manager
                GlobalSystemMediaTransportControlsSessionManager smtcSessionManager = await GlobalSystemMediaTransportControlsSessionManager.RequestAsync();

                if (smtcSessionManager == null)
                {
                    HideMediaInformation();
                    return;
                }

                //Get the current media session
                GlobalSystemMediaTransportControlsSession smtcSession = smtcSessionManager.GetCurrentSession();
                if (smtcSession == null)
                {
                    HideMediaInformation();
                    return;
                }

                GlobalSystemMediaTransportControlsSessionMediaProperties mediaProperties = await smtcSession.TryGetMediaPropertiesAsync();

                GlobalSystemMediaTransportControlsSessionPlaybackInfo mediaPlayInfo = smtcSession.GetPlaybackInfo();
                //Debug.WriteLine("Media: " + mediaProperties.Title + "/" + mediaProperties.Artist + "/" + mediaProperties.AlbumTitle + "/" + mediaProperties.Subtitle + "/" + mediaProperties.PlaybackType + "/" + mediaProperties.TrackNumber + "/" + mediaProperties.AlbumTrackCount);
                //Debug.WriteLine("Play: " + mediaPlayInfo.PlaybackStatus + "/" + mediaPlayInfo.PlaybackType);

                //Load the media artist
                string mediaArtist = mediaProperties.Artist;
                if (string.IsNullOrWhiteSpace(mediaArtist))
                {
                    mediaArtist = mediaProperties.Subtitle;
                    if (string.IsNullOrWhiteSpace(mediaArtist))
                    {
                        mediaArtist = "Unknown artist";
                    }
                }

                //Load the media title
                string mediaTitle = mediaProperties.Title;
                if (string.IsNullOrWhiteSpace(mediaTitle))
                {
                    mediaTitle = "Unknown title";
                }

                //Update the media and volume information
                AVActions.ActionDispatcherInvoke(delegate
                {
                    main_Media_Information_Artist.Text = mediaArtist;
                    main_Media_Information_Title.Text  = " " + mediaTitle;
                    main_Media_Information.Visibility  = Visibility.Visible;

                    if (mediaPlayInfo.PlaybackStatus == GlobalSystemMediaTransportControlsSessionPlaybackStatus.Playing)
                    {
                        main_Media_Information_Artist.Opacity = 1;
                        main_Media_Information_Title.Opacity  = 1;
                    }
                    else
                    {
                        main_Media_Information_Artist.Opacity = 0.40;
                        main_Media_Information_Title.Opacity  = 0.40;
                    }
                });
            }
            catch
            {
                //Debug.WriteLine("Failed updating playing media.");
                HideMediaInformation();
            }
        }
Exemple #24
0
        //Process controller input for keyboard
        public async Task ControllerInteractionKeyboard(ControllerInput ControllerInput)
        {
            bool ControllerDelay125 = false;
            bool ControllerDelay250 = false;
            bool ControllerDelay500 = false;

            try
            {
                if (GetSystemTicksMs() >= vControllerDelay_Keyboard)
                {
                    //Check the keyboard mode
                    KeyboardMode keyboardMode = (KeyboardMode)Convert.ToInt32(Setting_Load(vConfigurationDirectXInput, "KeyboardMode"));

                    //Send internal arrow left key
                    if (ControllerInput.DPadLeft.PressedRaw)
                    {
                        if (keyboardMode == KeyboardMode.Media)
                        {
                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.ArrowLeft, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                        }
                        else
                        {
                            //Update the window style to activate window
                            await UpdateWindowStyleVisible();

                            //Check the foreground window
                            if (vInteropWindowHandle != vProcessForeground.WindowHandle)
                            {
                                PlayInterfaceSound(vConfigurationCtrlUI, "Move", false, false);
                                KeySendSingle(KeysVirtual.Left, vInteropWindowHandle);
                            }
                        }
                        ControllerDelay125 = true;
                    }
                    //Send internal arrow right key
                    else if (ControllerInput.DPadRight.PressedRaw)
                    {
                        if (keyboardMode == KeyboardMode.Media)
                        {
                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.ArrowRight, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                        }
                        else
                        {
                            //Update the window style to activate window
                            await UpdateWindowStyleVisible();

                            //Check the foreground window
                            if (vInteropWindowHandle != vProcessForeground.WindowHandle)
                            {
                                PlayInterfaceSound(vConfigurationCtrlUI, "Move", false, false);
                                KeySendSingle(KeysVirtual.Right, vInteropWindowHandle);
                            }
                        }
                        ControllerDelay125 = true;
                    }
                    //Send internal arrow up key
                    else if (ControllerInput.DPadUp.PressedRaw)
                    {
                        if (keyboardMode == KeyboardMode.Media)
                        {
                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.ArrowUp, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                        }
                        else
                        {
                            //Update the window style to activate window
                            await UpdateWindowStyleVisible();

                            //Check the foreground window
                            if (vInteropWindowHandle != vProcessForeground.WindowHandle)
                            {
                                PlayInterfaceSound(vConfigurationCtrlUI, "Move", false, false);
                                KeySendSingle(KeysVirtual.Up, vInteropWindowHandle);
                            }
                        }
                        ControllerDelay125 = true;
                    }
                    //Send internal arrow down key
                    else if (ControllerInput.DPadDown.PressedRaw)
                    {
                        if (keyboardMode == KeyboardMode.Media)
                        {
                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.ArrowDown, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                        }
                        else
                        {
                            //Update the window style to activate window
                            await UpdateWindowStyleVisible();

                            //Check the foreground window
                            if (vInteropWindowHandle != vProcessForeground.WindowHandle)
                            {
                                PlayInterfaceSound(vConfigurationCtrlUI, "Move", false, false);
                                KeySendSingle(KeysVirtual.Down, vInteropWindowHandle);
                            }
                        }
                        ControllerDelay125 = true;
                    }

                    //Send internal space key
                    else if (ControllerInput.ButtonA.PressedRaw)
                    {
                        //Update the window style to activate window
                        await UpdateWindowStyleVisible();

                        //Check the foreground window
                        if (vInteropWindowHandle != vProcessForeground.WindowHandle)
                        {
                            KeySendSingle(KeysVirtual.Space, vInteropWindowHandle);
                        }

                        ControllerDelay125 = true;
                    }
                    //Send external enter key
                    else if (ControllerInput.ButtonB.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);

                        await AVActions.ActionDispatcherInvokeAsync(async delegate
                        {
                            if (border_EmojiListPopup.Visibility == Visibility.Visible || border_TextListPopup.Visibility == Visibility.Visible)
                            {
                                await HideTextEmojiPopup();
                            }
                            else if (keyboardMode == KeyboardMode.Media)
                            {
                                await MediaNext();
                            }
                            else
                            {
                                vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.Enter, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                            }
                        });

                        ControllerDelay125 = true;
                    }
                    //Send external space key
                    else if (ControllerInput.ButtonY.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);

                        if (keyboardMode == KeyboardMode.Media)
                        {
                            await MediaPlayPause();
                        }
                        else
                        {
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.Space, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                        }

                        ControllerDelay125 = true;
                    }
                    //Send external backspace or delete key
                    else if (ControllerInput.ButtonX.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);

                        if (keyboardMode == KeyboardMode.Media)
                        {
                            await MediaPrevious();
                        }
                        else if (vCapsEnabled)
                        {
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.Delete, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                        }
                        else
                        {
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.Backspace, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                        }

                        ControllerDelay125 = true;
                    }

                    //Send external arrow left key
                    else if (ControllerInput.ButtonThumbLeft.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);

                        if (keyboardMode == KeyboardMode.Media)
                        {
                            await VolumeInputMute();

                            ControllerDelay500 = true;
                        }
                        else
                        {
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.ArrowLeft, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                            ControllerDelay125 = true;
                        }
                    }
                    //Send external arrow right key
                    else if (ControllerInput.ButtonThumbRight.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);

                        if (keyboardMode == KeyboardMode.Media)
                        {
                            await VolumeOutputMute();

                            ControllerDelay500 = true;
                        }
                        else
                        {
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.ArrowRight, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                            ControllerDelay125 = true;
                        }
                    }

                    //Mute volume
                    else if (ControllerInput.TriggerLeft > 0 && ControllerInput.TriggerRight > 0)
                    {
                        Debug.WriteLine("Button: TriggerLeft and TriggerRight / Mute");

                        if (keyboardMode == KeyboardMode.Media)
                        {
                            await VolumeOutputMute();
                        }

                        ControllerDelay500 = true;
                    }
                    //Switch caps lock
                    else if (ControllerInput.TriggerLeft > 80)
                    {
                        Debug.WriteLine("Button: TriggerLeft / Caps lock");

                        if (border_EmojiListPopup.Visibility == Visibility.Visible)
                        {
                            await SwitchEmojiTypeListTrigger(true);

                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                        }
                        else if (keyboardMode == KeyboardMode.Media)
                        {
                            await VolumeDown();
                        }
                        else
                        {
                            SwitchCapsLock();
                        }

                        ControllerDelay250 = true;
                    }
                    //Send external tab
                    else if (ControllerInput.TriggerRight > 80)
                    {
                        Debug.WriteLine("Button: TriggerRight / Press Tab");

                        if (border_EmojiListPopup.Visibility == Visibility.Visible)
                        {
                            await SwitchEmojiTypeListTrigger(false);

                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                        }
                        else if (keyboardMode == KeyboardMode.Media)
                        {
                            await VolumeUp();
                        }
                        else if (vCapsEnabled)
                        {
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.ShiftLeft, KeyboardModifiers.None, KeyboardKeys.Tab, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                        }
                        else
                        {
                            vFakerInputDevice.KeyboardPressRelease(KeyboardModifiers.None, KeyboardModifiers.None, KeyboardKeys.Tab, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None, KeyboardKeys.None);
                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false, false);
                        }

                        ControllerDelay250 = true;
                    }

                    //Show hide text emoji popup
                    else if (ControllerInput.ButtonBack.PressedRaw)
                    {
                        Debug.WriteLine("Button: BackPressed / Show hide text emoji popup");

                        if (keyboardMode == KeyboardMode.Media)
                        {
                            await MediaFullscreen();
                        }
                        else
                        {
                            await AVActions.ActionDispatcherInvokeAsync(async delegate
                            {
                                if (vLastPopupListType == "Text")
                                {
                                    await ShowHideTextListPopup();
                                }
                                else
                                {
                                    await ShowHideEmojiListPopup();
                                }
                            });
                        }

                        ControllerDelay250 = true;
                    }
                    //Switch keyboard mode
                    else if (ControllerInput.ButtonStart.PressedRaw)
                    {
                        Debug.WriteLine("Button: StartPressed / Switch keyboard mode");
                        await SwitchKeyboardMode();

                        ControllerDelay250 = true;
                    }

                    //Delay input to prevent repeat
                    if (ControllerDelay125)
                    {
                        vControllerDelay_Keyboard = GetSystemTicksMs() + vControllerDelayTicks125;
                    }
                    else if (ControllerDelay250)
                    {
                        vControllerDelay_Keyboard = GetSystemTicksMs() + vControllerDelayTicks250;
                    }
                    else if (ControllerDelay500)
                    {
                        vControllerDelay_Keyboard = GetSystemTicksMs() + vControllerDelayTicks500;
                    }
                }
            }
            catch { }
        }
Exemple #25
0
        //Process controller input for keyboard
        public async Task ControllerInteractionKeyboard(ControllerInput ControllerInput)
        {
            bool ControllerDelayShort  = false;
            bool ControllerDelayMedium = false;

            try
            {
                if (GetSystemTicksMs() >= vControllerDelay_Keyboard)
                {
                    //Send internal arrow left key
                    if (ControllerInput.DPadLeft.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Move", false);
                        await KeySendSingle(KeysVirtual.Left, vInteropWindowHandle);

                        ControllerDelayShort = true;
                    }
                    //Send internal arrow right key
                    else if (ControllerInput.DPadRight.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Move", false);
                        await KeySendSingle(KeysVirtual.Right, vInteropWindowHandle);

                        ControllerDelayShort = true;
                    }
                    //Send internal arrow up key
                    else if (ControllerInput.DPadUp.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Move", false);
                        await KeySendSingle(KeysVirtual.Up, vInteropWindowHandle);

                        ControllerDelayShort = true;
                    }
                    //Send internal arrow down key
                    else if (ControllerInput.DPadDown.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Move", false);
                        await KeySendSingle(KeysVirtual.Down, vInteropWindowHandle);

                        ControllerDelayShort = true;
                    }

                    //Send internal space key
                    else if (ControllerInput.ButtonA.PressedRaw)
                    {
                        await KeySendSingle(KeysVirtual.Space, vInteropWindowHandle);

                        ControllerDelayShort = true;
                    }
                    //Send external enter key
                    else if (ControllerInput.ButtonB.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        await KeyPressSingleAuto(KeysVirtual.Enter);

                        ControllerDelayShort = true;
                    }
                    //Send external space key
                    else if (ControllerInput.ButtonY.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        await KeyPressSingleAuto(KeysVirtual.Space);

                        ControllerDelayShort = true;
                    }
                    //Send external backspace or delete key
                    else if (ControllerInput.ButtonX.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        if (vCapsEnabled)
                        {
                            await KeyPressSingleAuto(KeysVirtual.Delete);
                        }
                        else
                        {
                            await KeyPressSingleAuto(KeysVirtual.BackSpace);
                        }

                        ControllerDelayShort = true;
                    }

                    //Send external arrow left key
                    else if (ControllerInput.ButtonShoulderLeft.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        await KeyPressSingleAuto(KeysVirtual.Left);

                        ControllerDelayShort = true;
                    }
                    //Send external arrow right key
                    else if (ControllerInput.ButtonShoulderRight.PressedRaw)
                    {
                        PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        await KeyPressSingleAuto(KeysVirtual.Right);

                        ControllerDelayShort = true;
                    }

                    //Switch caps lock
                    else if (ControllerInput.TriggerLeft > 0)
                    {
                        Debug.WriteLine("Button: TriggerLeft / Caps lock");

                        if (border_EmojiListPopup.Visibility == Visibility.Visible)
                        {
                            await SwitchEmojiTypeListTrigger(true);

                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        }
                        else
                        {
                            await SwitchCapsLock();
                        }

                        ControllerDelayMedium = true;
                    }
                    //Send external tab
                    else if (ControllerInput.TriggerRight > 0)
                    {
                        Debug.WriteLine("Button: TriggerRight / Press Tab");

                        if (vCapsEnabled)
                        {
                            await KeyPressComboAuto(KeysVirtual.Shift, KeysVirtual.Tab);

                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        }
                        else if (border_EmojiListPopup.Visibility == Visibility.Visible)
                        {
                            await SwitchEmojiTypeListTrigger(false);

                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        }
                        else
                        {
                            await KeyPressSingleAuto(KeysVirtual.Tab);

                            PlayInterfaceSound(vConfigurationCtrlUI, "Click", false);
                        }

                        ControllerDelayMedium = true;
                    }

                    //Show hide text emoji popup
                    else if (ControllerInput.ButtonBack.PressedRaw)
                    {
                        Debug.WriteLine("Button: BackPressed / Show hide text emoji popup");
                        await AVActions.ActionDispatcherInvokeAsync(async delegate
                        {
                            if (vLastPopupListType == "Text")
                            {
                                await ShowHideTextListPopup();
                            }
                            else
                            {
                                await ShowHideEmojiListPopup();
                            }
                        });

                        ControllerDelayMedium = true;
                    }
                    //Switch scroll and move
                    else if (ControllerInput.ButtonStart.PressedRaw)
                    {
                        Debug.WriteLine("Button: StartPressed / Scroll and Move");
                        SwitchKeyboardMode();

                        ControllerDelayMedium = true;
                    }

                    if (ControllerDelayShort)
                    {
                        vControllerDelay_Keyboard = GetSystemTicksMs() + vControllerDelayShortTicks;
                    }
                    else if (ControllerDelayMedium)
                    {
                        vControllerDelay_Keyboard = GetSystemTicksMs() + vControllerDelayMediumTicks;
                    }
                }
            }
            catch { }
        }