WP8 Application closes with out error, While navigating between pages - windows-phone-8

I am developing a Windows phone 8 application. Everything is working fine, but while i am navigating from one screen to other (using NavigationService.Navigate) , the app closes intermittently. There are no errors/exceptions but app closes and takes me to the apps list. This is happening 1-2 times if i navigation around 10 times.
Anyone else also facing same issue?, please share the solution for the same.

So it's easy, use relative, because it's relative to the current directory.
Change
NavigationService.Navigate(new Uri("/Home.xaml", UriKind.RelativeOrAbsolute));
to
NavigationService.Navigate(new Uri("/Home.xaml", UriKind.Relative));

If you're navigating between the same pages, you should use the first opened page as the start point and then use backward navigation to return to that page:
NavigationService.GoBack();
This removes the current page from the BackStack and restores the previous one. Otherwise use the normal navigation:
NavigationService.Navigate(new Uri("/MyNewPage.xaml", UriKind.Relative));
You should try that and if it doesn't help, debug the page initialization and loads line by line.

Related

Instagram in app browser is shifting all click events

On the iPhone's Instagram app browser(in app) if you open a website that includes html inputs of any type, something strange happens.
In the beginning everything is working, but once you tap an input and type something ( and the keyboard is opened), after you close the keyboard you can't click on anything anymore because all buttons/inputs/elements are clickable in a different location than where they showed ( button is showed in the original 100px location but click events are now on 50px).
It looks like after the keyboard opens the whole location calculation is shifted up(because the keyboard pushes the whole body up)
How to even begin to debug such thing ?
Honestly, I've been there. There is no way to debug the in-app browser (you can try on an iphone device mirroring with Chrome in MAC, but you will eventually fail), but I've tried without success.
It turned out that after digging around with similar issues, there was a caching issue and some disabled features with WP ENGINE from my client. They were able to fix it by allowing some parameters on nginx settings and then the In App browser wasn't stucked anymore.
I know every issue is different, but at this time, I haven't found a way to debug the In - App browser.
I can't speak to iOS specifically, but there definitely are ways to remote debug things.
My go-to for stuff like this (speaking from experience of browsers on gaming consoles) is Weinre: https://people.apache.org/~pmuellr/weinre/docs/latest/Home.html You get something similar to Chrome Developer Tools, but it works over a Socket.IO connection.
Another tool I like to use is Fiddler. While it won't help you with your DOM issues, if you ever need to debug network stuff on oddball devices, it's perfect. It serves as a proxy server and can intercept all your connections, including HTTPS. https://www.telerik.com/fiddler
Turns out, that it's a fixed position and it's not supported, which means when keyboard is closed, the system will push back the whole view but click events stay up (because it's being pushed up when you open a keyboard).
So instead of make it an absolute modal, which has it's own problem, we keep it fixed, BUT, we do the pushing up/down by our own.
We could just push the screen back down on input unfocused, but if user click the next field you get unwanted behavior, so we create a delay based machine like so :
var isfocused=0;
var focusTimer=0;
$("input").blur(function() {
isfocused=0;
focusTimer = setTimeout(focusDone, 150);
});
$("input").focus(function(){
isfocused=1;
});
function focusDone(){
if(isfocused===0)
$(window).scrollTop(0,0);
clearTimeout(focusTimer);
}
This works great on social browsers, with fixed positioned modals that has inputs inside them.

Windows Phone Universal - Issue in Navigation and On Loading of page

I am facing a weird problem in windows phone 8.1 page navigation.
I have got two pages.
Login page > Consists of app bar in which one of the button take us to second page.
Second page is Cached using MVVM i.e Registered the Second page to IOC on launch of app and binding the instance of it to page 2 XAML.
In the Second page View model Constructor I am making Server call to get the data.
Problems facing.
On Clicking the app bar button to navigate to second page, the app stays in the first page until the second page make server call and get the response. Then its navigating.
But actual behavior must be it should navigate to second page and wait there to get response showing progress bar.
One quick fix is I made the thread to stop for some 50 millisecond in page 2 constructor of view model and then made service call
It navigated to Second page immediately and waited there until response but the previous page App Bar still displays until I get the response.
I even find the quick solution for it by Collapsing the App bar just before Navigating to that page.
I know these quick fixes are not good. So please help me to find out the problem or if you already know please revert back with the solution.
Don't use constructor to initiate the web service calls . Use OnNavigatedTo or Page_Loaded event .

Back Key doesn't terminate the app and doesn't back to mai page

I'm working in a Windows Phone 8.1 Project and have created it from a WP blank page (XAML and C#). After that added a new blank page and I navigate from main page through a blank page using a button. Now I'm struggling to navigate between pages.
If I'm at main page and press the physical back key button of my cellphone, my app doesn't terminate, instead it goes to background.
If I'm at blank page and press the physical back key button of my cellphone, my app doesn't go back to main page, instead it goes to background.
I have tried several methods from internet (most of them using silverlight which is not my case) but I didn't understand how to create an event handler to deal with that.
Navigation doesn't work in 8.1 because it isn't built in by default as it was in 8.0. You either have to do it yourself or instead of using a new Blank Page use a Basic Page.
The first time you add a Basic Page to your project the IDE will automagically add all the stuff to do automatic back page navigation. It will add a new NavigationHelper class under the Common directory. It will also add NavigationHelper methods to the page where you can add code for recreating the page after a terminate and resume.

WebResource.axd Suddenly Stopped Working In ASP.Net Offline Web App

Building an offline web app in VS2010. I have a master page with a navigation menu control. So far I've been able to add 4 new pages, each navigated to from this menu control. All has been added to the Cache Manifest file and all has worked offline up until now. After the most recent page was added to the project, now when I am offline, my menu control doesn't load properly and the console shows that the webresource.axd for the menu control couldn't be found and then gives the sys is not defined error. The error does not occur just by navigating to a page, only when button is clicked that causes a location.reload(true).
I've seen from VS where things will be working and then when you restart VS the next morning stuff will suddenly be broken. But I mean this is really blowing my mind.
Is there another way maybe to refresh an offline page such that the controls reset back to original value? That is the only reason I am doing the refresh.
It was something so simple I am embarrassed. I changed location.reload(true) to location.reload(false). That way, it wasn't trying to reload the page from the server. All fixed.

Creating Chrome popup with a C++ program

Problem context:
I have a C++ program and a web presence. Currently the way things are working I have made a control panel with javascript and html. And it send commands via an unimportant communication medium to control things or get information from the C++ program.
Now, when the C++ program launches, I'm making it run a
ShellExecute(NULL, "open", addressBuffer," --new-window", NULL, SW_NORMAL);
This is a way of launching the default browser with the given address. The addressBuffer in this case points to an intermediate HTML file that quickly turns around and uses the
window.open()
in Javascript to open the final popup, then closes itself.
The result is the user now has the popup control panel that I want them to have but the user's main browser window also gets given focus, un-minimized, and placed on a different tab than the one they had selected. (Basically pops up out of nowhere and selects a another tab)
Problem:
I'm looking for a way to launch a Chrome popup, without disturbing a previously open browser window. Any ideas or solutions would be very helpful.
Lastly, it's worth noting that the " --new-window" from the code above doesn't actually open a new window like you would expect. In this case it's actually doing nothing... If it did work, none of this would really be an issue.
I know this is wordy so thanks in advance for you time!
-Michael
Alright, I came up with a solution.
Something about how ShellExecute processes it's commands was preventing the command line args to be passed in correctly.
My work-around includes grabbing the path to Chrome from the registry,
HKET_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
Then simply doing a system() command with the chrome path "--new-window" and the web path.
Then I let the intermediate html page open it's popup and close itself.
Tada done.
Thanks.