aegif / CmisSync

Synchronize content between a CMIS repository and your desktop. Like Dropbox for Enterprise Content Management!
http://CmisSync.com
164 stars 123 forks source link

How to use SharpShell with CmisSync to behave like Dropbox? #648

Open ahmedtolba1984 opened 8 years ago

ahmedtolba1984 commented 8 years ago

I want to know how to integrate SharpShell with CmisSync; i want the Dropbox behaviour

lelmarir commented 8 years ago

I've done this in my fork (here on github you can see the first version, but it is only a proof of concept and it still lack the Dropbox like icons). I've followed this guide: http://www.codeproject.com/Articles/545781/NET-Shell-Extensions-Shell-Icon-Overlay-Handlers using WCF for comunication but i can't release the code because it is part of a internal product

cattura

hope this helps

antton commented 8 years ago

Nice!

ahmedtolba1984 commented 8 years ago

Thanks; I want only some hints not the code I mean, for example:- if you support multiple states such as syncing, synced, how you will change the icon dynamically according to states

lelmarir commented 8 years ago

You can't....not with only one shell extension at least. The icon is set in "GetOverlayIcon" and can't be changed.

I don't support multiple states, i only mark the file as synced or not right now. You could also mark "to be synced" files, but i would suggest to not mark syncing ones, since the sync process is generally fast and this state would not last long. Besides the icon overlay on the file will not update in real time or in close intervals, so you could end up never catching the syncing or with a file marked as syncing still after it has completed.

As you can see in the tutorial, you must create a "SharpIconOverlayHandler" and in the method "CanShowOverlay" tell if the icon overlay should be shown or not. For this you should access the sync db (that keep track of all synced files) but this is already opened by the sync process. So, i've created a WCF service (you could use any inter-process communication) to let the "CanShowOverlay" method ask to the synchronizer (that can access the db) if a specific file is synchronized.

If you want to show multiple icons you would have to repeat this multiple times creating one dll (SharpIconOverlayHandler) for each icon overlay and register them all.

A tip: windows support only a small number of such extension dll, so, if in your system you already have some (Google Drive, Dropbox, Tortoise Git) you should disable some to let the new one be used. See: http://stackoverflow.com/questions/4411336/shelliconoverlayidentifiers-why-so-few An usefull tool: http://www.nirsoft.net/utils/shexview.html

let me know if you need some other help