/// <summary> /// See <see cref="IIsSelected"/>. /// </summary> public virtual void SetIsSelected(bool isSelected, SelectionSource source, SelectionOrigin origin) { // if selection changes if (IsSelected != isSelected) { // Update IsSelected IsSelected = isSelected; // if the origin of the selecion change is the biz tier (this tier), then propagate it up to // the presenter. Otherwise just change the IsSelected property. if (origin == SelectionOrigin.Business) { // fire the event signaling the IsSelected value has changed OnSelectionChanged(new SelectionEventArgs(IsSelected, source, origin)); } } }
public void SetIsSelected_Does_Not_Fire_SelectionChangedEvent_If_The_Selection_Origin_Is_Not_Business(SelectionOrigin origin) { //Arrange var _pipe = new NeutralPipe(); SelectionSource source = SelectionSource.Code; HelperForPipes helper = new HelperForPipes(); _pipe.SelectionChanged += new SelectionEventHandler<IPipe, SelectionEventArgs>(helper.SelectionChanged_DummyHandler); _pipe.SetIsSelected(true, source, origin); Assert.True(_pipe.IsSelected); Assert.Equal(0, helper.SelectionChanged_TimesCalled); }
public void SetIsSelected(bool isSelected, SelectionSource source, SelectionOrigin origin) { throw new NotImplementedException(); }
public SelectionEventArgs(bool isSelected, SelectionSource source, SelectionOrigin origin) { IsSelected = isSelected; Source = source; Origin = origin; }
internal void SelectionChangedFromView(bool isSelected, SelectionSource source, SelectionOrigin origin) { // the change originated at the UI level and has already been applied at the UI level. if (Pipe.IsSelected != isSelected) { // propagate the selection change to the model if the Source is a UI source: Mouse, Keyboard, UserInput if (source == SelectionSource.Mouse) { Pipe.SetIsSelected(isSelected, source, origin); VerifySelectionStates(View, Pipe); } else if (source == SelectionSource.KeyBoard) { Pipe.SetIsSelected(isSelected, source, origin); VerifySelectionStates(View, Pipe); } else if (source == SelectionSource.UserInput) { Pipe.SetIsSelected(isSelected, source, origin); VerifySelectionStates(View, Pipe); } } }
public void SetIsSelected(bool isSelected, SelectionSource source, SelectionOrigin origin) { throw new Exception("The method or operation is not implemented."); }