Exemplo n.º 1
0
        void PopupIntellisensePresenter_PropertyChanged(IHexPopupIntellisensePresenter popupPresenter, string propertyName)
        {
            if (wpfHexView.IsClosed)
            {
                UnregisterPopupIntellisensePresenterEvents(popupPresenter);
                return;
            }
            var sessionState = TryGetSessionState(popupPresenter);

            Debug.Assert(sessionState != null);
            if (sessionState == null)
            {
                return;
            }
            if (propertyName == nameof(popupPresenter.PresentationSpan) || propertyName == nameof(popupPresenter.PopupStyles))
            {
                var presentationSpan = popupPresenter.PresentationSpan;
                if (presentationSpan.IsDefault || sessionState.SpaceReservationAgent == null)
                {
                    PresenterUpdated(popupPresenter.Session);
                }
                else
                {
                    sessionState.SpaceReservationManager.UpdatePopupAgent(sessionState.SpaceReservationAgent, presentationSpan, popupPresenter.PopupStyles);
                }
            }
            else if (propertyName == nameof(popupPresenter.SurfaceElement))
            {
                PresenterUpdated(popupPresenter.Session);
            }
        }
Exemplo n.º 2
0
 void UnregisterPopupIntellisensePresenterEvents(IHexPopupIntellisensePresenter popupPresenter)
 {
     if (popupPresenter != null)
     {
         popupPresenter.PopupStylesChanged      -= PopupIntellisensePresenter_PopupStylesChanged;
         popupPresenter.PresentationSpanChanged -= PopupIntellisensePresenter_PresentationSpanChanged;
         popupPresenter.SurfaceElementChanged   -= PopupIntellisensePresenter_SurfaceElementChanged;
     }
 }
Exemplo n.º 3
0
 SessionState TryGetSessionState(IHexPopupIntellisensePresenter popupPresenter)
 {
     foreach (var sessionState in sessionStates)
     {
         if (sessionState.PopupIntellisensePresenter == popupPresenter)
         {
             return(sessionState);
         }
     }
     return(null);
 }
		void PopupIntellisensePresenter_PropertyChanged(IHexPopupIntellisensePresenter popupPresenter, string propertyName) {
			if (wpfHexView.IsClosed) {
				UnregisterPopupIntellisensePresenterEvents(popupPresenter);
				return;
			}
			var sessionState = TryGetSessionState(popupPresenter);
			Debug.Assert(sessionState != null);
			if (sessionState == null)
				return;
			if (propertyName == nameof(popupPresenter.PresentationSpan) || propertyName == nameof(popupPresenter.PopupStyles)) {
				var presentationSpan = popupPresenter.PresentationSpan;
				if (presentationSpan.IsDefault || sessionState.SpaceReservationAgent == null)
					PresenterUpdated(popupPresenter.Session);
				else
					sessionState.SpaceReservationManager.UpdatePopupAgent(sessionState.SpaceReservationAgent, presentationSpan, popupPresenter.PopupStyles);
			}
			else if (propertyName == nameof(popupPresenter.SurfaceElement))
				PresenterUpdated(popupPresenter.Session);
		}
		void UnregisterPopupIntellisensePresenterEvents(IHexPopupIntellisensePresenter popupPresenter) {
			if (popupPresenter != null) {
				popupPresenter.PopupStylesChanged -= PopupIntellisensePresenter_PopupStylesChanged;
				popupPresenter.PresentationSpanChanged -= PopupIntellisensePresenter_PresentationSpanChanged;
				popupPresenter.SurfaceElementChanged -= PopupIntellisensePresenter_SurfaceElementChanged;
			}
		}
		SessionState TryGetSessionState(IHexPopupIntellisensePresenter popupPresenter) {
			foreach (var sessionState in sessionStates) {
				if (sessionState.PopupIntellisensePresenter == popupPresenter)
					return sessionState;
			}
			return null;
		}