public async void Activate(ShareTargetActivatedEventArgs args) { _viewModel = new ShareViewModel(args.ShareOperation); DataContext = _viewModel; Window.Current.Content = this; Window.Current.Activate(); }
/// <summary> /// Invoked when the application is activated as the target of a sharing operation. /// </summary> /// <param name="args">Details about the activation request.</param> protected override async void OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs args) { try { // start... await StreetFooRuntime.Start("Client"); // logon? var logon = TinyIoCContainer.Current.Resolve <ILogonPageViewModel>(); logon.Initialize(new NullViewModelHost()); if (await logon.RestorePersistentLogonAsync()) { var shareTargetPage = new ShareTargetPage(); shareTargetPage.Activate(args); } else { var notLoggedOnPage = new NotLoggedOnPage(); notLoggedOnPage.Activate(args); } } catch (Exception ex) { Debug.WriteLine(ex); throw ex; } }
/// <summary> /// 在其他应用程序想要共享此应用程序中的内容时进行调用。 /// </summary> /// <param name="e">用于与 Windows 协调进程的激活数据。</param> public async void Activate(ShareTargetActivatedEventArgs e) { this._shareOperation = e.ShareOperation; // 通过视图模型沟通关于共享内容的元数据 var shareProperties = this._shareOperation.Data.Properties; var thumbnailImage = new BitmapImage(); this.DefaultViewModel["Title"] = shareProperties.Title; this.DefaultViewModel["Description"] = shareProperties.Description; this.DefaultViewModel["Image"] = thumbnailImage; this.DefaultViewModel["Sharing"] = false; this.DefaultViewModel["ShowImage"] = false; this.DefaultViewModel["Comment"] = String.Empty; this.DefaultViewModel["Placeholder"] = "Add a comment"; this.DefaultViewModel["SupportsComment"] = true; Window.Current.Content = this; Window.Current.Activate(); // 在后台更新共享内容的缩略图 if (shareProperties.Thumbnail != null) { var stream = await shareProperties.Thumbnail.OpenReadAsync(); thumbnailImage.SetSource(stream); this.DefaultViewModel["ShowImage"] = true; } }
/// <summary> /// Invoked when another application wants to share content through this application. /// </summary> /// <param name="args">Activation data used to coordinate the process with Windows.</param> public async void Activate(ShareTargetActivatedEventArgs args) { this._shareOperation = args.ShareOperation; // Communicate metadata about the shared content through the view model var shareProperties = this._shareOperation.Data.Properties; var thumbnailImage = new BitmapImage(); this.DefaultViewModel["Title"] = shareProperties.Title; this.DefaultViewModel["Description"] = shareProperties.Description; this.DefaultViewModel["Image"] = thumbnailImage; this.DefaultViewModel["Sharing"] = false; this.DefaultViewModel["ShowImage"] = false; this.DefaultViewModel["Comment"] = String.Empty; this.DefaultViewModel["SupportsComment"] = true; Window.Current.Content = this; Window.Current.Activate(); Detector dt = new Detector(_shareOperation.Data); dt.Detect(); this.DataContext = dt.Detected; // Update the shared content's thumbnail image in the background if (shareProperties.Thumbnail != null) { var stream = await shareProperties.Thumbnail.OpenReadAsync(); thumbnailImage.SetSource(stream); this.DefaultViewModel["ShowImage"] = true; } }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { var rootFrame = new Frame(); rootFrame.Navigate(typeof(MainPage), args.ShareOperation); Window.Current.Content = rootFrame; Window.Current.Activate(); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(ShareTarget), args.ShareOperation); } Window.Current.Activate(); }
/// <summary> /// 他のアプリケーションがこのアプリケーションを介してコンテンツの共有を求めた場合に呼び出されます。 /// </summary> /// <param name="args">Windows と連携して処理するために使用されるアクティベーション データ。</param> public async void Activate(ShareTargetActivatedEventArgs args) { this.currentModel = BookmarkerModel.GetDefault(); await this.currentModel.LoadAsync(); this._shareOperation = args.ShareOperation; // ビュー モデルを使用して、共有されるコンテンツのメタデータを通信します var shareProperties = this._shareOperation.Data.Properties; var thumbnailImage = new BitmapImage(); this.DefaultViewModel["Title"] = shareProperties.Title; this.DefaultViewModel["Description"] = shareProperties.Description; this.DefaultViewModel["Image"] = thumbnailImage; this.DefaultViewModel["Sharing"] = false; this.DefaultViewModel["ShowImage"] = false; this.DefaultViewModel["Comment"] = String.Empty; this.DefaultViewModel["SupportsComment"] = true; this.addBookmarkView.Title = shareProperties.Title; this.addBookmarkView.Uri = (await this._shareOperation.Data.GetUriAsync()).ToString(); Window.Current.Content = this; Window.Current.Activate(); // 共有されるコンテンツの縮小版イメージをバックグラウンドで更新します if (shareProperties.Thumbnail != null) { var stream = await shareProperties.Thumbnail.OpenReadAsync(); thumbnailImage.SetSource(stream); this.DefaultViewModel["ShowImage"] = true; } }
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { if (args.ShareOperation.Data.Contains(StandardDataFormats.WebLink)) { Uri uri = await args.ShareOperation.Data.GetWebLinkAsync(); if (null != uri) try { using (var socket = new MessageWebSocket()) { socket.Control.MessageType = SocketMessageType.Utf8; await socket.ConnectAsync(new Uri("ws://" + settings["Host"].ToString() + ":" + settings["Port"].ToString())); using (var writer = new DataWriter(socket.OutputStream)) { writer.WriteString(uri.AbsoluteUri); await writer.StoreAsync(); args.ShareOperation.ReportCompleted(); } } } catch { show(); } } }
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { await InitializeFrameAsync(args.PreviousExecutionState); // TODO: Implement this directly in App.xaml.cs ShareTargetPage.OnShareTargetActivated(args); }
/// <summary> /// Invoked when another application wants to share content through this application. /// </summary> /// <param name="args">Activation data used to coordinate the process with Windows.</param> public void Activate(ShareTargetActivatedEventArgs args) { // set... this.ShareOperation = args.ShareOperation; // show... Window.Current.Content = this; Window.Current.Activate(); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { var view = new ShareTarget(); view.ShareOperation = args.ShareOperation; GetTextFromShare(view, args); Window.Current.Content = view; Window.Current.Activate(); base.OnShareTargetActivated(args); }
/// <summary> /// Invoked when another application wants to share content through this application. /// </summary> /// <param name="args">Activation data used to coordinate the process with Windows.</param> public async void Activate(ShareTargetActivatedEventArgs args) { // give it to the view-model... await this.Model.SetupShareDataAsync(args.ShareOperation); // show... Window.Current.Content = this; Window.Current.Activate(); }
// Important: Add share target declaration in application manifest (Package.appxmanifest) public static async void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { // TODO: Implement this directly in App.xaml.cs var frame = (MtFrame)Window.Current.Content; await frame.NavigateAsync(typeof(ShareTargetPage)); var page = (ShareTargetPage)frame.CurrentPage.Page; page.Initialize(args); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { // Normally wouldn't need to do this but need the container to be initialised Initialize(); // replace the share operation in the container container.UnregisterHandler(typeof(ShareOperation), null); container.Instance(args.ShareOperation); DisplayRootViewFor<ShareTargetViewModel>(); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { base.OnShareTargetActivated(args); var view = new ShareView(); var viewModel = new ShareViewModel(); viewModel.SetShareTarget(args); view.DataContext = viewModel; Window.Current.Content = view; Window.Current.Activate(); }
/// <summary> /// Wird aufgerufen, wenn eine andere Anwendung Inhalte durch diese Anwendung freigeben möchte. /// </summary> /// <param name="e">Aktivierungsdaten zum Koordinieren des Prozesses mit Windows.</param> public async void Activate(ShareTargetActivatedEventArgs e) { this.shareOperation = e.ShareOperation; var shareProperties = this.shareOperation.Data.Properties; this.DefaultViewModel["Title"] = shareProperties.Title; // Gets the title from the sender app. this.DefaultViewModel["Description"] = shareProperties.Description; // Gets the description from the sender app. this.DefaultViewModel["Sharing"] = false; this.DefaultViewModel["Url"] = await shareOperation.Data.GetWebLinkAsync(); // Because wallabag is saving links, the web link is the most important thing in this code block. Window.Current.Content = this; Window.Current.Activate(); }
private async void Initialize(ShareTargetActivatedEventArgs args) { _shareTargetArgs = args; // Load shared data args.ShareOperation.ReportStarted(); var uri = await args.ShareOperation.Data.GetWebLinkAsync(); args.ShareOperation.ReportDataRetrieved(); // Show shared data in UI UriTextBlock.Text = uri.ToString(); }
/// <summary> /// Invoked when the application is activated as the target of a sharing operation. /// </summary> /// <param name="args">Details about the activation request.</param> protected override void OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs args) { try { var shareTargetPage = new Skycap.Pages.ShareTargetPage(); shareTargetPage.Activate(args); } catch (Exception ex) { LogFile.Instance.LogError("", "", ex.ToString()); } }
/// <summary> /// The on share target activated. /// </summary> /// <param name="args"> /// The args. /// </param> protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { var shareOperation = args.ShareOperation; MappingSetup.Map(); var rootFrame = new Frame(); Window.Current.Content = rootFrame; Window.Current.Activate(); rootFrame.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => rootFrame.Navigate(typeof(ShareLink), shareOperation)); }
public void Activate(ShareTargetActivatedEventArgs args) { DefaultViewModel["Sharing"] = false; _ShareOperation = args.ShareOperation; DataPackagePropertySetView shareProperties = _ShareOperation.Data.Properties; DefaultViewModel["Link"] = new Link { Name = shareProperties.Title, Uri = new Uri(shareProperties.Description) }; Window.Current.Content = this; Window.Current.Activate(); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); Window.Current.Content = rootFrame; } // To output the text from this example, you need a TextBlock control // with a name of "sharedContent". //sharedContent.Text = "Text: " + text; rootFrame.Navigate(typeof(ShareTarget), args); Window.Current.Activate(); }
public async void Activate(ShareTargetActivatedEventArgs args) { _shareOperation = args.ShareOperation; DataPackageView dpv = args.ShareOperation.Data; var props = dpv.Properties; txtTitle.Text = props.Title; txtDescription.Text = props.Description; var thumbnailImage = new BitmapImage(); if (props.Thumbnail != null) { var s = await props.Thumbnail.OpenReadAsync(); thumbnailImage.SetSource(s); } img.Source = thumbnailImage; Window.Current.Content = this; Window.Current.Activate(); }
protected async override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { //var rootFrame = CreateRootFrame(); //rootFrame.Navigate(typeof(ShareTarget), args.ShareOperation); //Window.Current.Activate(); await Utils.MessageBox("OnShareTargetActivated"); ShareOperation shareOperation = args.ShareOperation; if (shareOperation.Data.Contains(StandardDataFormats.Text)) { //string text = await shareOperation.Data.GetTextAsync(); // To output the text from this example, you need a TextBlock control // with a name of "sharedContent". //sharedContent.Text = "Text: " + text; } }
/// <summary> /// Invoked when another application wants to share content through this application. /// </summary> /// <param name="e">Activation data used to coordinate the process with Windows.</param> public async void Activate(ShareTargetActivatedEventArgs e) { _shareOperation = e.ShareOperation; // Communicate metadata about the shared content through the view model var shareProperties = _shareOperation.Data.Properties; var thumbnailImage = new BitmapImage(); DefaultViewModel["Title"] = shareProperties.Title; DefaultViewModel["Description"] = shareProperties.Description; DefaultViewModel["Image"] = thumbnailImage; DefaultViewModel["Sharing"] = false; DefaultViewModel["ShowImage"] = false; DefaultViewModel["Comment"] = String.Empty; DefaultViewModel["Placeholder"] = "Add a comment"; DefaultViewModel["SupportsComment"] = true; Window.Current.Content = this; Window.Current.Activate(); // Update the shared content's thumbnail image in the background if (shareProperties.Thumbnail != null) { var stream = await shareProperties.Thumbnail.OpenReadAsync(); thumbnailImage.SetSource(stream); DefaultViewModel["ShowImage"] = true; } var files = await _shareOperation.Data.GetStorageItemsAsync(); if (!files.Any()) return; foreach (var file in files.Where(f => f.IsOfType(StorageItemTypes.File)).Cast<StorageFile>()) { await file.CopyAsync(ApplicationData.Current.LocalFolder); } }
/// <summary> /// Invoked when another application wants to share content through this application. /// </summary> /// <param name="args">Activation data used to coordinate the process with Windows.</param> public async void Activate(ShareTargetActivatedEventArgs args) { this._shareOperation = args.ShareOperation; // Communicate metadata about the shared content through the view model var shareProperties = this._shareOperation.Data.Properties; var thumbnailImage = new BitmapImage(); this.DefaultViewModel["Title"] = shareProperties.Title; this.DefaultViewModel["Description"] = shareProperties.Description; this.DefaultViewModel["Image"] = thumbnailImage; this.DefaultViewModel["Sharing"] = false; this.DefaultViewModel["ShowImage"] = false; this.DefaultViewModel["Comment"] = String.Empty; this.DefaultViewModel["SupportsComment"] = true; // Parse Transhipment package var geo = await _shareOperation.Data.GetStructuredDataAsync(Schema.GeoCoordinates) as IGeoCoordinates; if (geo != null) { DefaultViewModel["ThingName"] = geo.Name; DefaultViewModel["Latitude"] = geo.Latitude; DefaultViewModel["Longitude"] = geo.Longitude; } Window.Current.Content = this; Window.Current.Activate(); // Update the shared content's thumbnail image in the background if (shareProperties.Thumbnail != null) { var stream = await shareProperties.Thumbnail.OpenReadAsync(); thumbnailImage.SetSource(stream); this.DefaultViewModel["ShowImage"] = true; } }
/// <summary> /// 在将应用程序作为共享操作的目标激活时调用。 /// </summary> /// <param name="e">有关激活请求的详细信息。</param> protected override void OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs e) { var shareTargetPage = new MVVM.FristPage(); shareTargetPage.Activate(e); }
protected override void OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs args) { var shareTargetPage = new ApressShareTargetDemo.ShareTargetPage(); shareTargetPage.Activate(args); }
async void GetTextFromShare(ShareTarget target, ShareTargetActivatedEventArgs args) { if (args.ShareOperation.Data.Contains(StandardDataFormats.Text)) { var text = await args.ShareOperation.Data.GetTextAsync(); target.Title = text; } }
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { await InternalActivatedAsync(args); }
/// <summary> /// Invoked when the application is activated as the target of a sharing operation. /// </summary> /// <param name="args">Details about the activation request.</param> protected override void OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs args) { var shareTargetPage = new SharingTargetSample.ShareTargetPage(); shareTargetPage.Activate(args); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { base.OnShareTargetActivated(args); Activate(args); }
/// <summary> /// Invoked when the application is activated as the target of a sharing operation. /// </summary> /// <param name="e">Details about the activation request.</param> protected override void OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs e) { // var shareTargetPage = new Xcontact.Pages.ShareTarget1(); //shareTargetPage.Activate(e); }
/// <summary> /// 在将应用程序作为共享操作的目标激活时调用。 /// </summary> /// <param name="e">有关激活请求的详细信息。</param> protected override void OnShareTargetActivated(Windows.ApplicationModel.Activation.ShareTargetActivatedEventArgs e) { var shareTargetPage = new StoreCozy.ShareTargetPage1(); shareTargetPage.Activate(e); }
protected override async void OnShareTargetActivated( ShareTargetActivatedEventArgs args ) { using ( new Initializer( this ) ) { Messenger.Send( await MakeRequestAsync( args.ShareOperation ) ); } }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { var shareTargetPage = new ShareTargetView(); shareTargetPage.Activate(args); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { var rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } rootFrame.Navigate(typeof(SharePage), args); Window.Current.Activate(); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { }