mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add IApp & AppExtensions for accessing the properties & functions from anywhere in the application
This commit is contained in:
parent
20ffff6d1b
commit
8b910500c6
2 changed files with 28 additions and 0 deletions
15
Flow.Launcher.Core/AppExtensions.cs
Normal file
15
Flow.Launcher.Core/AppExtensions.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System.Windows;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
||||
namespace Flow.Launcher.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Extension properties and functions of the current application singleton object.
|
||||
/// </summary>
|
||||
public static class AppExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the public API of the current application singleton object.
|
||||
/// </summary>
|
||||
public static IPublicAPI API => (Application.Current as IApp)!.PublicAPI;
|
||||
}
|
||||
13
Flow.Launcher.Core/IApp.cs
Normal file
13
Flow.Launcher.Core/IApp.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using Flow.Launcher.Plugin;
|
||||
|
||||
namespace Flow.Launcher.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for the current application singleton object exposing the properties
|
||||
/// and functions that can be accessed from anywhere in the application.
|
||||
/// </summary>
|
||||
public interface IApp
|
||||
{
|
||||
public IPublicAPI PublicAPI { get; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue