示例#1
0
        protected override void Destroy()
        {
            // Mark effect system as destroyed (so that async effect compilation are ignored)
            lock (cachedEffects)
            {
                // Clear effects
                foreach (var effect in cachedEffects)
                {
                    effect.Value.ReleaseInternal();
                }
                cachedEffects.Clear();

                // Mark as not initialized anymore
                isInitialized = false;
            }

#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            if (directoryWatcher != null)
            {
                directoryWatcher.Modified -= FileModifiedEvent;
                directoryWatcher.Dispose();
                directoryWatcher = null;
            }
#endif

            base.Destroy();
        }
 void OnDestroy()
 {
     UnsetListeners();
     BuildWatcher.Dispose();
     PartWatcher.Dispose();
     TuneWatcher.Dispose();
     CartridgeWatcher.Dispose();
 }
 public void TearDown()
 {
     _watcher.Dispose();
     File.Delete(_file);
     File.Delete(_localConfig);
     if (Directory.Exists(_directory))
     {
         Directory.Delete(_directory);
     }
 }
示例#4
0
 protected void Dispose(bool disposing)
 {
     if (IsDisposed)
     {
         return;
     }
     if (disposing)
     {
         DirectoryWatcher.Dispose();
     }
     IsDisposed = true;
 }
示例#5
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             DirectoryWatcher.Dispose();
             Locker.Dispose();
             Context.Dispose();
         }
     }
     _disposed = true;
 }
示例#6
0
 /// <summary>
 /// Invoked <see cref="IDisposable.Dispose"/>.
 /// </summary>
 /// <param name="isDisposing">False if invoked from a finalizer.</param>
 protected virtual void Dispose(bool isDisposing)
 {
     if (!isDisposing)
     {
         return;
     }
     CompositionRequested      = null;
     DirectoryWatcher.Changed -= HandleDirectoryWatcherChanged;
     DirectoryWatcher.Dispose();
     lock (ComposedAssemblies) {
         ComposedAssemblies.Clear();
     }
 }
示例#7
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (isDisposed)
            {
                return;
            }

            isDisposing = true;
            tokenSourceForImportHash.Cancel();
            EnableTracking = false; // Will terminate the thread if running

            DirectoryWatcher?.Dispose();
            isDisposed = true;
        }
示例#8
0
        static void Main(string[] args)
        {
            IDirectoryWatcher watcher = new DirectoryWatcher(
                new FileSystemWatcher(ConfigurationManager.AppSettings["sourceFolder"],
                                      ConfigurationManager.AppSettings["searchPattern"]));
            ITaskManager manager = new TaskManager(2);

            manager.RegisterWatcherEventHandlers(watcher);
            watcher.Start();
            Console.ReadKey();
            watcher.Stop();
            manager.Dispose();
            watcher.Dispose();
        }
示例#9
0
 public void Dispose()
 {
     if (_subscription != null)
     {
         _subscription.Dispose();
     }
     if (_watcher != null)
     {
         _watcher.Dispose();
     }
     if (_container != null)
     {
         _container.Dispose();
     }
 }
        public AcSettingsDamageDisplayer()
        {
            _directory = Path.Combine(AcRootDirectory.Instance.RequireValue, "content", "texture", "damage");

            InitializeComponent();
            DataContext = new ViewModel();
            this.AddWidthCondition(1080).Add(v => Grid.Columns = v ? 2 : 1);

            AcSettingsHolder.DamageDisplayer.SubscribeWeak(this, OnDamageDisplayerPropertyChanged);
            UpdatePosition();

            AcSettingsHolder.Video.SubscribeWeak(this, OnVideoPropertyChanged);
            UpdateResolution();

            var watcher = new DirectoryWatcher(_directory, "*.png");

            watcher.Update += OnWatcherUpdate;
            this.OnActualUnload(() => watcher.Dispose());
        }
示例#11
0
 public void Dispose()
 {
     _watcher.Dispose();
 }