Skip to content

Commit 8b91050

Browse files
committed
Add IApp & AppExtensions for accessing the properties & functions from anywhere in the application
1 parent 20ffff6 commit 8b91050

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Windows;
2+
using Flow.Launcher.Plugin;
3+
4+
namespace Flow.Launcher.Core;
5+
6+
/// <summary>
7+
/// Extension properties and functions of the current application singleton object.
8+
/// </summary>
9+
public static class AppExtensions
10+
{
11+
/// <summary>
12+
/// Gets the public API of the current application singleton object.
13+
/// </summary>
14+
public static IPublicAPI API => (Application.Current as IApp)!.PublicAPI;
15+
}

Flow.Launcher.Core/IApp.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Flow.Launcher.Plugin;
2+
3+
namespace Flow.Launcher.Core
4+
{
5+
/// <summary>
6+
/// Interface for the current application singleton object exposing the properties
7+
/// and functions that can be accessed from anywhere in the application.
8+
/// </summary>
9+
public interface IApp
10+
{
11+
public IPublicAPI PublicAPI { get; }
12+
}
13+
}

0 commit comments

Comments
 (0)