Commit Graph

257 Commits

Author SHA1 Message Date
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
Antony Male 9532f3eca1 Change capitalisation of ValidationModeBase.AutoValidate 2014-08-02 17:54:15 +01:00
Antony Male db08349c02 Add unit tests for ApplicationLoader, and fix Bootstrapper tests 2014-08-02 17:50:18 +01:00
Antony Male bc9362eeee Change DebugLogger to TraceLogger, which logs even in Release builds 2014-07-30 15:22:29 +01:00
Antony Male 14f1c4a4d5 Rename StyletLogManager -> LogManager and IStyletLogger -> ILogger, but put in Logger namespace 2014-07-27 18:21:14 +01:00
Antony Male 7952d15e83 Rename ILogger and LogManager to not conflict with NLog 2014-07-26 18:17:49 +01:00
Antony Male 642a038488 Add Execute.PostToUIThreadAsync 2014-07-26 11:51:46 +01:00
Antony Male 4ed753e89e Bring unit test code coverage back to par 2014-07-25 13:11:51 +01:00
Antony Male 60aca05dd2 Simplify IViewManager, by aligning it to what someone actually wants the ViewManager to do 2014-07-24 16:39:26 +01:00
Antony Male 3e4e09a598 Prevent double closure of a Screen 2014-07-24 09:45:20 +01:00
Antony Male b254f92fe8 Add OnStart hook for when Stylet starts up, and rename the existing hooks to avoid confusion 2014-07-23 13:24:12 +01:00
Antony Male 092cf02599 Fix bug in BoolToVisibilityConverter, causing exception with some argument types 2014-07-21 11:20:29 +01:00
Antony Male 58d5a6e55e Change the handler type for Bind and BindWeak, to include the sender and property name 2014-06-22 17:22:24 +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 6f63c5cc2d Add channels to the EventAggregator 2014-06-17 17:44:35 +01:00
Antony Male ad4aa28b64 Extend BoolToVisibilityConverter to handle more types 2014-06-07 13:50:38 +01:00
Antony Male 17d280a898 Rename LambdaComparer to LambdaEqualityComparer, and create actual LambdaComparer 2014-06-06 13:14:20 +01:00
Antony Male eeeb761e0d ViewManager methods should have been protected... 2014-05-26 19:13:08 +01:00
Antony Male a914d58668 Refactor the ViewManager, splitting out a few methods to make it easier to customize 2014-05-26 18:54:55 +01:00
Antony Male 6d72e2d525 MessageBox supports MessageBoxOptions 2014-05-23 13:03:21 +01:00
Antony Male 0ba6061e59 Move BootstrapperBase's autoLaunch to Start 2014-05-21 12:22:13 +01:00
Antony Male ac7c504d94 Write tests for the updated BoolToVisibilityConverter 2014-05-21 12:04:19 +01:00
Antony Male a2aa1e43b7 Allow MessageBox users to override text on individual buttons on a per-case basis 2014-05-21 11:48:48 +01:00
Antony Male 99f79d1e29 Add more unit tests for MessageBox, and convert to use more system types 2014-05-20 21:24:29 +01:00
Antony Male 2093d9c3cb Start writing unit tests for the MessageBox stuff 2014-05-20 21:24:28 +01:00
Antony Male 5823437a28 Support design-time application running 2014-05-16 09:46:16 +01:00
Antony Male 6b2c8d9583 Fix WindowManager tests 2014-05-13 17:57:15 +01:00
Antony Male bac99ab647 Refactor ValidatingModelBase slightly to support easier overriding 2014-05-13 17:56:54 +01:00
Antony Male b89c61a91e Move View into the Xaml namespace, so it's accessible through https://github.com/canton7/Stylet 2014-05-11 20:02:21 +01:00
Antony Male 0b75df35ef Rename Execute methods 2014-05-11 19:59:23 +01:00
Antony Male fc4a7fb61c Push coverage up to 99.7% 2014-05-10 20:11:02 +01:00
Antony Male a39bcfbadb Use Dispatcher instead of SynchronizationContext for synchronization.
It looks like the SynchronizationContext can now change on the same thread
(see http://msdn.microsoft.com/en-us/library/system.windows.basecompatibilitypreferences.reusedispatchersynchronizationcontextinstance%28v=vs.110%29.aspx)
meaning that we can no longer do a reference comparison between SynchronizationContext.Current
and the captured SynchronizationConext to check whether a dispatch is required.
It turns out we shouldn't have been doing this anyway.... So switch to using a Dispatcher,
which does support this stuff.

Additionally, Execute now uses an IDispatcher, which means the implementation can be switched
again in the future. It also makes unit testing easier....
2014-05-09 15:46:03 +01:00
Antony Male 4a527c75d6 Push code coverage up to 98.7%, including integration tests 2014-05-09 14:40:40 +01:00
Antony Male a96ec2a6e4 Add tests for CommandAction and EventAction 2014-05-09 13:59:38 +01:00
Antony Male 55b23a61ed Couple lines more coverage 2014-05-08 17:44:04 +01:00
Antony Male 1e76531e36 Add test code coverage for ValidatingModelBase 2014-05-08 17:37:33 +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 fe13725062 More unit tests, more code coverage 2014-05-07 17:48:00 +01:00
Antony Male fe377e3955 Provide a decent error if unbound generic type used as an abstract factory, and fill in more coverage 2014-05-07 16:22:51 +01:00
Antony Male 6d3a222249 Fix StyletIoC bug w/ singleton unbound generics, and improve coverage further 2014-05-07 16:11:15 +01:00
Antony Male 43fe090fa9 Add more unit tests 2014-05-07 13:20:36 +01:00
Antony Male d648b264d1 Improve unit test code coverage further 2014-05-07 08:37:48 +01:00
Antony Male 5cc0ee96d2 Fix some rakefile issues 2014-05-06 18:30:04 +01:00
Antony Male 4fa4133248 Improve unit test code coverage some more 2014-05-06 17:42:55 +01:00
Antony Male 3ecb0c38c8 Improve test coverage slightly 2014-05-06 13:11:51 +01:00
Antony Male 48e7de53a6 Fix some namespacing issues 2014-05-06 12:38:38 +01:00
Antony Male 77f1804724 Improve some error messages given by StyletIoC 2014-05-03 10:39:41 +01:00
Antony Male 44f1631a27 Fix bugs when using the StyletIoC syntax 'Bind(typeof(IInterface<>)).ToAllImplementations()' 2014-05-01 17:44:22 +01:00
Antony Male 4711e3fefa Fix tests involving changes to Execute 2014-04-24 12:58:09 +01:00
Antony Male 9e96e8c052 Rename Conductor<T>.Collections to Conductor<T>.Collection, and move Conductor<T>.Collections.Nagivation to Conductor<T>.StackNavigation 2014-04-24 08:11:21 +01:00
Antony Male f7210b8aa9 Rename IPropertyChangedBinding -> IEventBinding 2014-04-23 17:45:26 +01:00
Antony Male afe8b9c20f Remove tests which were no longer relevant, since Bind/BindWeak refactor 2014-04-23 17:44:55 +01:00
Antony Male c8e5ef3715 We can't use NotifyCollectionChangedAction.Add or Remove with a list of items, apparently 2014-04-23 17:41:20 +01:00
Antony Male 6eb9c6dbef Replace BindWeak with a WeakEventManager, and let Screen have an instance 2014-04-17 10:11:53 +01:00
Antony Male 6a1e8e688e Finish off having conductors with collections respond property to that collection being manipulated 2014-04-15 12:22:05 +01:00
Antony Male 0d3538c932 Document ViewManager a bit 2014-04-10 13:14:17 +01:00
Antony Male 4e887447d3 Add some unit tests for the navigating conductor 2014-04-07 12:41:35 +01:00
Antony Male 8106e6a3ac Start on unit testing WindowManager, but there's not a lot I can do since Window is so hard to mock 2014-04-03 12:57:42 +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
Antony Male 3e102ea274 Work on screens: tidying, bug-fixing 2014-03-26 13:16:26 +00:00
Antony Male 0f6994721a Attempt to change Deactivate(true) to Close()
Probably needs a bit more testing and verifying, but the tests pass
2014-03-26 08:36:19 +00:00
Antony Male 31c9844c47 Add more conductor tests, and tests for Execute, PropertyChangedBase 2014-03-25 13:20:31 +00:00
Antony Male fc156247b0 Ensure that FactoryCreators also build up the result 2014-03-23 18:13:01 +00:00
Antony Male 364111afbc Change copyright from Sagentia -> Antony Male 2014-03-23 15:08:04 +00:00
Antony Male 695a1a345e Fix namespace 2014-03-15 14:52:57 +00:00
Antony Male 0aef92ac49 Add some tests for Conductor.Collections.OneActive, but still needs some more 2014-03-15 14:51:52 +00:00
Antony Male 06fa5b646d Move xaml stuff to Xaml folder 2014-03-15 14:11:27 +00:00
Antony Male 907c59acf1 Add documentation to the conductors 2014-03-15 14:09:38 +00:00
Antony Male b279305958 Add tests for Conductor.Collections.AllActive 2014-03-15 13:50:17 +00:00
Antony Male e68fbb12cc Remove the cache of factories
It would only have been hit if someone did .ToAbstractFactory() on the same
type, twice, which would have caused a multiple registrations error further
down the line, anyway
2014-03-15 11:20:10 +00:00
Antony Male d4e563efab Very early start on ConducotOneActiveTests 2014-03-13 13:22:52 +00:00
Antony Male 9a3a8ba4f6 Finish up unit tests for Conductor 2014-03-13 13:05:12 +00:00
Antony Male 7ef6d6521a Start writing unit tests for Conductor 2014-03-12 22:01:59 +00:00
Antony Male e4f80348f9 Remove BootstrapperBase tests, as I'm having lots of problems running an Application inside a unit test context 2014-03-12 21:27:10 +00:00
Antony Male aa395d9cb5 Start writing unit tests for BootstrapperBase 2014-03-12 13:10:25 +00:00
Antony Male 3592a75723 Add unit tests for ActionExtension 2014-03-12 12:54:22 +00:00
Antony Male 70010884a3 Actually test that EventAggregator doesn't retain its target 2014-03-11 13:52:44 +00:00
Antony Male 877a9b87a4 Small fices to BindableCollection, and finish its unit test suite 2014-03-11 13:34:42 +00:00
Antony Male 228147b634 Fix WasAutoCreated, and use to allow the user to replace framework-created bindings 2014-03-05 13:27:04 +00:00
Antony Male cc8e3343cf Finish off (?) the PropertyChangedExtensionsTests 2014-03-05 12:37:49 +00:00
Antony Male 3f304d131c Start writing tests for (and fixing) PropertyChangedExtensions
Currently a test is breaking, not sure why
2014-03-04 13:20:58 +00:00
Antony Male 6ee8927137 Stitch EventAggregator into bootstrapper 2014-02-25 13:21:26 +00:00
Antony Male f41645ab89 Finish EventAggregator, and start writing tests 2014-02-25 13:12:34 +00:00
Antony Male b4aecbab9a Start work on the README 2014-02-20 14:45:28 +00:00
Antony Male 0bcc6d192d Documentation, bug-fixes, tests... 2014-02-20 13:23:28 +00:00
Antony Male c7d24a75df Allow [Inject] attribute on abstract factory methods to specify key to be injected 2014-02-20 12:39:31 +00:00
Antony Male 3e09ba7e8c Move to a builder/container split
This allows proper fluent syntax to be used, e.g.
    builder.Bind(..).To(..).WithKey(..).InSingletonScope()
as well as making it clear that they can't modify the container after
it's been created. Also means less documentation duplication between
interface and implementation...

Documentation needs fixing, and the exceptions will need looking at to
make sure they still give enough information.
2014-02-19 22:13:00 +00:00
Antony Male a73a5f65d9 Reflector StyletIoC into multiple implementation files 2014-02-18 13:15:24 +00:00
Antony Male 374f5d9049 Fix parameter injection 2014-02-18 12:26:08 +00:00
Antony Male c7ea379071 Working towards IInjectionAware, but for some reason test case isn't being injected at all... 2014-02-18 08:27:14 +00:00
Antony Male 9a18af55c9 Fix BuildUp, and add unit tests 2014-02-17 17:51:39 +00:00
Antony Male 3639289b93 Add dyanamic factory implementation, with Bind(...).ToAbstractFactory() syntax 2014-02-17 12:47:29 +00:00
Antony Male 931950c2fb Finish off TypeKeys (at least, the unit tests pass...)
Required moving back to the old way of specifying keys, but oh well
2014-02-16 13:39:30 +00:00
Antony Male d001d56973 The option to associate a key with a binding is now given by Bind...To...WithKey(key) 2014-02-14 12:45:58 +00:00
Antony Male 07469bbf3a Add a ton more tests, and fix a bug or two 2014-02-13 21:55:30 +00:00
Antony Male eb163586cc Couple more ctor injection unit tests 2014-02-13 17:43:23 +00:00
Antony Male e71a1f0dc7 Fix a corner-case with unbound generic registrations 2014-02-13 13:34:26 +00:00
Antony Male 0005e2b194 More work on unit tests 2014-02-12 17:45:15 +00:00
Antony Male cf9f0857a9 Start writing StyletIoC unit tests in earnest 2014-02-11 21:55:11 +00:00
Antony Male 652bd6d82b Finish implementing non-generic binding methods 2014-02-11 12:34:01 +00:00