Commit Graph

23 Commits

Author SHA1 Message Date
Antony Male 97567f9cc2 If a Screen is deactivated from closed, make sure it's activated again
Relates to #14
2016-11-17 12:50:08 +00:00
Antony Male 3916c825ae Deprecate Screen.State, in favour of Screen.ScreenState
It's confusing to have a property called 'State'
2016-08-26 11:44:35 +01:00
Antony Male 6cd4546a80 Deprecate CanClose
There's no nice way to make it work alongside CanCloseAsync when you're
in a conductor hierarchy. There will always be difference between how
CanClose and CanCloseAsync behave when there are children which need
to be interrogated as well, and that's confusing.
2016-08-26 11:44:34 +01:00
Antony Male 3a6e82557a Allow initial activate after a close 2016-01-06 21:22:01 +00:00
Antony Male fc7f164c53 Remove unnecessary usings in unit tests 2015-09-23 21:46:36 +01:00
Antony Male a321c6f94a Start screens in Deactivated, not Initial
This means there's no further confusion around screens being deactivated
without first being activated. This is also closer to the Caliburn.Micro
model.

The Initial state used to be useful for determining the first transition
to Activated, but that turned out not to work, see recent commits.
2015-09-23 21:45:13 +01:00
Antony Male 0bf916691f Change my mind on whether Deactivated can be entered before Active
It was getting too convoluted: if something sets the state, the Screen should
enter that state
2015-09-09 12:27:21 +01:00
Antony Male af5d2f0273 Do not allow Initial -> Deactivated transition
This caused a regression when screen states were added. Childre of
conductors are deactivated initially, then activated when the parent is
activated. This caused the Initial -> Deactivated transition. Then when
the child was activated, the 'from' state was not Initial, and so the
OnInitialActivate method was not called.

The choice to remain in Initial in this case makes sense: we don't want
to go to Deactivated (and come up with another mechanism for firing
OnInitialActivate), as that would fire OnDeactivate without there being
a corresponding OnActivate, which might mess things up.
2015-09-08 22:03:12 +01:00
Antony Male 48ee25ba29 Add OnStateChanged hook to Screen 2015-02-27 16:48:04 +00:00
Antony Male 4468740338 Implement proper state management in Screen
This takes the old flag-based state management in Screen, and replaces it
with one based on a ScreenState enum. This also gives a way for
interested parties to query the current state, and for an event which
notifies of any state transition.

This meant combining IActivate, IDeactivate, and IClose. This is a sensible
move: these interfaces were inextricably linked anyway, and separating
them had no advantages and a few disadvantages. If external parties are
using these interfaces directly, then migration is necessary, but these
are usually only used by Conductors
2015-01-19 13:08:10 +00:00
Antony Male dca24b4d5e Get unit test coverage back up 2015-01-14 20:30:51 +00:00
Antony Male b4b24441aa Rename TryClose to RequestClose, and put in IRequestClose 2015-01-14 20:25:01 +00:00
Antony Male f36de34bb2 Execute.Dispatcher can never be null, and dispatches synchronously by default
The previous behaviour was to raise an exception unless Execute.Dispatcher
had been explicitly defined. This was to detect cases where the user hadn't
set up Execute correctly, and treat them as errors rather than simply going
ahead with some possibly-unexpected behaviour.

However, since BootstrapperBase sets Execute.Dispatcher automatically, it's
highly unlikely that itwould ever not be set when it needed to be. Exceptions
are design mode and unit tests, both of which want (or can cope with) a
synchronous dispatcher.

Hence the behaviour change. Execute.Dispatcher is a synchronous dispatcher
by default, but is overridden to one that uses Application.Current.Dispatcher
by the bootstrapper if we're in a real application.
2015-01-04 21:30:34 +00:00
Antony Male 9ee23f1469 Remove Execute.TestExecuteSynchronously, in favour of a synchronous IDispatcher implementation 2015-01-04 13:10:37 +00:00
Antony Male 94d4a31b85 Be draconian about using readonly where appropriate 2014-12-04 17:06:12 +00:00
Antony Male 77c6d347a5 Add overridable CanClose() method to Screen - meaning they don't have to use Tasks 2014-12-02 12:13:26 +00:00
Antony Male 3e4e09a598 Prevent double closure of a Screen 2014-07-24 09:45:20 +01:00
Antony Male c18563267f Remove the WeakEventManager, as it was too complex
It's replaced with a BindWeak extension method, similar to the existing
Bind. This rejects delegates with compiler-generated targets
2014-06-22 16:41:52 +01:00
Antony Male d56f3b5c26 Rename IValidatorAdapter back to IModelValidator, as the latter is more description of its end use 2014-05-08 13:52:53 +01:00
Antony Male d648b264d1 Improve unit test code coverage further 2014-05-07 08:37:48 +01:00
Antony Male 4711e3fefa Fix tests involving changes to Execute 2014-04-24 12:58:09 +01:00
Antony Male 3b287e55e3 Finish off the screen unit tests 2014-04-03 12:36:35 +01:00
Antony Male 20509d9c77 Start writing unit tests for Screen 2014-04-02 13:25:27 +01:00