Is it possible to get the picture token from Picture Class? - windows-phone-7

to receive a Picture over Picture Hub this code works fine:
MediaLibrary library = new MediaLibrary();
Picture picture = library.GetPictureFromToken(NavigationContext.QueryString["token"]);
Is it possible, to get the token string from the Picture instance?
Any casts your tricks?

To uniquely identify a Picture in the MediaLibrary you'l need to use a combination of Name and Date.
You coudl also try using HashCode but when you have a large number of images it can be easier to find an image by name than checking the HashCode of all images.

From what I can gather, the token is provided to your application (intended as an "Extras" application) by the operating system, but there is no way for you to get a token for a specific image. What are you trying to achieve? Are you creating a Silverlight or XNA application?
You may find the following resources useful:
WP7–Adding to the Image Hub 'extras' menu
WP7 Saving to Media Library

Related

How can I display images from an arbitrary folder in Xamarin Forms on Windows 8

This may be a dead horse, but I need to be able to supply a local folder full of images OUTSIDE my Xamarin application - not as resources, not requiring compilation to add more images - and display those images in the application, in Image objects. My main target platform is Windows 10. Others nice to have, not required.
Xamarin Forms Image normally takes either a File name (no path) or a URI. I can't get either method to locate and display images from the local file system. I must be doing something basic wrong.
Non-working sample:
Image i = new Image();
i.Source = ImageSource.FromFile(some.png); // Needs to be from folder on local disk
grid.Children.Add(i, c, r);
Most articles I find explain how to bundle images WITH the application as part of the source; again I need to display them in the application from a folder WITHOUT bundling them with the application. Users should be able to add more images to the folder and they would work in the app without recompiling/reinstalling - like an image gallery.
EDIT: I am able to successfully read a text file using PCLStorage https://github.com/dsplaisted/pclstorage. Is there a way to wire that to Xamarin forms image?
You would need to write a platform specific class to read the images and return a stream that could be consumed by StreamImageSource. Then you can use DependencyService to expose this behavior to your Forms PCL.
Alternatively, you could use PCLStorage
var f = await FileSystem.Current.LocalStorage.GetFileAsync (path);
Stream s = await f.OpenAsync (FileAccess.Read);
image.Source = ImageSource.FromStream(() => s);
Basically, you can't. If you don't bundle the images with your application, you somehow have to transfer the images to the application. Most common case is that you serve these images on a web server somewhere, where the application downloads the images from that web server.

How to fetch ooyala image?

I've been looking around the web all day long but I'm not able to find a way to get the URL for a video image that's hosted on Ooyala. I read that the URL's vary from video to video, but I wonder if there isn't ANY way to get the image from the embed code.
In case you're wondering, I'm not uploading the vids to Ooyala myself, I'm simply running a site that embeds some Ooyala vids (as well as videos from other sites). Does anyone have a solution, or is there simply no way for me to get a preview image?
Thanks!
I don't know on which technology you are working upon. But i have used ruby on rails with ooyala V2. So Ooyala have a ruby on rails module. Which can be downloaded from their site.
Also, u need to have OOYALA_API_KEY,OOYALA_V2_SECRET_CODE. Which u can get by logging into ur ooyala account under developer section.
After getting the module of ruby on rails from ooyala.
The code is simple as follows:
ooyala_obj = Ooyala::API.new(OOYALA_API_KEY,OOYALA_V2_SECRET_CODE)
thumbnail = ''
response = ooyala_obj.get("/v2/assets/#{embed_code}/generated_preview_images")
response.each do |attribute|
if attribute["url"].present?
thumbnail = attribute["url"]
break
end
end
return thumbnail
As only embed code will not work, you need to have a verfied signature to get the generated preview image from ooyala which is only done by API KEY AND SECRET CODE.
I hope I helped you..

How to use NokiaMap for WP7

I'm trying to use a NokiaMaps for windows phone 7 and I've tried follow from this sites:
http://developer.nokia.com/Community/Wiki/Nokia_Maps_for_WP7_using_Bing_Map_Control.
But "MapTileLayer" as Hybrid,Physical,Street,Satellite... does not work !
I think this problem is UriFomat but i can't solve.
Can you please tell me the reason ?
For using the Bing Map control successfully you need to obtain a Bing Map Token (NokiaMapTile.cs, topic 4). You can obtain it here: https://www.bingmapsportal.com/
Beware that when requesting the token you need to specify the same app name as the test one (in this case NokiaMaps).
And be sure to update the .cs and .xaml files with your newly created token data.
Regards,

switch the cameratype in Windows Phone7

all, as we know, the CameraType property indicates the location of the camera on the device. But when I try to swich the cameratype from Primary to FrontFacing by using the following code, it does not work. After reviewing the MSDN document, I found it was a protected set method. And obviously I have no access permition. Is there any way to do that?
Could any one help me?
Thanks in advance!
camera.CameraType = CameraType.FrontFacing;
It seems like you can't force the camera to a different mode after you initialize it.
Use the constructor of the implementation.
For ex: Constructor of PhotoCamera class
I assume you're trying to create a custom camera app ? or something similar ?
If you just want to capture a picture, use Camera Capture Task instead of this. Otherwise your app will fail certification.
If photo capture is not a core feature of your application, consider using the Camera Capture Task to capture photos instead of using the camera APIs directly. Memory allocated for the Camera Capture Task does not count toward total application memory use. This helps minimize your application’s memory use, which is particularly important when your application runs on a 256-MB device. For more information, see Developing for 256-MB Devices and How to: Use the Camera Capture Task for Windows Phone.

Can I access a string value from resource dll in windows phone 7 app?

OK, so I've successfully managed to create a localisation resource library for the title of my WP7 app using the msdn tutorial
The app title is therefore stored in a string table within the resource library AppResLib.dll. This resource string is accessible from the WMAppManifest.xml file by using the following code:
#AppResLib.dll,-200
I would like to know if it's possible to access the app title string from a class within my app? My google searches seem to suggest that it's not possible. It's not possible to use a solution as outlined here, as it just returns the string "#AppResLib.dll,-200".
I think the only solution is to define the app title a second time in a localised string resource file as shown here which I would prefer not to do.
Any help would be greatly appreciated. Thanks for your time.
I'm use localised ressources, but it's a ressource file, I want to call my labels, title, and other text ressourecs in all my application (in my c# class and in XAML) .
if you want tutorial ( in french, sorry ) is here (you want to use google translate for translate all page in english )

Resources