Create WriteableBitmap using HTML content in Windows phone 8.1 - windows-phone-8

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.

Related

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);

Windows Phone 8 Live tiles Text & image update

I created an app for windows Phone 8 and want to implement Live tiles in my app. I don't even know anything about live tiles. I tried many examples from the forums and all.
But all are in the form of buttons(Like Flip, Cycle) If i click Cycle Button it will direct to the start screen to show the Cycle Tile.
But, How could i implement in my app. i want to shows the lives tiles only when user pins into the start screen.
anyone, help me to solve this????
Thanks in Advance.
The first thing you need to know is that LiveTiles on Windows Phone 8 can be implemented only from C#/.NET code, not C++. The native libraries don't have access to LiveTiles, so you need to use the .NET API.
Next... if your app is written in C++ with DirectX, you need to use XAML with Direct3D interop. This means you will have at least 2 VS projects, one using XAML/C#, the other using C++. LiveTiles will be updated through callbacks and delegates, sending events from the C++ component to the C# XAML component.
(If your app is using only C#/.NET, you don;t need any callbacks)
One more thing: the only type of LiveTile which always works on Windows Phone is FlipTile type. If you use iconic tiles, WP8 usually ignores colors, and shows only white&transparency.
Here is a snippet from my C++ component:
std:string dummyStd = "test string to display";
std::wstring dummyWs.assign(dummyStd.begin(), dummyStd.end());
Platform::String^ dummy = ref new Platform::String(separatorWs.c_str());
m_d3DInterop->OnLiveTilesUpdates(dummy);
and a snippet from the C# component:
public void OnLiveTilesUpdates(String s)
{
String szTitle = "title";
String szText = s;
ShellTile oTile = ShellTile.ActiveTiles.First();
{
FlipTileData oFliptile = new FlipTileData();
oFliptile.Title = "";
oFliptile.Count = 0;
oFliptile.BackTitle = szText;
oFliptile.BackContent = szTitle;
oFliptile.WideBackContent = szTitle;
oFliptile.SmallBackgroundImage = new Uri("/Assets/Tiles/FlipTileFrontSmall.png", UriKind.Relative);
oFliptile.BackgroundImage = new Uri("/Assets/Tiles/FlipTileFrontMedium.png", UriKind.Relative);
oFliptile.WideBackgroundImage = new Uri("/Assets/Tiles/FlipTileFrontHigh.png", UriKind.Relative);
oFliptile.BackBackgroundImage = new Uri("/Assets/Tiles/FlipTileFrontMedium.png", UriKind.Relative);
oFliptile.WideBackBackgroundImage = new Uri("/Assets/Tiles/FlipTileFrontHigh.png", UriKind.Relative);
oTile.Update(oFliptile);
}
Remember you need to bind the two snippets of code using events and delegates/callbacks (only if you use XAML with Direct3D interop).
Also, if you arrive here, you should know that the best component to use for rendering is DrawingSurface, because DrawingSurfaceBackgroundGrid has some z-order issues in WP8, and SwapChainBackgroundPanel is not supported in WP8.
PS: you should also do some research regarding secondary tiles.

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!

Google Map V2 GIcon.shadow Image display in local development server but not from test server

I have custom marker icon (gif/png) to display on Google Map V2. I am using GICON and shadow property to set image path. The marker icons are diplaying as expected in development system. But after i deploy the system into server (Windows server 2008 r2, IIS 7.5), the icons are not displaying in some PC (not all). For some users the icons are displaying but for some users it is not displaying. I really appreciate all your help on this regard.
The code used is below :
var cm_baseIcon = new GIcon();
if (Records[i].Act == '1')
cm_baseIcon.shadow = "images/img/Markers/green.gif";
else
cm_baseIcon.shadow = "images/img/Markers/red.gif";
cm_baseIcon.iconSize = new GSize(27, 27);
cm_baseIcon.iconAnchor = new GPoint(9, 34);
cm_baseIcon.infoWindowAnchor = new GPoint(0, 0);
cm_baseIcon.infoShadowAnchor = new GPoint(13, 27);
var markerOpts = {};
var icon = new GIcon(cm_baseIcon);
markerOpts.icon = icon;
When I load your test page, I don't see any markers. Should the page create some markers when first loaded like this, or do I need to interact with the page in some way to get it to display any markers?
I set a breakpoint inside the initialize() function. Your Records variable is an empty array, i.e. []. So the for loop in this function that creates the markers never executes.
Do you know how to use the JavaScript debugger in a browser? It will let you figure out what is going wrong without having to ask anyone. I and other people here are happy to help, of course, but you'll make much faster progress if you can debug this on your own.
I recommend the developer tools in the Chrome browser. Here is a good introduction to the Chrome DevTools. Read through that and try out the JavaScript debugger in particular. You can stop your code and look at variables, change values, single step through the code to see what each line does, etc. This will at least double your productivity in JavaScript, and probably even more than that.

Capture video without sound in Windows Store App

I want to write a Windows Store App that can capture video (without any sound) and take pictures. Imagine a digital camera: you can preview the picture on the screen of your device before pushing the button which takes the pic.
The problem I'm facing now is the fact that the Windows.Media.Capture namespace has only classes for objects that capture video with sound (CameraCaptureUI, MediaCapture). I'm not troubled by the objects' capabilities, but by the fact that I will have to include in the manifest of the app the Microphone capability and it does not make sense for the app to use it. I need a class that uses only the Webcam capability.
Any ideas?
I found the answer and I thought I should share it. I'm sorry for answering my own question, but here goes:
One can specify in the settings of the MediaCapture object, when initializing it, that it will use only the Video part:
var mediaCaptureMgr = new MediaCapture();
var captureSettings = new MediaCaptureInitializationSettings();
captureSettings.StreamingCaptureMode = StreamingCaptureMode.Video;
await mediaCaptureMgr.InitializeAsync(captureSettings);
RTFM!