Commit 9bf1eecf authored by Ghislain MARY's avatar Ghislain MARY

Allow launching the belle-sip-tester app on Windows 10 with the belle-sip-tester: URI scheme.

parent b3f9f492
......@@ -112,5 +112,23 @@ namespace belle_sip_tester
//TODO: Save application state and stop any background activity
deferral.Complete();
}
protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.Protocol)
{
var protocolArgs = (ProtocolActivatedEventArgs)args;
var uri = protocolArgs.Uri;
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
rootFrame.Navigate(typeof(MainPage), uri);
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
base.OnActivated(args);
}
}
}
......@@ -39,7 +39,10 @@ namespace belle_sip_tester
base.OnNavigatedTo(e);
BelleSipTester.Instance.setWritableDirectory(ApplicationData.Current.LocalFolder);
_suites = UnitTestDataSource.GetSuites(BelleSipTester.Instance);
TryAutoLaunch();
if ((e.Parameter is Uri) && (e.Parameter.ToString().Equals("belle-sip-tester:autolaunch")))
{
AutoLaunch();
}
}
public IEnumerable<UnitTestSuite> Suites
......@@ -173,23 +176,18 @@ namespace belle_sip_tester
});
}
private async void TryAutoLaunch()
private void AutoLaunch()
{
try
CommandBar.IsEnabled = false;
ProgressIndicator.IsIndeterminate = true;
ProgressIndicator.IsEnabled = true;
BelleSipTester.Instance.runAllToXml();
if (BelleSipTester.Instance.AsyncAction != null)
{
await ApplicationData.Current.LocalFolder.GetFileAsync("autolaunch");
CommandBar.IsEnabled = false;
ProgressIndicator.IsIndeterminate = true;
ProgressIndicator.IsEnabled = true;
BelleSipTester.Instance.runAllToXml();
if (BelleSipTester.Instance.AsyncAction != null)
{
BelleSipTester.Instance.AsyncAction.Completed += (asyncInfo, asyncStatus) => {
App.Current.Exit();
};
}
BelleSipTester.Instance.AsyncAction.Completed += (asyncInfo, asyncStatus) => {
App.Current.Exit();
};
}
catch (Exception) { }
}
private UnitTestCase RunningTestCase;
......
......@@ -24,6 +24,11 @@
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="belle-sip-tester" />
</uap:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment