Skip to content

Commit

Permalink
Updated WPF-UI
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCichecki committed Aug 20, 2023
1 parent 4a1e67b commit 8bc4efc
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ public class DisplayBrightnessAutomationStepControl : AbstractAutomationStepCont
private readonly NumberBox _brightness = new()
{
Width = 150,
IntegersOnly = true,
ClearButtonEnabled = false,
Min = 0,
Max = 100,
Step = 5,
MaxDecimalPlaces = 0,
Minimum = 0,
Maximum = 100,
SmallChange = 5,
LargeChange = 5
};

private readonly Grid _grid = new();
Expand All @@ -29,7 +30,7 @@ public DisplayBrightnessAutomationStepControl(DisplayBrightnessAutomationStep st
Subtitle = Resource.DisplayBrightnessAutomationStepControl_Message;
}

public override IAutomationStep CreateAutomationStep() => new DisplayBrightnessAutomationStep((int)_brightness.Value);
public override IAutomationStep CreateAutomationStep() => new DisplayBrightnessAutomationStep((int?)_brightness.Value ?? 0);

protected override UIElement GetCustomControl()
{
Expand Down
19 changes: 10 additions & 9 deletions LenovoLegionToolkit.WPF/Controls/ColorPickerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
Grid.Column="1"
Margin="0,0,0,8"
ClearButtonEnabled="False"
IntegersOnly="True"
Max="255"
Min="0"
MaxDecimalPlaces="0"
Maximum="255"
Minimum="0"
Text="0"
TextChanged="NumberBox_TextChanged" />
<wpfui:NumberBox
Expand All @@ -102,20 +102,21 @@
Grid.Column="1"
Margin="0,0,0,8"
ClearButtonEnabled="False"
IntegersOnly="True"
Max="255"
Min="0"
MaxDecimalPlaces="0"
Maximum="255"
Minimum="0"
Text="0"
TextChanged="NumberBox_TextChanged" />
<wpfui:NumberBox
x:Name="_blueNumberBox"
Grid.Row="3"
Grid.Column="1"
Margin="0,0,0,8"
AcceptsExpression="False"
ClearButtonEnabled="False"
IntegersOnly="True"
Max="255"
Min="0"
MaxDecimalPlaces="0"
Maximum="255"
Minimum="0"
Text="0"
TextChanged="NumberBox_TextChanged" />

Expand Down
2 changes: 1 addition & 1 deletion LenovoLegionToolkit.WPF/LenovoLegionToolkit.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageReference Include="Markdig.Wpf" Version="0.5.0.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="PixiEditor.ColorPicker" Version="3.3.1" />
<PackageReference Include="WPF-UI" Version="2.0.3" />
<PackageReference Include="WPF-UI" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LenovoLegionToolkit.Lib\LenovoLegionToolkit.Lib.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@
<ui:NumberBox
x:Name="_timePickerHours"
ClearButtonEnabled="False"
IntegersOnly="True"
Max="23"
Min="0"
Step="1" />
MaxDecimalPlaces="0"
Maximum="23"
Minimum="0" />
<Label
Margin="4,0,4,0"
VerticalContentAlignment="Center"
Content=":" />
<ui:NumberBox
x:Name="_timePickerMinutes"
ClearButtonEnabled="False"
IntegersOnly="True"
Max="59"
Min="0"
Step="1" />
MaxDecimalPlaces="0"
Maximum="59"
Minimum="0" />
<Label
Margin="8,0,0,0"
VerticalContentAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public ITimeAutomationPipelineTrigger GetTrigger()
if (!_timePickerPanel.IsEnabled)
return null;

var pickedHour = (int)_timePickerHours.Value;
var pickedMinute = (int)_timePickerMinutes.Value;
var pickedHour = (int?)_timePickerHours.Value ?? 0;
var pickedMinute = (int?)_timePickerMinutes.Value ?? 0;

var utc = DateTimeExtensions.LocalFrom(pickedHour, pickedMinute).ToUniversalTime();
return new Time { Hour = utc.Hour, Minute = utc.Minute };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@
Width="120"
Margin="32,0,0,0"
ClearButtonEnabled="False"
IntegersOnly="True"
Max="100"
Min="0" />
MaxDecimalPlaces="0"
Maximum="100"
Minimum="0" />
</wpfui:CardControl>

<wpfui:CardControl x:Name="_minValueOffsetCardControl" Margin="0,0,0,8">
Expand All @@ -282,9 +282,9 @@
Width="120"
Margin="32,0,0,0"
ClearButtonEnabled="False"
IntegersOnly="True"
Max="0"
Min="-100" />
MaxDecimalPlaces="0"
Maximum="0"
Minimum="-100" />
</wpfui:CardControl>

</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ private async Task<bool> ApplyAsync()
GPUTotalProcessingPowerTargetOnAcOffsetFromBaseline = preset.GPUTotalProcessingPowerTargetOnAcOffsetFromBaseline?.WithValue(_gpuTotalProcessingPowerTargetOnAcOffsetFromBaselineControl.Value),
FanTableInfo = preset.FanTableInfo is not null ? _fanCurveControl.GetFanTableInfo() : null,
FanFullSpeed = preset.FanFullSpeed is not null ? _fanFullSpeedToggle.IsChecked : null,
MaxValueOffset = preset.MaxValueOffset is not null ? (int)_maxValueOffsetNumberBox.Value : null,
MinValueOffset = preset.MinValueOffset is not null ? (int)_minValueOffsetNumberBox.Value : null
MaxValueOffset = preset.MaxValueOffset is not null ? (int?)_maxValueOffsetNumberBox.Value : null,
MinValueOffset = preset.MinValueOffset is not null ? (int?)_minValueOffsetNumberBox.Value : null
};

var newPresets = new Dictionary<Guid, GodModePreset>(presets)
Expand Down

0 comments on commit 8bc4efc

Please sign in to comment.