/// <summary> /// Runs the task. /// </summary> private void Execute() { // Validate state. lock (Lock) { State = TaskState.Executing; } // Update native backend. UnmanagedModel.Update(); // Get results. DynamicDrawableData.ReadFrom(UnmanagedModel); // Update state. lock (Lock) { State = TaskState.Executed; // Release native if requested. if (ShouldReleaseUnmanaged) { OnReleaseUnmanaged(); } } }
/// <summary> /// Actually releases native resource(s). /// </summary> private void OnReleaseUnmanaged() { UnmanagedModel.Release(); Moc.ReleaseUnmanagedMoc(); UnmanagedModel = null; }