public void Start(IDataFeedContext dataFeedContext, IPanelCommunicator panelCommunicators)
        {
            var bookmarkLocation = dataFeedContext.GetSettings()["ChromeBookmarkLocation"].SettingValue;

            bookmarkLocation = Environment.ExpandEnvironmentVariables(bookmarkLocation);
            SendBookmarks(bookmarkLocation, panelCommunicators);
            _watcher = new FileSystemWatcher
            {
                Path         = Path.GetDirectoryName(bookmarkLocation),
                Filter       = Path.GetFileName(bookmarkLocation),
                NotifyFilter = NotifyFilters.LastAccess |
                               NotifyFilters.LastWrite |
                               NotifyFilters.FileName |
                               NotifyFilters.DirectoryName
            };

            _watcher.Changed += (o, e) => SendBookmarks(bookmarkLocation, panelCommunicators);
            _watcher.Created += (o, e) => SendBookmarks(bookmarkLocation, panelCommunicators);
            _watcher.Renamed += (o, e) => SendBookmarks(bookmarkLocation, panelCommunicators);

            _watcher.EnableRaisingEvents = true;
        }
Example #2
0
 /// <summary>
 /// Called when data feed should start providing data. An IPanelCommunicator is provided in order to send that data
 /// to the panel. This method will be called in its own thread, so feel free to add loops and sleeps, as it will not
 /// affect the running of the Desktop Client.
 /// </summary>
 /// <param name="dataFeedContext">The context of this datafeed. Provides some useful information that may be needed for your datafeed to run</param>
 /// <param name="panelCommunicator">A communicator used to send messages to the panel.</param>
 public abstract void Start(IDataFeedContext dataFeedContext, IPanelCommunicator panelCommunicators);