我想從外部環境獲取文本。OnShareTargetActivated on Windows10
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
{
var frame = new Frame();
frame.Navigate(typeof(Pages.WorkPage), args.ShareOperation);
Window.Current.Content = new MainPage(frame);
Window.Current.Activate();
}
我的MainPage Construcor:
public MainPage(Frame frame)
{
this.InitializeComponent();
this.splitView.Content = frame;
((Frame)splitView.Content).Navigate(typeof(Pages.WorkPage));
}
..和OnNavigatedTo
在我WorkPage這樣
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.Parameter == null) return;
var shareOperation = (Windows.ApplicationModel.DataTransfer.ShareTarget.ShareOperation)e.Parameter;
if (shareOperation.Data.Contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.Text))
txtMessages.Text = await shareOperation.Data.GetTextAsync();
}
我怎樣才能改變OnShareTargetActivated
讓我OnNavigatedTo
正常工作?