Windows Phone 8.1 Has No Sample Images? - windows-phone-8

I am testing PhotoChooserTask in my 8.1 app and I do not see any available sample images that come with the emulator? Is there a way to get sample images?
void photoChooserTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
//MessageBox.Show(e.ChosenPhoto.Length.ToString());
//Code to display the photo on the page in an image control named myImage.
System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
bmp.SetSource(e.ChosenPhoto);
myImage.Source = bmp;
}
}

You don't need to download from the Internet. I found a great workaround for this.. In the new WP8.1 emulator you have the option to emulate a SD card. Its great. I have created a blog post and a YouTube video. Have a look. Hope it helps.
http://wpdevkvk.wordpress.com/2014/07/19/adding-your-own-photos-to-windows-phone-8-1-emulator/

In the Windows Phone 8.1 emulator there aren't any images available. Actually there are some images for selecting as the background for the start screen, but it is only available for start+theme app in settings page. You can't access them. But you have a workaround for that. Before you test your app you can open the camera app and take some photos. (Obviously it will take save some images of random squares but it will have to do) Then next time you run the app your PhotoChooserTask has some photos to select from.

Related

Create WriteableBitmap using HTML content in Windows phone 8.1

Create WriteableBitmap using HTML content in Windows phone 8.1 Without involving the XAML
I have created WebView object in c# and render HTML content in WebView.NaviagateToString and trying to get the object using WebView.CapturePreviewToStreamAsync method but i am getting the Global exception ( value does not fall within the expected range).
WebView wv = new WebView();
wv.NavigateToString(HTML Content);
InMemoryRandomAccessStream imras = new InMemoryRandomAccessStream();
await wv.CapturePreviewToStreamAsync(imras);
And also i tried using the below code, but i didn't find the dlls.
Bitmap m_Bitmap = new Bitmap(400, 600);
PointF point = new PointF(0, 0);
SizeF maxSize = new System.Drawing.SizeF(500, 500);
HtmlRenderer.HtmlRender.Render(Graphics.FromImage(m_Bitmap),"<html><body><p>This is a shitty html code</p><p>This is another html line</p></body>", point,maxSize);
m_Bitmap.Save(#"C:\Test.bmp")
Please help me out from this.
Thanks.
t's impossible currently, Windows Phone Store apps do have a phone-only ScreenCapture API, but it still need to show your content in you app.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

How do you make live tiles for Windows Phone 8.1 Apps?

How do you make live tiles for Windows Phone 8.1 Apps?
It is the best kept secret on the internet!
I am trying to make a tile, which whenever the app is suspended, it updates the live tile with some text.
I have read/watched roughly a dozen "tutorials" on live tiles, and none of them are compatible with Windows Phone 8.1.
At a high level, what steps do I need to follow to accomplish this?
Note: I am well aware that Tile Templates exist...but the secret is what to do with them. All of the code out there not only does not compile for Windows Phone 8.1, but on top of that, the code assumes that people already know how to make the live tiles.
Below is how to create live tile in windows phone 8.1
//Generates an image tile
StringBuilder sb = new StringBuilder("<tile>");
sb.Append("<visual version=\"2\">");
sb.Append("<binding template=\"TileSquare150x150Image\" fallback=\"TileSquarePeekImage01\">");
sb.Append("<image id=\"1\" src=\"ms-appx:///Assets/Logo.scale-141.png\"/>");
sb.Append("</binding>");
sb.Append("</visual>");
sb.Append("</tile>");
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(sb.ToString());
TileNotification tileNotification = new TileNotification(xmldoc);
TileUpdater tileUpdator = TileUpdateManager.CreateTileUpdaterForApplication();
tileUpdator.Update(tileNotification);

WP8 Play sound when application is onbackground

Developing tools : Visual Studio 2012, target wp platform : wp8.
I am facing the above problem:
When my application is running on background and i am receiving a notification i vibrate the phone successful and i want to play a specific sound.
What i have tried so far:
Player = new MediaElement();
Player.AutoPlay = true;
Player.Volume = 5;
Player.Source = new Uri("/data/alert.mp3", UriKind.RelativeOrAbsolute);
Player.MediaOpened += (Object s, RoutedEventArgs args) =>
{
Player.Play();
};
I i am not getting any exception but no sound. Neither on foreground nor background .
Am i missing something?
I will appreciate any help.
You can't use the MediaElement API to play notification sounds when the app is in background. In order to launch a notification and play a custom sound, you need to use the ShellToast and use the Sound property via reflection.
Here is how play a custom notification sound from background (MSDN link) Using custom sounds in toasts on Windows Phone 8 Update 3
EDIT: When the app is running in foreground, you can use the same technique (ShellToast with Sound).
Even MediaPlayer class can help you play songs and media in the background when you are showing a toast or a small pop up dialog.
Check here : http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.play.aspx

How to use Front-facing camera to take pictures on windows phone?

I've got two questions about how to access the camera on Windows Phone 8:
How can I access the front-facing camera to take pictures?
How can I access the flash/torch of main camera?
This article from MSDN has an example of both accessing the front and back cameras, as well as accessing the flash, assuming your using C# (since you didn't specify). Here's a snippet under the Creating the Capture Device heading:
System.Collections.Generic.IReadOnlyList<Windows.Foundation.Size> SupportedResolutions =
PhotoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Front);
Windows.Foundation.Size res = SupportedResolutions[0];
this.captureDevice = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Front, res);
For accessing the flash of the camera, here is a snippet under the Specifying Camera Properties heading:
cam.SetProperty(KnownCameraPhotoProperties.FlashMode, FlashState.On);
cam.SetProperty(KnownCameraGeneralProperties.PlayShutterSoundOnCapture, true);
cam.SetProperty(KnownCameraGeneralProperties.AutoFocusRange, AutoFocusRange.Infinity);
Hope this helps!

Windows 8 Metro C# Camera

I have a problem with web cams in Win8 metro.
I want to make an application that will draw on photo.source video from webcam.
Unfortunately, I found only this How to get camera feeds in Windows 8 Metro style app? and app opens only capture and I need show only the webcam. Thanks for answers.
You could use the CaptureElement to integrate the camera feed in your application. In XAML:
<CaptureElement x:Name="capElement" Width="400"></CaptureElement>
In code-behind, you need to activate the source:
MediaCapture captureMgr = new MediaCapture();
await captureMgr.InitializeAsync();
capElement.Source = captureMgr;
await captureMgr.StartPreviewAsync();
You mean something like this? windowsapps/CameraCaptureUI