Esempio n. 1
0
 private static void CheckAccess()
 {
     if (!WindowsHelper.CheckAccess())
     {
         throw new InvalidOperationException("View model properties and methods must be accessed on UI thread.");
     }
 }
Esempio n. 2
0
        void IActivatable.OnDeactivate(bool close)
        {
            // Note: The method is an explicit interface implementation because it should never be
            // called directly. It should only be called by an IConductor through the IActivatable
            // interface.
            Debug.Assert(WindowsHelper.CheckAccess(), "Screen conduction not called on UI thread.");
            Debug.Assert(IsOpen || !IsActive, "Invalid state: An item can only be active when it is open.");
            if (!IsOpen)
            {
                return;
            }

            if (!IsActive && !close)
            {
                return;
            }

            IsActive = false;
            if (close)
            {
                IsOpen = false;
            }

            OnDeactivated(new DeactivationEventArgs(close));
        }
Esempio n. 3
0
        /// <inheritdoc/>
        public void Show(StatusViewModel viewModel)
        {
            if (!WindowsHelper.CheckAccess())
            {
                throw new InvalidOperationException("Cross-thread operation not valid: The method needs to be invoked on the UI thread.");
            }

            _statusConductor.ActivateItem(viewModel);
        }
Esempio n. 4
0
        void IActivatable.OnActivate()
        {
            // Note: The method is an explicit interface implementation because it should never be
            // called directly. It should only be called by an IConductor through the IActivatable
            // interface.
            Debug.Assert(WindowsHelper.CheckAccess(), "Screen conduction not called on UI thread.");
            Debug.Assert(IsOpen || !IsActive, "Invalid state: An item can only be active when it is open.");
            if (IsActive)
            {
                return;
            }

            bool opened = !IsOpen;

            IsOpen   = true;
            IsActive = true;
            OnActivated(new ActivationEventArgs(opened));
        }