Add:OverlayFeedbackElement.ClosedEvent fixed HeadlessTest.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:u="https://irihi.tech/ursa"
|
||||
MinHeight="200"
|
||||
MinWidth="500"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="HeadlessTest.Ursa.Controls.DrawerCloseTestPopupControl">
|
||||
<u:OverlayDialogHost x:Name="_overlayDialogHost" ></u:OverlayDialogHost>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace HeadlessTest.Ursa.Controls;
|
||||
|
||||
public partial class DrawerCloseTestPopupControl : UserControl
|
||||
{
|
||||
public DrawerCloseTestPopupControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
_overlayDialogHost.HostId = _hostid;
|
||||
}
|
||||
|
||||
private readonly string _hostid = Path.GetRandomFileName();
|
||||
public DrawerCloseTestPopupControl Popup { get; set; }
|
||||
public int LResult { get; set; }
|
||||
public int RResult { get; set; }
|
||||
|
||||
public async void OpenPopup()
|
||||
{
|
||||
var vm = new DrawerCloseTestPopupControlVM();
|
||||
LResult = vm.Result;
|
||||
RResult = await Drawer.ShowCustomModal<int>(Popup = new(), vm, _hostid);
|
||||
}
|
||||
|
||||
public void ClosePopup()
|
||||
{
|
||||
(Popup.DataContext as DrawerCloseTestPopupControlVM)?.Close();
|
||||
}
|
||||
|
||||
|
||||
public void Close()
|
||||
{
|
||||
(DataContext as DrawerCloseTestPopupControlVM)?.Close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Irihi.Avalonia.Shared.Contracts;
|
||||
|
||||
namespace HeadlessTest.Ursa.Controls;
|
||||
|
||||
public class DrawerCloseTestPopupControlVM : IDialogContext
|
||||
{
|
||||
public void Close()
|
||||
{
|
||||
RequestClose?.Invoke(this, Result);
|
||||
}
|
||||
|
||||
public int Result { get; } = Random.Shared.Next();
|
||||
|
||||
public event EventHandler<object?>? RequestClose;
|
||||
}
|
||||
Reference in New Issue
Block a user