private void FinalizeRelease()
        {
            bool justReleased = false;

            lock (_lockObj)
            {
                if (_refCount == 0)
                {
                    justReleased = true;
                    _released    = true;
                }
            }

            if (justReleased)
            {
                UnregisterForEvents();
                if (InternalReleased == null)
                {
                    // For more information about using Multiple Views, see https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/features/multiple-views.md
                    throw new InvalidOperationException("ExceptionViewLifeTimeControlMissingReleasedSubscription".GetLocalized());
                }

                InternalReleased.Invoke(this, null);
            }
        }
Esempio n. 2
0
        private void FinalizeRelease()
        {
            bool justReleased = false;

            lock (_lockObj)
            {
                if (_refCount == 0)
                {
                    justReleased = true;
                    _released    = true;
                }
            }

            if (justReleased)
            {
                UnregisterForEvents();
                if (InternalReleased == null)
                {
                    // For more information about using Multiple Views, see https://github.com/Microsoft/WindowsTemplateStudio/blob/release/docs/UWP/features/multiple-views.md
                    throw new InvalidOperationException("All pages opened in a new window must subscribe to the Released Event.");
                }

                InternalReleased.Invoke(this, null);
            }
        }
Esempio n. 3
0
        private void FinalizeRelease()
        {
            bool justReleased = false;

            lock (this)
            {
                if (_refCount == 0)
                {
                    justReleased = true;
                    _released    = true;
                }
            }

            if (justReleased)
            {
                UnregisterForEvents();
                InternalReleased?.Invoke(this, null);
            }
        }
        // Called when a view has been "consolidated" (no longer accessible to the user)
        // and no other view is trying to interact with it. This should only be closed after the reference
        // count goes to 0 (including being consolidated). At the end of this, the view should be closed manually.
        private void FinalizeRelease()
        {
            bool justReleased = false;

            lock (syncObject)
            {
                if (refCount == 0)
                {
                    justReleased = true;
                    released     = true;
                }
            }

            // This assumes that released will never be made false after it
            // it has been set to true
            if (justReleased)
            {
                UnregisterForEvents();
                InternalReleased?.Invoke(this, new EventArgs());
                WindowControlsMap.TryRemove(Id, out var removed);
            }
        }
        // Called when a view has been "consolidated" (no longer accessible to the user)
        // and no other view is trying to interact with it. This should only be closed after the reference
        // count goes to 0 (including being consolidated). At the end of this, the view is closed.
        private void FinalizeRelease()
        {
            bool justReleased = false;

            lock (this)
            {
                if (refCount == 0)
                {
                    justReleased = true;
                    released     = true;
                }
            }

            // This assumes that released will never be made false after it
            // it has been set to true
            if (justReleased)
            {
                UnregisterForEvents();

                InternalReleased?.Invoke(this, null);
            }
        }