-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMainPage.xaml.cs
55 lines (42 loc) · 1.84 KB
/
MainPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using Windows.ApplicationModel.DataTransfer;
using Windows.System;
using Windows.UI.ApplicationSettings;
using Windows.UI.Xaml.Controls;
namespace JayBeavers.ChronoZoom
{
public sealed partial class MainPage
{
private Uri _currentUri;
public MainPage()
{
InitializeComponent();
ChronoZoomWebView.NavigationCompleted += ChronoZoomWebView_NavigationCompleted;
DataTransferManager.GetForCurrentView().DataRequested += MainPage_DataRequested;
SettingsPane.GetForCurrentView().CommandsRequested += SettingsCommandsRequested;
}
private void MainPage_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
if (_currentUri == null) return;
var request = args.Request;
request.Data.Properties.Title = "I'd like to share this timeline '" + ChronoZoomWebView.DocumentTitle + "' with you...";
request.Data.Properties.Description = "Share timeline '" + ChronoZoomWebView.DocumentTitle + "'";
request.Data.SetWebLink(_currentUri);
request.Data.Properties.ContentSourceWebLink = _currentUri;
}
private void SettingsCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
var privacyStatement = new SettingsCommand(
"privacy",
"Privacy Statement",
x => Launcher.LaunchUriAsync(new Uri("http://join.chronozoom.com/notices/#privacy"))
);
args.Request.ApplicationCommands.Clear();
args.Request.ApplicationCommands.Add(privacyStatement);
}
private void ChronoZoomWebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
_currentUri = args.Uri;
}
}
}