diff --git a/Directory.Build.props b/Directory.Build.props
index 30484437..34cdf1ee 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -5,7 +5,7 @@
disable
- 11.0.9
+ 11.2.1
https://github.com/jinek/Consolonia/graphs/contributors
Text User Interface implementation of Avalonia UI (GUI Framework)
Copyright © Evgeny Gorbovoy 2021 - 2022
diff --git a/src/Consolonia.Core/Consolonia.Core.csproj b/src/Consolonia.Core/Consolonia.Core.csproj
index 32e010f8..ef64cb24 100644
--- a/src/Consolonia.Core/Consolonia.Core.csproj
+++ b/src/Consolonia.Core/Consolonia.Core.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs
index cda946f7..15176ce3 100644
--- a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs
+++ b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs
@@ -1,5 +1,7 @@
+using System;
using Avalonia;
using Avalonia.Controls;
+using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Media;
@@ -59,4 +61,16 @@ public override void OnFrameworkInitializationCompleted()
}
}
}
+
+ public class ConsoloniaApplication : ConsoloniaApplication
+ where TMainWindow: Window
+ {
+ public override void OnFrameworkInitializationCompleted()
+ {
+ if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+ desktop.MainWindow = Activator.CreateInstance();
+
+ base.OnFrameworkInitializationCompleted();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Consolonia.Core/README.md b/src/Consolonia.Core/README.md
index 4287de91..febb1204 100644
--- a/src/Consolonia.Core/README.md
+++ b/src/Consolonia.Core/README.md
@@ -3,7 +3,60 @@ TUI (Text User Interface) (GUI Framework) implementation for [Avalonia UI](https
Supports XAML, data bindings, animation, styling and the rest from Avalonia.
-## Showcase (click picture to see video)
+# Showcase (click picture to see video)
[![datagridpic](https://user-images.githubusercontent.com/10516222/141980173-4eb4057a-6996-45bf-83f6-931316c98d88.png)](https://youtu.be/ttgZmbruk3Y)
-This package is the core Consolonia support.
\ No newline at end of file
+This package is the core Consolonia library.
+
+# Usage
+Define an application with a theme (See Consolonia.Themes.TurboVision for themes)
+
+## Define a Window
+HelloWorldWindow.axaml
+```xaml
+
+
+
+```
+
+## Define an application
+You need to define an application that defines a theme and sets the main window.
+
+HelloWorldApp.cs
+```csharp
+// use HelloWorldWindow as the MainWindow for the application
+public class HelloWorldApp : ConsoloniaApplication
+{
+ public override void Initialize()
+ {
+ // set the theme
+ Styles.Add(new MaterialTheme());
+ }
+}
+```
+
+
+## Setup program.cs
+
+Program.cs
+```csharp
+[STAThread]
+private static void Main(string[] args)
+{
+ BuildAvaloniaApp()
+ .StartWithConsoleLifetime(args);
+}
+
+public static AppBuilder BuildAvaloniaApp()
+ => AppBuilder.Configure()
+ .UseConsolonia()
+ .UseAutoDetectedConsole()
+ .LogToException();
+```
+
+> **NOTE:**
+> * You need package **Consolonia**.**Themes**.**TurboVision** for themes
+> * You need package **Consolonia**.**PlatformSupport** to add an IConsole implementation via the .UseAutoDetectedConsole() method
+
\ No newline at end of file
diff --git a/src/Consolonia.Designer/ConsolePreview.cs b/src/Consolonia.Designer/ConsolePreview.cs
index 92a40bb9..5be89b3e 100644
--- a/src/Consolonia.Designer/ConsolePreview.cs
+++ b/src/Consolonia.Designer/ConsolePreview.cs
@@ -2,7 +2,6 @@
using Avalonia;
using Avalonia.Controls;
-#if DEBUG
using Consolonia.PreviewHost;
using System;
using System.Diagnostics;
@@ -15,7 +14,6 @@
using Avalonia.Threading;
using Consolonia.Core.Drawing.PixelBufferImplementation;
using Newtonsoft.Json;
-#endif
namespace Consolonia.Designer
{
@@ -45,7 +43,6 @@ public class ConsolePreview : UserControl
public ConsolePreview()
{
-#if DEBUG
_process = null;
FontFamily = FontFamily.Parse("Cascadia Mono");
Initialized += (_, _) => LoadXaml();
@@ -54,7 +51,6 @@ public ConsolePreview()
{
if (e.Property == FileNameProperty) LoadXaml();
};
-#endif
}
@@ -102,7 +98,6 @@ protected void Dispose(bool disposing)
if (disposing)
{
// TODO: dispose managed state (managed objects)
-#if DEBUG
#pragma warning disable CA1416 // Validate platform compatibility
if (_process != null)
{
@@ -111,7 +106,6 @@ protected void Dispose(bool disposing)
_process = null;
}
#pragma warning restore CA1416 // Validate platform compatibility
-#endif
}
_disposedValue = true;
@@ -125,14 +119,10 @@ public void Dispose()
Dispose(true);
}
-#if DEBUG
private Process? _process;
private readonly Typeface _typeface = new("Cascadia Mono");
private double _charWidth;
private double _charHeight;
-#endif
-
-#if DEBUG
private void LoadXaml()
{
@@ -451,6 +441,5 @@ public void Flush()
_textRunCharWidth = 0;
}
}
-#endif
}
}
\ No newline at end of file
diff --git a/src/Consolonia.Designer/Consolonia.Designer.csproj b/src/Consolonia.Designer/Consolonia.Designer.csproj
index 375a4be5..0ad7294e 100644
--- a/src/Consolonia.Designer/Consolonia.Designer.csproj
+++ b/src/Consolonia.Designer/Consolonia.Designer.csproj
@@ -1,7 +1,10 @@
-
+
+ false
+
+
@@ -17,7 +20,7 @@
-
+
diff --git a/src/Consolonia.Designer/Extensions.cs b/src/Consolonia.Designer/Extensions.cs
index e6722a4d..12cfb558 100644
--- a/src/Consolonia.Designer/Extensions.cs
+++ b/src/Consolonia.Designer/Extensions.cs
@@ -19,13 +19,11 @@ public static class Extensions
///
public static AppBuilder UseConsoloniaDesigner(this AppBuilder builder)
{
-#if DEBUG
- if (Design.IsDesignMode) //AppDomain.CurrentDomain.FriendlyName == "Avalonia.Designer.HostApp")
+ if (Design.IsDesignMode)
return builder
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
-#endif
return builder.UseConsolonia();
}
diff --git a/src/Consolonia.Designer/README.md b/src/Consolonia.Designer/README.md
index 7f576338..8e8f844d 100644
--- a/src/Consolonia.Designer/README.md
+++ b/src/Consolonia.Designer/README.md
@@ -6,4 +6,21 @@ Supports XAML, data bindings, animation, styling and the rest from Avalonia.
## Showcase (click picture to see video)
[![datagridpic](https://user-images.githubusercontent.com/10516222/141980173-4eb4057a-6996-45bf-83f6-931316c98d88.png)](https://youtu.be/ttgZmbruk3Y)
-This package is the Consolonia support for design time previews.
\ No newline at end of file
+This package **EXPERIMENTAL** Consolonia support for design time previews.
+
+## Usage
+```csharp
+[STAThread]
+private static void Main(string[] args)
+{
+ BuildAvaloniaApp()
+ .StartWithConsoleLifetime(args);
+}
+
+public static AppBuilder BuildAvaloniaApp()
+ => AppBuilder.Configure()
+ .UseConsoloniaDesigner()
+ .UseAutoDetectedConsole()
+ .LogToException();
+```
+
diff --git a/src/Consolonia.Gallery/App.cs b/src/Consolonia.Gallery/App.cs
index dee28c8f..8fb77bc2 100644
--- a/src/Consolonia.Gallery/App.cs
+++ b/src/Consolonia.Gallery/App.cs
@@ -5,7 +5,7 @@
using Avalonia.Styling;
using Consolonia.Core.Infrastructure;
using Consolonia.Gallery.View;
-using Consolonia.Themes.TurboVision.Themes.Material;
+using Consolonia.Themes.TurboVision.Themes;
namespace Consolonia.Gallery
{
@@ -19,9 +19,9 @@ static App()
public App()
{
- // Styles.Add(new TurboVisionTheme(new Uri("avares://Consolonia.Themes.TurboVision/Themes/TurboVisionDark/TurboVisionDark.axaml")));
- Styles.Add(new MaterialTheme(new Uri("avares://Consolonia.Themes.TurboVision/Themes/Material/Material.axaml")));
- // Styles.Add(new FluentTheme(new Uri("avares://Consolonia.Themes.TurboVision/Themes/Fluent/Fluent.axaml")));
+ // Styles.Add(new TurboVisionTheme());
+ Styles.Add(new MaterialTheme());
+ // Styles.Add(new FluentTheme());
}
public override void RegisterServices()
diff --git a/src/Consolonia.NUnit/Consolonia.NUnit.csproj b/src/Consolonia.NUnit/Consolonia.NUnit.csproj
index 2c4bda34..5f104704 100644
--- a/src/Consolonia.NUnit/Consolonia.NUnit.csproj
+++ b/src/Consolonia.NUnit/Consolonia.NUnit.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/Consolonia.NUnit/README.md b/src/Consolonia.NUnit/README.md
index 92292772..d890c865 100644
--- a/src/Consolonia.NUnit/README.md
+++ b/src/Consolonia.NUnit/README.md
@@ -9,6 +9,35 @@ Supports XAML, data bindings, animation, styling and the rest from Avalonia.
## Showcase (click picture to see video)
[![datagridpic](https://user-images.githubusercontent.com/10516222/141980173-4eb4057a-6996-45bf-83f6-931316c98d88.png)](https://youtu.be/ttgZmbruk3Y)
-Example of usage: https://github.com/jinek/ToolUI
+This package provides testing support for testing consolonia controls using NUnit.
-Solution contains one more readme file with coding information.
+## Usage
+To create a unit test against your consolonia application your test class should derive from ConsoloniaAppTestBase<App$gt;.
+
+You can define the size of your console by passing size parameter to base class.
+
+Then you can use UITest to interact with your application, and use UITest.AssertHasText() to verify the screen of text matches your expectation.
+
+### UITest.AssertHasText()
+Takes one or more Regex patterns and verifies that the screen contains the text that matches the pattern.
+
+### UITest.AssertHasNoText()
+Takes one or more Regex patterns and verifies that the screen does not contain the text that matches the pattern.
+
+## Example
+```csharp
+ public class Tests : ConsoloniaAppTestBase
+ {
+ public Tests : base(new PixelBufferSize(80, 40))
+ {
+ }
+
+
+ [Test]
+ public async Task DisplaysBasicText()
+ {
+ await UITest.KeyInput(Key.Tab);
+ await UITest.AssertHasText("This is TextBlock");
+ }
+ }
+```
diff --git a/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj b/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj
index 1e193695..1c672ec2 100644
--- a/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj
+++ b/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj
@@ -11,7 +11,7 @@
-
+