-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to show popup when changing brightness/temperature
- Loading branch information
Showing
17 changed files
with
422 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using NightGlow.Services; | ||
|
||
namespace NightGlow.ViewModels; | ||
|
||
public partial class PopupViewModel : ObservableObject | ||
{ | ||
|
||
private readonly SettingsService _settingsService; | ||
private readonly NightGlowService _nightGlowService; | ||
|
||
public SettingsService SettingsService { get => _settingsService; } | ||
public NightGlowService NightGlowService { get => _nightGlowService; } | ||
|
||
public PopupViewModel(SettingsService settingsService, NightGlowService nightGlowService) | ||
{ | ||
_settingsService = settingsService; | ||
_nightGlowService = nightGlowService; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<UserControl | ||
x:Class="NightGlow.Views.Controls.PopupDisplayInfoView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | ||
xmlns:local="clr-namespace:NightGlow.Views.Controls" | ||
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/" | ||
mc:Ignorable="d" | ||
Padding="10" | ||
> | ||
|
||
<Grid> | ||
|
||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="16"/> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="32"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<svgc:SvgViewbox | ||
Source="{Binding Icon, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:PopupDisplayInfoView}}}" | ||
Width="16" | ||
Height="16" | ||
Grid.Column="0" | ||
VerticalAlignment="Center" | ||
/> | ||
|
||
<materialDesign:Card | ||
materialDesign:ElevationAssist.Elevation="Dp0" | ||
UniformCornerRadius="2" | ||
Grid.Column="1" | ||
VerticalAlignment="Center" | ||
Margin="12,2,10,0" | ||
> | ||
|
||
<ProgressBar | ||
Value="{Binding SliderValue, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:PopupDisplayInfoView}}}" | ||
Minimum="{Binding SliderValueMin, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:PopupDisplayInfoView}}}" | ||
Maximum="{Binding SliderValueMax, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:PopupDisplayInfoView}}}" | ||
materialDesign:TransitionAssist.DisableTransitions="True" | ||
Foreground="{DynamicResource WinVolPopupDarkForeColor}" | ||
Background="{DynamicResource WinVolPopupProgressDarkBackColor}" | ||
BorderThickness="0" | ||
/> | ||
|
||
</materialDesign:Card> | ||
|
||
<TextBlock | ||
Text="{Binding SliderValue, StringFormat={}{0:F0}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:PopupDisplayInfoView}}}" | ||
FontSize="14" | ||
Grid.Column="2" | ||
VerticalAlignment="Center" | ||
TextAlignment="Center" | ||
Width="32" | ||
/> | ||
|
||
</Grid> | ||
|
||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace NightGlow.Views.Controls; | ||
|
||
public partial class PopupDisplayInfoView : UserControl | ||
{ | ||
|
||
public static readonly DependencyProperty SliderValueProperty = DependencyProperty.Register(nameof(SliderValue), typeof(double), typeof(PopupDisplayInfoView), null); | ||
|
||
public double SliderValue | ||
{ | ||
get => (double)GetValue(SliderValueProperty); | ||
set => SetValue(SliderValueProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty SliderValueMinProperty = DependencyProperty.Register(nameof(SliderValueMin), typeof(double), typeof(PopupDisplayInfoView), null); | ||
|
||
public double SliderValueMin | ||
{ | ||
get => (double)GetValue(SliderValueMinProperty); | ||
set => SetValue(SliderValueMinProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty SliderValueMaxProperty = DependencyProperty.Register(nameof(SliderValueMax), typeof(double), typeof(PopupDisplayInfoView), null); | ||
|
||
public double SliderValueMax | ||
{ | ||
get => (double)GetValue(SliderValueMaxProperty); | ||
set => SetValue(SliderValueMaxProperty, value); | ||
} | ||
|
||
public string Icon { get; set; } | ||
|
||
public PopupDisplayInfoView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<Window | ||
x:Class="NightGlow.Views.PopupWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:NightGlow.Views" | ||
xmlns:uc="clr-namespace:NightGlow.Views.Controls" | ||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | ||
xmlns:conv="clr-namespace:NightGlow.Views.Converters" | ||
mc:Ignorable="d" | ||
Width="200" | ||
WindowStyle="None" | ||
AllowsTransparency="True" | ||
Topmost="True" | ||
ResizeMode="NoResize" | ||
ShowInTaskbar="False" | ||
Background="Transparent" | ||
SizeToContent="Height" | ||
Focusable="False" | ||
TextElement.Foreground="{DynamicResource WinVolPopupDarkForeColor}" | ||
> | ||
|
||
<Window.Resources> | ||
<conv:DecToPctConverter x:Key="DecToPctConverter"/> | ||
</Window.Resources> | ||
|
||
<!-- View to animate in the window. Larger bottom padding so view isnt immediately cut off when starting to animate --> | ||
<Border | ||
x:Name="AnimatedContainer" | ||
Padding="4,4,4,16" | ||
> | ||
|
||
<Border.RenderTransform> | ||
<TranslateTransform x:Name="AnimatedContainerTransform" /> | ||
</Border.RenderTransform> | ||
|
||
<materialDesign:Card | ||
Style="{StaticResource MaterialDesignElevatedCard}" | ||
Background="{DynamicResource WinVolPopupDarkBackColor}" | ||
UniformCornerRadius="10" | ||
> | ||
|
||
<Border | ||
BorderBrush="{DynamicResource WinVolPopupDarkBorderColor}" | ||
BorderThickness="1" | ||
CornerRadius="10" | ||
Padding="0,2" | ||
> | ||
|
||
<StackPanel | ||
Orientation="Vertical" | ||
> | ||
|
||
<uc:PopupDisplayInfoView | ||
Icon="/Assets/popup-brightness.svg" | ||
SliderValue="{Binding NightGlowService.Brightness, Converter={StaticResource DecToPctConverter}}" | ||
SliderValueMin="{Binding SettingsService.BrightnessMin, Converter={StaticResource DecToPctConverter}}" | ||
SliderValueMax="{Binding SettingsService.BrightnessMax, Converter={StaticResource DecToPctConverter}}" | ||
/> | ||
|
||
<uc:PopupDisplayInfoView | ||
Icon="/Assets/popup-temperature.svg" | ||
SliderValue="{Binding NightGlowService.Temperature}" | ||
SliderValueMin="{Binding SettingsService.TemperatureMin}" | ||
SliderValueMax="{Binding SettingsService.TemperatureMax}" | ||
/> | ||
|
||
</StackPanel> | ||
</Border> | ||
</materialDesign:Card> | ||
</Border> | ||
</Window> |
Oops, something went wrong.