Catel.MVVM.Providers.LogicBase.IsCurrentDataContext C# (CSharp) Method

IsCurrentDataContext() protected method

Gets a value indicating whether the specified arguments represent the current data context.
protected IsCurrentDataContext ( DataContextChangedEventArgs e ) : bool
e DataContextChangedEventArgs
return bool
        protected bool IsCurrentDataContext(DataContextChangedEventArgs e)
        {
            if (e.AreEqual)
            {
                return true;
            }

            // CTL-891 Additional check for data context change
            var lastKnownDataContext = LastKnownDataContext;
            if (lastKnownDataContext != null && lastKnownDataContext.IsAlive)
            {
                if (ReferenceEquals(lastKnownDataContext.Target, e.NewContext))
                {
                    return true;
                }
            }

            return false;
        }