Windows Phone 8 resume/suspend /activated/deactivated - c#

I am currently trying to make an app that takes some data from a server. I have a list and I am populating it when I login with some data. The idea is that that data can change over short periods of time. I made an auto refresh button, works fine, but I wanted to implement something like this:
When you open the app, everything loads, is good (done).
If you minimize (put in taskbar, I don't know how to say, enter on another app or menu). Your app will be suspended. When you resume it, I want it to perform the refresh thing. (Need help).
I'm currently working with Windows Phone 8, started project on this one and want to finish with this one. App.current. doesn't have resume or suspend, which I have found on lots of YouTube videos or on the MSDN site. Therefore I think I should do something with activated / deactivated, but I don't know where to add this handler. On the MSDN site I only found the function.
I am looking for something like this: Event on returning to app, after exiting by Windows key [UWP][Win10 Mobile], but as I told, I don't have this.suspend / this.resume on Windows Phone 8.

If we talk about Windows Phone 8, we have to specify which app flavor is intended.
For Silverlight apps, there are Application_Activated() and Application_Deactivated() methods, usually they're auto-created automatically in the App.xaml.cs
For so called "RT apps" there are events Suspending and Resuming, 1st one is subscribed automatically in the App.xaml.cs (so just put your code into that auto-generated handler), and you have to subscribe to 2nd one by yourself.

Related

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.

how to make windows startup project with many methods running at the same time in the background

I have explained my project below and asked some questions with "My Question-" tag.
I have working on a project. At the time of windows logon page if I enter a wrong password my cam should take the picture, If I open regedit my system should take a screen shot and save these images in C:\Windows\system32\new folder (I tried a lot making this work with the help of manifest files but failed everytime) and emails it whenever finds an internet connection
I have a form based app because I didn't find any other way to capture image from webcam directly but taking input from pictureBox1.Image.
My cam, screenshot,email (didn't find a way to autocheck if has internet connection available or not) and 3 events checker for "firewall enable/disable, windows logon failure , regedit event called" are done and they are working good.
What I need to do is to assemble these codes to work as an app and running in the background continuously from the time of windows startup to shutdown
To validate positive events I need to make a desktop based db ("My Question"- still figuring out either to choose sql or localdatabase in c#. Please also tell me a suitable solution.I have to delete all the entries from the db once a day is over). The db would contain the following columns (event id, event name, event timestamp).
I want my app to check if this very event exists in the db then it should ignore the event generated on windows event log else it should make a new row with the db columns and it should do the following actions based on the event like taking webcam pic or screenshot.
"My Question"- I want my app to be live at the time of windows logon page. A lot of programs start later when you are authenticated but I need my program to be live at the time of logon page. Do I have to make 1 or many services? or multi-threaded? because in the typical form based app you can only call one function at a time and wait for it to return something or perform some task/action and then you call the second third whatever.
"My Question"- Do I need to use the backgroundworker in c#
Please help!
You have a lot of things going on here for one question.
You can put all your code in a background service that gets started at boot time. There is a walkthrough here to show you how to do that (along with a million other sites).
Addressing some of the other issues you listed:
Google is your friend...
Webcam - Found a quick reference here and here
File Modification - Another SO thread here
SQL vs. Other Database - Not sure you need anything elaborate here, probably something you can put together pretty quickly. Another SO thread addressing that here
Good Luck!

Is it possible to programmatically update a Windows Store app (when in Kiosk mode)?

I've found the following question asking whether it's possible to find out whether an app update is available:
Programmatically check Windows Store App update
(Not my primary question, but is there a better way?)
I know that it's possible to configure Windows 8.1 to auto-update apps, but this doesn't always happen as soon as I want.
So, now I know that an update is available, can I trigger the update from within the app?
If so, would this trigger have to take me through the Windows Store (which won't be possible in my scenario as I'm running in kiosk mode) or can it just start the auto-update?
Any thoughts/ideas on how I might be able to achieve this would be greatly appreciated.
Thanks
I've run into this problem as well.
What you can do is to check to see if there is an update available, then notify your users that they can either wait or update manually (through the Windows Store app, which you can open for them). You can also notify them of the importance level of the update (just UI fixes/additional features or is it a critical security patch?).
Lastly, you can also register the users for toast updates via an Azure Notification Hub, then send out a toast notification about it.
If it's truly critical, you can also include code in your app to do something like lock down unless it's fully updated or something similar.
In my experience, as of right now, these are our only options. Maybe one day they'll allow us to force an update via a Background Worker or something while the app isn't running. As of right now, that's not an option though.

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.

Detect between app start up and returning from another page

I am building a win 8 metro app. In my main page, I have to check settings when my app starts up. But if I navigate to another page and come back , I do not want it to execute again. How can I detect this?
If you want to do something once when the app is launched, use the Application.OnLaunched method. It is already implemented in the App.xaml.cs and you can add your code there.

Categories

Resources