Skip to content

Commit 8d133ec

Browse files
authored
Merge pull request #57 from muak/development
Fix SyncCanExecute #53
2 parents d2360c3 + 33b994f commit 8d133ec

File tree

5 files changed

+21
-33
lines changed

5 files changed

+21
-33
lines changed

AiForms.Effects.Droid/AddCommandPlatformEffect.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ protected override void OnAttachedOverride()
5858

5959
_view.Clickable = true;
6060
_view.LongClickable = true;
61-
61+
6262
UpdateSyncCanExecute();
6363
UpdateCommandParameter();
6464
UpdateLongCommandParameter();
65+
UpdateIsEnabled();
6566

66-
_view.Touch += _view_Touch;
67+
_view.Touch += _view_Touch;
6768
}
6869

6970
protected override void OnDetachedOverride()

AiForms.Effects.Droid/FeedbackPlatformEffect.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void UpdateEnableSound()
180180
_enableSound = GetEnableSound();
181181
}
182182

183-
void UpdateIsEnabled()
183+
protected void UpdateIsEnabled()
184184
{
185185
if(!IsClickable)
186186
{

Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs

+9-19
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,27 @@ namespace AiEffects.TestApp.ViewModels
1010
public class ForInvestigationViewModel
1111
{
1212
public ReactivePropertySlim<Color> BackColor { get; } = new ReactivePropertySlim<Color>();
13-
public List<string> ItemsSource { get; set; } = new List<string>();
14-
13+
1514
public ReactiveCommand GoCommand { get; set; } = new ReactiveCommand();
1615

17-
public ReactiveCommand CellCommand { get; set; } = new ReactiveCommand();
16+
public ReactiveCommand HogeCommand { get; set; }
17+
18+
public ReactivePropertySlim<bool> CanExecute { get; } = new ReactivePropertySlim<bool>();
1819

1920
public ForInvestigationViewModel(INavigationService navigationService)
2021
{
2122
BackColor.Value = Color.Blue;
22-
23-
ItemsSource.Add("ABC");
24-
ItemsSource.Add("CC");
25-
ItemsSource.Add("DD");
26-
ItemsSource.Add("EEE");
27-
ItemsSource.Add("FFF");
28-
ItemsSource.Add("GADSFS");
29-
ItemsSource.Add("HDSGDG");
30-
ItemsSource.Add("IGDG");
31-
ItemsSource.Add("YYUY");
32-
ItemsSource.Add("XXX");
23+
3324

3425
var toggle = false;
3526
GoCommand.Subscribe(async _ =>
3627
{
37-
//BackColor.Value = toggle ? Color.Blue : Color.Green;
38-
//toggle = !toggle;
39-
//await navigationService.NavigateAsync("MainPage",null,true);
40-
await navigationService.GoBackAsync();
28+
CanExecute.Value = !CanExecute.Value;
4129
});
4230

43-
CellCommand.Subscribe(_ =>
31+
HogeCommand = CanExecute.ToReactiveCommand();
32+
33+
HogeCommand.Subscribe(_ =>
4434
{
4535
Debug.WriteLine("Cell Tap!");
4636
});

Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml

+7-11
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@
77
x:Name="me">
88

99
<ContentPage.ToolbarItems>
10-
<ToolbarItem Text="Go" Clicked="ToolbarItem_Clicked" />
10+
<ToolbarItem Text="Go" Command="{Binding GoCommand}" />
1111
</ContentPage.ToolbarItems>
1212

13-
<CollectionView ItemsSource="{Binding ItemsSource}">
14-
<CollectionView.ItemsLayout>
15-
<LinearItemsLayout Orientation="Vertical" ItemSpacing="1" />
16-
</CollectionView.ItemsLayout>
17-
<CollectionView.ItemTemplate>
18-
<DataTemplate>
19-
<Label Text="{Binding}" ef:AddCommand.Command="{Binding BindingContext.CellCommand,Source={x:Reference me}}" />
20-
</DataTemplate>
21-
</CollectionView.ItemTemplate>
22-
</CollectionView>
13+
<ContentView ef:AddCommand.Command="{Binding HogeCommand}"
14+
ef:AddCommand.EffectColor="Red"
15+
ef:AddCommand.SyncCanExecute="True"
16+
BackgroundColor="Blue">
17+
<Label Text="Hoge" />
18+
</ContentView>
2319
</ContentPage>

nuget/AzurePipelines.nuspec

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
## Bug fixes
2121

22+
* AddCommand – Fixed AddCommand.SyncCanExecute does not work on Android #53
2223
* Android – Fixed null exception when popping a page. #54
2324
* AddText – Fixed the end of characters is sometimes omitted #48.
2425
* Feedback – Fixed Android OnOverlayTouch crash #49.

0 commit comments

Comments
 (0)