Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 2ae7a2d

Browse files
Updated NuGet Packages for Samples & UITests
1 parent f6916a9 commit 2ae7a2d

File tree

61 files changed

+12330
-12865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+12330
-12865
lines changed

EntryCustomReturn.Forms.Plugin.Abstractions/Effects/CustomReturnEffect.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static class CustomReturnEffect
1313
/// <summary>
1414
/// Return Type Property of the Keyboard Return Key
1515
/// </summary>
16-
public static readonly BindableProperty ReturnTypeProperty =
16+
public static readonly BindableProperty ReturnTypeProperty =
1717
BindableProperty.CreateAttached(BindablePropertyConstants.ReturnTypePropertyName,
1818
typeof(ReturnType),
1919
typeof(Entry),
@@ -23,7 +23,7 @@ public static class CustomReturnEffect
2323
/// <summary>
2424
/// Command that occurs when the user finalizes the text in an entry with the return key
2525
/// </summary>
26-
public static readonly BindableProperty ReturnCommandProperty =
26+
public static readonly BindableProperty ReturnCommandProperty =
2727
BindableProperty.CreateAttached(
2828
BindablePropertyConstants.ReturnCommandPropertyName,
2929
typeof(ICommand),
@@ -34,7 +34,7 @@ public static class CustomReturnEffect
3434
/// <summary>
3535
/// Backing store for the ReturnCommandParameter bindable property
3636
/// </summary>
37-
public static readonly BindableProperty ReturnCommandParameterProperty =
37+
public static readonly BindableProperty ReturnCommandParameterProperty =
3838
BindableProperty.CreateAttached(BindablePropertyConstants.ReturnCommandParameterPropertyName,
3939
typeof(object),
4040
typeof(Entry),
@@ -91,12 +91,10 @@ public static class CustomReturnEffect
9191

9292
static void UpdateEffect(BindableObject bindable)
9393
{
94-
switch (bindable)
94+
if (bindable is Entry entry)
9595
{
96-
case Entry entry:
97-
RemoveEffect(entry);
98-
entry.Effects.Add(new EntryReturnTypeEffect());
99-
break;
96+
RemoveEffect(entry);
97+
entry.Effects.Add(new EntryReturnTypeEffect());
10098
}
10199
}
102100

EntryCustomReturn.Forms.Plugin.Abstractions/EntryCustomReturn.Forms.Plugin.Abstractions.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
</PropertyGroup>
66

77
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
8+
<DebugType></DebugType>
89
<DocumentationFile>bin\Release\netstandard1.0\EntryCustomReturn.Forms.Plugin.Abstractions.xml</DocumentationFile>
910
</PropertyGroup>
1011

EntryCustomReturn.Forms.Plugin.Android/CustomKeyboardReturnEffect.cs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ sealed class CustomKeyboardReturnEffect : PlatformEffect
2424

2525
void SetKeyboardReturnButton()
2626
{
27-
var customControl = Control as FormsEditText;
28-
var entry = Element as Entry;
29-
30-
if (customControl != null && entry != null)
27+
if (Element is Entry entry
28+
&& Control is FormsEditText customControl)
3129
{
3230
customControl.ImeOptions = KeyboardHelpers.GetKeyboardButtonType(CustomReturnEffect.GetReturnType(entry));
3331

@@ -38,17 +36,13 @@ void SetKeyboardReturnButton()
3836

3937
void UnsetKeyboardReturnButton()
4038
{
41-
var customControl = Control as FormsEditText;
42-
4339
try
4440
{
45-
switch (Control)
41+
if (Control is FormsEditText formsEditText)
4642
{
47-
case FormsEditText formsEditText:
48-
formsEditText.ImeOptions = KeyboardHelpers.GetKeyboardButtonType(ReturnType.Default);
49-
formsEditText.EditorAction -= HandleEditorAction;
50-
formsEditText.KeyPress -= HandleKeyPress;
51-
break;
43+
formsEditText.ImeOptions = KeyboardHelpers.GetKeyboardButtonType(ReturnType.Default);
44+
formsEditText.EditorAction -= HandleEditorAction;
45+
formsEditText.KeyPress -= HandleKeyPress;
5246
}
5347
}
5448
catch (ObjectDisposedException e)
@@ -59,15 +53,15 @@ void UnsetKeyboardReturnButton()
5953

6054
void HandleEditorAction(object sender, TextView.EditorActionEventArgs e)
6155
{
62-
if (e?.Event?.KeyCode == Keycode.Enter)
56+
if (e?.Event?.KeyCode is Keycode.Enter)
6357
return;
6458

6559
ExecuteCommand();
6660
}
6761

6862
void HandleKeyPress(object sender, global::Android.Views.View.KeyEventArgs e)
6963
{
70-
if (e?.Event?.KeyCode == Keycode.Enter && e?.Event?.Action == KeyEventActions.Up)
64+
if (e?.Event?.KeyCode is Keycode.Enter && e?.Event?.Action is KeyEventActions.Up)
7165
ExecuteCommand();
7266

7367
e.Handled = false;

EntryCustomReturn.Forms.Plugin.Android/CustomReturnEntryRenderer.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,21 @@ protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
3737
{
3838
base.OnElementChanged(e);
3939

40-
var customEntry = Element as CustomReturnEntry;
41-
42-
if (Control != null && customEntry != null)
40+
if (Control != null && Element is CustomReturnEntry customEntry)
4341
{
4442
Control.ImeOptions = KeyboardHelpers.GetKeyboardButtonType(customEntry.ReturnType);
4543

4644
Control.KeyPress += (sender, keyEventArgs) =>
4745
{
48-
if (keyEventArgs?.Event?.KeyCode == Keycode.Enter && keyEventArgs?.Event?.Action == KeyEventActions.Up)
46+
if (keyEventArgs?.Event?.KeyCode is Keycode.Enter && keyEventArgs?.Event?.Action is KeyEventActions.Up)
4947
ExecuteCommand(customEntry);
5048

5149
keyEventArgs.Handled = false;
5250
};
5351

5452
Control.EditorAction += (object sender, TextView.EditorActionEventArgs args) =>
5553
{
56-
if (args?.Event?.KeyCode == Keycode.Enter)
54+
if (args?.Event?.KeyCode is Keycode.Enter)
5755
return;
5856

5957
ExecuteCommand(customEntry);
@@ -65,11 +63,9 @@ protected override void OnElementPropertyChanged(object sender, System.Component
6563
{
6664
base.OnElementPropertyChanged(sender, e);
6765

68-
if (e.PropertyName == CustomReturnEntry.ReturnTypeProperty.PropertyName)
66+
if (e.PropertyName.Equals(CustomReturnEntry.ReturnTypeProperty.PropertyName))
6967
{
70-
var customEntry = sender as CustomReturnEntry;
71-
72-
if (Control != null && customEntry != null)
68+
if (Control != null && sender is CustomReturnEntry customEntry)
7369
Control.ImeOptions = KeyboardHelpers.GetKeyboardButtonType(customEntry.ReturnType);
7470
}
7571
}

EntryCustomReturn.Forms.Plugin.Android/EntryCustomReturn.Forms.Plugin.Android.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<FileAlignment>512</FileAlignment>
1616
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
1717
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
18-
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
1918
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
2019
<NuGetPackageImportStamp>
2120
</NuGetPackageImportStamp>

EntryCustomReturn.Forms.Plugin.UWP/CustomKeyboardReturnEffect.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,31 @@ protected override void OnElementPropertyChanged(System.ComponentModel.PropertyC
2222
{
2323
base.OnElementPropertyChanged(args);
2424

25-
if (args.PropertyName == CustomReturnEntry.ReturnTypeProperty.PropertyName)
25+
if (args.PropertyName.Equals(CustomReturnEntry.ReturnTypeProperty.PropertyName))
2626
SetKeyboardReturnButton();
2727
}
2828

2929
void SetKeyboardReturnButton()
3030
{
31-
switch (Control)
31+
if (Control is FormsTextBox formsTextBox)
3232
{
33-
case FormsTextBox formsTextBox:
34-
KeyboardHelpers.SetKeyboardEnterButton(formsTextBox, CustomReturnEffect.GetReturnType(Element));
35-
Control.KeyUp += HandleKeyUp;
36-
break;
33+
KeyboardHelpers.SetKeyboardEnterButton(formsTextBox, CustomReturnEffect.GetReturnType(Element));
34+
Control.KeyUp += HandleKeyUp;
3735
}
3836
}
3937

4038
void UnsetKeyboardReturnButton()
4139
{
42-
switch (Control)
40+
if (Control is FormsTextBox formsTextBox)
4341
{
44-
case FormsTextBox formsTextBox:
45-
KeyboardHelpers.SetKeyboardEnterButton(formsTextBox, ReturnType.Default);
46-
Control.KeyUp -= HandleKeyUp;
47-
break;
42+
KeyboardHelpers.SetKeyboardEnterButton(formsTextBox, ReturnType.Default);
43+
Control.KeyUp -= HandleKeyUp;
4844
}
4945
}
5046

5147
void HandleKeyUp(object sender, KeyRoutedEventArgs e)
5248
{
53-
if (e.Key == Windows.System.VirtualKey.Enter)
49+
if (e.Key is Windows.System.VirtualKey.Enter)
5450
ExecuteCommand();
5551
}
5652

EntryCustomReturn.Forms.Plugin.UWP/CustomReturnEntryRenderer.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
3737

3838
Control.KeyUp += (sender, eventArgs) =>
3939
{
40-
if (eventArgs.Key == Windows.System.VirtualKey.Enter)
40+
if (eventArgs.Key is Windows.System.VirtualKey.Enter)
4141
ExecuteCommand(customEntry);
4242
};
4343
}
@@ -47,11 +47,9 @@ protected override void OnElementPropertyChanged(object sender, System.Component
4747
{
4848
base.OnElementPropertyChanged(sender, e);
4949

50-
if (e.PropertyName == CustomReturnEntry.ReturnTypeProperty.PropertyName)
50+
if (e.PropertyName.Equals(CustomReturnEntry.ReturnTypeProperty.PropertyName))
5151
{
52-
var customEntry = sender as CustomReturnEntry;
53-
54-
if (Control != null && customEntry != null)
52+
if (Control != null && sender is CustomReturnEntry customEntry)
5553
KeyboardHelpers.SetKeyboardEnterButton(Control, customEntry.ReturnType);
5654
}
5755

EntryCustomReturn.Forms.Plugin.iOSUnified/CustomKeyboardReturnEffect.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,25 @@ protected override void OnElementPropertyChanged(System.ComponentModel.PropertyC
2222
{
2323
base.OnElementPropertyChanged(args);
2424

25-
if (args.PropertyName == CustomReturnEntry.ReturnTypeProperty.PropertyName)
25+
if (args.PropertyName.Equals(CustomReturnEntry.ReturnTypeProperty.PropertyName))
2626
SetKeyboardReturnButton();
2727
}
2828

2929
void SetKeyboardReturnButton()
3030
{
31-
switch (Control)
31+
if (Control is UITextField uiTextField)
3232
{
33-
case UITextField uiTextField:
34-
uiTextField.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(CustomReturnEffect.GetReturnType(Element));
35-
uiTextField.ShouldReturn += HandleShouldReturn;
36-
break;
33+
uiTextField.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(CustomReturnEffect.GetReturnType(Element));
34+
uiTextField.ShouldReturn += HandleShouldReturn;
3735
}
3836
}
3937

4038
void UnsetKeyboardReturnButton()
4139
{
42-
switch (Control)
40+
if (Control is UITextField uiTextField)
4341
{
44-
case UITextField uiTextField:
45-
uiTextField.ReturnKeyType = UIReturnKeyType.Default;
46-
uiTextField.ShouldReturn -= HandleShouldReturn;
47-
break;
42+
uiTextField.ReturnKeyType = UIReturnKeyType.Default;
43+
uiTextField.ShouldReturn -= HandleShouldReturn;
4844
}
4945
}
5046

EntryCustomReturn.Forms.Plugin.iOSUnified/CustomReturnEntryRenderer.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
2828
{
2929
base.OnElementChanged(e);
3030

31-
var customEntry = Element as CustomReturnEntry;
32-
33-
if (Control != null && customEntry != null)
31+
if (Control != null && Element is CustomReturnEntry customEntry)
3432
{
3533
Control.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(customEntry.ReturnType);
3634

@@ -57,11 +55,9 @@ protected override void OnElementPropertyChanged(object sender, System.Component
5755
{
5856
base.OnElementPropertyChanged(sender, e);
5957

60-
if (e.PropertyName == CustomReturnEntry.ReturnTypeProperty.PropertyName)
58+
if (e.PropertyName.Equals(CustomReturnEntry.ReturnTypeProperty.PropertyName))
6159
{
62-
var customEntry = sender as CustomReturnEntry;
63-
64-
if (Control != null && customEntry != null)
60+
if (Control != null && sender is CustomReturnEntry customEntry)
6561
Control.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(customEntry.ReturnType);
6662
}
6763
}

0 commit comments

Comments
 (0)