Beispiel #1
0
 /// <summary>
 /// Triggers the StatusChanged event.
 /// </summary>
 internal virtual void OnStatusChanged(FxStatusChangeEventArgs ea)
 {
     if (StatusChanged != null)
         StatusChanged(this, ea);
 }
Beispiel #2
0
        /// <summary>
        /// Triggers the StatusChanged event.
        /// </summary>
        internal virtual void OnStatusChanged(FxStatusChangeEventArgs ea)
        {
            //  if (StatusChanged != null)
            //      StatusChanged(this, ea);

            if (StatusChanged != null)
            {
                if (IsAsynch)
                {
                    if (AsynchOp != null)
                    {
                        AsynchOp.Post
                        (
                            delegate(object arg) { StatusChanged(this, (FxStatusChangeEventArgs)arg); },
                            ea
                        );
                    }
                }
                else
                {
                    StatusChanged(this, ea);
                }
            }
        }
Beispiel #3
0
 public void StatusChanged_DummyHandler(ICompoundFx sender, FxStatusChangeEventArgs ea)
 {
     StatusChanged_TimesCalled++;
     RecievedEventArgs = ea;
 }
 internal override void _myFx_StatusChanged(ISimpleFx sender, FxStatusChangeEventArgs ea)
 {
     _myFx_StatusChanged_TimesCalled++;
 }
        public void _Fx_StatusChanged_EventHandler_Calls_View_UpdateFxStatus()
        {
            //Arrange
            var mockView = new Mock<IDataPropertiesView>();
            var mock2ndView = mockView.As<ISecondaryFxView>();
            var mockFx = new Mock<IDataPropertiesElementFx>();
            FxStatusChangeEventArgs ea = new FxStatusChangeEventArgs(FxStatus.UnInitialized, FxStatus.Validating);

            _presenter = new DataPropertiesFxPresenter(mockFx.Object, mockView.Object);

            //Act
            _presenter._Fx_StatusChanged(mockFx.Object, ea);

            mock2ndView.Verify(m => m.UpdateFxStatus(FxStatus.Validating), Times.Once);
        }
        public void DataPropertiesFx_StatusChanged_Event_Subscribed_To_When_Fx_Object_Is_Set()
        {
            //Arrange
            var mockView = new Mock<IDataPropertiesView>();
            var mock2ndView = mockView.As<ISecondaryFxView>();
            var mockFx = new Mock<IDataPropertiesElementFx>();
            var args = new FxStatusChangeEventArgs(FxStatus.Error, FxStatus.UnInitialized);

            mock2ndView.Setup(m => m.UpdateFxStatus(FxStatus.UnInitialized)).Verifiable();

            //Act
            _presenter = new DataPropertiesFxPresenter(null, null);
            _presenter.DataPropertiesFx = mockFx.Object;
            _presenter.DataPropertiesView = mockView.Object;

            //Assert
            mockFx.Raise(m => m.StatusChanged += null, args);
            mock2ndView.Verify();
        }
Beispiel #7
0
 public void StatusChanged_DummyHandler(ISimpleFx sender, FxStatusChangeEventArgs ea)
 {
     StatusChanged_TimesCalled++;
     RecievedEventArgs = ea;
     RecievedSender = sender;
 }
Beispiel #8
0
 internal void _myFx_StatusChanged(ICompoundFx sender, FxStatusChangeEventArgs ea)
 {
     if (sender != null)
     {
         switch (ea.NewStatus)
         {
             case FxStatus.UnInitialized:
                 SetStatus(ElementStatus.Incomplete, ea.ChangeDriver, ea.Message);
                 break;
             case FxStatus.Validating:
                 SetStatus(ElementStatus.Validating, ea.ChangeDriver, ea.Message);
                 break;
             case FxStatus.Executing:
                 SetStatus(ElementStatus.Executing, ea.ChangeDriver, ea.Message);
                 break;
             case FxStatus.Complete:
                 SetStatus(ElementStatus.Complete, ea.ChangeDriver, ea.Message);
                 #region Log complete
                 _logger.Debug(string.Format("_myFx_StatusChanged() NewStatus:{0}, Message:{1}", ea.NewStatus, ea.Message));
                 #endregion
                 break;
             case FxStatus.Error:
                 SetStatus(ElementStatus.Error, ea.ChangeDriver, null);
                 #region Log error
                 _logger.Error(string.Format("_myFx_StatusChanged() NewStatus:{0}, Message:{1}", ea.NewStatus, ea.Message));
                 #endregion
                 break;
         }
     }
 }
 internal void _Fx_StatusChanged(ICompoundFx sender, FxStatusChangeEventArgs ea)
 {
     if (sender != null)
     {
         View.UpdateFxStatus(ea.NewStatus);
     }
 }
        public void NetworkPropertiesFx_StatusChanged_Event_UnSubscribed_From_When_Fx_Object_Is_Set_To_Null_From_Non_Null()
        {
            //Arrange
            var mockView = new Mock<INetworkPropertiesView>();
            var mock2ndView = mockView.As<ISecondaryFxView>();
            var mockFx = new Mock<INetworkPropertiesElementFx>();
            var args = new FxStatusChangeEventArgs(FxStatus.Error, FxStatus.UnInitialized);

            //Act
            _presenter = new NetworkPropertiesFxPresenter(null, null);
            _presenter.NetworkPropertiesFx = mockFx.Object;
            _presenter.NetworkPropertiesFx = null;

            //Assert
            mockFx.Raise(m => m.StatusChanged += null, args);
            mock2ndView.Verify(m => m.UpdateFxStatus(FxStatus.UnInitialized), Times.Never);
        }
Beispiel #11
0
 /// <summary>
 /// Handles StatusChanged events from the underlying Fx object and changes the
 /// element status accordingly.
 /// </summary>
 internal virtual void _myFx_StatusChanged(ISimpleFx sender, FxStatusChangeEventArgs ea)
 {
     if (sender != null)
     {
         switch (ea.NewStatus)
         {
             case FxStatus.UnInitialized:
                 SetStatus(ElementStatus.Incomplete, ea.ChangeDriver, null);
                 break;
             case FxStatus.Validating:
                 SetStatus(ElementStatus.Executing, ea.ChangeDriver, null);
                 break;
             case FxStatus.Executing:
                 SetStatus(ElementStatus.Executing, ea.ChangeDriver, null);
                 break;
             case FxStatus.Complete:
                 SetStatus(ElementStatus.Complete, ea.ChangeDriver, null);
                 break;
             case FxStatus.Error:
                 SetStatus(ElementStatus.Error, ea.ChangeDriver, null);
                 break;
         }
     }
 }