コード例 #1
0
        protected virtual void UnLoad()
        {
            foreach (var kvp in _mementoHashtable)
            {
                if (kvp.Key.Contains(COLLECTION_INDICATOR))
                {
                    _mementoService.UnregisterCollection((INotifyCollectionChanged)kvp.Value);
                }
                else
                {
                    _mementoService.UnregisterObject((INotifyPropertyChanged)kvp.Value);
                }
            }

            _mementoHashtable.Clear();
        }
コード例 #2
0
        /// <summary>
        /// Called when the view model has just been closed.
        /// <para/>
        /// This method also raises the <see cref="E:Catel.MVVM.ViewModelBase.Closed"/> event.
        /// </summary>
        /// <param name="result">The result to pass to the view. This will, for example, be used as <c>DialogResult</c>.</param>
        protected override void OnClosed(bool?result)
        {
            _mementoService.UnregisterObject(this);

            base.OnClosed(result);
        }
コード例 #3
0
        /// <summary>
        /// Called when the view model has just been closed.
        /// <para/>
        /// This method also raises the <see cref="E:Catel.MVVM.ViewModelBase.ClosedAsync"/> event.
        /// </summary>
        /// <param name="result">The result to pass to the view. This will, for example, be used as <c>DialogResult</c>.</param>
        protected override async Task OnClosedAsync(bool?result)
        {
            _mementoService.UnregisterObject(this);

            await base.OnClosedAsync(result);
        }