I am developing an app in which I am downloading images from a webservice. If there are multiple images then it consumes a lot of time. So I want to download multiple images using a thread in background and display them on Image Control as they get downloaded.
I got my answer setting BitmapCreateOptions.BackgroundCreation make a work in background.It was so easy
BitmapImage imgage = new BitmapImage(new Uri(b, UriKind.Absolute));
imgage.CreateOptions = BitmapCreateOptions.BackgroundCreation;
If you want more Information then follow
MSDN POST
You can use Background file transfer for windows phone that helps you to download/upload files in background you read more about background file transfer from Here and Here
You need a Background worker class. Take a look into official documentation - msdn.
Related
I've just started learning how to code starting with HTML. I'm using Codepen and when I add any image it refuses to populate. I can see on the page where it shows my alt text and the image load fail icon, so I'm confident I've coded it correctly. Can you not just pull any image off the web using it's source? Is there some library of widely available images that I can use? Just a little confused.
In response to your doubts
Can you not just pull any image off the web using it's source?
If it is possible to locate images directly from the internet, but you have to be careful to have the consent for the use of it
Is there some library of widely available images that I can use?
There are several portals where to locate images of different categories, some images are paid, others are free, to mention one you have pexels.com,
Next I leave you an example of the code looking for an image in this portal
<img
src = "https://images.pexels.com/photos/374631/pexels-photo-374631.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"
alt = "Image"
width = '250px'
>
I hope I have been able to help you
Best regards
The image is in a folder "more" which is in a folder "Pictures" which is in "My PC".
Hello and welcome to StackOverflow!
You would need to upload this picture to Codepen, so Codepen can actually access this picture even if your Computer is shut down. Unfortunately, this is a pro feature (bottom-left corner -> "Assets")
Using a free Webspace:
However, there are many websites online that provide a free webspace, where you can upload your html, css, images, php files and more and often you also get your own subdomain (like mywebsite.webhost.com).
From the top of my head I only know bplaced.net but feel free to search around.
Using an image hoster:
If you want to stay with Codepen and the nice IDE you can look out for an Image Hoster where you can upload your file and get a direct link to the image which you can then use on your codepen.
You can download xampp or wampp (if you are on windows) or there are plugins for VSCode to mimic a quck http server. You can do everything on your machine.
You can upload files in your system to codepen in assests (pro feature). or you can use their own free design asstes
Is there a way by which we can play music in the background when it is launched through a WebBrowser control of Windows Phone 8 (using HTML5 "audio" element)?
I am aware that background tasks are not supported for WebBrowser, but is there a workaround?What are the other options of launching Html and JavaScript code, if not a WebBrowser control? Can it be done using XAML / C# / WPF?
Thanks.
I am assuming that you want to open a audio file from webserver / site and want to play it in background on windows phone.
You can use AudioPlayerAgent for do that and another thing I found is for steaming audio file from server is this.
Check out either of these options. Due to some limitation over more lines of code and code complexity, I can not put code blocks here.
For launching getting javascript event back to C# , you can use Browser_ScriptNotify and InvokeScript. Other things depend on you business logic. I do not know how your web server is behaving while managing audiofiles.
As an alternate to using HTML5/JS, you can use AudioStreamingAgent
https://code.msdn.microsoft.com/windowsapps/Background-Audio-Streamer-e85b8deb
or
You can use BackgroundAudioPlayer, here is
downloadable sample code: http://go.microsoft.com/fwlink/p/?LinkId=219073
I strongly suggest you to read this page first, because it includes best practices to follow when you implement background audio in your app:
Background audio overview for Windows Phone 8
Then you should check this page, it has very detailed explanations and the complete source code for the example applications, where you can see not only the full apss but every piece of code behind every functionality. This should be all the information and source code you need.
How to play background audio for Windows Phone 8
Of course if you have a more specific question please provide more information and i will provide a detailed explanation.
What I exactly need is to load and show images from a location external to the application's. As the photos are constantly changing my proposal was to load them from the Camera Directory so that it's as simply as storing in that folder the images.
The specific need here is:
How can I load and show on an img tag element an image from the camera directory?
Raymond Camden has very good tutorials on some basic uses and some cool features that a developer can use with PhoneGap. In your case, he has a tutorial that semi-relates to you question. He gives the sourcecode with the tutorial so I'm sure you'll be able to extrapolate from there. Basically it's a little Diary app that you can add a picture to. I'm sure you'll be interested in the picture part of the app.
Is there a way to disable a user from downloading a file from a URL?
For example I have a link:
wow.mywebsitedomain.com/templates/filename.svg
I want to disable the user from downloading the filename.svg
These svg files are not just an image, they are editable designs that I have spent countless hours on each. No, I do not care if someone does a screenprint or gets a png etc, as those are not scalable, editable, vector files.
When the user clicks on a png thumbnail my actual link opens my online design editor to allow the user to customize these files, then save to my server, then purchase printed media, and they are not allowed to download any files.
I tried putting the actual files into a password protected folder on my server, but they do not open properly, and I do not want the user to have password access to this folder.
Essentially I need the link to be accessible, just not show the actual link for someone to copy and open/save/download etc.
Hopefully there is a simple solution for a non-programmer with basic html skills?
Thanks
Your can do things like "disabling right-click" and stuff - it may prevent some users from downloading your file, BUT basically you cannot prevent a file which is downloaded and interpreted by the browser from being downloaded to a user's hard drive.
This is not only true for SVGs, but also for music, videos, etc.
Instead, you can convert your SVG file to a PNG on server-side, and show only the PNG to the user. Note that you have the possibility to create PNGs of different sizes on the fly - dependent on the request, user's screen resolution, etc. You can also implement caching of the generated PNGs if needed.
On how to create a PNG from SVG in PHP read here:
Convert SVG image to PNG with PHP
You can choose other raster image format, of course.
If they can view it, they can download it. End of story. If you only want them to see a PNG, make a PNG from it and put that up
My understanding is; if you can see it, you can download it,