How to show only once time page Windows Phone 8.1 Runtime - windows-runtime

I Want it That One page is only shown once the application starts and the next time go to the Home screen.I'm trying to look into NavigationHelper but doesn't work!

Check in your App.xaml.cs file, you should have something looking like this code in the OnLaunched method:
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
Here, you can check whether the app is launched for the first time (for instance, by storing a value on the phone), and replace the call to rootFrame.Navigate(typeof(MainPage), args.Arguments)) by the page you want to navigate to.

Related

In Google App Maker, how do you display a snackbar message?

I am currently trying to build an application using Google App Maker. After a user hits a "Create" button, depending on whether the files were successfully or unsuccessfully sent, a popup snackbar should display saying "File successfully sent" or "Something went wrong. File not sent." I want to indicate to the user in the final deployed application (no bottom console log) whether their files were sent or not. I do not know how to do this. I have tried creating separate pre-created snackbars (one for success, one for failure) and having the clientscript function display either one depending on what is returned from the serverscript function. However, I do not know how to show them. How do you display a snackbar popup in a clientscript function? Thank you for your help!
Please follow below steps in order to display Snackbar page.
Create a Snackbar page in your appmaker. In order to click on Left Hand Side panel '+' button on the "Page" section.
Choose Pop up. Click "Next" button. On the Next page Select "Snackbar" and click on "Create".
This will create a snack bar page for you. Open the snack bar page. On the bottom part you can see a text box which will display your custom message. Bind a Function to it. Show cased below.
Now in the client script add the following code to configure Snackbar.
This will create a Reusable Snack bar for you for all different messages.
//Client Script
var notificationText='';
function setNotificationText(text)
{
notificationText=text;
}
function getNotificationText()
{
return notificationText;
}
Whenever any event happens add the following code to Display Snackbar.
setNotificationText('Congratulations!!! You have successfully showcased SnackBar');
app.popups.Snackbar.visible = true; //Snackbar is page name.
Here configuring Snackbar code is optional, just to reuse one page for many messages. You can directly showcase the Snackbar page by adding app.popups.Snackbar.visible = true; code in your client script.

Page not working properly after pushing it in subscribe Firebase.onNotificationOpen Ionic 2

I have an Ionic 2 app which uses Firebase to send notifications to users. In the app.component.ts file I have a _setupFirebase function in which I subscribe to
Firebase.onNotificationOpen.
private _setupFirebase() {
//if I push the page here it works properly
this.nav.push(MyPage);
Firebase.onNotificationOpen()
.subscribe(data => {
//if I push the page here it doesn't work
this.nav.push(MyPage);
});
}
The problem is that I need the data obtained in the onNotificationOpen method to choose which page to open depending on the notification and send some data through to that page.
The page I'm pushing has a form that has a few checkboxes. If I push that page in the subscription of onNotificationOpen, like on line 7 of the code, when I click on a checkbox the value changes but the view doesn't get updated.

Chrome Extensions: Show modified background.html

I have an array of data that I want to show to the user of the extension. I thought of manipulating the background page and populating it with data then showing it to the user via: chrome.tabs.create({url: chrome.extension.getURL('background.html')}
However, this opens a brand new background.html page that is not manipulated and, further more, within a totally different context than the original background.html...
i.e I don't have access in that new page to my array that I want to show to the user.
I also tried with a different page than background.html -> results.html...I get its url then send it a message with the array that I want to show to the user:
chrome.tabs.create({url: chrome.extension.getURL('results.html')},function(tab){
chrome.tabs.sendMessage(tab.id,{'personsarray':persons});
});
Then in results.js:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(request);
//other operations
});
but it seems the message is not being sent! can't find anything in the console!
Questions:
Is it possible to show data to user using the background.html page?
What are the appropriate ways to show data to the user in chrome extensions?
Why am I not receiving the message sent from background.js to results.js?
Background pages have unrestricted access to each other. When you created the results.html the next appropriate step would have been to call chrome.runtime.getBackgroundPage() from results.html 's javascript page to get the background page window object. That object will contain all of the data and objects in background.html.

Refresh the displayed data from a Dojo Grid

I have a Dojo Grid. Every row has a link to the formular, where the data can be changed. Now, when I click save and close (in the form) I want the grid to reload the displayed data. So far, I've managed to reload the data, but I always jump back to the start of the grid. But, e.g. if I'm at the end of the table, I want to reload just the last few entries.
My grid is connected to a JSONRest Store, so basically I just should know the range which is displayed right now... . How do I get the range?
If you have backed your grid by a store, you simply "put" the changed object to your store. The JsonRest store you are using will send the changes back to your server with a PUT request and the grid will pick up the changes and update the corresponding item.
When pressing save in your form, you would need to create a json representation of your form data (that matches the one used in the grid) and put this to the store:
require(["dojo/dom-form", ... ], function(domForm, ...) {
...
var updatedItem = domForm.toObject("yourFormId");
yourGridStore.put(updatedItem).then(function() {
console.log("put was successful");
});
...
}
I've managed to solve the problem without any put to the store. Here is the code:
grid._lastScrollTop=grid.scrollTop;
grid._refresh();
And here is the link where I've found the answer. It is the answer number 6.

Submit form to new window's frame

I want a html-form to
open a new window (which contains 2 frames)
send the data of the form to one of these frames as a request
Is this possible? Currently, the form just opens a new window with and sends the request to the URL of the page that processes it. But what I want is that the new window that opens has two frames, one of which processes the form data.
I hope you understand my question and thank you for an answer.
Option A
you will need to use AJAX and make those steps:
Open new window
Send request by using AJAX
Get response
Put response to DIV in new window
Option B
you will need to create special html file that will be default page one of frame. next you will need to copy whole form with values of inputs to this file and trigger the submit. this way is without AJAX but it's more hmm.... twisted?
tell which option you prefere and then i can help you with code if you want of course
You can open and access new window by:
newWin = null;
newWin = open("page.html", 'win1')
if(newWin&&newWin.open&&!newWin.closed){
newDiv=newWin.document.createElement("DIV")
newWin.document.body.appendChild(newDiv)
newWin.focus()
} else {
alert("The window is not open")
}