Skip to content

Commit c946920

Browse files
Merge branch 'develop'
2 parents 2422bed + 5b84794 commit c946920

File tree

10 files changed

+334
-74
lines changed

10 files changed

+334
-74
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<assembly name="Shuriken.Wpf, Version=1.3.1.0">
2+
<member name="M:Shuriken.AsyncCommand.#ctor(System.Func{System.Threading.Tasks.Task},System.Func{System.Boolean},Shuriken.CommandOptions)">
3+
<parameter name="execute">
4+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
5+
</parameter>
6+
</member>
7+
<member name="M:Shuriken.AsyncCommand.#ctor(System.Func{System.Threading.CancellationToken,System.Threading.Tasks.Task},System.Func{System.Boolean},Shuriken.CommandOptions)">
8+
<parameter name="execute">
9+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
10+
</parameter>
11+
</member>
12+
<member name="M:Shuriken.AsyncCommand.#ctor(System.Func{Shuriken.CommandExecutionController,System.Threading.CancellationToken,System.Threading.Tasks.Task},System.Func{System.Boolean},Shuriken.CommandOptions)">
13+
<parameter name="execute">
14+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
15+
</parameter>
16+
</member>
17+
<member name="M:Shuriken.AsyncCommand`1.#ctor(System.Func{`0,System.Threading.Tasks.Task},System.Func{`0,System.Boolean},Shuriken.CommandOptions)">
18+
<parameter name="execute">
19+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
20+
</parameter>
21+
</member>
22+
<member name="M:Shuriken.AsyncCommand`1.#ctor(System.Func{`0,System.Threading.CancellationToken,System.Threading.Tasks.Task},System.Func{`0,System.Boolean},Shuriken.CommandOptions)">
23+
<parameter name="execute">
24+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
25+
</parameter>
26+
</member>
27+
<member name="M:Shuriken.AsyncCommand`1.#ctor(System.Func{`0,Shuriken.CommandExecutionController,System.Threading.CancellationToken,System.Threading.Tasks.Task},System.Func{`0,System.Boolean},Shuriken.CommandOptions)">
28+
<parameter name="execute">
29+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
30+
</parameter>
31+
</member>
32+
<member name="M:Shuriken.Command.#ctor(System.Action,System.Func{System.Boolean},Shuriken.CommandOptions)">
33+
<parameter name="execute">
34+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
35+
</parameter>
36+
</member>
37+
<member name="M:Shuriken.Command.#ctor(System.Action{System.Threading.CancellationToken},System.Func{System.Boolean},Shuriken.CommandOptions)">
38+
<parameter name="execute">
39+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
40+
</parameter>
41+
</member>
42+
<member name="M:Shuriken.Command.#ctor(System.Action{Shuriken.CommandExecutionController,System.Threading.CancellationToken},System.Func{System.Boolean},Shuriken.CommandOptions)">
43+
<parameter name="execute">
44+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
45+
</parameter>
46+
</member>
47+
<member name="M:Shuriken.Command`1.#ctor(System.Action{`0},System.Func{`0,System.Boolean},Shuriken.CommandOptions)">
48+
<parameter name="execute">
49+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
50+
</parameter>
51+
</member>
52+
<member name="M:Shuriken.Command`1.#ctor(System.Action{`0,System.Threading.CancellationToken},System.Func{`0,System.Boolean},Shuriken.CommandOptions)">
53+
<parameter name="execute">
54+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
55+
</parameter>
56+
</member>
57+
<member name="M:Shuriken.Command`1.#ctor(System.Action{`0,Shuriken.CommandExecutionController,System.Threading.CancellationToken},System.Func{`0,System.Boolean},Shuriken.CommandOptions)">
58+
<parameter name="execute">
59+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
60+
</parameter>
61+
</member>
62+
<member name="P:Shuriken.CommandBase.Options">
63+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
64+
</member>
65+
<member name="P:Shuriken.CommandExecutionController.Execution">
66+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
67+
</member>
68+
<member name="M:Shuriken.ParameterizedCommand`1.CanExecute(`0)">
69+
<attribute ctor="M:JetBrains.Annotations.PureAttribute.#ctor" />
70+
</member>
71+
<member name="M:Shuriken.ParameterlessCommand.CanExecute">
72+
<attribute ctor="M:JetBrains.Annotations.PureAttribute.#ctor" />
73+
</member>
74+
<member name="P:Shuriken.RunningCommandExecution.CancelCommand">
75+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
76+
</member>
77+
<member name="M:Shuriken.Diagnostics.EventListener.ToDebugMessage(System.Diagnostics.Tracing.EventWrittenEventArgs)">
78+
<attribute ctor="M:JetBrains.Annotations.PureAttribute.#ctor" />
79+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
80+
</member>
81+
<member name="M:Shuriken.Monitoring.ApplicationMonitorScope.#ctor(Shuriken.Monitoring.INotificationContext)">
82+
<parameter name="notificationContext">
83+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
84+
</parameter>
85+
</member>
86+
<member name="P:Shuriken.Monitoring.ApplicationMonitorScope.NotificationContext">
87+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
88+
</member>
89+
<member name="M:Shuriken.Monitoring.ApplicationMonitorScope.Suspend">
90+
<attribute ctor="M:JetBrains.Annotations.MustUseReturnValueAttribute.#ctor" />
91+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
92+
</member>
93+
<member name="M:Shuriken.Monitoring.INotificationContext.Invoke(System.Action)">
94+
<parameter name="action">
95+
<attribute ctor="M:JetBrains.Annotations.InstantHandleAttribute.#ctor" />
96+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
97+
</parameter>
98+
</member>
99+
<member name="M:Shuriken.Monitoring.INotificationContext.InvokeAsync(System.Action)">
100+
<attribute ctor="M:JetBrains.Annotations.PureAttribute.#ctor" />
101+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
102+
<parameter name="action">
103+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
104+
</parameter>
105+
</member>
106+
<member name="M:Shuriken.Monitoring.WpfNotificationContext.#ctor(System.Windows.Threading.Dispatcher)">
107+
<parameter name="dispatcher">
108+
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
109+
</parameter>
110+
</member>
111+
</assembly>

Sources/Shuriken.Deployment/Shuriken.Annotations.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>Shuriken.Annotations</id>
5-
<version>1.3.0</version>
5+
<version>1.3.1</version>
66
<title>Shuriken Annotations</title>
77
<authors>Michael Damatov</authors>
88
<description>Annotations for the Shuriken library.</description>

Sources/Shuriken.Deployment/Shuriken.Deployment.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
</None>
7878
</ItemGroup>
7979
<ItemGroup>
80+
<Content Include="Annotations\Shuriken.Wpf\1.3.1.0.xml">
81+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
82+
</Content>
8083
<Content Include="Annotations\Shuriken.Wpf\1.3.0.0.xml">
8184
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8285
</Content>

Sources/Shuriken.Wpf/Monitoring/_ValueBags/ParameterizedCommandValueBag.cs

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ internal ParameterizedCommandValueBag(
4949
}
5050
}
5151

52-
public override bool HasValidValue => isValueValid && isIsExecutingValid;
53-
54-
public override bool HasChangedValue => isValueChanged || isIsExecutingChanged;
55-
56-
public override void UpdateNewValue(ObservableObject observableObject)
52+
[MustUseReturnValue]
53+
CommandBase GetCurrentValue(ObservableObject observableObject)
5754
{
5855
try
5956
{
60-
newValue = propertyAccessor.Getter(observableObject);
57+
var value = propertyAccessor.Getter(observableObject);
58+
6159
isValueValid = true;
60+
return value;
6261
}
6362
catch (Exception e)
6463
{
@@ -68,13 +67,38 @@ public override void UpdateNewValue(ObservableObject observableObject)
6867
}
6968

7069
isValueValid = false;
70+
return default;
7171
}
72+
}
73+
74+
[MustUseReturnValue]
75+
bool GetCurrentIsExecuting([NotNull] CommandBase value)
76+
{
77+
var isExecuting = value.RunningExecution != null;
7278

73-
if (isValueValid && newValue != null)
79+
isIsExecutingValid = true;
80+
81+
return isExecuting;
82+
}
83+
84+
public override bool HasValidValue => isValueValid && isIsExecutingValid;
85+
86+
public override bool HasChangedValue => isValueChanged || isIsExecutingChanged;
87+
88+
public override void UpdateNewValue(ObservableObject observableObject)
89+
{
90+
var value = GetCurrentValue(observableObject);
91+
if (isValueValid)
7492
{
75-
newIsExecuting = newValue.RunningExecution != null;
93+
newValue = value;
7694

77-
isIsExecutingValid = true;
95+
if (value != null)
96+
{
97+
var isExecuting = GetCurrentIsExecuting(value);
98+
99+
Debug.Assert(isIsExecutingValid);
100+
newIsExecuting = isExecuting;
101+
}
78102
}
79103
}
80104

@@ -84,22 +108,7 @@ public override void AnalyzeNewValue()
84108
Debug.Assert(isIsExecutingValid);
85109

86110
isValueChanged = currentValue != newValue;
87-
88-
if (isValueChanged)
89-
{
90-
currentValue = newValue;
91-
isIsExecutingChanged = true;
92-
currentIsExecuting = newIsExecuting;
93-
}
94-
else
95-
{
96-
isIsExecutingChanged = currentIsExecuting != newIsExecuting;
97-
98-
if (isIsExecutingChanged)
99-
{
100-
currentIsExecuting = newIsExecuting;
101-
}
102-
}
111+
isIsExecutingChanged = isValueChanged || currentIsExecuting != newIsExecuting;
103112

104113
newValue = null;
105114
newIsExecuting = false;
@@ -122,6 +131,20 @@ public override void NotifyPropertyChanged(ObservableObject observableObject)
122131
finally
123132
{
124133
isValueChanged = false;
134+
135+
var value = GetCurrentValue(observableObject);
136+
if (isValueValid)
137+
{
138+
currentValue = value;
139+
140+
if (value != null)
141+
{
142+
var isExecuting = GetCurrentIsExecuting(value);
143+
144+
Debug.Assert(isIsExecutingValid);
145+
currentIsExecuting = isExecuting;
146+
}
147+
}
125148
}
126149
}
127150

@@ -143,6 +166,14 @@ public override void NotifyPropertyChanged(ObservableObject observableObject)
143166
finally
144167
{
145168
isIsExecutingChanged = false;
169+
170+
if (currentValue != null)
171+
{
172+
var isExecuting = GetCurrentIsExecuting(currentValue);
173+
174+
Debug.Assert(isIsExecutingValid);
175+
currentIsExecuting = isExecuting;
176+
}
146177
}
147178
}
148179
}

0 commit comments

Comments
 (0)