Commit Graph

215 Commits

Author SHA1 Message Date
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
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