View on GitHub

Synchro

Synchronize folders for Windows

Synchro

Synchronize folders for Windows.

The Synchro control is a Visual Studio multithreaded user control allowing folder copy and synchronization. The control is visually a progress bar that can be added to a form. After its properties have been set, it can be launched by its method SyncStart. A separate thread is run so the program interface remains reactive. When it is done, it raises an event SyncDone. It may also be used in a console application, as a single thread.

The example application uses all the control properties and shows how to get information about the control status and treat the final event. It allows synchronizing several folders at the same time and saving parameters as documents. It runs both interactively or as a command line (see Help for the syntax). It was not written to replace Robocopy (from Windows Resource Kit) as a tool typically used in a scheduled task. Synchro (the application) is, however, much easier to use by common people.

Download binaries

The installers will download .NET Framework 4.7 if needed.

Using the code

The control is in the ctlSynchro folder. The folder can be added to your project. It is currently localized in French and English.

Put the control (say ctlSynchro1) onto your form and set its properties:

Option values are:

Start the job with ctlSynchro1.SyncStart.

At any time, the following public properties are used to follow what the control is doing:

Running status may be:

During the process, it may be useful to show detailed information about what is going on. By default, the progress bar is the only thing visible. A way to do this is to use a timer. In the example, a timer is activated just after SyncStart and regularly (the frequency is chosen as an option) runs RefreshDisplay. See the code for details.

The process can be aborted by the SyncStop method (called by the Stop button on the form).

When the synchronization is done, a SyncDone event is raised by the control. A handler must be added to the form code. It may use a message box to confirm the results. See the code for the CtlSynchro1.SyncDone handler in frmDocument.vb.

Finally, the thread thrSynchro can be accessed directly for advanced purposes: you may want to suspend it or wait for it to complete (join).

Other people’s work

The Arguments class, a command line parser, is a straight Basic adaptation of the C# version available on CodeProject.

.NET Animation Control is a control to show animations, available on CodeProject.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3).