Fix little bug, return original page. also Add cancel button feature for UWP#354
Fix little bug, return original page. also Add cancel button feature for UWP#354huangjinshe wants to merge 2 commits intoRedth:masterfrom huangjinshe:master
Conversation
Fix exception, fix return page problem. and add show cancel button feature.
Also add cancel button feature to UWP
|
@f1nzer I'm curious what your thoughts are on this idea for UWP (creating a new frame).... I do like the idea of being able to remove the NavigationCacheMode attribute... |
|
@Redth I also add return cancel button. If still use old |
|
I'm test it based on the Xamarin+UWP. So I just need some one could test it on UWP project. |
|
I just create a So if |
|
also I really don't know how you guys test about |
|
As for me it's very common practice to use NavigationCacheMode in UWP apps and it's not the only place where you should use this property in your app (tombstombing is great!). For now I don't know how to implement it's in a better way (mby to use ContentDialog? 😄). Creating new frame will cause many problems such as:
This PR doesn't handle first point in any way so app closes on hardware back button click. |
|
@f1nzer Actually I've already uploaded the sample about MasterDetailPage problem. Go and download this sample. Another problem which the page mess up after scan back when navigate. I didn't reproduced today.(maybe that problem will reproduce when click the back button which I added, not the real back button on the phone. Maybe that's why I change the original logic to new Frame) Let's see the original code:
That's why I change it to new frame, new frame don't worry change the original frame. a separate part. Don't need to worry too much. Now let's face on those problems your mention:
|
|
@huangjinshe In your MasterDetailsPage sample you just need to add handler for hardware back button (#362).
You must enable back navigation for all hardware and software system back buttons. (check this link https://msdn.microsoft.com/en-us/library/windows/apps/mt465734.aspx). So it's not our problem if it's not enabled (we can just remind users don't forget this in readme.md).
You can also check "default" suggested implementation for back button: Frame rootFrame = Window.Current.Content as Frame;If anyone uses this logic => you can expect app closing with your new frame logic because backstack on your frame is empty and event is not handled. |
|
Ok. I got you, I hope you guys could add this in this project home page, avoid developers still couldn't return to original page. Also If you guys want to keep cancel button feature, please tell developers: in the default the cancel button will show on (because you guys give it the default value already : "Cancel" ). If developers want to hide it, just remove the value from it: Also please keep the bug fix about the |
|
I have some ideas about back button implementation and NavigationCacheMode notification. |
|
I close it.
|
Fix exception, fix return page problem. and add show cancel button
feature.
1.Fix when finish scan stop, the mediaCapture.stopPreview() will execute more than onece, then there is a excpetion problem.
2.Old UWP will always use the current mainWindow Frame, that cause a lot of problem, like can't return to the original page. So I create a new Frame and replace mainWindow.Content, after finish scan just restore the original mainWindow.Content. All fine, I test it on real phone.
Now you could remove the description about add on MainWindow on Home page, because you don't need it anymore:
NavigationCacheMode="Enabled"3.I add a cancel button. But If you want to use it, just need to set the CancelButtonText. like:
var scanner = new ZXing.Mobile.MobileBarcodeScanner(); scanner.CancelButtonText = "Return";That will more helpful because you don't need to press Back button on the phone, and cause some trouble.