Commit Graph

254 Commits

Author SHA1 Message Date
Antony Male ef52b7ef12 Update MSBuild.SDK.Extras, and remove warning suppressions 2021-01-21 20:05:01 +00:00
Antony Male 26d905c6f0 Explicitly target net5.0-windows
Things worked when referenced from a net5.0-windows project anyway, but might as
well keep with the times
2020-11-28 12:18:14 +00:00
T.M 6bc5f646f1 ConductorBaseWithActiveItem sets new item as ActiveItem before activating it
Up to now, ScreenExtemsions.TryActivate(newItem) was called
before Conductor.ActiveItem was set to the new item. This commit moves
setting ActiveItem to before TryActivate(newItem) call. This allows for
nested activation - that is, a scenario where newItem can "intercept"
its activation and force parent Conductor to immediately activate
another item inside its OnActivate() override, effectively skipping
newItem without displaying it.

Fixes #140
2020-07-26 19:11:52 +01:00
Antony Male f5b72703c2 Fix bug in EventAggregator
Publishing to multiple channels would only deliver messages to
subscribers subcribed to all of those channels, not any of them.

Fixes #127
2020-06-20 12:05:18 +01:00
Antony Male 9f7b596a5e Throw a better exception than an NRE if they forget to call builder.Bind(..).To(..)
Fixes #114
2020-04-23 17:58:28 +01:00
Antony Male bc068f8b27 Make namespace of StyletIoC unit tests consistent 2020-04-23 17:52:45 +01:00
Antony Male f946b8b9ac Support building abstract factories for two interfaces with the same name
Fixes #123
2020-04-23 17:52:45 +01:00
Antony Male b3064171c1 Fix up the failing unit tests 2019-09-22 17:12:54 +01:00
Antony Male 3c7639bdc8 Turns out it is possible to have a single csproj targetting both core and framework
<EnableDefaultItems>false</EnableDefaultItems> along with
<Compile Include="**\*.cs" Exclude="obj\**" /> and <None Remove="**\*.cs" />
is needed, though.
2019-09-22 17:12:54 +01:00
Antony Male f7ec7a255a WIP towards getting unit tests working 2019-09-22 17:12:53 +01:00
Antony Male f4e6e3ecf5 Split Stylet and IntegrationTests projects into Framework and Core
Annoyingly we need to have two separate projects in two separate directories,
since Framework WPF projects aren't supported in sdk-style csprojs. The
Framework and Core projects also stamp over each others' bin and obj
directories, even if you set IntermediateFilePath, hence the need to put
them in entirely separate places
2019-09-22 17:12:53 +01:00
Antony Male 8183c83190 Add BindAndInvoke
Fixes #43
2018-09-30 18:50:55 +01:00
Antony Male eb2da81b9d Deprecate BindWeak
Weak event subscriptions are basically impossible to get right, if
you allow anonymous delegates.

Fixes #38
2018-09-30 18:43:31 +01:00
Antony Male d32045b518 Allow the owner of a dialog/window to be explicitly set
Fixes #36
2018-09-30 18:29:10 +01:00
Antony Male 2027fad730 Add support for CommandBinding in Actions
CommandBinding isn't a DependencyObject, so we can't get its DataContext
or View.ActionTarget -- we can only use the
IRootObjectProvider.RootObject. This should be good enough for most cases,
as these tend to get installed at the root of a window.

Fixes #50
2018-09-30 17:56:51 +01:00
Antony Male e01e6e41f3 If a ConductorOneActive item is closed, don't dispose it twice
Fixes #28
2017-05-18 10:09:21 +01:00
Antony Male e4941c1c66 When removing ConductorOneActive's ActiveItem, don't Close then Deactivate
Closing and then Deactivating causes the ActiveItem to be reactivated, in order
to deactivate it. Not good.

Fixes #27
2017-05-15 13:04:44 +01:00
Antony Male 151371f9f6 Conductor.OneActive should close children removed with items.Clear()
Conductor.AllActive reacts appropriately to the Reset event on its items
collection. Conductor.OneActive doesn't, and should.

Fixes #18
2016-12-03 13:15:14 +00:00
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 5a5cfc5cfb Fix ConductorOneActive to not deactivate activate item twice when closing
It closed each of its children individually, then cleared 'this.items',
which caused of all its children to be deactivated again,.

Fixes #14
2016-11-17 12:50:08 +00:00
Antony Male ffb218d666 Add default FlowDirection and TextAlignment to MessageBoxViweModel
This removes the MessageBoxOptions input to MessageBoxViewModel, and
replaces it with explicit FlowDirection and TextAlignment inputs.
I think this is fair enough - we weren't using most of the members
of MessageBoxOptions, so allowing them to be provided was misleading.

Fixes #12
2016-11-12 11:35:58 +00:00
Antony Male 6dd8c072c1 StyletIoC: Detect basic copy constructors, and don't attempt to call them
This doesn't do full recursion detection, but catches the simple case of
copy constructors.
2016-10-09 11:30:11 +01:00
Antony Male e538bbbd8f Dispose Instance bindings by default, but allow this to be configured 2016-09-23 11:20:55 +01: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 35c1b3320f Fix the ValidatingModelBase, in the face of WPF asking for model-wide errors
Fixes #11
2016-08-26 11:27:37 +01:00
Antony Male b6b9811ab0 Conductors, which override CanCloseAsync, must call CanClose
Otherwise subclasses which override CanClose but not CanCloseAsync won't
work as expected.

Fixes #10
2016-07-09 12:50:51 +01:00
Antony Male 10c8fa4f3a Move to automatic nuget package restore 2016-07-09 12:15:32 +01:00
Antony Male 16a61db659 Rewrite parts of the EventAggregator to avoid reentrancy issues 2016-03-24 10:21:49 +00:00
Antony Male ffac9b6016 Fix bug in ViewManager when searching multiple assemblies
Also helpfully search the same assembly as the ViewModel was in
2016-03-22 18:40:50 +00:00
Antony Male 235504941f Throw (by default) if ToAllImplementations does not find any implementations
This will happen if someone takes a concrete class (with no subclasses), uses
ToAllImplementations on it (and InSingletonScope), and wonders why the singleton
registration didn't 'take': the ToAllImplementations didn't create any bindings,
so we fell back to auto-binding the type
2016-03-02 17:15:22 +00:00
Antony Male b9d1487e91 Fix access modifier on BootstrapperBase.Launch 2016-02-02 08:24:31 +00:00
Antony Male 78e7da40b4 Don't crash if Imaging.CreateBitmapSourceFromHIcon fails 2016-01-30 14:22:23 +00:00
Antony Male 86896e97e5 Change the ViewManager to take a ViewManagerConfig configuration object
This means it possible for users to provide their own ViewManagers, without
having to use a .ToInstance() binding.
2016-01-29 12:47:16 +00:00
Antony Male e0c7edd27a Rework slightly how the root VM is launched, to avoid it being created only to be disposed 2016-01-27 12:30:26 +00:00
Antony Male 5d752f1fa9 Dispose the RootViewModel when Bootstrapper disposed
The Bootstrapper owns the RootViewModel, so this is the right thing
to do
2016-01-08 11:47:37 +00:00
Antony Male 3a6e82557a Allow initial activate after a close 2016-01-06 21:22:01 +00:00
Antony Male fdfaefa94e Implement another mechanism of backup ActionTarget, using IRootObjectProvider 2015-10-06 12:57:08 +01:00
Antony Male 54cd9cf18f Revert the BindingProxy stuff
Trying to do this properly turns out to just be unworkable
2015-10-06 11:54:33 +01:00
Antony Male 764cfe0b39 Use multi-binding in bootstrapper 2015-10-03 17:06:12 +01:00
Antony Male df7e024bf5 Slightly more testing, and docs 2015-10-03 17:06:11 +01:00
Antony Male bd18b94e82 Start getting towards something that works... 2015-10-03 17:06:11 +01:00
Antony Male 447f68f1f0 Only throw on click if action not found
It turns out there was a lovely little race with View.ActionTarget, where
either the View.ActionTarget or the corresponding {s:Action} could be
evaluated first. This meant setting View.ActionTarget was risky.

It happened to work in previous releases because the bootstrapper accessed
View.ViewManager, which caused its class ctor to run and somehow caused
View.ActionTarget to be evaluated earlier.

I don't think there's a decent way of getting around this: we can't
guarentee the order in which things in Xaml are going to be evaluated.
That's not the WPF way.

Therefore, only throw exceptions if someone actually clicks the button.
2015-10-03 15:50:55 +01:00
Antony Male 81f256d231 Move away from separate ViewManagerConfig class 2015-09-25 15:19:23 +01:00
Antony Male 667564c3af Add support for customising 'View' and 'ViewModel' suffixes in ViewManager 2015-09-25 11:16:50 +01:00
Antony Male 8a6f010fbb Add support for namespace transformations to ViewManager 2015-09-25 10:57:46 +01:00
Antony Male 3dd1ec2bfe Ensure that ViewManagerConfig properties cannot be null 2015-09-25 10:43:17 +01:00
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