mirror of
https://github.com/amwx/FluentAvalonia.git
synced 2026-10-28 11:46:53 +08:00
45 lines
934 B
C#
45 lines
934 B
C#
using System;
|
|
using Avalonia.Controls;
|
|
using FluentAvalonia.UI.Controls;
|
|
using FluentAvaloniaSamples.Controls;
|
|
|
|
namespace FluentAvaloniaSamples.Services;
|
|
|
|
public class NavigationService
|
|
{
|
|
public static NavigationService Instance { get; } = new NavigationService();
|
|
|
|
public void SetFrame(Frame f)
|
|
{
|
|
_frame = f;
|
|
}
|
|
|
|
public void SetOverlayHost(Panel p)
|
|
{
|
|
_overlayHost = p;
|
|
}
|
|
|
|
public void Navigate(Type t)
|
|
{
|
|
_frame.Navigate(t);
|
|
}
|
|
|
|
public void ShowControlDefinitionOverlay(Type targetType)
|
|
{
|
|
if (_overlayHost != null)
|
|
{
|
|
(_overlayHost.Children[0] as ControlDefinitionOverlay).TargetType = targetType;
|
|
(_overlayHost.Children[0] as ControlDefinitionOverlay).Show();
|
|
}
|
|
}
|
|
|
|
public void ClearOverlay()
|
|
{
|
|
_overlayHost?.Children.Clear();
|
|
|
|
}
|
|
|
|
private Frame _frame;
|
|
private Panel _overlayHost;
|
|
}
|