protected override bool GetShareContent(DataRequest request) { bool succeeded = false; string dataPackageFormat = DataFormatInputBox.Text; if (!String.IsNullOrEmpty(dataPackageFormat)) { string dataPackageText = CustomDataTextBox.Text; if (!String.IsNullOrEmpty(dataPackageText)) { DataPackage requestData = request.Data; requestData.Properties.Title = TitleInputBox.Text; requestData.Properties.Description = DescriptionInputBox.Text; // The description is optional. requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.SetData(dataPackageFormat, dataPackageText); succeeded = true; } else { request.FailWithDisplayText("Enter the custom data you would like to share and try again."); } } else { request.FailWithDisplayText("Enter a custom data format and try again."); } return succeeded; }
public void Share(DataRequest request) { // We work with a copy of the list of document references List<DocumentReference> list = null; if (DocumentReferences != null) { list = DocumentReferences.ToList(); } request.Data.Properties.Title = SearchResultInfo; // request.Data.Properties.Description = ...; if (list != null) { var stb = new StringBuilder(); stb.AppendLine(); stb.Append("Suchresultate:\r\n"); foreach (var docref in list) { stb.AppendFormat("{0}, {1}\r\nRIS Bundesrecht Österreich URL: risdok://{2}/\r\nWeb URL: {3}\r\n\r\n", docref.ArtikelParagraphAnlage, docref.Kurzinformation, docref.Dokumentnummer, docref.DokumentUrl); } request.Data.SetText(stb.ToString()); } else { request.FailWithDisplayText("Keine Resultate für Sharing vorhanden"); } }
protected override bool GetShareContent(DataRequest request) { bool succeeded = false; Uri selectedApplicationLink = ApplicationLinkComboBox.SelectedItem as Uri; if (selectedApplicationLink != null) { DataPackage requestData = request.Data; requestData.Properties.Title = TitleInputBox.Text; requestData.Properties.Description = DescriptionInputBox.Text; // The description is optional. requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.SetApplicationLink(selectedApplicationLink); // Place the selected logo and the background color in the data package properties if (MicrosoftLogo.IsChecked.Value) { requestData.Properties.Square30x30Logo = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///assets/microsoftLogo.png")); requestData.Properties.LogoBackgroundColor = GetLogoBackgroundColor(); } else if (VisualStudioLogo.IsChecked.Value) { requestData.Properties.Square30x30Logo = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///assets/visualStudioLogo.png")); requestData.Properties.LogoBackgroundColor = GetLogoBackgroundColor(); } succeeded = true; } else { request.FailWithDisplayText("Select the application link you would like to share and try again."); } return succeeded; }
protected override bool GetShareContent(DataRequest request) { bool succeeded = false; if (this.imageFile != null) { DataPackage requestData = request.Data; requestData.Properties.Title = TitleInputBox.Text; requestData.Properties.Description = DescriptionInputBox.Text; // The description is optional. requestData.Properties.ContentSourceApplicationLink = ApplicationLink; // It's recommended to use both SetBitmap and SetStorageItems for sharing a single image // since the target app may only support one or the other. List<IStorageItem> imageItems = new List<IStorageItem>(); imageItems.Add(this.imageFile); requestData.SetStorageItems(imageItems); RandomAccessStreamReference imageStreamRef = RandomAccessStreamReference.CreateFromFile(this.imageFile); requestData.Properties.Thumbnail = imageStreamRef; requestData.SetBitmap(imageStreamRef); succeeded = true; } else { request.FailWithDisplayText("Select an image you would like to share and try again."); } return succeeded; }
protected override bool GetShareContent(DataRequest request) { string errorMessage = CustomErrorText.Text; if (String.IsNullOrEmpty(errorMessage)) { errorMessage = "Enter a failure display text and try again."; } request.FailWithDisplayText(errorMessage); return false; }
// This function is implemented by each scenario to share the content specific to that scenario (text, link, image, etc.). protected bool GetShareContent(DataRequest request) { bool succeeded = false; var app = Application.Current as App; if (!String.IsNullOrEmpty(app.SharingTitle)) { DataPackage requestData = request.Data; requestData.Properties.Title = app.SharingTitle; requestData.Properties.Description = app.SharingText; // The description is optional. requestData.SetUri(new Uri(app.SharingLink)); succeeded = true; } else { request.FailWithDisplayText("nothing to share"); } return succeeded; }
protected override bool GetShareContent(DataRequest request) { bool succeeded = false; if (storageItems != null) { DataPackage requestData = request.Data; requestData.Properties.Title = TitleInputBox.Text; requestData.Properties.Description = DescriptionInputBox.Text; // The description is optional. requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.SetStorageItems(this.storageItems); succeeded = true; } else { request.FailWithDisplayText("Select the files you would like to share and try again."); } return succeeded; }
protected override bool GetShareContent(DataRequest request) { bool succeeded = false; if (this.selectedImage != null) { DataPackage requestData = request.Data; requestData.Properties.Title = "Delay rendered image"; requestData.Properties.Description = "Resized image from the Share Source sample"; requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.Properties.Thumbnail = RandomAccessStreamReference.CreateFromFile(this.selectedImage); requestData.SetDataProvider(StandardDataFormats.Bitmap, providerRequest => this.OnDeferredImageRequestedHandler(providerRequest, this.selectedImage)); succeeded = true; } else { request.FailWithDisplayText("Select an image you would like to share and try again."); } return succeeded; }
protected override bool GetShareContent(DataRequest request) { bool succeeded = false; // The URI used in this sample is provided by the user so we need to ensure it's a well formatted absolute URI // before we try to share it. rootPage.NotifyUser("", NotifyType.StatusMessage); Uri dataPackageUri = ValidateAndGetUri(UriToShare.Text); if (dataPackageUri != null) { DataPackage requestData = request.Data; requestData.Properties.Title = TitleInputBox.Text; requestData.Properties.Description = DescriptionInputBox.Text; // The description is optional. requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.SetWebLink(dataPackageUri); succeeded = true; } else { request.FailWithDisplayText("Enter the web link you would like to share and try again."); } return succeeded; }
protected override bool GetShareContent(DataRequest request) { // Get the user's selection from the WebView. Since this is an asynchronous operation we need to acquire the deferral first. DataRequestDeferral deferral = request.GetDeferral(); // Make sure to always call Complete when done with the deferral. try { var requestDataOperation = ShareWebView.CaptureSelectedContentToDataPackageAsync(); requestDataOperation.Completed += (asyncInfo, status) => { DataPackage requestData = asyncInfo.GetResults(); if ((requestData != null) && (requestData.GetView().AvailableFormats.Count > 0)) { requestData.Properties.Title = "A web snippet for you"; requestData.Properties.Description = "HTML selection from a WebView control"; // The description is optional. requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.Properties.ContentSourceWebLink = new Uri("http://msdn.microsoft.com"); request.Data = requestData; deferral.Complete(); } else { // FailWithDisplayText calls Complete on the deferral. request.FailWithDisplayText("Make a selection in the WebView control and try again."); } }; } catch (Exception) { deferral.Complete(); } // At this point, we haven't populated the data package yet. It's done asynchronously above. return false; }
private bool GetShareContent(DataRequest request) { bool succeeded = false; if (this.flipView.SelectedItem != null) { var item = (Item)this.flipView.SelectedItem; // string customData = @"{ // ""type"" : ""http://schema.org/Product"", // ""properties"" : // { // ""url"" : ""#URL#"", // ""description"" : ""#DESC#"", // ""name"" : ""#NAME#"", // ""model"" : ""#MODEL#"", // ""price"" : ""#PRICE#"" // } // }"; // customData = customData.Replace("#URL#", item.Uri).Replace("#DESC#", item.Descricao).Replace("#NAME#", item.Nome).Replace("#MODEL#", item.Categoria.Nome).Replace("#PRICE#", "R$ " + item.Valor); requestData = request.Data; //requestData.SetData("http://schema.org/Product", customData); requestData.Properties.Title = item.Nome == null ? "Imagem compartilhada" : item.Nome; requestData.Properties.Description = item.Descricao; RandomAccessStreamReference imageStreamRef = null; imageStreamRef = RandomAccessStreamReference.CreateFromUri(new Uri(_baseUri, item.ImageUrl)); if (imageStreamRef != null) { requestData.SetUri(new Uri(_baseUri, item.ImageUrl)); requestData.Properties.Title = string.Format("{0} - {1}", Win8CatalogApplication.Instance.Empresa.Nome, item.Nome); requestData.Properties.Description = item.Descricao; requestData.SetText(item.Descricao); requestData.Properties.Thumbnail = imageStreamRef; requestData.SetBitmap(imageStreamRef); succeeded = true; } } else { request.FailWithDisplayText("Selecione a imagem que deseja compartilhar e tente novamente."); } return succeeded; }
public void OnShareRequested(DataRequest dataRequest) { if (string.IsNullOrWhiteSpace(_exceptionString)) { dataRequest.FailWithDisplayText("There is nothing to share at this moment."); } else { dataRequest.Data.Properties.Title = "Error report"; dataRequest.Data.Properties.Description = "Share this with us by email"; dataRequest.Data.Properties.ApplicationName = "Subsonic8"; var dataBuilder = new StringBuilder(); var actionInformation = string.Format( _resourceService.GetStringResource("ErrorDialogViewModelStrings/ActionInformation"), _resourceService.GetStringResource("ErrorDialogViewModelStrings/ErrorReportDeliveryEmail")); dataBuilder.Append(string.Format("<h2>{0}</h2><br/>", actionInformation)); dataBuilder.Append(string.Format("<div><span>{0}</span></div>", ExceptionString)); dataRequest.Data.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat(dataBuilder.ToString())); } }
public bool GetShareContent(DataRequest request) { bool succeeded = false; string dataPackageText = "I started using my fashion assistant ! it's very useful and free \n "; if (!String.IsNullOrEmpty(dataPackageText)) { DataPackage requestData = request.Data; requestData.Properties.Title = "My Fashion assistant"; requestData.Properties.Description = "My Fashion assistant it's a free application that helps you to get better dressed"; // The description is optional. //requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.SetText(dataPackageText); succeeded = true; } else { request.FailWithDisplayText("Enter the text you would like to share and try again."); } return succeeded; }
private async void OnShareRequested(DataRequest request) { var defferal = request.GetDeferral(); await ApplicationData.Current.ClearAsync(ApplicationDataLocality.Temporary); var from = From.Date; var until = Until.Date.AddDays(1).AddMilliseconds(-1); var exportFiles = GetExportFiles(from, until).ToArray(); if (exportFiles.Any()) { request.Data.Properties.Title = "Exported SensorCore files"; request.Data.Properties.Description = "Exported SensorCore files"; request.Data.SetStorageItems(await Task.WhenAll(exportFiles)); } else { request.FailWithDisplayText("Nothing selected to Export."); } defferal.Complete(); }
private void ProvideSharingDataFromWebView(DataRequest request) { try { var html = new StringBuilder(webView.InvokeScript("eval", new string[] { "document.documentElement.outerHTML;" })); // Fix Urls to base Urls otherwise it won't look right (css, js et cetera missing) - really, really simple html.Replace("src=\"/", "src=\"http://www.ris.bka.gv.at/"); html.Replace("href=\"/", "href=\"http://www.ris.bka.gv.at/"); request.Data.Properties.Title = ViewModel.PageTitle; request.Data.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat(html.ToString())); } catch { request.FailWithDisplayText("Es gibt keine Inhalte die geteilt werden können"); } }
bool GetShareContent(DataRequest request) { bool succeeded = false; if (this._imageFile != null) { DataPackage requestData = request.Data; requestData.Properties.Title = this._imageFile.DisplayName; requestData.Properties.Description = this._imageFile.DateCreated.ToString(); List<IStorageItem> imageItems = new List<IStorageItem>(); imageItems.Add(this._imageFile); requestData.SetStorageItems(imageItems); RandomAccessStreamReference imageStreamRef = RandomAccessStreamReference.CreateFromFile(this._imageFile); requestData.Properties.Thumbnail = imageStreamRef; requestData.SetBitmap(imageStreamRef); succeeded = true; } else { request.FailWithDisplayText("Select an image you would like to share and try again."); } return succeeded; }
private bool GetShareContent(DataRequest request) { bool succeeded = false; //The URI used in this sample is provided by the user so we need to ensure it's a well formatted absolute URI //before we try to share it. Uri dataPackageUri = ValidateAndGetUri(ShareItem.OriginalUrl); if (dataPackageUri != null) { DataPackage requestData = request.Data; requestData.Properties.Title = ShareItem.Title; requestData.Properties.ContentSourceApplicationLink = ApplicationLink; requestData.SetWebLink(dataPackageUri); succeeded = true; } else { request.FailWithDisplayText("Enter the web link you would like to share and try again."); } return succeeded; }
protected bool GetShareContent(DataRequest request) { bool succeeded = false; App app = (App)Application.Current; activeDeplyment = app.ActiveMap; Uri dataPackageUri = ValidateAndGetUri(activeDeplyment.url); if (dataPackageUri != null) { request.Data.SetUri(dataPackageUri); request.Data.Properties.Title = activeDeplyment.name; request.Data.Properties.Description = activeDeplyment.description; //request.Data.SetText( // "@Ushahidi Deployment, " + ": " + activeDeplyment.description.Substring(0, 50) + " " // ); succeeded = true; } else { request.FailWithDisplayText("Enter the link you would like to share and try again."); } return succeeded; }
private bool GetShareContent(DataRequest request) { bool succeeded = false; App app = (App)Application.Current; incident = app.ActiveIncident; ActiveDeployment = app.ActiveMap; Uri dataPackageUri = ValidateAndGetUri(ActiveDeployment.url + "reports/view/"+incident.incident.incidentid); if (dataPackageUri != null) { request.Data.SetUri(dataPackageUri); request.Data.Properties.Title = incident.incident.incidenttitle+" @ushahidi 4 #Windows8"; request.Data.Properties.Description = incident.incident.incidentdescription; //request.Data.SetText( // "@Ushahidi Deployment, " + ": " + incident.incident.incidentdescription.Substring(0, 50) + " " // ); succeeded = true; } else { request.FailWithDisplayText("Enter the link you would like to share and try again."); } return succeeded; }
protected bool GetShareContent(DataRequest request) { bool succeeded = false; string dataPackageText = Synopsis.Text; if (!String.IsNullOrEmpty(dataPackageText)) { DataPackage requestData = request.Data; requestData.Properties.Title = PageTitle.Text; requestData.SetText(dataPackageText); succeeded = true; } else { request.FailWithDisplayText("Enter the text you would like to share and try again."); } return succeeded; }