messagebox causes poor responsiveness windows phone 8 - c#

When I run my app in store test kit (Automated test-Windows phone application analysis) I get a red mark near responsiveness as app responsiveness is poor, I am using a background thread to call a web service and display a messagebox with particular result from web service.
I have tried using separate thread and dispatcher for displaying the message box, still I get the same results in store kit.I am sure that other parts of my code are not causing it, when I comment out messagebox.show(), the app passes responsiveness test.
There is one more link I found relevant http://social.msdn.microsoft.com/Forums/wpapps/en-us/dfd3bc28-6a90-4a77-92f7-c42982eafa40/app-poor-responsiveness-in-wp7?forum=wpdevelop it says this would not affect the certification process,Can some one please confirm this or provide more details of how do I go about making my app responsive?

Message boxes are synchronous, when you display one then the UI thread stops processing the other elements of your interface. That why an automated testing tool will detect it as a lack of responsiveness, even though it's on purpose. Don't worry about it, it won't affect the certification process.

Related

How to perform a simple background task on Xamarin iOS

In our app users can track and submit journeys they have recorded. I need a simple way of creating a task in iOS. I have already created and tested this on Android. It works via:
The user selects the journeys they would like to submit.
Taps sync and a foreground service is created that syncs the journeys to our API.
This service will continue to sync journeys even if the app is put into the background or even closed.
So in short how can i achieve this on iOS 9-13?
I have already tried creating a background-safe tasks using:
nint taskID = UIApplication.SharedApplication.BeginBackgroundTask( () => {});
However, this only gives the task 2 mins to run which isn't enough. I have looked into the NSURlSessions but they require URls, whereas we are using our own API wrapper.
I would simply like a way of creating a task when the user taps 'sync' and this task also being capable to run in the background. I am not too bothered if the task is cancelled when the app is closed, although if possible would like the task to continue.
Thanks.
This service will continue to sync journeys even if the app is put
into the background or even closed.
First, if your app is closed in iOS, I'm sure do can't run any service in background.
Then if your app is put into background, Apple has strict limit to allow apps running in the background. background-tasks has time limits, you can read the document about more information. There is a section about handling-background-task-time-limits which you can have a try.
Also, Apple allows some specific apps to run in background which have to perform tasks in the background. For example, app that needs to play music in background, update location in background and etc. You can see the Application Registration Categories here. If your app meets the requirement there, you can apply for a background running permission from system.
Refer: Backgrounding in Xamarin.iOS
I would advise you to leverage on Shiny to achieve it.
PerformFetch is the closest thing to what you ask for, it will run in the background and update your app when iOS thinks it is needed (it predicts that according to the previous behavior the user will soon open your app and that the new content is available).
The only alternative is to send the push notification when you want the app to be updated.
That's about it, I understand your wish but it is just that - a wish and not something that can be real.

Creating A Pop Up Outside Of App Xamarin Forms

I have an app that needs to create a pop up to notify the user of something, even when the app is closed. I would like it to be fullscreen, but if that's not possible, a pop up that takes up most of the screen will do. I don't know how to make part of the app run in the background on Android and iOS to check if it's time for the pop up. I also don't know how to go about making the actual pop up. Any help would be greatly appreciated!
Side notes: I am using a cross platform Xamarin.Forms app. I have a main page that the user can set the time they want the pop up to appear, and I save this to the Application.Current.Properties dictionary for data persistence.
Background tasks on mobile has quite a lot of limitations. Which is logical. The user would not like if some app will always run in background and collect user data, drain the battery or affect overal performance of the the mobile device. Therefore for there are strict set of rules every developer must follow when creating a background tasks.
You best bet would be to use local notifications, there is a well documented open source library that you can use for this. There will be no pop-ups but notifications which you could customize according to OS guides.

Taking screenshots of partially hidden windows from .NET WPF applications

I am working on a program that starts several other c# WPF applications and checks wether there are errors (using .NET Automation Services / UITesting).
One of the requirements of it is to take a screenshot of the main window and to put it into a word document. I alread got it working quite fine when it´s one application at a time (using code from this site: http://www.developerfusion.com/code/4630/capture-a-screen-shot/) , but as soon as i am using parallelism (say, checking 5 applications in a parallel manner), i am running into the problem that the screenshots of the windows may be overlapped by other windows that just popped up or that are always brought to the front (e.g. splash screens). Bringing the window to the front does not really help.
There was an older similar thread not directly regarding to WPF applications, and sadly, without a clear solution: Taking screenshot of a partially hidden window in a programmatic way
Is there a way to get a "clean" screenshot, may be with the use of the windows AutomationElement instance?

launch winforms app on schedule - provided conditions are met?

I am designing an app which basically is going to check for new data, my initial thought for this is to use a windows service. If i get any new data i need to display a winforms app which i'll populate with this data so that the user can acknowledge it.
I know there are restrictions running UI apps from a service so i'm just wondering what others believe is the best approach for both. Also i need to run this on XP
The timer that gets the data
how to launch the WinForms App
As im writing this i've also been toying with the idea of using a console app but nothing seems to be fitting together in terms of functionality.
You can use a regular Winforms app. As soon as the application loads, hide the entry form from within the Form_Load method, this will keep the form hidden from the user. Keep a timer on the entry form that frequently checks for relevant data and pops up windows as and when required.

Is there a way to bring an application's GUI to the current desktop?

Background:
Started a fair amount of work before realizing that a Windows Service cannot start an app with a GUI that displays without potential problems. The proper solution of separating the GUI of the app to be started is non-trivial, so I'm trying to think of alternative solutions.
There is a GUI to manage the service that is a separate executable, but the process to be launched (actually multiple instances of it) has its own GUI that needs to be shown. It doesn't need to be made visible by the service itself, but it needs to be at least able to be made visible by another process with a visible GUI. The Windows User that is running the service and that needs to see the GUI of the launched process is the same and known at install time.
Is there some way to accomplish this or is it back to the drawing board?
Also both the service and the app to launch are both our code and modifiable.
My first thought was to suggest that you look at the WTS* functions and CreateProcessAsUser and then I followed the link you provided and saw that you have already considered this and dismissed it.
As an alternative, if I understood you correctly you have a Windows Service and GUI which is used to manage the service. So why not use the communication channel you have between the Service and the management GUI to send a message from the service to the management GUI and have the management GUI launch the other GUI apps on behalf of the service? Of course this would assume that the management GUI is always running.
You might even do this with a hidden application that is not visible and launches when the user logs-in, that way you reduce the risk of the user inadvertantly closing the application, this would be a separate app from the actual management application.

Categories

Resources