I need to pass one object from my App to webviews html page.
I know we can invoke function of webview's page uusing invokescriptasync and also pass data as parameter. but it takes only string as parameter.
object which I want to pass cannot be serialized. so I need to pass it as it is.
The app and the Webview run in isolated script contexts, thus you are limited to passing information as string properties of the args object given to invokeScriptAsync. This is by design for security reasons, with no means to bypass it; otherwise you open the potential for malicious code in a Webview to directly modify app objects.
Related
I'm using the Xero API to do some calculations on employees. This requires an OAuth2Token, specifically the tenantId and the accessToken. This is gotten by redirecting the user to log in and then providing them with the token
The tenantId is a generic list of Tenant. I grab the token through API means and then I assign it to a variable as a XeroOAuth2Token.
Then I send it as the route value. Using breakpoints I can see that the variable looks fine as it is sent to RedirectToPage.
Yet the immediate OnGet that is called, everything is the same except the TenantList no longer has any members?
The solution to this is to serialize the object and send it as a prop inside an anonymous object, I want to know why I have to do that. Thank you for any insight
Currently I'm trying to create a simple login form with Microsoft PowerApps.
I have a login action (Web API2) that is called:
SampleAPI.AuthLogin({UserName:UserNameTextBox.Text, Password:PasswordTextBox.Text})
This is working great. The Login method is returning a json web token which should be passed in all following requests. Is this possible?
Futhermore, when clicking on the Login button, a new screen should appear. (Using Navigate).
So how can I set the result of AuthLogin as the Authentication Header in all following http requests?
Thank you very much!
Yes, this is possible. I'm not sure what aspect of what you are trying to do is causing you grief.
I'm going to guess it is holding on to the json web token that is returned. I'm guessing you would like the equivalent of a global variable to hold this value? PowerApps does not have global variables, but it does have global collections. Use the Collect function to store the value in a collection that you can then access from anywhere in the app. You can view collections in your app with the File menu.
If you don't need a global variable, as a variable scoped to the screen will suffice, then you can use a context variable instead.
I created an application to act as a protocol handler, the registry are set up according to http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx
Then in the webpage I have something like:
Test App
If I click the link, the app is launched and "testapp:arg1" is passed in as an argument.
Now I want to pass multiple arguments to the handler. I'm guessing in the "command" registry key, I would have "path_to_exe" "%1" "%2". However I can't figure out how to write the html link to supply multiple arguments.
Is it possible to pass multiple arguments? If so, how do I do it and are there differences between different browsers?
In Registering an Application to a URI Scheme, it says that
When a user clicks a link containing your custom URI scheme, Windows Internet Explorer launches the pluggable protocol handler registered for that URI scheme. If the specified open command specified in the registry contains a %1 parameter, Internet Explorer passes the URI to the registered pluggable protocol handler application.
which means, spaces will be handled as the character in the whole URI.
how to make a web service call in fragment.
i am working on a project which require a service call and i am working with fragments.
how to make the JSON call and place the result in a fragment.
If i understand your problem properly, you are trying to make webservice call from the fragment. When a fragment creates it calls like below steps:
onCreate(): The system calls this when creating the fragment. Within your implementation, you should initialize essential components of the fragment that you want to retain when the fragment is paused or stopped, then resumed.
onCreateView(): The system calls this when it's time for the fragment to draw its user interface for the first time. To draw a UI for your fragment, you must return a View from this method that is the root of your fragment's layout. You can return null if the fragment does not provide a UI.
So better approach will be; in your onCreate() method, call the webservice by using AsyncTask or Volley. If you use AsyncTask, it will call onPostExecute method when its done. Now you create your object (if you follow mvc) and update ui.
Does Windows.Foundation.Uri supports data URI Scheme, if yes, can I use that in Windows.UI.StartScreen.SecondaryTile as logoReference parameter? Please help.
Just tested this using the JavaScript Grid app template, and it does not work.
The constructor for Windows.Foundation.Uri will happily accept a data URI, but the constructor for Windows.UI.StartScreen.SecondaryTile throws an exception when attempting to initialize the tile with the data URI.
So you will probably need to find another way of solving this. Perhaps you can dynamically create the tile image and save it to your appdata folder, which can then be accessed via the ms-appdata:// URI scheme?
For more info on Windows Store app development, register for Generation App.