// Disposes all IDisposable object resources in the collection of disposable // objects. // // NOTE: Since this class exists to dispose of unmanaged resources, the // disposeManagedResources parameter is ignored. protected virtual void Dispose(bool disposeManagedResources) { // If the DisposeCollector exists, have it dispose of all COM objects. if (!IsDisposed) { DisposeCollector?.Dispose(); } // The DisposeCollector is done, and can be discarded. DisposeCollector = null; }
/// <summary> /// Disposes of object resources. /// </summary> /// <param name="disposeManagedResources">If true, managed resources should be /// disposed of in addition to unmanaged resources.</param> protected virtual void Dispose(bool disposeManagedResources) { if (disposeManagedResources) { // Dispose all ComObjects if (DisposeCollector != null) { DisposeCollector.Dispose(); } DisposeCollector = null; } }
/// <summary> /// Initializes all adapters with the specified factory. /// </summary> /// <param name="factory1">The factory1.</param> internal static void Initialize(Factory1 factory1) { if (staticCollector != null) { staticCollector.Dispose(); } staticCollector = new DisposeCollector(); defaultFactory = factory1; staticCollector.Collect(defaultFactory); int countAdapters = defaultFactory.GetAdapterCount1(); var adapterList = new List <GraphicsAdapter>(); for (int i = 0; i < countAdapters; i++) { var adapter = new GraphicsAdapter(i); staticCollector.Collect(adapter); adapterList.Add(adapter); } defaultAdapter = adapterList.Count > 0 ? adapterList[0] : null; adapters = adapterList.ToArray(); }
/// <summary> /// Initializes all adapters with the specified factory. /// </summary> /// <param name="factory1">The factory1.</param> internal static void Initialize(Factory1 factory1) { if (staticCollector != null) { staticCollector.Dispose(); } staticCollector = new DisposeCollector(); Factory = factory1; staticCollector.Collect(Factory); int countAdapters = Factory.GetAdapterCount1(); var adapters = new List <GraphicsAdapter>(); for (int i = 0; i < countAdapters; i++) { var adapter = new GraphicsAdapter(i); staticCollector.Collect(adapter); adapters.Add(adapter); } Default = adapters[0]; Adapters = adapters.ToArray(); }