Example #1
0
        /// <summary>
        ///     Starts watching the project file for changes.
        /// </summary>
        private void Watch()
        {
            FileWatcher          = new FileWatcher(FilePath);
            FileWatcher.Changed += (s, e) =>
            {
                if (e.ChangeType is WatcherChangeTypes.Renamed)
                {
                    LoadBasicInfo(e.Name);
                }

                if (e.ChangeType is WatcherChangeTypes.Deleted)
                {
                    Dispose();
                    return;
                }

                LoadPackageReferences();
            };
            FileWatcher.EnableRaisingEvents = true;
        }
Example #2
0
 /// <summary>
 ///     Stops the <see cref="FileWatcher"/> used by this instance
 ///     before disposal.
 /// </summary>
 public void Dispose()
 {
     FileWatcher.EnableRaisingEvents = false;
     FileWatcher?.Dispose();
 }