Skip to content

Commit 45bf50e

Browse files
committed
1.7.9
[Bug fixes] - Unable to scroll Applications list properly #49 - Log file became garbage - possible fix for (Switching to HDR according to profile settings seems broken #50)
1 parent 393f0cc commit 45bf50e

File tree

15 files changed

+180
-151
lines changed

15 files changed

+180
-151
lines changed
0 Bytes
Binary file not shown.

Source/HDRProfile/App.xaml

Lines changed: 19 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -6,115 +6,49 @@
66
xmlns:uwp="clr-namespace:AutoHDR.UWP"
77
xmlns:prflActns="clr-namespace:AutoHDR.Profiles.Actions"
88
xmlns:info="clr-namespace:AutoHDR.Info"
9+
xmlns:thm="clr-namespace:AutoHDR.Theming"
910
xmlns:tb="http://www.hardcodet.net/taskbar"
1011
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
1112
xmlns:system="clr-namespace:System;assembly=mscorlib"
1213
xmlns:corewpf="clr-namespace:CodectoryCore.UI.Wpf;assembly=CodectoryCore.UI.Wpf"
1314
StartupUri="Views\AutoHDRMainView.xaml">
1415

1516
<Application.Resources>
16-
17-
18-
1917
<system:String x:Key="DonateLink">https://paypal.me/HeikoH89</system:String>
2018
<system:String x:Key="GitHubRepoLink">https://github.com/Codectory/AutoHDR</system:String>
19+
20+
2121
<Color x:Key="ActiveColor">#2ac987</Color>
2222
<Color x:Key="AccentColor">#ff6666</Color>
2323

2424
<Color x:Key="ControlMouseOverColor">#fa8e8e</Color>
2525
<Color x:Key="ControlPressedColor">#e36b6b</Color>
2626

27-
28-
29-
30-
<!--Control colors.-->
31-
<Color x:Key="WindowColor">#FFE8EDF9</Color>
32-
<Color x:Key="ContentAreaColorLight">#FFC5CBF9</Color>
33-
<Color x:Key="ContentAreaColorDark">#FF7381F9</Color>
34-
35-
<Color x:Key="DisabledControlLightColor">#FFE8EDF9</Color>
36-
<Color x:Key="DisabledControlDarkColor">#FFC5CBF9</Color>
37-
<Color x:Key="DisabledForegroundColor">#FF888888</Color>
38-
27+
<Color x:Key="WindowColor">White</Color>
3928
<Color x:Key="SelectedBackgroundColor">#fca9a9</Color>
4029
<Color x:Key="SelectedUnfocusedColor">#FFDDDDDD</Color>
41-
4230
<Color x:Key="ControlLightColor">White</Color>
4331
<Color x:Key="ControlMediumColor">#FFCCCCCC</Color>
44-
<Color x:Key="ControlDarkColor">#FF444444</Color>
45-
4632
<Color x:Key="GlyphColor">#FF444444</Color>
33+
<Color x:Key="DisabledForegroundColor">#cfcfcf</Color>
34+
<Color x:Key="DisabledControlDarkColor">#8a8a8a</Color>
4735

48-
<!--Border colors-->
49-
<Color x:Key="BorderLightColor">#FFCCCCCC</Color>
50-
<Color x:Key="BorderMediumColor">#fa4d4d</Color>
51-
<Color x:Key="BorderDarkColor">#de2323</Color>
52-
53-
<Color x:Key="PressedBorderLightColor">#FF888888</Color>
54-
<Color x:Key="PressedBorderDarkColor">#FF444444</Color>
55-
56-
<Color x:Key="DisabledBorderLightColor">#FFAAAAAA</Color>
5736
<Color x:Key="DisabledBorderDarkColor">#FF888888</Color>
5837

59-
<Color x:Key="DefaultBorderBrushDarkColor">Black</Color>
60-
61-
<!--Control-specific resources.-->
62-
<Color x:Key="HeaderTopColor">#FFC5CBF9</Color>
63-
<Color x:Key="DatagridCurrentCellBorderColor">Black</Color>
64-
<Color x:Key="SliderTrackDarkColor">#FFC5CBF9</Color>
38+
39+
6540
<system:Double x:Key="DefaultFontSize">15</system:Double>
6641

6742

68-
<Color x:Key="NavButtonFrameColor">#fa4d4d</Color>
69-
70-
<LinearGradientBrush x:Key="MenuPopupBrush"
71-
EndPoint="0.5,1"
72-
StartPoint="0.5,0">
73-
<GradientStop Color="{DynamicResource ControlLightColor}"
74-
Offset="0" />
75-
<GradientStop Color="{DynamicResource ControlMediumColor}"
76-
Offset="0.5" />
77-
<GradientStop Color="{DynamicResource ControlLightColor}"
78-
Offset="1" />
79-
</LinearGradientBrush>
80-
81-
<LinearGradientBrush x:Key="ProgressBarIndicatorAnimatedFill"
82-
StartPoint="0,0"
83-
EndPoint="1,0">
84-
<LinearGradientBrush.GradientStops>
85-
<GradientStopCollection>
86-
<GradientStop Color="#000000FF"
87-
Offset="0" />
88-
<GradientStop Color="#ff6666"
89-
Offset="0.4" />
90-
<GradientStop Color="#ff6666"
91-
Offset="0.6" />
92-
<GradientStop Color="#000000FF"
93-
Offset="1" />
94-
</GradientStopCollection>
95-
</LinearGradientBrush.GradientStops>
96-
</LinearGradientBrush>
9743

9844

9945

100-
101-
102-
103-
104-
105-
106-
107-
108-
109-
<!--<Color x:Key="AccentColor">#5d9ac7</Color> -->
110-
<SolidColorBrush x:Key="ButtonForegroundBrush">White</SolidColorBrush>
111-
46+
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="{StaticResource WindowColor}"/>
47+
<SolidColorBrush x:Key="ButtonForegroundBrush" Color="{StaticResource WindowColor}"/>
11248
<SolidColorBrush x:Key="ActiveBrush" Color="{StaticResource ActiveColor}"/>
11349
<SolidColorBrush x:Key="AccentBrush" Color="{StaticResource AccentColor}"/>
11450
<SolidColorBrush x:Key="HighlightedBrush" Color="{StaticResource SelectedBackgroundColor}"/>
11551
<SolidColorBrush x:Key="MouseOverBrush" Color="{StaticResource ControlMouseOverColor}"/>
116-
117-
11852
<SolidColorBrush x:Key="InactiveAccentBrush">#ad7b7b</SolidColorBrush>
11953
<SolidColorBrush x:Key="DisabledAccentBrush">#949ea6</SolidColorBrush>
12054
<SolidColorBrush x:Key="HighlightedInactiveAccentBrush" Color="#95bfdb"/>
@@ -133,9 +67,18 @@
13367
<Setter Property="Foreground" Value="Black"/>
13468

13569
</Style>
70+
13671
<Style TargetType="TextBlock" BasedOn="{StaticResource DefaultTextBlock}"/>
13772

13873

74+
<Style x:Key="DefaultUserControl" TargetType="UserControl">
75+
<Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}"/>
76+
<Setter Property="Foreground" Value="Black"/>
77+
78+
</Style>
79+
<Style TargetType="UserControl" BasedOn="{StaticResource DefaultUserControl}"/>
80+
81+
13982
<Style x:Key="RoundedBorder" TargetType="Border">
14083
<Setter Property="CornerRadius" Value="{StaticResource CornerRadius}"/>
14184
</Style>

Source/HDRProfile/App.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
using System.Threading.Tasks;
88
using System.Windows;
99
using AutoHDR.ProjectResources;
10+
using AutoHDR.Theming;
1011

1112
namespace AutoHDR
1213
{
1314
/// <summary>
1415
/// Interaktionslogik für "App.xaml"
1516
/// </summary>
1617
///
17-
1818
public partial class App : Application
1919
{
20+
21+
public static Theme Theme { get; set; } = Theme.Light;
22+
2023
static Mutex mutex;
2124

2225
[STAThread]

Source/HDRProfile/AutoHDR.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@
180180
<Reference Include="PresentationFramework" />
181181
</ItemGroup>
182182
<ItemGroup>
183+
<Compile Include="Theming\ThemeResourceDirectory.cs" />
184+
<Compile Include="Theming\Theme.cs" />
185+
<Compile Include="Windows\UI.cs" />
183186
<Page Include="App.xaml">
184187
<Generator>MSBuild:Compile</Generator>
185188
<SubType>Designer</SubType>
@@ -265,6 +268,10 @@
265268
<Compile Include="UWP\AppxManifest.cs" />
266269
<Compile Include="UWP\UWPAppsManager.cs" />
267270
<Compile Include="UWP\UWPApp.cs" />
271+
<Page Include="Theming\LightColors.xaml">
272+
<SubType>Designer</SubType>
273+
<Generator>MSBuild:Compile</Generator>
274+
</Page>
268275
<Page Include="Views\AudioActionView.xaml">
269276
<Generator>MSBuild:Compile</Generator>
270277
<SubType>Designer</SubType>

Source/HDRProfile/AutoHDRDaemon.cs

Lines changed: 21 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using CodectoryCore.UI.Wpf;
1010
using CodectoryCore.Windows;
1111
using System;
12+
using System.Collections.Generic;
1213
using System.Collections.ObjectModel;
1314
using System.Collections.Specialized;
1415
using System.ComponentModel;
@@ -166,59 +167,39 @@ private void UpdateCurrentProfile(ApplicationItem application, ApplicationChange
166167

167168
if (profile == null)
168169
return;
169-
Globals.Logs.Add($"Profile changed to {profile.Name}", false);
170-
170+
bool profileChanged = Equals(profile, CurrentProfile);
171+
172+
CurrentProfile = profile;
173+
if (profileChanged)
174+
Globals.Logs.Add($"Profile changed to {profile.Name}", false);
175+
List<IProfileAction> actions = new List<IProfileAction>();
171176
switch (changedType)
172177
{
173178
case ApplicationChangedType.Started:
174-
if (profile.ApplicationStarted.Count > 0)
175-
App.Current.Dispatcher.Invoke(() => LastActions.Clear());
176-
foreach (var action in profile.ApplicationStarted)
177-
{
178-
App.Current.Dispatcher.Invoke(() => LastActions.Add(action));
179-
action.NewLog += ActionLog;
180-
action.RunAction();
181-
action.NewLog -= ActionLog;
182-
}
179+
actions = profile.ApplicationStarted.ToList();
183180
break;
184181
case ApplicationChangedType.Closed:
185-
if (profile.ApplicationClosed.Count > 0)
186-
App.Current.Dispatcher.Invoke(() => LastActions.Clear());
187-
foreach (var action in profile.ApplicationClosed)
188-
{
189-
App.Current.Dispatcher.Invoke(() => LastActions.Add(action));
190-
action.NewLog += ActionLog;
191-
action.RunAction();
192-
action.NewLog -= ActionLog;
193-
}
182+
actions = profile.ApplicationClosed.ToList();
194183
break;
195184
case ApplicationChangedType.GotFocus:
196-
if (profile.ApplicationGotFocus.Count > 0)
197-
App.Current.Dispatcher.Invoke(() => LastActions.Clear());
198-
foreach (var action in profile.ApplicationGotFocus)
199-
{
200-
App.Current.Dispatcher.Invoke(() => LastActions.Add(action));
201-
action.NewLog += ActionLog;
202-
action.RunAction();
203-
action.NewLog -= ActionLog;
204-
205-
}
185+
actions = profile.ApplicationGotFocus.ToList();
206186
break;
207187
case ApplicationChangedType.LostFocus:
208-
if (profile.ApplicationLostFocus.Count > 0)
209-
App.Current.Dispatcher.Invoke(() => LastActions.Clear());
210-
foreach (var action in profile.ApplicationLostFocus)
211-
{
212-
App.Current.Dispatcher.Invoke(() => LastActions.Add(action));
213-
action.NewLog += ActionLog;
214-
action.RunAction();
215-
action.NewLog -= ActionLog;
216-
}
188+
actions = profile.ApplicationLostFocus.ToList();
217189
break;
218190
}
191+
if (actions.Count > 0)
192+
App.Current.Dispatcher.Invoke(() => LastActions.Clear());
193+
foreach (var action in actions)
194+
{
195+
App.Current.Dispatcher.Invoke(() => LastActions.Add(action));
196+
action.NewLog += ActionLog;
197+
action.RunAction();
198+
action.NewLog -= ActionLog;
199+
System.Threading.Thread.Sleep(100);
200+
}
219201
if (profile.RestartApplication && changedType == ApplicationChangedType.Started)
220202
assignment.Application.Restart();
221-
CurrentProfile = profile;
222203
if (changedType == ApplicationChangedType.Closed)
223204
CurrentProfile = null;
224205
}
@@ -247,15 +228,11 @@ private void CheckForNewVersion()
247228
{
248229
ShowInfo(data);
249230
}));
250-
251231
}
252232
else
253233
Globals.Logs.Add($"Local version is up to date.", false);
254-
255234
});
256235
}
257-
258-
259236
private void InitializeTrayMenuHelper()
260237
{
261238
TrayMenuHelper = new TrayMenuHelper();

Source/HDRProfile/Profiles/Actions/DisplayAction.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public override ActionEndResult RunAction(params object[] parameters)
127127
CallNewLog(new CodectoryCore.Logging.LogEntry($"{(EnableHDR ? "Activating" : "Deactivating")} HDR for display {Display.Name}"));
128128
Displays.HDRController.SetHDRState(Display.UID, EnableHDR);
129129
}
130+
System.Threading.Thread.Sleep(100);
130131
if (SetResolution)
131132
if (Display.Equals(Displays.Display.AllDisplays))
132133
{
@@ -139,7 +140,7 @@ public override ActionEndResult RunAction(params object[] parameters)
139140
CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting resolution {Resolution} for display {Display.Name}"));
140141
Display.SetResolution(Resolution);
141142
}
142-
143+
System.Threading.Thread.Sleep(100);
143144
if (SetRefreshRate)
144145
if (Display.Equals(Displays.Display.AllDisplays))
145146
{
@@ -153,7 +154,7 @@ public override ActionEndResult RunAction(params object[] parameters)
153154
CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting refresh rate {RefreshRate} for display {Display.Name}"));
154155
Display.SetRefreshRate(RefreshRate);
155156
}
156-
157+
System.Threading.Thread.Sleep(100);
157158
if (SetColorDepth)
158159
if (Display.Equals(Displays.Display.AllDisplays))
159160
{
@@ -167,7 +168,7 @@ public override ActionEndResult RunAction(params object[] parameters)
167168
CallNewLog(new CodectoryCore.Logging.LogEntry($"Setting color depth {ColorDepth} for display {Display.Name}"));
168169
Display.SetColorDepth(RefreshRate);
169170
}
170-
171+
System.Threading.Thread.Sleep(100);
171172
return new ActionEndResult(true);
172173
}
173174
catch (Exception ex)

Source/HDRProfile/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@
5252
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
5353
// indem Sie "*" wie unten gezeigt eingeben:
5454
// [assembly: AssemblyVersion("1.0.*")]
55-
[assembly: AssemblyVersion("1.7.8.0")]
56-
[assembly: AssemblyFileVersion("1.7.8.0")]
55+
[assembly: AssemblyVersion("1.7.9.0")]
56+
[assembly: AssemblyFileVersion("1.7.9.0")]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3+
<Color x:Key="ActiveColor">#2ac987</Color>
4+
<Color x:Key="AccentColor">#ff6666</Color>
5+
6+
<Color x:Key="ControlMouseOverColor">#fa8e8e</Color>
7+
<Color x:Key="ControlPressedColor">#e36b6b</Color>
8+
9+
<Color x:Key="WindowColor">White</Color>
10+
<Color x:Key="SelectedBackgroundColor">#fca9a9</Color>
11+
<Color x:Key="SelectedUnfocusedColor">#FFDDDDDD</Color>
12+
<Color x:Key="ControlLightColor">White</Color>
13+
<Color x:Key="ControlMediumColor">#FFCCCCCC</Color>
14+
<Color x:Key="GlyphColor">#FF444444</Color>
15+
<Color x:Key="DisabledBorderDarkColor">#FF888888</Color>
16+
</ResourceDictionary>

Source/HDRProfile/Theming/Theme.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace AutoHDR.Theming
8+
{
9+
public enum Theme
10+
{
11+
Dark,
12+
Light
13+
}
14+
}

0 commit comments

Comments
 (0)