void view_Closed(object sender, EventArgs e) { var view = sender as IWpfTextView; view.GotAggregateFocus -= view_GotAggregateFocus; System.Diagnostics.Debug.Print("document close"); GCHelper.Collect(); }
/// <summary> /// Обновить кэш аттачей. /// </summary> public void Refresh() { lock (Locker) { loadedAttaches = false; allAttachments.Clear(); predicatedAttachments.Clear(); GCHelper.Collect(); LoadAttaches(); } }
protected void DestroyServiceHost() { CheckDisposed(); lock (_serviceLock) { if (!_isServiceLoaded) { return; } var serviceHost = Interlocked.Exchange(ref _serviceHost, null); try { if (serviceHost != null) { UnhookServiceHostEventHandlers(serviceHost); serviceHost.StopService(); } } catch (Exception e) { GameLog.Server.General.ErrorFormat("Exception occurred while stopping WCF service: {0}", e.Message); } finally { _isServiceLoaded = false; } var serviceDomain = Interlocked.CompareExchange(ref _serviceDomain, null, null); if (serviceDomain == null) { return; } try { serviceDomain.UnhandledException -= OnServiceDomainUnhandledException; GCHelper.Collect(); AppDomain.Unload(serviceDomain); } catch (Exception e) { GameLog.Server.General.ErrorFormat("Exception occurred while unloading WCF service AppDomain: {0}", e.Message); } } }
private IGameController ResolveGameController() { GCHelper.Collect(); var gameController = _container.Resolve <IGameController>(); if (gameController == null) { throw new SupremacyException("A game controller could not be created."); } if (Interlocked.CompareExchange(ref _gameController, gameController, null) != null) { return(_gameController); } gameController.Terminated += OnGameControllerTerminated; return(gameController); }