📜 ⬆️ ⬇️

Practical cross-platform

After six months of using Ubuntu Linux, I finally decided that this is exactly the system I need for work and entertainment. I organized mail in Evolution and was pleasantly surprised that everything I needed was there, but nothing superfluous (which is especially surprising after working in Microsoft Office Outlook)!

It so happened that I bought myself a PocketPC based on WM6 (Windows Mobile 6).

Everything was great until the moment when I had many tasks and tasks: I needed complete synchronization between the three products:

Search for a solution


After some searching on the Internet, I discovered that I couldn’t synchronize the Evolution with the PDA through the USB cable (WM6 is not yet supported, and the project for synchronization with WM5 has died completely).
')
Further, I discovered that in theory it is possible to synchronize all three systems through the Exchange server (and this is the right approach). But I did not find a free Exchange server on the network (I found one, but Evolution refused to work with it because the @ sign was used in the login). But maybe I did not try to look for it - I like to reinvent the wheel and gain experience, having fun in learning new things.

Task


The task, in general, was clear. It was necessary to write a program that would provide synchronization.

BUT!

I had absolutely no desire to write three different programs for all three systems. It was necessary to organize the work in such a way as to minimize the labor intensity.

After a certain review, I discovered:

1. MS Office Outlook provides an object model for .NET applications.
2. Evolution provides an object model for mono applications.
For those who do not know: mono is a cross-platform (Win / * nix / Mac) implementation of the .NET Framework.
3. WM Outlook provides an object model for .NET applications.

Great! So, I can write everything on C #!

Decision


The most important thing is to design everything well! I built some abstract model:

The synchronization provider is an abstract class. Must be run for all three data sources.
Synchronizer is a system for finding data differences that interacts with synchronization providers. Uniform for all three programs.
Network Manager - a system for exchanging data between applications over the network (directly or through a server - it does not matter).
Configurator is a system for working with configuration.
Features of the system - a subsystem that stores data about the features of work on different platforms.

I distributed these areas of responsibility as follows:

Program: Sync Provider Implementation
Library (Sync.dll): Synchronizer , Network Manager , Configurator
Library (Platform.dll): System Features

It turns out that I am writing the Sync.dll library, which is the same for everyone, I implement the synchronization providers in all three programs and I write Platform.dll, which will inform the features of the system in which it is executed (the paths to the necessary folders, etc.).

For the work!


I started Visual Studio and in one breath implemented Sync.dll. After that, I started WM Outlook and (after a certain sex when setting up debugging on a virtual device) I wrote the first synchronization provider.

Tax ... now Evolution. I launched MonoDevelop, set evolution mono bindings (with huge sex, as the package did not have dependencies properly observed). And wrote the second synchronization provider!

Launched, and lo and behold! Contacts from Evolution copied to the PDA! Now we need to finish the transfer too and fix the little things! :-)

Results


I was surprised that .NET is now truly cross-platform (and, so to speak, cross-device)! I realized that I can write the same code for three different platforms, one of which is a PDA in general. And here there is already a lot of room for fantasy! :-)

Source: https://habr.com/ru/post/27020/


All Articles