Commit Graph

257 Commits

Author SHA1 Message Date
Antony Male 7bc6a6b863 Update NuGet packages 2015-09-24 17:55:38 +01:00
Antony Male 1731f2388a Change how ViewManager is configured
Instead of taking a reference to the Bootstrapper, it takes a configuration
object which is populated by the Bootrapper. This will pave the way for
easier views-in-multiple-assemblies handling in the near future...

This also involved some work to remove registering Stylet's assembly with
the IoC container and the ViewManager. It wasn't really necessary
anyway and just slowed things down.
2015-09-24 17:48:40 +01:00
Antony Male b378027018 Introduce proper testing 2015-09-24 13:02:54 +01:00
Antony Male a703659095 Playing around with BindingProxy 2015-09-24 12:12:34 +01: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
Kai Eichinger 0089029ea8 Fixed broken tests for Systems that don't use "." as decimal separator 2015-09-22 20:53:56 +02:00
Antony Male 477d30ab4e Remove 'Task.Delay(1)' from unit tests 2015-09-22 09:18:42 +01:00
Antony Male 44cff93967 Update NuGet packages 2015-09-09 12:43:31 +01:00
Antony Male 786438dc50 Fix unit test which could crash
We were trying to close a window on a non-STA thread after the test had
finished executing, which was evil.

Threading is hard.
2015-09-09 12:43:26 +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 c1b842342b Add NUnit VS test runner NuGet package 2015-09-08 22:03:33 +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 5e412af659 Behave better if s:View.Model used on a bad container
Fixes #6
2015-06-02 16:01:12 +01:00
Antony Male 97192899eb Eliminate View.ViewManager
I think that's the last step towards supporting multiple Applications
(if anyone every actually wants to do that). It's good architecture,
anyway
2015-06-02 15:51:27 +01:00
Antony Male 8479672028 Remove dependency on Application.Current from WindowManager
This means that the WindowManager is entirely self-sufficient, and does
not rely on anything static
2015-03-30 15:02:07 +01:00
Antony Male e222af3c84 Throw if the user tries to show a Window using s:View.Model
Fixes #5
2015-03-24 09:23:35 +00:00
Antony Male 56395d8a8a Give StyletIoCBuilder a default list of assemblies
This is used by ToAllImplementations and Autobind, which means we
don't need to pass the correct assemblies into each.

Fixes #4
2015-03-17 12:27:52 +00:00
Antony Male 12e1fd344f Add InverseInstance property to BoolToVisibilityConverter 2015-02-28 18:35:09 +00:00
Antony Male 2a6350ad73 WindowManager sets window title if it's the same as the window name 2015-02-28 17:57:29 +00:00
Antony Male b11a9dabff Make the MessageBox display properly with multi-line content 2015-02-28 13:25:35 +00:00
Antony Male 48ee25ba29 Add OnStateChanged hook to Screen 2015-02-27 16:48:04 +00:00
Antony Male 21e6441a2f Re-jig ViewManager slightly to make it easier to override 2015-02-27 09:19:36 +00:00
Antony Male 51007f4a22 Add support for DependencyPropertyChangedEventHandler to EventAction 2015-02-24 15:38:50 +00:00
Antony Male 9552cbeeee Add extra 'operators after collection' test to EventAction 2015-02-24 12:40:39 +00:00
Antony Male b98226b29f Use a DependencyProperty in CommandAction/EventAction to watch ActionTarget for changes
Seems to work much better. Could probably remove quite a bit of code though
a sensible base class
2015-02-24 12:38:53 +00:00
Antony Male 52b8da8ab6 Register IContainer with the builder 2015-02-23 10:47:56 +00:00
Antony Male c024a2dfd8 Write unit tests for DependencyPropertyChangeNotifier 2015-02-22 22:06:40 +00:00
Antony Male cc4de1c852 CommandAction and EventAction no longer retain the View forever
Still needs a level of unit testing for PropertyChangeNotifier
2015-02-22 18:47:33 +00:00
Antony Male d2efcf48cb WindowManager avoids creating a new View if ViewModel already has a View attached 2015-02-22 16:47:34 +00:00
Antony Male 9ab3655c5f Improve test coverage slightly 2015-02-19 22:17:30 +00:00
Antony Male 0b088b04fd Get coverage up slightly 2015-02-09 12:48:18 +00:00
Antony Male 386b7cb035 Bring more sanity to the Bootstrapper 2015-02-09 12:39:21 +00:00
Antony Male 68a826e66f WindowManager does not set Title binding if Title has a value already 2015-01-20 10:24:12 +00:00
Antony Male 64e83c526b Set WindowStartupLocation appropriately if the user hasn't set it themselves 2015-01-20 10:18:25 +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 3785fbf2af Add test to ensure guard method is propagated 2015-01-18 22:05:59 +00:00
Antony Male b3601e6f81 Actions throw on execute of ActionTarget hasn't changed from the default 2015-01-18 22:02:06 +00:00
Antony Male 1fd12fd54b Keep ReSharper happy 2015-01-15 10:35:27 +00:00
Antony Male 3418fda5a2 Handle null/empty property name in ValidatingModelBase.ValidatePropertyAsync
In this case, we call ValidateAllProperties instead
2015-01-15 10:12:37 +00:00
Antony Male 07160aa4fe Make BootstrapperBase non-generic
Instead, it has an abstract RootViewModel property, which bootstrapper
overrides to return an instance of TRootViewModel from the container.

This means that the root ViewModel is treated a singleton by the bootstrapper,
regardless of whether it's singleton in the container
2015-01-15 10:06:00 +00:00
Antony Male 46dc485eee Add tests for new conductor Dispose behaviour 2015-01-15 09:54:05 +00:00
Antony Male 20c708ddbe Conductor optionally disposes children, and WindowConductor never does 2015-01-15 09:28:24 +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 06b1d6f632 Improve coverage 2015-01-14 15:27:57 +00:00
Antony Male 66e6f9a925 Squash 'unused' warning in unit tests 2015-01-14 15:10:59 +00:00
Antony Male c777d295af ActionExtension: Handle attached events 2015-01-14 13:39:09 +00:00
Antony Male 185c49ad3d Improve bootstapper's container disposing 2015-01-14 10:21:04 +00:00
Antony Male a3d15cd958 Unwrap TargetInvocationException for EventAction 2015-01-14 10:10:49 +00:00
Antony Male 49f851e384 Accent any (reasonable) event signature for EventAction, not just RoutedEventHandler 2015-01-14 09:59:36 +00:00
Antony Male 68a60b0aee CommandAction unwraps TargetInvocationException, preserving stack trace 2015-01-14 08:30:08 +00:00
Antony Male 0b8c22fc08 Fix Resharper warnings, and downgrade unnecessary ones to Hint 2015-01-12 10:24:26 +00:00
Antony Male 0a169e6b69 Add unit tests for BindableCollection modifications 2015-01-06 14:06:14 +00:00
Antony Male f26413f5a7 Catch corner-case with ConductorAllActive where AddRange / RemoveRange wouldn't handle added/removed items 2015-01-06 13:43:31 +00:00
Antony Male 0a541c769c Modify BindableCollection to carry out all operations on the UI thread
This means the concept of a dispatcher for it is now out of date - remove
these
2015-01-05 17:27:39 +00:00
Antony Male a9e541c1a1 Get test coverage back up 2015-01-05 13:04:29 +00:00
Antony Male 3f2d298ba2 Add more descriptive exceptions to Action error cases 2015-01-05 12:28:26 +00:00
Antony Male d62ea7a22d Allow setting of Execute.InDesignMode, for obscure unit testing ONLY 2015-01-05 12:22:00 +00:00
Antony Male b538f11453 Fix up previous commit 2015-01-05 12:21:46 +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 27b80717ea Make View name resolution a bit smarter 2015-01-04 17:05:16 +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 9765f6c3fe Fix up BindableCollection collection dispatcher, and add tests 2015-01-04 12:37:33 +00:00
Antony Male 2ed54c4acd Refactor BootstrapperBase slightly, to call OnStartup at a better point in time 2015-01-04 12:28:02 +00:00
Antony Male 6d72032f8c Allow IModelValidator to return IEnumerable<string> rather than string[]
Closes #1
2014-12-26 22:55:41 +00:00
Antony Male 4a2c345bec Have different default PropertyChanged and CollectionChanged despatchers
This is because PropertyChanged events can be async - WPF handles the
marshalling. However if CollectionChanged events are async, then the
thing listening to the event can still be iterating the collection while
the user's editing it, leading to irritating little exceptions
2014-12-05 10:59:22 +00:00
Antony Male 94d4a31b85 Be draconian about using readonly where appropriate 2014-12-04 17:06:12 +00:00
Antony Male a48eda896f Remove LambdaComparer and LambdaEqualityComparer - they have no business in an MVVM framework 2014-12-04 13:29:08 +00:00
Antony Male 509d428dc8 Move back to lots of separate arguments for ShowMessageBox - consistent with MessageBox.Show 2014-12-02 16:16:32 +00:00
Antony Male f47db1cbec Change some Bootstrapper methods to public, to avoid explicit interface implementation 2014-12-02 15:20:16 +00:00
Antony Male 743961ec68 ViewManager now accepts an IViewManagerConfig, which makes the IoC container setup neater 2014-12-02 12:52:58 +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 a421fc6922 Remove AssemblySource, relying instead on a List<Assembly> on BootstrapperBase 2014-11-30 15:19:13 +00:00
Antony Male 0f93eb1832 Remove the IoC class in its entirety - it's not needed any more, and it's a bad idea 2014-11-30 14:23:56 +00:00
Antony Male e36179098e ViewManager no longer depends on IoC 2014-11-30 14:05:08 +00:00
Antony Male 83557fa29b Move ShowMessageBox onto the IWindowManager
Having it as an extension method is good architecturally, but make it harder
to change its behaviour. This way, users can override it easily if they wish.

This also means that the WindowManager does not depend on the IoC service
locator, insteady accepting a Func<IMessageBoxViewModel>
2014-11-29 20:50:21 +00:00
Antony Male 17a3799811 Push unit test coverage up to 99.6% 2014-11-27 11:06:12 +00:00
Antony Male 44a6fa67f4 Get rid of funcs with key. Keep those without a key 2014-10-22 20:35:02 +01:00
Antony Male d6452c6517 Strip out child container stuff
I've forked the IoC container to SlimIoC, so this is going to be simplified a bit
2014-10-22 20:33:47 +01:00
Antony Male be22da44d0 Add Modules to StyletIoC 2014-09-14 12:19:48 +01:00
Antony Male 3efd74609d PerChildContainer registrations request themselves using the service type (oops) 2014-09-12 16:39:16 +01:00
Antony Male 142fb40ed9 GetAll returns empty enumerable if no registrations found 2014-09-12 16:38:57 +01:00
Antony Male 5f77356584 Disable some binding checks for factories and instances 2014-09-12 14:04:46 +01:00
Antony Male 05f509fd47 Add ability to register instances 2014-09-12 13:11:39 +01:00
Antony Male bc05f57b79 Mostly new docs 2014-09-12 10:20:15 +01:00
Antony Male 5fd04a410e Split the builder up into separate files, and move a couple of things out to extension methods 2014-09-12 09:50:23 +01:00
Antony Male f9a16df8be Revamp the fluent interface for IStyletIoCBuilder to make weak bindings better 2014-09-11 17:58:41 +01:00
Antony Male d69507b7be Split up all of the files with multiple classes, in StyletIoC 2014-09-11 13:18:33 +01:00
Antony Male 3887d38a4a Little bit of work on the unit test coverage 2014-09-11 12:46:59 +01:00
Antony Male ad8ba84ee8 First attempt at func factories. Passes almost all tests 2014-09-10 21:14:38 +01:00
Antony Male 8f180c235f Rename ChildContainerScope to PerContainerScope 2014-09-10 14:07:00 +01:00
Antony Male 0222106c4e Fix up a couple of bugs 2014-09-10 13:54:26 +01:00
Antony Male 37289a2b83 Get InChildContainerScope working - first time! 2014-09-10 13:21:19 +01:00
Antony Male 816df04f18 Add singleton disposing 2014-09-10 12:59:54 +01:00
Antony Male 3246f5db29 Add some unit tests 2014-09-10 12:49:28 +01:00
Antony Male ac58ef8bde Allow StyletIoC to accept other scopes 2014-08-27 19:15:21 +01:00
Antony Male ea2a45e17d Remove failing tests, which can't be fixed 2014-08-27 18:57:53 +01:00
Antony Male 5596ba272d Conductors will also Dispose their children if the're IDisposable 2014-08-04 17:35:16 +01:00
Antony Male 25e025f542 Fix warning in unit tests 2014-08-04 07:59:44 +01:00