Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing a desktop .NET application that can work offline.

Tags:

c#

.net

wpf

offline

I need to create a desktop WPF application in .NET.

The application communicates with a web server, and can work in offline mode when the web server isn't available.

For example the application needs to calculate how much time the user works on a project. The application connects to the server and gets a list of projects, the user selects one project, and presses a button to start timer. The user can later stop the timer. The project start and stop times need to be sent to the server.

How to implement this functionality when the application is in offline mode?

Is there are some existing solution or some libraries to simplify this task?

Thanks in advance.

like image 862
Serghei Avatar asked Dec 28 '22 06:12

Serghei


1 Answers

You'll need to do a couple of things differently in order to work offline.

First, you'll need to cache a list of projects. This way, the user doesn't have to go online to get the project list - you can pull it from your local cache when the user is offline.

Secondly, you'll need to save your timing results locally. Once you go online again, you can update the server will all of the historic timing data.

This just requires saving the information locally. You can choose to save it anywhere you wish, and even a simple XML file would suffice for the information you're saving, since it's simple - just a project + a timespan.

It sounds like this is a timing application for business tracking purposes, in which case you'll want to prevent the user from easily changing the data. Personally, I would probably save this in Isolated Storage, and potentially encrypt it.

like image 138
Reed Copsey Avatar answered Jan 24 '23 11:01

Reed Copsey