//Hide the launcher app async Task HideLauncherApp(ListBox listboxSender, int listboxSelectedIndex, DataBindApp dataBindApp) { try { await Notification_Send_Status("Hide", "Hiding launcher " + dataBindApp.Name); Debug.WriteLine("Hiding launcher by name: " + dataBindApp.Name); //Create new profile shared ProfileShared profileShared = new ProfileShared(); profileShared.String1 = dataBindApp.Name; //Add shortcut file to the ignore list vCtrlIgnoreLauncherName.Add(profileShared); JsonSaveObject(vCtrlIgnoreLauncherName, "CtrlIgnoreLauncherName"); //Remove application from the list await RemoveAppFromList(dataBindApp, false, false, true); //Select the previous index await ListboxFocusIndex(listboxSender, false, false, listboxSelectedIndex, vProcessCurrent.MainWindowHandle); } catch (Exception ex) { await Notification_Send_Status("Hide", "Failed hiding"); Debug.WriteLine("Failed hiding launcher: " + ex.Message); } }
//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 { } }
//Add text string to list void Btn_Settings_KeyboardTextString_Add_Click(object sender, RoutedEventArgs e) { try { string textString = textbox_Settings_KeyboardTextString.Text; string placeholderString = (string)textbox_Settings_KeyboardTextString.GetValue(TextboxPlaceholder.PlaceholderProperty); Debug.WriteLine("Adding new text string: " + textString); //Color brushes BrushConverter BrushConvert = new BrushConverter(); Brush BrushInvalid = BrushConvert.ConvertFromString("#CD1A2B") as Brush; Brush BrushValid = BrushConvert.ConvertFromString("#1DB954") as Brush; //Check if the text is empty if (string.IsNullOrWhiteSpace(textString)) { textbox_Settings_KeyboardTextString.BorderBrush = BrushInvalid; Debug.WriteLine("Please enter a text string."); return; } //Check if the text is place holder if (textString == placeholderString) { textbox_Settings_KeyboardTextString.BorderBrush = BrushInvalid; Debug.WriteLine("Please enter a text string."); return; } //Check if text already exists if (vDirectKeyboardTextList.Any(x => x.String1.ToLower() == textString.ToLower())) { textbox_Settings_KeyboardTextString.BorderBrush = BrushInvalid; Debug.WriteLine("Text string already exists."); return; } //Clear text from the textbox textbox_Settings_KeyboardTextString.Text = placeholderString; textbox_Settings_KeyboardTextString.BorderBrush = BrushValid; //Add text string to the list ProfileShared profileShared = new ProfileShared(); profileShared.String1 = textString; vDirectKeyboardTextList.Add(profileShared); JsonSaveObject(vDirectKeyboardTextList, @"User\DirectKeyboardTextList"); //Hide keyboard no text set App.vWindowKeyboard.textblock_TextListNoTextSet.Visibility = Visibility.Collapsed; } catch { } }
void Combobox_TextPosition_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { ComboBox senderComboBox = sender as ComboBox; ProfileShared FpsPositionProcessName = senderComboBox.DataContext as ProfileShared; Debug.WriteLine("Position changed to: " + senderComboBox.SelectedIndex + " for " + FpsPositionProcessName.String1); FpsPositionProcessName.Int1 = senderComboBox.SelectedIndex; JsonSaveObject(vFpsPositionProcessName, @"User\FpsPositionProcessName"); } catch { } }
void Button_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { try { Button senderButton = sender as Button; ProfileShared FpsPositionProcessName = senderButton.DataContext as ProfileShared; Debug.WriteLine("Removing application: " + FpsPositionProcessName.String1); vFpsPositionProcessName.Remove(FpsPositionProcessName); JsonSaveObject(vFpsPositionProcessName, @"User\FpsPositionProcessName"); } catch { } }
//Add position processes void AddPositionProcesses() { try { string processNameString = textbox_AddApp.Text; string placeholderString = (string)textbox_AddApp.GetValue(TextboxPlaceholder.PlaceholderProperty); Debug.WriteLine("Adding new process: " + processNameString); //Color brushes BrushConverter BrushConvert = new BrushConverter(); Brush BrushInvalid = BrushConvert.ConvertFromString("#CD1A2B") as Brush; Brush BrushValid = BrushConvert.ConvertFromString("#1DB954") as Brush; //Check if the name is empty if (string.IsNullOrWhiteSpace(processNameString)) { textbox_AddApp.BorderBrush = BrushInvalid; Debug.WriteLine("Please enter an application process."); return; } //Check if the name is place holder if (processNameString == placeholderString) { textbox_AddApp.BorderBrush = BrushInvalid; Debug.WriteLine("Please enter an application process."); return; } //Check if process already exists if (AppVariables.vFpsPositionProcessName.Any(x => x.String1.ToLower() == processNameString.ToLower())) { textbox_AddApp.BorderBrush = BrushInvalid; Debug.WriteLine("Application process already exists."); return; } //Clear name from the textbox textbox_AddApp.Text = placeholderString; ProfileShared FpsPositionProcessName = new ProfileShared(); FpsPositionProcessName.String1 = processNameString; FpsPositionProcessName.Int1 = 0; AppVariables.vFpsPositionProcessName.Add(FpsPositionProcessName); JsonSaveObject(AppVariables.vFpsPositionProcessName, "FpsPositionProcessName"); textbox_AddApp.BorderBrush = BrushValid; } catch { } }
void KeyTypeStringSenderShared(object sender) { try { ListBox ListboxSender = (ListBox)sender; if (ListboxSender.SelectedItems.Count > 0 && ListboxSender.SelectedIndex != -1) { PlayInterfaceSound(vConfigurationCtrlUI, "Click", false); ProfileShared SelectedItem = (ProfileShared)ListboxSender.SelectedItem; KeyTypeStringSend(SelectedItem.String1); } } catch { } }
private void Checkbox_AddLaunchEnableHDR_Click(object sender, RoutedEventArgs e) { try { //Enable monitor HDR string executableName = string.Empty; string executableNameRaw = string.Empty; if (string.IsNullOrWhiteSpace(tb_AddAppNameExe.Text)) { executableName = Path.GetFileNameWithoutExtension(tb_AddAppExePath.Text).ToLower(); executableNameRaw = tb_AddAppExePath.Text.ToLower(); } else { executableName = Path.GetFileNameWithoutExtension(tb_AddAppNameExe.Text).ToLower(); executableNameRaw = tb_AddAppNameExe.Text.ToLower(); } List <ProfileShared> enabledHDR = vCtrlHDRProcessName.Where(x => x.String1.ToLower() == executableName || x.String1.ToLower() == executableNameRaw).ToList(); if ((bool)checkbox_AddLaunchEnableHDR.IsChecked) { if (!enabledHDR.Any()) { ProfileShared newProfile = new ProfileShared(); newProfile.String1 = executableNameRaw; vCtrlHDRProcessName.Add(newProfile); JsonSaveObject(vCtrlHDRProcessName, @"User\CtrlHDRProcessName"); } Debug.WriteLine("Enabled HDR profile for: " + executableNameRaw); } else { if (enabledHDR.Any()) { foreach (ProfileShared removeProfile in enabledHDR) { vCtrlHDRProcessName.Remove(removeProfile); } JsonSaveObject(vCtrlHDRProcessName, @"User\CtrlHDRProcessName"); } Debug.WriteLine("Disabled HDR profile for: " + executableNameRaw); } } catch (Exception ex) { Debug.WriteLine("Failed to change enable HDR profile: " + ex.Message); } }
//Delete the edit profile async Task ProfileManager_DeleteProfile() { try { ProfileShared selectedProfile = (ProfileShared)lb_ProfileManager.SelectedItem; Debug.WriteLine("Removing profile value: " + selectedProfile); //Remove the selected profile value await ListBoxRemoveItem(lb_ProfileManager, vProfileManagerListShared, selectedProfile, true); //Save the updated json values JsonSaveObject(vProfileManagerListShared, @"User\" + vProfileManagerName); await Notification_Send_Status("Profile", "Removed profile value"); } catch { } }
//Load ignored controllers to list void ListboxLoadIgnoredController() { try { //Clear current list items listbox_ControllerIgnore.Items.Clear(); //Check ignored controllers if (vDirectControllersIgnored.Any()) { listbox_ControllerIgnore.Visibility = Visibility.Visible; textblock_ControllerIgnore.Visibility = Visibility.Collapsed; } else { listbox_ControllerIgnore.Visibility = Visibility.Collapsed; textblock_ControllerIgnore.Visibility = Visibility.Visible; return; } //Load ignored controllers foreach (ControllerIgnored controllerIgnored in vDirectControllersIgnored) { foreach (string productId in controllerIgnored.ProductIDs) { try { ProfileShared profileShared = new ProfileShared(); profileShared.String1 = controllerIgnored.CodeName; profileShared.String2 = controllerIgnored.VendorID; profileShared.String3 = productId; profileShared.Object1 = controllerIgnored; listbox_ControllerIgnore.Items.Add(profileShared); } catch { } } } Debug.WriteLine("Loaded ignored controller list."); } catch { } }
//Allow the ignored controller async Task AllowIgnoredController() { try { ProfileShared selectedItem = (ProfileShared)listbox_ControllerIgnore.SelectedItem; ControllerIgnored allowController = (ControllerIgnored)selectedItem.Object1; //Update json profile List <string> existingProducts = allowController.ProductIDs.ToList(); existingProducts.Remove(selectedItem.String3); //Check empty vendor if (existingProducts.Any()) { allowController.ProductIDs = existingProducts.ToArray(); } else { vDirectControllersIgnored.Remove(allowController); } Debug.WriteLine("Allowed controller in ignore list: " + selectedItem.String2 + "/" + selectedItem.String3); //Save json profile JsonSaveObject(vDirectControllersIgnored, @"User\DirectControllersIgnored"); //Load ignored controllers to list ListboxLoadIgnoredController(); //Notify user controller is allowed NotificationDetails notificationDetailsAllowed = new NotificationDetails(); notificationDetailsAllowed.Icon = "Controller"; notificationDetailsAllowed.Text = "Allowed the controller"; await App.vWindowOverlay.Notification_Show_Status(notificationDetailsAllowed); } catch { } }
//Remove text string from list void Btn_Settings_KeyboardTextString_Remove_Click(object sender, RoutedEventArgs e) { try { ProfileShared selectedProfile = (ProfileShared)combobox_KeyboardTextString.SelectedItem; Debug.WriteLine("Removing text string: " + selectedProfile.String1); //Remove mapping from list vDirectKeyboardTextList.Remove(selectedProfile); //Save changes to Json file JsonSaveObject(vDirectKeyboardTextList, @"User\DirectKeyboardTextList"); //Select the default profile combobox_KeyboardTextString.SelectedIndex = 0; //Check if texts are set if (!vDirectKeyboardTextList.Any()) { App.vWindowKeyboard.textblock_TextListNoTextSet.Visibility = Visibility.Visible; } } catch { } }
//Add new profile value private async Task AddSaveNewProfileValue() { try { string profileString1 = grid_Popup_ProfileManager_textbox_ProfileString1.Text; string profileString2 = grid_Popup_ProfileManager_textbox_ProfileString2.Text; Debug.WriteLine("Adding new profile value: " + profileString1 + " / " + profileString2); //Color brushes BrushConverter BrushConvert = new BrushConverter(); Brush BrushInvalid = BrushConvert.ConvertFromString("#CD1A2B") as Brush; Brush BrushValid = BrushConvert.ConvertFromString("#1DB954") as Brush; //Check if the string1 is empty if (string.IsNullOrWhiteSpace(profileString1)) { grid_Popup_ProfileManager_textbox_ProfileString1.BorderBrush = BrushInvalid; await Notification_Send_Status("Profile", "Empty profile value"); Debug.WriteLine("Please enter a profile value."); return; } //Check if the string2 is empty if (grid_Popup_ProfileManager_Value2.Visibility == Visibility.Visible && string.IsNullOrWhiteSpace(profileString2)) { grid_Popup_ProfileManager_textbox_ProfileString2.BorderBrush = BrushInvalid; await Notification_Send_Status("Profile", "Empty profile value"); Debug.WriteLine("Please enter a profile value."); return; } //Create new profile shared ProfileShared profileShared = new ProfileShared(); Func <ProfileShared, bool> profileFilter = null; //Check first string value if (!string.IsNullOrWhiteSpace(profileString1)) { profileShared.String1 = profileString1; profileFilter = x => x.String1.ToLower() == profileString1.ToLower(); } //Check second string value if (!string.IsNullOrWhiteSpace(profileString2)) { profileShared.String2 = profileString2; profileFilter = x => x.String1.ToLower() == profileString1.ToLower() && x.String2.ToLower() == profileString2.ToLower(); } //Check if values already exists if (vProfileManagerListShared.Any(profileFilter)) { grid_Popup_ProfileManager_textbox_ProfileString1.BorderBrush = BrushInvalid; grid_Popup_ProfileManager_textbox_ProfileString2.BorderBrush = BrushInvalid; await Notification_Send_Status("Profile", "Profile already exists"); Debug.WriteLine("Profile value already exists."); return; } //Clear added value from the textbox grid_Popup_ProfileManager_textbox_ProfileString1.Text = string.Empty; grid_Popup_ProfileManager_textbox_ProfileString2.Text = string.Empty; //Add the new profile value await ListBoxAddItem(lb_ProfileManager, vProfileManagerListShared, profileShared, false, false); //Save the updated json values JsonSaveObject(vProfileManagerListShared, @"User\" + vProfileManagerName); //Show profile added notification await Notification_Send_Status("Profile", "New value added"); grid_Popup_ProfileManager_textbox_ProfileString1.BorderBrush = BrushValid; grid_Popup_ProfileManager_textbox_ProfileString2.BorderBrush = BrushValid; } catch { } }
//Update the window position public void UpdateFpsOverlayPosition(string processName) { try { //Load the text position OverlayPosition targetTextPosition = (OverlayPosition)Convert.ToInt32(Setting_Load(vConfigurationFpsOverlayer, "TextPosition")); if (!string.IsNullOrWhiteSpace(processName)) { ProfileShared FpsPositionProcessName = vFpsPositionProcessName.Where(x => x.String1.ToLower() == processName.ToLower()).FirstOrDefault(); if (FpsPositionProcessName != null) { Debug.WriteLine("Found fps position for: " + FpsPositionProcessName.String1 + " / " + FpsPositionProcessName.Int1); targetTextPosition = (OverlayPosition)FpsPositionProcessName.Int1; } } //Hide or show the fps overlayer if (targetTextPosition == OverlayPosition.Hidden) { AVActions.ActionDispatcherInvoke(delegate { grid_FpsOverlayer.Visibility = Visibility.Collapsed; }); return; } else if (!vManualHidden) { AVActions.ActionDispatcherInvoke(delegate { grid_FpsOverlayer.Visibility = Visibility.Visible; }); } //Move fps to set position if (targetTextPosition == OverlayPosition.TopLeft) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); grid_FpsOverlayer.Margin = new Thickness(marginHorizontal, marginVertical, 0, 0); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Top; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Left; }); } else if (targetTextPosition == OverlayPosition.TopCenter) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); grid_FpsOverlayer.Margin = new Thickness(marginHorizontal, marginVertical, 0, 0); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Top; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Center; }); } else if (targetTextPosition == OverlayPosition.TopRight) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); grid_FpsOverlayer.Margin = new Thickness(0, marginVertical, marginHorizontal, 0); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Top; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Right; }); } else if (targetTextPosition == OverlayPosition.MiddleRight) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); grid_FpsOverlayer.Margin = new Thickness(0, marginVertical, marginHorizontal, 0); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Center; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Right; }); } else if (targetTextPosition == OverlayPosition.BottomRight) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); marginVertical += vKeypadBottomMargin; grid_FpsOverlayer.Margin = new Thickness(0, 0, marginHorizontal, marginVertical); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Bottom; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Right; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Right; }); } else if (targetTextPosition == OverlayPosition.BottomCenter) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); marginVertical += vKeypadBottomMargin; grid_FpsOverlayer.Margin = new Thickness(marginHorizontal, 0, 0, marginVertical); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Bottom; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Center; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Center; }); } else if (targetTextPosition == OverlayPosition.BottomLeft) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); marginVertical += vKeypadBottomMargin; grid_FpsOverlayer.Margin = new Thickness(marginHorizontal, 0, 0, marginVertical); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Bottom; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Left; }); } else if (targetTextPosition == OverlayPosition.MiddleLeft) { AVActions.ActionDispatcherInvoke(delegate { double marginHorizontal = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginHorizontal")); double marginVertical = Convert.ToDouble(Setting_Load(vConfigurationFpsOverlayer, "MarginVertical")); grid_FpsOverlayer.Margin = new Thickness(marginHorizontal, marginVertical, 0, 0); grid_FpsOverlayer.VerticalAlignment = VerticalAlignment.Center; grid_FpsOverlayer.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentMem.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentGpu.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentCpu.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentNet.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentFps.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentApp.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentTime.HorizontalAlignment = HorizontalAlignment.Left; stackpanel_CurrentMon.HorizontalAlignment = HorizontalAlignment.Left; }); } } catch { } }