struct _EventArgs {};
template<typename... TArgs>
using _Action = std::function<void(TArgs...)>;
template<typename TSender, typename TEventArgs>
using _EventHandler = _Action<TSender, TEventArgs>;
template<typename T>
class _Event;
template<typename TSender, std::derived_from<_EventArgs> TEventArgs>
class _Event<_EventHandler<TSender, TEventArgs>>
{
};
_Event<_EventHandler<int, _EventArgs>> globalEvent; // Нет ошибки
void Test()
{
_Event<_EventHandler<int, _EventArgs>> localEvent; //E0070
}
struct TestStruct
{
_Event<_EventHandler<int, _EventArgs>> FieldEvent; //E0070
};
template<typename... TArgs>
using Action = Delegate<void(TArgs...)>;
template<typename TSender, std::derived_from<EventArgs> TEventArgs>
using EventHandler = Action<TSender&, const TEventArgs&>;
Event<EventHandler<Application, EventArgs>> e; // E0070
template<typename TSender, std::derived_from<EventArgs> TEventArgs>
using EventHandler = Delegate<void(TSender&, const TEventArgs&)>;
Event<EventHandler<Application, EventArgs>> e;
public interface IPushNotificationService
{
public void Notify(string title, string message);
public void OnStart();
public void OnStop();
}
#if WINDOWS
using Microsoft.Toolkit.Uwp.Notifications;
// other code
#endif
namespace ArticleTracker.Platforms.Windows
{
public class PushNotificationManager : IPushNotificationManager
{
public void SendNotification(string title, string message)
{
var notification = new AppNotificationBuilder()
.AddText(title)
.AddText(message)
.BuildNotification();
AppNotificationManager.Default.Show(notification);
}
}
}