May I embed images as data URI with Windows 8/10 toast notifications? - windows-8

I'm trying to write an application that offers toast notifications on Windows 8 and newer.
Is it possible instead of referencing an image file on the local disk to use data URIs in order to display an image via the XML that one passes to show the toast? I was unable to come up with any documentation so far and I am still in the research phase for my project (so no code to "simply" try, yet).

No. DataUris are not supported for images in toasts (or tiles)
Update/documentation/proof:
For 8
From https://msdn.microsoft.com/en-us/library/windows/apps/hh761494.aspx
In this set of templates, the image element is expressed using one of
these protocols:
•http:// or https:// A web-based image.
•ms-appx:/// An image included in the app package.
•ms-appdata:///local/ An image saved to local storage.
•file:/// A local image. (Only supported for desktop apps.)
And for 10
From https://msdn.microsoft.com/en-us/library/windows/apps/br230844.aspx
The URI of the image source, using one of these protocol handlers:
•http:// or https:// A web-based image.
•ms-appx:/// An image included in the app package.
•ms-appdata:///local/ An image saved to local storage.
•file:/// A local image. (Supported only for desktop apps. This protocol cannot be used by Windows Store apps.)
Bonus, on WP 8.X you couldn't even specify the image, it just used the app icon.

Related

how do I remove write-protection from a Google Cloud Platform Compute Engine image?

I've opened my first Compute Engine VM (Linux in this case), added what I need (applications for instance), and created an Image from it.
I can then use that Image to spin up other VMs.
However the files I've put in the image then seem to be write-protected, and I can't alter them. How do I remove this write-protection?
If that's not possible, how can I change the image?
I don't think there is a direct way to access the custom image and modifying it without connecting to the VM-Instance. As per my understanding you can attach the custom image to the new VM-instance, modify that image further as per your requirements and then make another image and assign it another version number . Please see the link-1 for Setting image versions in an image family.

Issue with sap.m.PDFViewer (1.48) on mobile devices

I am developing a Master-Detail application which should show an embedded PDF in its detail view. The project is based on UI5 version 1.48, so the new PDFViewer control can be used.
In desktop mode, everything works as expected:
But on a mobile screen, PDF is not showing properly:
The data source property binding at the PDFViewer is done by OData path.
<FlexBox id="fbPDFViewer"
direction="Column"
renderType="Div"
class="sapUiSmallMargin">
<PDFViewer id="idPDFViewer"
source="{myModel>/myPDFUrl}"
title=""
busy="true"
showDownloadButton="false"
height="700px"
width="95%"
loaded="onPDFLoaded"
errorMessage="{i18n>notFoundText}"
errorPlaceholderMessage="{i18n>notFoundText}">
</PDFViewer>
</FlexBox>
Even the SAP sample for embedded usage doesn't work on mobile devices.
According to the source code (1.48), the viewer renders its PDF document directly in the app / iframe only when ..:
The source is valid
It's coming from the same domain
It has a valid URI format
UI5 thinks the user is using a desktop computer (Device.system.desktop returns true) or the displayTypeapi, available since 1.58, is set to Embedded.
UI5 detects that the user agent (browser) has a certain type of PDF plugin enabled. Currently, there are no known mobile browsers which support displaying PDF documents directly in the page.
The steps 2 and 3 explain why the PDF is not rendered on a mobile device even if the source is valid. In such cases, I guess the only option is to provide a download option instead of trying to render the PDF forcefully in the mobile app.
You can use nabi.m.PDFViewer from the the nabi.m library. It works cross device, even on iOS (where you typically don't have the adobe PDF plugin). For details see https://github.com/nzamani/ui5-nabi-m
There you will find also how to try it out on localhost. I have also added some detailed instructions for deployment of the library to NW ABAP as well as SAP CP.
You can find live demos at http://ui5lab.io/browser/#/Samples/nabi.m/Sample/nabi.m.PDFViewer.PDFViewer and http://ui5lab.io/browser/#/Samples/nabi.m/Sample/nabi.m.PDFViewer.InPagePDFViewer
Open the two links on your iOS device or any other device to see how it looks like.
On mobile devices (smartphones and tablets), the PDF viewer control renders a toolbar with the title and a download icon, which behaves as a standard device/browser file link. We've made this note in Fiori Design Guidelines 1.48 and we'll add it to the SDK documentation.
(More in openui5 issue 1759 on GitHub)
Thank you for your responses and hints...
Installing an Adobe Acrobat viewer on the mobile devices was not an option here.
Source of the PDF had same domain like app itself and had a valid URI format too
Due to project timeline in meantime I decided to fall back to a solution that SAP provided with it's "Paystub" (Fiori 1.0). Therein they're using a 3rd-Party control for displaying PDF's which unfortunately has an overhead of code and implementations steps but it works (with minor issues only) perfect on desktop devices as well as on mobile devices.
So far, this is workaround solved my requirement.
Thanks.

How can I use code-generated images on my WinRT live tile?

I'm trying to create live tiles in my app by using BitmapRender (in Windows 8.1) to create an image from a user control, which I then want to add as my live tile image.
Creating the image works perfectly, and I store it in the app's roaming folder. However, I can't get the image to add to the live tile when created this way. The odd thing is that if I copy my generated file into the project and then try to attach it to the live tile it works (so the image must be correctly formatted/size, etc.); and if I copy a random image into my roaming folder and set that as the live tile image it also works (meaning I am able to use a file in the roaming folder to set the tile image)...so that means I am referencing the file location correctly, and the image itself is capable of being used on a live tile...so why doesn't it work?
I have created a sample project (link below) that illustrates that my live tile creating code works (with an image stored in the project), and also that I can successfully create an image from a UI control and store it in the roaming folder (FWIW I've tried using different folders with no change in behaviour).
Is there something I'm missing? Any insight or help would be greatly appreciated.
Project is in VB.net, but I can figure out answers in C# if that's easier.
Sample project to illustrate the issue
The trouble is that you're attempting to use an absolute file path to reference the image, which is not supported. If you look in the tile schema, specifically at the page for the element, you'll see that the src must be an URI using http[s]://, ms-appx:///, or ms-appdata:///local for Windows Store apps. The fact that you can use a relative in-package path of /livetile.png is a bit of a fluke, as that's defaulting to ms-appx:///livetile.png.
What you need to do, then, is just use this for a filepath:
filepath = "ms-appdata:///local/livetile.png"
I tried this in your sample and it worked fine. Do note that only the local folder is supported here, not roaming. This is primarily because roaming appdata is limited to 100K to begin with, and dropping tile images in there would often quickly fill your quota. You'll want to then generate the image locally on each device (which would make sense also because you can then take the current scaling into account).

Setting ApplicationBarButton.IconUri with icon from Isolated Storage

I am working on windows phone application in which i need to change ApplicationBarButton icon dinamically, for example to show current date like in default Windows Phone Calendar app. Regarding to this article, we can use only png images previously added to solution and reference to them with relative Uri.
It is not a problem for me to generate correct png image (this way and using ToolStack C# PNG Writer Library) and save it to isolated storage, but when i'm initializing AppBarButton with absolute Uri to this image and trying to add it to ApplicationBar, my app throws ArgumentException.
Am i doing something wrong or i just have to draw 366 icons and add them to my project? :)
Thanks in advance!

Fine Uploader: resizing large files before upload?

I'm evaluating Fine Uploader compared to various other options, specifically JQuery File Upload.
I generally prefer the Fine Uploader approach as it's more lightweight, compared to JQuery File Uploader which has dependencies on Bootstrap and JQuery UI.
However it's important to be able to resize images: e.g., a user may select a large file from their camera and this may be very large - uploading the full resolution photo may take a very long time. JQuery File Upload doe this.
Additionally we don't have much use for very high resolution files.
If possible (I'm aware some browsers may not support this), I'd like to be able to resize images client size.
Is this possible?
Fine Uploader does not currently have any native support for image manipulation. This is a feature in our backlog, but we have not had many users tell us they are interested in this. This is one of the reasons why such a feature has yet to be implemented natively. There is a case, #707 that marks the start of native image-editing support for Fine Uploader. It is tentatively scheduled for 4.0.
However, you can certainly make use of FileReader and Canvas to resize the image. You can then submit this resized image as a Blob to Fine Uploader via the addFiles API method. At that point, the file has been submitted and Fine Uploader is ready to upload the item.
Essentially, the steps you would follow to handle this specific scenario, before Fine Uploader natively supports image manipulation:
Provide your own file input element(s) or make use of Fine Uploader's file/folder drag and drop support to get a handle on some files selected by the user.
Use FileReader to read the contents of the image.
FileReader will provide you with a URL for the image, assign that to the src attribute of an img element.
Draw the img onto a canvas element. This is where the resizing occurs.
Grab the URL of the resized image from the canvas element (canvas.toDataURL(...)).
Convert the URL to a Blob.
Pass the Blob to the addFiles API method of Fine Uploader.
The intent is to take care of most if not all of this for integrators such as yourself in the future by adding native image manipulation support to Fine Uploader.
Hope this helps.