Skip to content
Merged

sync #704

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
4bc3951
DAO
joecare99 Apr 9, 2026
55e9c17
BaseGenClasses
joecare99 Apr 9, 2026
6d8d40f
BaseGenClassesTests
joecare99 Apr 9, 2026
c954a01
WinAhnenNew
joecare99 Apr 9, 2026
1cefd91
WinAhnenNew.Model
joecare99 Apr 9, 2026
16936cc
WinAhnenNew.Model.Tests
joecare99 Apr 9, 2026
1dc4515
Merge remote-tracking branch 'GH_CSharp/GenFreeWin'
joecare99 Apr 9, 2026
34faa16
SharpHack.Server
joecare99 Apr 9, 2026
3684253
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Apr 9, 2026
506b0c8
Merge remote-tracking branch 'GH_CSharp/MVVM_Tutorial'
joecare99 Apr 9, 2026
519b8eb
DAO
joecare99 Apr 9, 2026
01a6e8f
GenDBImplOLEDBTests
joecare99 Apr 9, 2026
b42dd38
GenFreeBaseClassesTests
joecare99 Apr 9, 2026
76dac52
GenFreeBaseTests
joecare99 Apr 9, 2026
c3378d9
GenFreeBrowser.Tests
joecare99 Apr 9, 2026
04eb0dc
GenFreeDataTests
joecare99 Apr 9, 2026
fb8fe77
GenFreeHelperTests
joecare99 Apr 9, 2026
adb39f8
GenFreeWinFormsTests
joecare99 Apr 9, 2026
4839a59
GenFreeWinTests
joecare99 Apr 9, 2026
a20f889
GenSecure.Core.Tests
joecare99 Apr 9, 2026
4c80312
MdbBrowserTests
joecare99 Apr 9, 2026
5fcea7f
VBUnObfusicatorTests
joecare99 Apr 9, 2026
b04de51
BaseGenClassesTests
joecare99 Apr 9, 2026
18dc4c7
WinAhnenClsTests
joecare99 Apr 9, 2026
13d5c31
WinAhnenNew.Model.Tests
joecare99 Apr 9, 2026
16627df
WinAhnenNew.UI.Tests
joecare99 Apr 9, 2026
88e6551
GenFreeWin
joecare99 Apr 9, 2026
68061ce
Merge remote-tracking branch 'GH_CSharp/GenFreeWin'
joecare99 Apr 9, 2026
f3207d4
DAO
joecare99 Apr 10, 2026
38c47d1
GenFreeBase
joecare99 Apr 10, 2026
603ae27
AmtsblattLoader.Console
joecare99 Apr 10, 2026
83da0e8
RnzTrauer.Console
joecare99 Apr 10, 2026
db110fc
RnzTrauer.Core
joecare99 Apr 10, 2026
6d2b1b1
RnzTrauer.Tests
joecare99 Apr 10, 2026
307d360
GenFreeWin
joecare99 Apr 10, 2026
b091b7a
AA16_Usercontrol1
joecare99 Apr 11, 2026
c1d436c
Avln_AnimationTiming
joecare99 Apr 11, 2026
5d9c293
Avln_AnimationTimingTests
joecare99 Apr 11, 2026
10aed73
Avln_Brushes
joecare99 Apr 11, 2026
1454f3b
Avln_Complex_Layout
joecare99 Apr 11, 2026
786c132
Avln_Complex_LayoutTests
joecare99 Apr 11, 2026
08921fe
Avln_CustomAnimation
joecare99 Apr 11, 2026
bd82b0c
Avln_Geometry
joecare99 Apr 11, 2026
6b6d2ec
Avln_Hello_World
joecare99 Apr 11, 2026
4e03e5b
Avln_Hello_WorldTests
joecare99 Apr 11, 2026
05c5c60
Avln_ImageView
joecare99 Apr 11, 2026
3c8c916
Avln_IntegrationTestApp
joecare99 Apr 11, 2026
d79d60b
Avln_MoveWindow
joecare99 Apr 11, 2026
2d17f63
Avln_MoveWindowTests
joecare99 Apr 11, 2026
efa553d
Avln_RenderDemo
joecare99 Apr 11, 2026
f560c89
Avln_Sample_Template
joecare99 Apr 11, 2026
589bbbc
Avln_TextTestApp
joecare99 Apr 11, 2026
bde7150
SampleControls
joecare99 Apr 11, 2026
a990e8e
Avln_BaseLib
joecare99 Apr 11, 2026
3cbea4a
Avln_BaseLibTests
joecare99 Apr 11, 2026
affe7ae
BaseLib
joecare99 Apr 11, 2026
b5955bd
BaseLibTests
joecare99 Apr 11, 2026
505e7e1
RenderImage.BaseTests
joecare99 Apr 11, 2026
1ff83c1
Avalonia_Apps
joecare99 Apr 11, 2026
28bc731
Merge remote-tracking branch 'GH_CSharp/Avalonia_Apps'
joecare99 Apr 11, 2026
550439b
Add IFile interface and FileProxy for file abstraction
joecare99 Apr 11, 2026
c3405b9
Remove DataAnnotation disabling, update placeholders, add security
joecare99 Apr 11, 2026
1f92a55
Adapt ViewModel and dialogs to Avalonia async API
joecare99 Apr 11, 2026
9792d3e
AA06_Converters4Tests
joecare99 Apr 11, 2026
329cebd
AA15_LabyrinthTests
joecare99 Apr 11, 2026
f5d5e4e
AA25_RichTextEditTests
joecare99 Apr 11, 2026
ad054ce
Avalonia_App_01.Browser
joecare99 Apr 11, 2026
3fa884b
Add overlay message box with async request support
joecare99 Apr 12, 2026
e83d5b6
Add draggable overlay dialog component for Avalonia
joecare99 Apr 12, 2026
e7d50a2
TraceCsv2realCsv
joecare99 Apr 12, 2026
c7ad008
Calc
joecare99 Apr 12, 2026
4a5096e
Data
joecare99 Apr 12, 2026
60d515c
Games
joecare99 Apr 12, 2026
262c474
Graphics
joecare99 Apr 12, 2026
5e8c51e
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Apr 12, 2026
9517578
RnzTrauer.Console
joecare99 Apr 12, 2026
89a9967
RnzTrauer.Core
joecare99 Apr 12, 2026
1103374
RnzTrauer.Tests
joecare99 Apr 12, 2026
3d272e0
GenFreeWin
joecare99 Apr 12, 2026
8f8c082
Merge remote-tracking branch 'GH_CSharp/GenFreeWin'
joecare99 Apr 12, 2026
7332dfe
Merge remote-tracking branch 'GH_CSharp/MVVM_Tutorial'
joecare99 Apr 12, 2026
36dbac4
AppWithPlugin
joecare99 Apr 12, 2026
4209a50
AppWithPluginTest
joecare99 Apr 12, 2026
d54e418
HelloPluginTest
joecare99 Apr 12, 2026
9f1c5f0
TestGJKAlgTest
joecare99 Apr 12, 2026
17831b9
TestStatementsTest
joecare99 Apr 12, 2026
091cb1e
Merge remote-tracking branch 'GH_CSharp/TestStatements'
joecare99 Apr 12, 2026
2ed5180
Analyzer1
joecare99 Apr 12, 2026
42e55dc
Analyzer1.Test
joecare99 Apr 12, 2026
b94ce50
Analyzer1.Vsix
joecare99 Apr 12, 2026
fa2f0a3
TranspilerLib.CSharp.Tests
joecare99 Apr 12, 2026
cc4c499
TranspilerLib.DriveBASIC.Tests
joecare99 Apr 12, 2026
9994640
TranspilerLib.IEC.Tests
joecare99 Apr 12, 2026
22cbb83
TranspilerLib.Pascal.Tests
joecare99 Apr 12, 2026
5c4d816
TranspilerLibTests
joecare99 Apr 12, 2026
535496e
Trnsp.Show.Lfm.Tests
joecare99 Apr 12, 2026
3e7858f
Trnsp.Show.Pas.Tests
joecare99 Apr 12, 2026
c92bc51
Merge remote-tracking branch 'GH_CSharp/Transpiler_pp'
joecare99 Apr 12, 2026
54a70b0
AA05_CommandParCalc
joecare99 Apr 12, 2026
ca7a14c
AA09_DialogBoxes
joecare99 Apr 12, 2026
c80d8f8
Avalonia_Apps
joecare99 Apr 12, 2026
b285089
Merge remote-tracking branch 'GH_CSharp/Avalonia_Apps'
joecare99 Apr 12, 2026
c4dcabb
TestStatements
joecare99 Apr 13, 2026
37ecc61
Transpiler_pp
joecare99 Apr 13, 2026
ee37d51
Merge branch 'Transpiler_pp'
joecare99 Apr 13, 2026
60a5c2c
TraceCsv2realCsv
joecare99 Apr 13, 2026
4a510a0
Data
joecare99 Apr 13, 2026
a86a707
Graphics
joecare99 Apr 13, 2026
d4031c9
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ Apply these defaults when working in this repository unless the user explicitly
## General Guidelines
- Document code thoroughly in English.
- Validate changes with relevant builds and tests before finishing.
- If requirements are unclear, ask clarifying questions before starting implementation.
- If requirements are unclear, ask clarifying questions before starting implementation or planning refinement.
- Avoid UI text strings in core services. Use Enumerations instead, and keep UI-facing strings in the ViewModel/UI layer.
- Prefer one class/interface/struct per file.
- document changes in an DevOps-manner markdown prefered, extrapolate bugs, tasks, baglogs and features
- Use `DevOps` as the planning directory in this workspace, and treat `.Info.md` as the general planning description file. Team terminology around Azure DevOps backlog items may differ from generic 'story' naming.

## Testing
- Use `MSTest` in the latest practical version for new or updated tests.
Expand All @@ -17,7 +21,9 @@ Apply these defaults when working in this repository unless the user explicitly

## Architecture
- Use MVVM architecture for UI components to separate concerns and improve testability, using CommunityToolkit.Mvvm for MVVM implementation.
- Prefer `NotifyPropertyChangedFor` over manual `OnPropertyChanged(nameof(...))` in CommunityToolkit.Mvvm observable properties where applicable.
- Use Dependency Injection to manage dependencies and improve testability, using Microsoft.Extensions.DependencyInjection.
- UI-facing strings and summary formatting should stay in the ViewModel/UI layer, not in extracted application logic services.

## Naming Conventions
- Distinguish between UI control naming and variable/field naming.
Expand All @@ -33,7 +39,7 @@ Apply these defaults when working in this repository unless the user explicitly
- Prefer meaningful domain names over type prefixes when the intent is already clear.
- In UI code, use short 3-character prefixes for actual controls in views and code-behind, e.g.
- `lst` for list controls
- `btn` for buttons
- `btn` for all kind of buttons,
- `edt` for any keyboard input control
- `lbl` for any text output control
- Do not use UI control prefixes for ViewModel properties or other non-UI members.
Expand Down
33 changes: 33 additions & 0 deletions Avalonia_Apps/.github/upgrades/dotnet-upgrade-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# .NET 8.0 Upgrade Plan

## Execution Steps

Execute steps below sequentially one by one in the order they are listed.

1. Validate that an .NET 8.0 SDK required for this upgrade is installed on the machine and if not, help to get it installed.
2. Ensure that the SDK version specified in global.json files is compatible with the .NET 8.0 upgrade.
3. Upgrade UWP_00_Test\UWP_00_Test.csproj

## Settings

This section contains settings and data used by execution steps.

### Excluded projects

Table below contains projects that do belong to the dependency graph for selected projects and should not be included in the upgrade.

| Project name | Description |
|:-------------|:-----------:|

### Project upgrade details
This section contains details about each project upgrade and modifications that need to be done in the project.

#### UWP_00_Test\UWP_00_Test.csproj modifications

Project properties changes:
- Include shared props: `..\MVVM_Tutorial.props`
- Enable nullable reference types: `nullable` set to `enable`
- Migrate project to SDK style targeting .NET 8 (Windows): adopt `Microsoft.NET.Sdk` with appropriate target framework if required by the app model

Other changes:
- Review and adjust Windows application model dependencies as needed for .NET 8 (e.g., Windows App SDK / WinUI migration if applicable)
19 changes: 0 additions & 19 deletions Avalonia_Apps/AA05_CommandParCalc/AA05_CommandParCalc/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Linq;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Avalonia.Platform;
using AA05_CommandParCalc.Models;
Expand Down Expand Up @@ -44,27 +41,11 @@ protected void InitDesktopApp(IClassicDesktopStyleApplicationLifetime desktop)

Services = services.BuildServiceProvider();

// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
DisableAvaloniaDataAnnotationValidation();
desktop.MainWindow = new MainWindow
{
DataContext = Services.GetRequiredService<ICommandParCalcViewModel>()
};
}

private void DisableAvaloniaDataAnnotationValidation()
{
// Get an array of plugins to remove
var dataValidationPluginsToRemove =
BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();

// remove each entry found
foreach (var plugin in dataValidationPluginsToRemove)
{
BindingPlugins.DataValidators.Remove(plugin);
}
}

public IServiceProvider? Services { get; private set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Bool2VisibilityConverterTests
/// <param name="value">The value.</param>
/// <param name="expected">The expected.</param>
/// <autogeneratedoc />
[DataTestMethod]
[TestMethod]
[DataRow(10.5, true)]
[DataRow(0.99, true)]
[DataRow(true, true)]
Expand All @@ -58,7 +58,7 @@ public void ConvertTest(object? value, bool expected)
/// Defines the test method ConvertBackTest.
/// </summary>
/// <autogeneratedoc />
[DataTestMethod()]
[TestMethod()]
[DataRow(true, true)]
[DataRow(false, false)]
[DataRow(false, null)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ namespace AA06_Converters_4.View.Converter.Tests;
[TestClass()]
public class WindowPortToGridLinesTests
{
#pragma warning disable CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Fügen Sie ggf. den „erforderlichen“ Modifizierer hinzu, oder deklarieren Sie den Modifizierer als NULL-Werte zulassend.
WindowPortToGridLines testVC;
#pragma warning restore CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Fügen Sie ggf. den „erforderlichen“ Modifizierer hinzu, oder deklarieren Sie den Modifizierer als NULL-Werte zulassend.
ViewModels.SWindowPort wp;

public static IEnumerable<object[]> ConvertTestData
Expand All @@ -34,7 +36,7 @@ public void WindowPortToGridLinesTest()
Assert.Fail();
}

[DataTestMethod()]
[TestMethod()]
[DynamicData(nameof(ConvertTestData))]
public void ConvertTest(object o)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Linq;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Avalonia.Platform;
using AA06_ValueConverter2.Models;
Expand Down Expand Up @@ -46,25 +43,11 @@ protected void InitDesktopApp(IClassicDesktopStyleApplicationLifetime desktop)

// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
DisableAvaloniaDataAnnotationValidation();
desktop.MainWindow = new MainWindow
{
DataContext = Services.GetRequiredService<IValueConverterViewModel>()
};
}

private void DisableAvaloniaDataAnnotationValidation()
{
// Get an array of plugins to remove
var dataValidationPluginsToRemove =
BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();

// remove each entry found
foreach (var plugin in dataValidationPluginsToRemove)
{
BindingPlugins.DataValidators.Remove(plugin);
}
}

public IServiceProvider? Services { get; private set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="MsBox.Avalonia" />
</ItemGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
Expand All @@ -57,6 +56,9 @@
<Compile Update="Views\DialogWindow.axaml.cs">
<DependentUpon>DialogWindow.axaml</DependentUpon>
</Compile>
<Compile Update="Views\OverlayDialogControl.axaml.cs">
<DependentUpon>OverlayDialogControl.axaml</DependentUpon>
</Compile>
<Compile Update="App.axaml.cs">
<DependentUpon>App.axaml</DependentUpon>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging.Messages;
using AA09_DialogBoxes.ViewModels;
using MsBox.Avalonia.Enums;

namespace AA09_DialogBoxes.Messages;

public sealed class MessageBoxRequestMessage : AsyncRequestMessage<ButtonResult>
public enum MsgBoxResult { None, Yes, No }

public sealed class MessageBoxRequestMessage : AsyncRequestMessage<MsgBoxResult>
{
public string Title { get; }
public string Content { get; }

public MessageBoxRequestMessage(string title, string content)
{
Title = title;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using CommunityToolkit.Mvvm.Messaging.Messages;

namespace AA09_DialogBoxes.Messages;

public sealed class OverlayMessageRequestMessage : AsyncRequestMessage<MsgBoxResult>
{
public string Title { get; }
public string Content { get; }

public OverlayMessageRequestMessage(string title, string content)
{
Title = title;
Content = content;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using CommunityToolkit.Mvvm.Messaging;
using AA09_DialogBoxes.Messages;
using System.Threading.Tasks;
using MsBox.Avalonia.Enums;

namespace AA09_DialogBoxes.ViewModels;

Expand Down Expand Up @@ -55,7 +54,7 @@ private async Task OpenMsg()
var request = new MessageBoxRequestMessage("Frage", "Willst Du Das ?");
WeakReferenceMessenger.Default.Send(request);
var result = await request.Response;
Name = result == ButtonResult.Yes ? "42 Entwickler" : "Nö";
Name = result == MsgBoxResult.Yes ? "42 Entwickler" : "Nö";
}

[RelayCommand]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@
using AA09_DialogBoxes.Messages;
using Avalonia.ViewModels;
using System.Threading.Tasks;
using MsBox.Avalonia.Enums;

namespace AA09_DialogBoxes.ViewModels;

public enum MsgBoxResult { None, Yes, No }

public partial class MainWindowViewModel : ViewModelBase
{
#region Properties
[ObservableProperty]
public partial string Name { get; set; }= "<Name>";
public partial string Name { get; set;} = "<Name>";
[ObservableProperty]
public partial string Email { get; set; }= "<Email>";
public partial string Email { get; set; } = "<Email>";
[ObservableProperty]
private int cnt = 1;
#endregion
Expand All @@ -42,12 +39,21 @@ private async Task OpenMsg()
var request = new MessageBoxRequestMessage("Frage", "Willst Du Das ?");
WeakReferenceMessenger.Default.Send(request);
var result = await request.Response;
if (result == ButtonResult.Yes)
if (result == MsgBoxResult.Yes)
Name = "42 Entwickler";
else
Name = "Nö";
}

[RelayCommand]
private async Task OpenOverlayMsg()
{
var request = new OverlayMessageRequestMessage("Overlay Frage", "Soll der In-Window-Overlay-Dialog verwendet werden?");
WeakReferenceMessenger.Default.Send(request);
var result = await request.Response;
Name = result == MsgBoxResult.Yes ? "Overlay: Ja" : "Overlay: Nein";
}

[RelayCommand]
private async Task OpenDialog()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<vm:DialogViewModel />
</Design.DataContext>
<StackPanel Margin="16" Spacing="8">
<TextBox Text="{Binding Name, Mode=TwoWay}" Watermark="Name"/>
<TextBox Text="{Binding Email, Mode=TwoWay}" Watermark="Email"/>
<TextBox Text="{Binding Name, Mode=TwoWay}" PlaceholderText="Name"/>
<TextBox Text="{Binding Email, Mode=TwoWay}" PlaceholderText="Email"/>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button Content="Open Dialog" Command="{Binding OpenDialogCommand}"/>
<Button Content="Open Message" Command="{Binding OpenMsgCommand}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<vm:DialogWindowViewModel />
</Design.DataContext>
<StackPanel Margin="16" Spacing="8">
<TextBox Text="{Binding Name, Mode=TwoWay}" Watermark="Name"/>
<TextBox Text="{Binding Email, Mode=TwoWay}" Watermark="Email"/>
<TextBox Text="{Binding Name, Mode=TwoWay}" PlaceholderText="Name"/>
<TextBox Text="{Binding Email, Mode=TwoWay}" PlaceholderText="Email"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8">
<Button Content="OK" Command="{Binding OKCommand}"/>
<Button Content="Cancel" Command="{Binding CancelCommand}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
x:Class="AA09_DialogBoxes.Views.MainWindow"
Width="600" Height="400"
Title="Dialog Demo"
x:DataType="vm:MainWindowViewModel"
x:DataType="vm:MainWindowViewModel"
mc:Ignorable="d">
<Design.DataContext>
<vm:MainWindowViewModel />
</Design.DataContext>
<StackPanel Margin="16" Spacing="8">
<TextBox Text="{Binding Name, Mode=TwoWay}" Watermark="Name"/>
<TextBox Text="{Binding Email, Mode=TwoWay}" Watermark="Email"/>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button Content="Open Dialog" Command="{Binding OpenDialogCommand}"/>
<Button Content="Open Message" Command="{Binding OpenMsgCommand}"/>

<Grid x:Name="MainRootGrid">
<StackPanel Margin="16" Spacing="8">
<TextBox Text="{Binding Name, Mode=TwoWay}" PlaceholderText="Name"/>
<TextBox Text="{Binding Email, Mode=TwoWay}" PlaceholderText="Email"/>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button Content="Open Dialog" Command="{Binding OpenDialogCommand}"/>
<Button Content="Open Message" Command="{Binding OpenMsgCommand}"/>
<Button Content="Open Overlay Message" Command="{Binding OpenOverlayMsgCommand}"/>
</StackPanel>
<TextBlock Text="{Binding Cnt}"/>
</StackPanel>
<TextBlock Text="{Binding Cnt}"/>
</StackPanel>
</Grid>
</Window>
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
using System;
using Avalonia.Controls;
using AA09_DialogBoxes.ViewModels;
using MsBox.Avalonia;
using MsBox.Avalonia.Enums;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using AA09_DialogBoxes.Messages;
using MessageBox.Avalonia.Enums;

namespace AA09_DialogBoxes.Views;

public partial class MainWindow : Window
{
private readonly OverlayDialogControl _overlayDialogControl;

public Func<object,IDialogWindow> NewDialogWindow = (o) => new DialogWindow() { DataContext = o};

public MainWindow()
{
InitializeComponent();
DataContext ??= new MainWindowViewModel();

var root = this.FindControl<Grid>("MainRootGrid")!;
_overlayDialogControl = new OverlayDialogControl();
_overlayDialogControl.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch;
_overlayDialogControl.VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch;
_overlayDialogControl.SetValue(Panel.ZIndexProperty, 10);
root.Children.Add(_overlayDialogControl);

this.Opened += Window_Opened;
}

private void Window_Opened(object? sender, EventArgs e)
{
// Register UI handlers for messages
WeakReferenceMessenger.Default.Register<MessageBoxRequestMessage>(this, async (r, m) =>
WeakReferenceMessenger.Default.Register<MessageBoxRequestMessage>(this, (r, m) =>
{
var box = new MessageBoxWindow(m.Title, m.Content);
m.Reply(box.ShowDialog<MsgBoxResult>(this));
});

WeakReferenceMessenger.Default.Register<OverlayMessageRequestMessage>(this, (r, m) =>
{
var box = MessageBoxManager.GetMessageBoxStandard(m.Title, m.Content, ButtonEnum.YesNo);
m.Reply(box.ShowAsync());
m.Reply(_overlayDialogControl.ShowAsync(this, m.Title, m.Content));
});

WeakReferenceMessenger.Default.Register<EditDialogRequestMessage>(this, (r, m) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="AA09_DialogBoxes.Views.MessageBoxWindow" Width="420" Height="240" MinWidth="360" MinHeight="200" CanResize="False" WindowStartupLocation="CenterOwner" Title="Frage"><Grid RowDefinitions="*,Auto"><ScrollViewer Grid.Row="0" Margin="16" VerticalScrollBarVisibility="Auto"><TextBlock x:Name="MessageText" TextWrapping="Wrap" VerticalAlignment="Top" /></ScrollViewer><StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8" Margin="16,0,16,16"><Button x:Name="YesButton" Click="OnYesClick" MinWidth="80"><TextBlock><Run TextDecorations="Underline">J</Run><Run>a</Run></TextBlock></Button><Button x:Name="NoButton" Click="OnNoClick" MinWidth="80"><TextBlock><Run TextDecorations="Underline">N</Run><Run>ein</Run></TextBlock></Button></StackPanel></Grid></Window>
Loading
Loading