Skip to content

Commit

Permalink
Small clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCichecki committed Jun 21, 2023
1 parent a485757 commit 023727a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ private async Task AuroraRefreshAsync(int profile, CancellationToken token)
}
}

private bool IsReady(SafeFileHandle handle)
private static bool IsReady(SafeHandle handle)
{
try
{
Expand All @@ -635,7 +635,7 @@ private bool IsReady(SafeFileHandle handle)
}
}

private void SetAndGetFeature<TIn, TOut>(SafeFileHandle handle, TIn input, out TOut output) where TIn : notnull where TOut : struct
private static void SetAndGetFeature<TIn, TOut>(SafeHandle handle, TIn input, out TOut output) where TIn : notnull where TOut : struct
{
lock (IoLock)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private AbstractAutomationStepControl GenerateStepControl(IAutomationStep automa
return control;
}

private void ShowContextMenu(Control control)
private void ShowContextMenu(FrameworkElement control)
{
var menuItems = new List<MenuItem>();

Expand Down Expand Up @@ -392,7 +392,7 @@ private void ShowContextMenu(Control control)
control.ContextMenu.IsOpen = true;
}

private void MoveStep(Control control, int index)
private void MoveStep(UIElement control, int index)
{
_stepsStackPanel.Children.Remove(control);
_stepsStackPanel.Children.Insert(index, control);
Expand All @@ -409,7 +409,7 @@ private void AddStep(AbstractAutomationStepControl control)
OnChanged?.Invoke(this, EventArgs.Empty);
}

private void DeleteStep(Control control)
private void DeleteStep(UIElement control)
{
_stepsStackPanel.Children.Remove(control);
_cardHeaderControl.Subtitle = GenerateSubtitle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private Control CreateGroupControl(DashboardItem dashboardItem)
return control;
}

private void MoveItemUp(Control control)
private void MoveItemUp(UIElement control)
{
var index = _itemsStackPanel.Children.IndexOf(control);
index--;
Expand All @@ -204,7 +204,7 @@ private void MoveItemUp(Control control)
_itemsStackPanel.Children.Insert(index, control);
}

private void MoveItemDown(Control control)
private void MoveItemDown(UIElement control)
{
var index = _itemsStackPanel.Children.IndexOf(control);
index++;
Expand All @@ -216,7 +216,7 @@ private void MoveItemDown(Control control)
_itemsStackPanel.Children.Insert(index, control);
}

private void DeleteItem(Control control)
private void DeleteItem(UIElement control)
{
_itemsStackPanel.Children.Remove(control);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ private void EditEffect(SpectrumKeyboardEffectControl effectControl)
window.ShowDialog();
}

private async Task ReplaceEffectAsync(SpectrumKeyboardEffectControl effectControl, SpectrumKeyboardBacklightEffect effect)
private async Task ReplaceEffectAsync(UIElement effectControl, SpectrumKeyboardBacklightEffect effect)
{
DeselectAllButtons();

Expand All @@ -525,7 +525,7 @@ private async Task ReplaceEffectAsync(SpectrumKeyboardEffectControl effectContro
await ApplyProfileAsync();
}

private async Task DeleteEffectAsync(SpectrumKeyboardEffectControl effectControl)
private async Task DeleteEffectAsync(UIElement effectControl)
{
_effects.Children.Remove(effectControl);

Expand Down
8 changes: 4 additions & 4 deletions LenovoLegionToolkit.WPF/Pages/AutomationPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private async Task<IAutomationStep[]> GetSupportedAutomationStepsAsync()
return supportedSteps.ToArray();
}

private AutomationPipelineControl GenerateControl(AutomationPipeline pipeline, StackPanel stackPanel)
private AutomationPipelineControl GenerateControl(AutomationPipeline pipeline, Panel stackPanel)
{
var control = new AutomationPipelineControl(pipeline, _supportedAutomationSteps);
control.MouseRightButtonUp += (_, e) =>
Expand All @@ -217,7 +217,7 @@ private void PipelinesChanged()
_saveRevertStackPanel.Visibility = Visibility.Visible;
}

private void ShowPipelineContextMenu(AutomationPipelineControl control, StackPanel stackPanel)
private void ShowPipelineContextMenu(AutomationPipelineControl control, Panel stackPanel)
{
var menuItems = new List<MenuItem>();

Expand Down Expand Up @@ -258,7 +258,7 @@ private void ShowPipelineContextMenu(AutomationPipelineControl control, StackPan
control.ContextMenu.IsOpen = true;
}

private void MovePipeline(AutomationPipelineControl control, StackPanel stackPanel, int index)
private void MovePipeline(UIElement control, Panel stackPanel, int index)
{
stackPanel.Children.Remove(control);
stackPanel.Children.Insert(index, control);
Expand Down Expand Up @@ -326,7 +326,7 @@ private async Task ChangePipelineIconAsync(AutomationPipelineControl control)
catch (TaskCanceledException) { }
}

private void DeletePipeline(AutomationPipelineControl control, StackPanel stackPanel)
private void DeletePipeline(UIElement control, Panel stackPanel)
{
stackPanel.Children.Remove(control);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public partial class EditDashboardWindow
{
private readonly DashboardSettings _dashboardSettings = IoCContainer.Resolve<DashboardSettings>();

private DashboardGroup[] _groups;
private readonly DashboardGroup[] _groups;

public event EventHandler? Apply;

Expand Down Expand Up @@ -72,7 +72,7 @@ private async void AddButton_Click(object sender, RoutedEventArgs e)
_groupsStackPanel.Children.Add(CreateGroupControl(new(DashboardGroupType.Custom, result)));
}

private async void DefaultButton_Click(object sender, RoutedEventArgs e)
private void DefaultButton_Click(object sender, RoutedEventArgs e)
{
_dashboardSettings.Store.Groups = null;
_dashboardSettings.SynchronizeStore();
Expand Down Expand Up @@ -113,7 +113,7 @@ private Control CreateGroupControl(DashboardGroup dashboardGroup)
return control;
}

private void MoveGroupUp(Control control)
private void MoveGroupUp(UIElement control)
{
var index = _groupsStackPanel.Children.IndexOf(control);
index--;
Expand All @@ -125,7 +125,7 @@ private void MoveGroupUp(Control control)
_groupsStackPanel.Children.Insert(index, control);
}

private void MoveGroupDown(Control control)
private void MoveGroupDown(UIElement control)
{
var index = _groupsStackPanel.Children.IndexOf(control);
index++;
Expand All @@ -137,7 +137,7 @@ private void MoveGroupDown(Control control)
_groupsStackPanel.Children.Insert(index, control);
}

private void DeleteGroup(Control control)
private void DeleteGroup(UIElement control)
{
_groupsStackPanel.Children.Remove(control);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using LenovoLegionToolkit.Lib;
using LenovoLegionToolkit.Lib.Controllers;
using LenovoLegionToolkit.Lib.Features;
Expand Down Expand Up @@ -64,7 +65,7 @@ private async Task RefreshAsync()
_loader.IsLoading = false;
}

private void Refresh(ComboBox comboBox, PowerPlan[] powerPlans, PowerModeState powerModeState)
private void Refresh(Selector comboBox, PowerPlan[] powerPlans, PowerModeState powerModeState)
{
var settingsPowerPlanGuid = _settings.Store.PowerPlans.GetValueOrDefault(powerModeState);
var selectedValue = powerPlans.FirstOrDefault(pp => pp.Guid == settingsPowerPlanGuid);
Expand Down

0 comments on commit 023727a

Please sign in to comment.