Skip to content

Commit

Permalink
add layouts refresh button
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytackydln committed Jun 7, 2024
1 parent 6e6be6f commit cca377e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project-Aurora/Project-Aurora/ConfigUi.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public ConfigUi(Task<ChromaSdkManager> rzSdkManager, Task<PluginManager> pluginM
_controlInterface = controlInterface;
_updateModule = updateModule;

_settingsControl = new Control_Settings(rzSdkManager, pluginManager, httpListener, deviceManager, ipcListener);
_settingsControl = new Control_Settings(rzSdkManager, pluginManager, httpListener, deviceManager, ipcListener, layoutManager);

_updateKeyboardLayouts = async () =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private async Task RefreshLinkLayout()
}
}

private async Task LoadBrandDefault()
internal async Task LoadBrandDefault()
{
var cancellationTokenSource = _cancellationTokenSource;
await cancellationTokenSource.CancelAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using AuroraRgb.Modules;
using AuroraRgb.Modules.GameStateListen;
using AuroraRgb.Modules.HardwareMonitor;
using AuroraRgb.Modules.Layouts;
using AuroraRgb.Modules.Razer;
using Button = System.Windows.Controls.Button;
using MessageBox = System.Windows.MessageBox;
Expand All @@ -24,7 +25,8 @@ public partial class Control_Settings
{
private readonly Task<AuroraHttpListener?> _httpListener;

public Control_Settings(Task<ChromaSdkManager> rzSdkManager, Task<PluginManager> pluginManager, Task<AuroraHttpListener?> httpListener, Task<DeviceManager> deviceManager, Task<IpcListener?> ipcListener)
public Control_Settings(Task<ChromaSdkManager> rzSdkManager, Task<PluginManager> pluginManager, Task<AuroraHttpListener?> httpListener,
Task<DeviceManager> deviceManager, Task<IpcListener?> ipcListener, Task<KeyboardLayoutManager> layoutManager)
{
_httpListener = httpListener;
InitializeComponent();
Expand All @@ -38,7 +40,7 @@ public Control_Settings(Task<ChromaSdkManager> rzSdkManager, Task<PluginManager>
LnkRepository.NavigateUri = new Uri($"https://github.com/{o}/{r}");
LnkContributors.NavigateUri = new Uri($"https://github.com/{o}/{r}#contributors-");

var devicesAndWrappers = new Control_SettingsDevicesAndWrappers(rzSdkManager, deviceManager);
var devicesAndWrappers = new Control_SettingsDevicesAndWrappers(rzSdkManager, deviceManager, layoutManager);
var controlDeviceManager = new Control_DeviceManager(deviceManager, ipcListener);
var deviceMapping = new DeviceMapping(deviceManager, ipcListener);
var plugins = new Control_PluginManager(pluginManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<TextBlock HorizontalAlignment="Left" Margin="0,1,0,1" Height="22" TextWrapping="Wrap"
Text="Bitmap Accuracy/Ratio: " VerticalAlignment="Top"
ToolTip="Determines how accurate the Freestyle key sequence option will map to the keys it is drawn over. Better accuracy comes at the cost of CPU/RAM usage, will likely only be a problem at Best" />
<Button HorizontalAlignment="Right" Margin="0,1,0,1" Height="22"
VerticalAlignment="Top"
Content=""
Click="LayoutsRefreshButton_OnClick"
ToolTip="Reload layouts" />
</StackPanel>
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Vertical">
<ComboBox SelectedValue="{Binding KeyboardLocalization}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Windows.Threading;
using AuroraRgb.Devices;
using AuroraRgb.Modules;
using AuroraRgb.Modules.Layouts;
using AuroraRgb.Modules.Logitech;
using AuroraRgb.Modules.Razer;
using RazerSdkReader;
Expand All @@ -20,16 +21,17 @@ public partial class Control_SettingsDevicesAndWrappers
{
private readonly Task<ChromaSdkManager> _rzSdkManager;
private readonly Task<DeviceManager> _deviceManager;
private readonly Task<KeyboardLayoutManager> _layoutManager;

private const string StatusConflict = """✗""";
private const string StatusCheck = """✔""";
private const string StatusNoMatter = "‐";

public Control_SettingsDevicesAndWrappers(Task<ChromaSdkManager> rzSdkManager,
Task<DeviceManager> deviceManager)
public Control_SettingsDevicesAndWrappers(Task<ChromaSdkManager> rzSdkManager, Task<DeviceManager> deviceManager, Task<KeyboardLayoutManager> layoutManager)
{
_rzSdkManager = rzSdkManager;
_deviceManager = deviceManager;
_layoutManager = layoutManager;

InitializeComponent();

Expand Down Expand Up @@ -332,7 +334,6 @@ private async void razer_wrapper_disable_device_control_button_Click(object? sen
await ChromaInstallationUtils.DisableDeviceControlAsync();
}


private void wrapper_install_lightfx_32_Click(object? sender, RoutedEventArgs e)
{
try
Expand Down Expand Up @@ -402,4 +403,10 @@ private void ChromaAdvancedButton_OnClick(object sender, RoutedEventArgs e)
ChromaAdvancedButton.IsEnabled = true;
};
}

private async void LayoutsRefreshButton_OnClick(object sender, RoutedEventArgs e)
{
var keyboardLayoutManager = await _layoutManager;
await keyboardLayoutManager.LoadBrandDefault();
}
}

0 comments on commit cca377e

Please sign in to comment.