Skip to content

Commit cc61e65

Browse files
committed
Load free Dev Tools by default and Accelerate only when env var is set.
1 parent 04631e9 commit cc61e65

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,21 @@ Custom Avalonia Themes developed by [Devolutions](https://devolutions.net/)
88

99
➡️ [DevExpress Theme](https://github.com/Devolutions/avalonia-themes/blob/master/src/Devolutions.AvaloniaTheme.DevExpress/README.md)
1010

11+
➡️ [Linux Theme](https://github.com/Devolutions/avalonia-themes/blob/master/src/Devolutions.AvaloniaTheme.Linux/README.md)
12+
13+
# Sample App
14+
15+
Contributers can use the SampleApp to test, debug and document styles for the various controls under each theme.
16+
17+
## Debugging
18+
19+
The SampleApp attaches the Avalonia Dev Tools for inspecting controls (open with F12).
20+
21+
If you own a licence for the new Dev Tools in _Avalonia Accelerate_, you can set an environment variable in your IDE's debug configuration.
22+
For example, in Rider:
23+
24+
- Open **Run > Edit Configurations**
25+
- Pick your configuration for the SampleApp
26+
- In the **Environment Variables** field add `USE_AVALONIA_ACCELERATE_TOOLS=true`
27+
28+
The F12 key then opens the new Dev Tools, and F10 opens the old version

samples/SampleApp/App.axaml.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ public class App : Application
1919
public override void Initialize()
2020
{
2121
AvaloniaXamlLoader.Load(this);
22-
23-
#if DEBUG
24-
this.AttachDeveloperTools();
25-
#endif
2622

2723
if (!Avalonia.Controls.Design.IsDesignMode)
2824
{

samples/SampleApp/MainWindow.axaml.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using Avalonia;
23
using Avalonia.Controls;
34
using Avalonia.Controls.Primitives;
@@ -12,7 +13,20 @@ public MainWindow()
1213
{
1314
InitializeComponent();
1415
#if DEBUG
15-
this.AttachDevTools(new KeyGesture(Key.F10));
16+
bool useAccelerate = Environment.GetEnvironmentVariable("USE_AVALONIA_ACCELERATE_TOOLS")?.ToLowerInvariant() == "true";
17+
18+
if (useAccelerate)
19+
{
20+
// Enable Accelerate dev tools (AvaloniaUI.DiagnosticsSupport) - requiring a licence to use
21+
(Application.Current as App)?.AttachDeveloperTools();
22+
// Enable original free dev tools (Avalonia.Diagnostics) as an additional option available on F10
23+
this.AttachDevTools(new KeyGesture(Key.F10));
24+
}
25+
else
26+
{
27+
// Enable original free dev tools (Avalonia.Diagnostics)
28+
this.AttachDevTools();
29+
}
1630
#endif
1731
}
1832

0 commit comments

Comments
 (0)