If you want to do it the native way, its pretty easy. Add this to your MainPage.cs file near the bottom as a child function of MainPage():
/// \<summary\>Called by Lua when it is requesting a login popup to be shown.\</summary\> /// \<param name="sender"\>The CoronaRuntimeEnvironment that dispatched this event.\</param\> /// \<param name="e"\>Provides the Lua vent table's fields/properties.\</param\> /// \<returns\>Returns a boxed object to Lua.\</returns\> private CoronaLabs.Corona.WinRT.ICoronaBoxedData rateApp( CoronaLabs.Corona.WinRT.CoronaRuntimeEnvironment sender, CoronaLabs.Corona.WinRT.CoronaLuaEventArgs e) { MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask(); marketplaceReviewTask.Show(); // This returns nil to Lua. return null; }
At the top, in the “using” area add this line:
using Microsoft.Phone.Tasks;
In the OnCoronaRuntimeLoaded function add:
private void OnCoronaRuntimeLoaded( object sender, CoronaLabs.Corona.WinRT.CoronaRuntimeEventArgs e) { // Keep a reference to the Corona runtime environment. // It's needed so that your login window's results can be dispatched to Corona. fCoronaRuntimeEnvironment = e.CoronaRuntimeEnvironment; fCoronaRuntimeEnvironment.AddEventListener("rateApp", rateApp); }
Then in your Lua code for the touch/tap handler for your Rate button do:
local requestRateApp = { name = "rateApp", } Runtime:dispatchEvent(requestRateApp)
Rob