file scoped namespaces (#565)
This commit is contained in:
@@ -6,55 +6,54 @@ using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Launch;
|
||||
using Wino.Messaging.Client.Shell;
|
||||
|
||||
namespace Wino.Activation
|
||||
namespace Wino.Activation;
|
||||
|
||||
internal class ProtocolActivationHandler : ActivationHandler<ProtocolActivatedEventArgs>
|
||||
{
|
||||
internal class ProtocolActivationHandler : ActivationHandler<ProtocolActivatedEventArgs>
|
||||
private const string MailtoProtocolTag = "mailto:";
|
||||
|
||||
private readonly INativeAppService _nativeAppService;
|
||||
private readonly ILaunchProtocolService _launchProtocolService;
|
||||
|
||||
public ProtocolActivationHandler(INativeAppService nativeAppService, ILaunchProtocolService launchProtocolService)
|
||||
{
|
||||
private const string MailtoProtocolTag = "mailto:";
|
||||
_nativeAppService = nativeAppService;
|
||||
_launchProtocolService = launchProtocolService;
|
||||
}
|
||||
|
||||
private readonly INativeAppService _nativeAppService;
|
||||
private readonly ILaunchProtocolService _launchProtocolService;
|
||||
protected override Task HandleInternalAsync(ProtocolActivatedEventArgs args)
|
||||
{
|
||||
// Check URI prefix.
|
||||
var protocolString = args.Uri.AbsoluteUri;
|
||||
|
||||
public ProtocolActivationHandler(INativeAppService nativeAppService, ILaunchProtocolService launchProtocolService)
|
||||
if (protocolString.StartsWith(MailtoProtocolTag))
|
||||
{
|
||||
_nativeAppService = nativeAppService;
|
||||
_launchProtocolService = launchProtocolService;
|
||||
// mailto activation. Try to parse params.
|
||||
_launchProtocolService.MailToUri = new MailToUri(protocolString);
|
||||
|
||||
if (_nativeAppService.IsAppRunning())
|
||||
{
|
||||
// Just send publish a message. Shell will continue.
|
||||
WeakReferenceMessenger.Default.Send(new MailtoProtocolMessageRequested());
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task HandleInternalAsync(ProtocolActivatedEventArgs args)
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected override bool CanHandleInternal(ProtocolActivatedEventArgs args)
|
||||
{
|
||||
// Validate the URI scheme.
|
||||
|
||||
try
|
||||
{
|
||||
// Check URI prefix.
|
||||
var protocolString = args.Uri.AbsoluteUri;
|
||||
|
||||
if (protocolString.StartsWith(MailtoProtocolTag))
|
||||
{
|
||||
// mailto activation. Try to parse params.
|
||||
_launchProtocolService.MailToUri = new MailToUri(protocolString);
|
||||
|
||||
if (_nativeAppService.IsAppRunning())
|
||||
{
|
||||
// Just send publish a message. Shell will continue.
|
||||
WeakReferenceMessenger.Default.Send(new MailtoProtocolMessageRequested());
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
var uriGet = args.Uri;
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool CanHandleInternal(ProtocolActivatedEventArgs args)
|
||||
{
|
||||
// Validate the URI scheme.
|
||||
|
||||
try
|
||||
{
|
||||
var uriGet = args.Uri;
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CanHandleInternal(args);
|
||||
}
|
||||
return base.CanHandleInternal(args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user