MVVMCross CrossUI.Droid Hello World - mvvmcross

I am Trying to use MVVMCross CrossUI Droid on its own for a quick test from here
In VS2013 I have created a new Android Application, added CrossUI and changed the target framework on CrossUI.Core (ticked all + 4.5+) to compile CrossUI.Core and CrossUI.Dialog.
The link for layouts in the ReadMe paragraph gives a 404 error.
"... and add these layouts to your Resources/Layout folder: Android.Dialog Layouts Expect an easier way to manage this after Mono for Android 4.4 is released."
I assume they will still be needed in layout as I get a missing layout error on run.
I have also "tried" to add some dialog layouts from old project that can be found here
using code (I am trying to piece this together but could be way off hence this help request) -
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
DroidResources.Initialize(typeof(Resource.Layout));
var Root = new RootElement()
{
new Section("Test Section")
{
new StringElement("Test:"),
}
};
var da = new DialogAdapter(this, Root);
var lv = new ListView(this) { Adapter = da };
SetContentView(lv);
}
still get -
02-28 10:56:32.639 E/Android.Dialog( 2382): LoadLayout failed: Could not find resource field dialog_multiline_labelfieldbelow
02-28 10:56:32.639 E/Android.Dialog( 2382): LoadStringElementLayout: Failed to load resource: dialog_multiline_labelfieldbelow
Could someone show / point me to a / some working sample(s) for getting CrossUI.Droid Dialogs rendering on screen?
Thanks for your help

I think you no longer need to include the resources manually when using MvvmCross.
The easiest starting point for this are probably:
The MvvmCross DialogExamples app
The N+1 video - see N=23 in this blog - including blog and code links

Related

Adding API's to chromium build in Electron framework

I would like to write custom functions in Window API in chromium source code. So how do we do it?
In case of doubts about window API here's a link to what I mean click here. I would like to have custom property functions analogus to those shown in the link.
It's for a github electron project.
Well after a week of searching I finally found the solution. Thanks to a pull request by magicae#github.
You need to look create your custom function in
electron/atom/browser/api/lib/atom_api_web_contents.cc
as say
bool WebContents::GetOkOk() {
return true;
}
And define the same in it'h header file
electron/atom/browser/api/lib/atom_api_web_contents.h
as
bool GetOkOk();
Lastly you need to export the function through the webContents method located in
electron/atom/renderer/lib/web-view/web-view.js
as
/* Public-facing API methods. - modified by Akshay Thakare */
methods = ['getOk','getURL', ... ];
And you are good to go.
Finally after you compile your electron app,
in the main.js file add,
console.log(mainWindow.webContents.getOk());
and your done.
As JS is prototype oriented, you could simply extend the BrowserWindow API
var BrowserWindow = require('electron').BrowserWindow; // main process
var BrowserWindow = require('electron').remote.BrowserWindow; // renderer process
BrowserWindow.foo = function() {
console.log('foo');
}
Not sure if you're looking for someting more specific, but I'm not sure you can extend it with heavy impacts on the system, could you explain exactly what you are trying to do ?

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.

Share Target and JumpListItemBackgroundConverter

I've added the Share Target declaration to my app for the data format WebLink and everything works as expected. However, when I add a JumpListItemBackgroundConverter or JumpListItemForegroundConverter anywhere in the app, the app hangs on the splash screen when you enter the app using the Share from IE. No exception, no crash, the debugger doesn't even stop. All I get is a cryptic error in the output window, "The program '...' has exited with code -1073741819 (0xc0000005) 'Access violation'." The documentation for those converters say they're fine with universal apps, just that they've been moved to a different namespace. Has anyone been able to get these two things to work in the same app? If so, where did I go wrong? Or is there something better than those two converters to get the LongListSelector look and feel?
Steps to reproduce:
Create a new universal app. I chose hub.
Add a share target of format WebLink to the appxmanifest declarations.
Add a new page to point the share contract to.
Add the OnShareTargetActivated code to app.xaml.cs to open the new page. See code below
Add a JumpListItemBackgroundConverter to the resources of the main page of the app. You don't need to apply it to anything, just declaring it is enough to break the sharing.
Go to IE and share a link. It should hang on the splash screen.
Code for app.xaml.cs:
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
{
// Replace SharePage with the name of the share target page
var rootFrame = new Frame();
rootFrame.Navigate(typeof(SharePage), args.ShareOperation);
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
It turns out this is a bug in the emulator. It works if you test on a physical device.
MSDN Forum - JumpListItemBackgroundConverter and Share Target in Windows Phone 8.1

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.

Using the Google Maps SDK in views other than the main view

I am trying to use the Google Maps SDK for iOS in a subview of the main view which I created in the storyboard and linked to the view controller via an IBOutlet (I called it extraView, subclassed from UIView). When I follow the steps in the SDK getting started guide, the SDK works just fine, but it uses the uppermost view in the hierarchy (the main view), which I don't want. I want my map to be in a smaller portion of the screen and use the rest of the screen for something else. When I attempt to assign the mapView_ object (see the getting started guide) to self.extraView instead of self.view, the whole screen is black and I get an error in the console output:
"Application windows are expected to have a root view controller at the end of application launch"
Has anyone else figured this out? I can't find anything in the documentation and the sample code Google provides does not use a storyboard.
Here's how...
add a UIView into the view controller where you're working
set it's class to be GMSMapView in the identity inspector.
Then control-drag it to your code as you would for any other outlet.
You can lazily instantiate it in its setter...
- (void) setMapView:(GMSMapView *)mapView {
if (!mapView) {
mapView = [[GMSMapView alloc] initWithFrame:mapView.bounds];
}
_mapView = mapView;
}
To display a map Google's sample code becomes...
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:1.285
longitude:103.848
zoom:12];
self.mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
I solved my problem just removing the loadview code that i took from the example.
Just adding a view as sberley said should works.
just on thing more, on the identity inspector, that attribute that you have to change is class, at least it is on xcode 4.5