Practical cross-platform

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

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

    Everything was wonderful until the moment when I had a lot of tasks and tasks: I needed complete synchronization between the three products:
    • Evolution
    • Windows Mobile Outlook
    • MS Office Outlook

    Search for a solution


    After some searching on the Internet, I discovered that through a USB cable I definitely could not synchronize Evolution with the PDA (WM6 is not yet supported, and the project for synchronizing with WM5 has completely died).

    Further, I found that in theory it is possible to synchronize all three systems through an 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 didn’t try to search - I like to reinvent the wheel and gain experience, having fun in learning new things.

    Task


    The task was generally 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 complexity.

    After a certain review, I found:

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

    Class! So I can write everything in C #!

    Decision


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

    synchronization provider is an abstract class. Must complete for all three data sources.
    Synchronizer - a system for finding data differences, interacting with synchronization providers. Unified for all three programs.
    Network manager - a system for exchanging data between applications over a network (either directly or through a server - it doesn’t matter).
    Configurator - a system for working with configuration.
    System features - a subsystem that stores data about the features of work on different platforms.

    I distributed these areas of responsibility as follows:

    Program: Implementing a synchronization provider
    Library (Sync.dll): Synchronizer , Network Manager , Configurator
    Library (Platform.dll): System Features

    It turns out that I write the Sync.dll library, which is the same for everyone, I implement synchronization providers in all three programs and write Platform.dll, which will report the features of the system in which it is running (features may include paths to the desired folders, path separator, etc.).

    To work!


    I launched Visual Studio and implemented Sync.dll in one go. Then WM Outlook took up and (after some sex when setting up debugging on a virtual device) I wrote the first synchronization provider.

    Dachshunds ... now Evolution. I launched MonoDevelop, installed evolution mono bindings (with huge sex, since the package did not have the correct dependencies). And the second synchronization provider wrote!

    Launched, and lo and behold! Contacts from Evolution were copied to the PDA! Now you need to finish the reverse gear too and fix the little things! :-)

    Summary


    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 generally a PDA. And here is a lot of room for imagination! :-)

    Also popular now: