UWP Unable to update UI after scanning
See original GitHub issueAfter scanning a QR Code, I perform a long running task, and update the UI to notify the user that the task is running. This does not work after performing a scan. Below is the code I am using to try and update the UI.
public sealed partial class MainPage : Page
{
MobileBarcodeScanner scanner;
public MainPage()
{
this.InitializeComponent();
scanner = new MobileBarcodeScanner(Dispatcher);
}
public void NotifyUser(bool runningLongTask)
{
// Update Some UI stuff here
}
private async void StartScan(object sender, RoutedEventArgs e)
{
await scanner.Scan().ContinueWith(async t =>
{
if (t.Result != null && !string.IsNullOrEmpty(t.Result.Text))
{
// Update UI Components. Does not work
NotifyUser(true);
// Simulate a long running task
await Task.Delay(10000);
// Update UI Components. Does not work again.
NotifyUser(false);
}
});
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
UWP update UI from Task
So I would like to update the UI during the scan. So here are the questions: At this moment I have several tasks...
Read more >Unable to update UI controls on UWP app after scanning with ...
I recently created a cross platform project in Visual Studio 2015 for Xamarin Forms. The purpose is to have a very simple barcode...
Read more >Launch the Windows Settings app - UWP applications
Learn how to launch the Windows Settings app from your app using the ms-settings URI scheme.
Read more >Version adaptive apps - UWP applications
Learn how to take advantage of new APIs while maintaining compatibility with previous versions.
Read more >Dell Command Update 4.7 pulled? : r/SCCM
I hope they fixed problem in 4.6.0 that I wasn't able to install as system and configure, still have a ticket open on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Added this to the sample and README in 4b45f9079366fc62ff6aeec12fbbe02db597b53b
Ok my very similar problem was fixed. Anyone having this problem might look into the solution in #320 . adding NavigationCacheMode=“Enabled” to the Page (in Xamarin PCL add this to the UWP Project MainPage.xaml not in any xaml files in the PCL folder as it does not exist in Xamarin)
If this solves it, it might be a good idea to include that into the Readme. And thanks again to Strifex for this solution.