Skip to content

Commit e7bc86d

Browse files
authored
housekeeping: Add Analyzers to the Sample App (#143)
* Add solution items * Modify references and sln files * Fix the stylecop errors in LoginApp.Android * Implement IUserDialogs in MainActivity * AvaloniaUI app matches the stylecop rules * Zero warnings in Xamarin Forms projects * Fix UWP warnings * Remove an extra using directive * Adjust the paths for MSVS
1 parent 15ad58c commit e7bc86d

32 files changed

+287
-311
lines changed

samples/Directory.build.props

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project>
2+
<PropertyGroup>
3+
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\src\analyzers.ruleset</CodeAnalysisRuleSet>
4+
<WarningsAsErrors>CS8600;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8623;CS8624;CS8625</WarningsAsErrors>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.205" PrivateAssets="all" />
8+
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0" PrivateAssets="All" />
9+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0" PrivateAssets="all" />
10+
</ItemGroup>
11+
<ItemGroup>
12+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)..\src\stylecop.json" Link="stylecop.json" />
13+
</ItemGroup>
14+
</Project>

samples/LoginApp.Android.sln

+9-116
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.30413.136
55
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3465E22A-2B94-448B-BF5E-37E464BF62D5}"
7+
ProjectSection(SolutionItems) = preProject
8+
..\.editorconfig = ..\.editorconfig
9+
..\.gitignore = ..\.gitignore
10+
..\src\analyzers.ruleset = ..\src\analyzers.ruleset
11+
Directory.build.props = Directory.build.props
12+
..\src\stylecop.json = ..\src\stylecop.json
13+
EndProjectSection
14+
EndProject
615
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoginApp", "LoginApp\LoginApp.csproj", "{A4B47D0D-AA6A-4698-A8FE-612ADE83BBFC}"
716
EndProject
817
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Targets", "Targets", "{ECC07E3E-9E01-410F-A706-37FB5E0F6BEB}"
918
EndProject
1019
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoginApp.Android", "LoginApp.Android\LoginApp.Android.csproj", "{AE0BF60D-51DE-4D8A-8449-89C4CE65F40C}"
1120
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Validation.AndroidX", "..\src\ReactiveUI.Validation.AndroidX\ReactiveUI.Validation.AndroidX.csproj", "{CF45657C-461C-4329-A288-006CD9E3ACFD}"
13-
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Validation", "..\src\ReactiveUI.Validation\ReactiveUI.Validation.csproj", "{C41760D4-C331-465B-A1CD-067D06372B5F}"
15-
EndProject
1621
Global
1722
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1823
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@@ -157,118 +162,6 @@ Global
157162
{AE0BF60D-51DE-4D8A-8449-89C4CE65F40C}.Release|x64.Build.0 = Release|Any CPU
158163
{AE0BF60D-51DE-4D8A-8449-89C4CE65F40C}.Release|x86.ActiveCfg = Release|Any CPU
159164
{AE0BF60D-51DE-4D8A-8449-89C4CE65F40C}.Release|x86.Build.0 = Release|Any CPU
160-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
161-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
162-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
163-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
164-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|ARM64.ActiveCfg = Debug|Any CPU
165-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|ARM64.Build.0 = Debug|Any CPU
166-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
167-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
168-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
169-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
170-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
171-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
172-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
173-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
174-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
175-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|Any CPU.Build.0 = Debug|Any CPU
176-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|ARM.ActiveCfg = Debug|Any CPU
177-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|ARM.Build.0 = Debug|Any CPU
178-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|ARM64.ActiveCfg = Debug|Any CPU
179-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|ARM64.Build.0 = Debug|Any CPU
180-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
181-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|iPhone.Build.0 = Debug|Any CPU
182-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
183-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
184-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|x64.ActiveCfg = Debug|Any CPU
185-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|x64.Build.0 = Debug|Any CPU
186-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|x86.ActiveCfg = Debug|Any CPU
187-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.AppStore|x86.Build.0 = Debug|Any CPU
188-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
189-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
190-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|ARM.ActiveCfg = Debug|Any CPU
191-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|ARM.Build.0 = Debug|Any CPU
192-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|ARM64.ActiveCfg = Debug|Any CPU
193-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|ARM64.Build.0 = Debug|Any CPU
194-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|iPhone.ActiveCfg = Debug|Any CPU
195-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|iPhone.Build.0 = Debug|Any CPU
196-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
197-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
198-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|x64.ActiveCfg = Debug|Any CPU
199-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|x64.Build.0 = Debug|Any CPU
200-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|x86.ActiveCfg = Debug|Any CPU
201-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Debug|x86.Build.0 = Debug|Any CPU
202-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
203-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|Any CPU.Build.0 = Release|Any CPU
204-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|ARM.ActiveCfg = Release|Any CPU
205-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|ARM.Build.0 = Release|Any CPU
206-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|ARM64.ActiveCfg = Release|Any CPU
207-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|ARM64.Build.0 = Release|Any CPU
208-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|iPhone.ActiveCfg = Release|Any CPU
209-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|iPhone.Build.0 = Release|Any CPU
210-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
211-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
212-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|x64.ActiveCfg = Release|Any CPU
213-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|x64.Build.0 = Release|Any CPU
214-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|x86.ActiveCfg = Release|Any CPU
215-
{CF45657C-461C-4329-A288-006CD9E3ACFD}.Release|x86.Build.0 = Release|Any CPU
216-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
217-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
218-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
219-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
220-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|ARM64.ActiveCfg = Debug|Any CPU
221-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|ARM64.Build.0 = Debug|Any CPU
222-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
223-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
224-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
225-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
226-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
227-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
228-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
229-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
230-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
231-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|Any CPU.Build.0 = Debug|Any CPU
232-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|ARM.ActiveCfg = Debug|Any CPU
233-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|ARM.Build.0 = Debug|Any CPU
234-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|ARM64.ActiveCfg = Debug|Any CPU
235-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|ARM64.Build.0 = Debug|Any CPU
236-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
237-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|iPhone.Build.0 = Debug|Any CPU
238-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
239-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
240-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|x64.ActiveCfg = Debug|Any CPU
241-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|x64.Build.0 = Debug|Any CPU
242-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|x86.ActiveCfg = Debug|Any CPU
243-
{C41760D4-C331-465B-A1CD-067D06372B5F}.AppStore|x86.Build.0 = Debug|Any CPU
244-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
245-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
246-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|ARM.ActiveCfg = Debug|Any CPU
247-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|ARM.Build.0 = Debug|Any CPU
248-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
249-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|ARM64.Build.0 = Debug|Any CPU
250-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|iPhone.ActiveCfg = Debug|Any CPU
251-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|iPhone.Build.0 = Debug|Any CPU
252-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
253-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
254-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|x64.ActiveCfg = Debug|Any CPU
255-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|x64.Build.0 = Debug|Any CPU
256-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|x86.ActiveCfg = Debug|Any CPU
257-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Debug|x86.Build.0 = Debug|Any CPU
258-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
259-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|Any CPU.Build.0 = Release|Any CPU
260-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|ARM.ActiveCfg = Release|Any CPU
261-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|ARM.Build.0 = Release|Any CPU
262-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|ARM64.ActiveCfg = Release|Any CPU
263-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|ARM64.Build.0 = Release|Any CPU
264-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|iPhone.ActiveCfg = Release|Any CPU
265-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|iPhone.Build.0 = Release|Any CPU
266-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
267-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
268-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|x64.ActiveCfg = Release|Any CPU
269-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|x64.Build.0 = Release|Any CPU
270-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|x86.ActiveCfg = Release|Any CPU
271-
{C41760D4-C331-465B-A1CD-067D06372B5F}.Release|x86.Build.0 = Release|Any CPU
272165
EndGlobalSection
273166
GlobalSection(SolutionProperties) = preSolution
274167
HideSolutionNode = FALSE

samples/LoginApp.Android/LoginApp.Android.csproj

+2-8
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,11 @@
7373
<ItemGroup>
7474
<PackageReference Include="ReactiveUI" Version="11.5.35" />
7575
<PackageReference Include="ReactiveUI.AndroidX" Version="11.5.35" />
76+
<PackageReference Include="ReactiveUI.Validation" Version="1.8.*" />
77+
<PackageReference Include="ReactiveUI.Validation.AndroidX" Version="1.8.*" />
7678
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0.5-rc3" />
7779
</ItemGroup>
7880
<ItemGroup>
79-
<ProjectReference Include="..\..\src\ReactiveUI.Validation\ReactiveUI.Validation.csproj">
80-
<Project>{A4B47D0D-AA6A-4698-A8FE-612ADE83BBF4}</Project>
81-
<Name>ReactiveUI.Validation</Name>
82-
</ProjectReference>
83-
<ProjectReference Include="..\..\src\ReactiveUI.Validation.AndroidX\ReactiveUI.Validation.AndroidX.csproj">
84-
<Project>{A4B47D0D-AA6A-4698-A8FE-612ADE83BBFD}</Project>
85-
<Name>ReactiveUI.Validation.AndroidX</Name>
86-
</ProjectReference>
8781
<ProjectReference Include="..\LoginApp\LoginApp.csproj">
8882
<Project>{A4B47D0D-AA6A-4698-A8FE-612ADE83BBFC}</Project>
8983
<Name>LoginApp</Name>

samples/LoginApp.Android/MainActivity.cs

+57-4
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,85 @@
1-
using System.Reactive.Disposables;
1+
// Copyright (c) 2020 .NET Foundation and Contributors. All rights reserved.
2+
// Licensed to the .NET Foundation under one or more agreements.
3+
// The .NET Foundation licenses this file to you under the MIT license.
4+
// See the LICENSE file in the project root for full license information.
5+
6+
using System.Reactive.Disposables;
27
using Android.App;
38
using Android.OS;
9+
using Android.Views.InputMethods;
410
using Android.Widget;
11+
using Google.Android.Material.Snackbar;
512
using Google.Android.Material.TextField;
13+
using LoginApp.Services;
614
using LoginApp.ViewModels;
715
using ReactiveUI;
816
using ReactiveUI.Validation.Extensions;
917

1018
namespace LoginApp.Droid
1119
{
20+
/// <summary>
21+
/// The main reactive activity for this sample application.
22+
/// </summary>
1223
[Activity(Label = "LoginApp", Theme = "@style/AppTheme", MainLauncher = true)]
13-
public class MainActivity : ReactiveActivity<SignUpViewModel>
24+
public class MainActivity : ReactiveActivity<SignUpViewModel>, IUserDialogs
1425
{
26+
/// <summary>
27+
/// Gets or sets the @+id/UsernameField declared in the activity_main Android XML file.
28+
/// Assigned by a call to the this.WireUpControls() extension method. This method is
29+
/// available in the ReactiveUI.AndroidX NuGet package.
30+
/// </summary>
1531
public TextInputLayout UsernameField { get; set; }
32+
33+
/// <summary>
34+
/// Gets or sets the @+id/PasswordField declared in the activity_main Android XML file.
35+
/// </summary>
1636
public TextInputLayout PasswordField { get; set; }
37+
38+
/// <summary>
39+
/// Gets or sets the @+id/ConfirmPasswordField declared in the activity_main Android XML file.
40+
/// </summary>
1741
public TextInputLayout ConfirmPasswordField { get; set; }
1842

43+
/// <summary>
44+
/// Gets or sets the @+id/Username declared in the activity_main Android XML file.
45+
/// </summary>
1946
public TextInputEditText Username { get; set; }
47+
48+
/// <summary>
49+
/// Gets or sets the @+id/Password declared in the activity_main Android XML file.
50+
/// </summary>
2051
public TextInputEditText Password { get; set; }
52+
53+
/// <summary>
54+
/// Gets or sets the @+id/ConfirmPassword declared in the activity_main Android XML file.
55+
/// </summary>
2156
public TextInputEditText ConfirmPassword { get; set; }
57+
58+
/// <summary>
59+
/// Gets or sets the @+id/SignUpButton declared in the activity_main Android XML file.
60+
/// </summary>
2261
public Button SignUpButton { get; set; }
23-
62+
63+
/// <summary>
64+
/// This is the implementation for the <see cref="IUserDialogs"/> interface.
65+
/// </summary>
66+
/// <inheritdoc />
67+
public void ShowDialog(string message)
68+
{
69+
Snackbar.Make(SignUpButton, message, 5000).Show();
70+
var inputMethodManager = (InputMethodManager)GetSystemService(InputMethodService);
71+
inputMethodManager?.HideSoftInputFromWindow(CurrentFocus?.WindowToken, 0);
72+
}
73+
74+
/// <inheritdoc />
2475
protected override void OnCreate(Bundle savedInstanceState)
2576
{
2677
base.OnCreate(savedInstanceState);
2778
SetContentView(Resource.Layout.activity_main);
28-
ViewModel = new SignUpViewModel();
79+
ViewModel = new SignUpViewModel(null, this);
2980

81+
// The WireUpControls method is a magic ReactiveUI utility method for Android, see:
82+
// https://www.reactiveui.net/docs/handbook/data-binding/xamarin-android/wire-up-controls
3083
this.WireUpControls();
3184
this.WhenActivated(disposables =>
3285
{
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1-
using System.Reflection;
2-
using System.Runtime.CompilerServices;
1+
// Copyright (c) 2020 .NET Foundation and Contributors. All rights reserved.
2+
// Licensed to the .NET Foundation under one or more agreements.
3+
// The .NET Foundation licenses this file to you under the MIT license.
4+
// See the LICENSE file in the project root for full license information.
5+
6+
using System.Reflection;
37
using System.Runtime.InteropServices;
4-
using Android.App;
58

6-
// General Information about an assembly is controlled through the following
7-
// set of attributes. Change these attribute values to modify the information
8-
// associated with an assembly.
99
[assembly: AssemblyTitle("LoginApp.Android")]
1010
[assembly: AssemblyDescription("")]
1111
[assembly: AssemblyConfiguration("")]
1212
[assembly: AssemblyCompany("")]
1313
[assembly: AssemblyProduct("LoginApp.Android")]
14-
[assembly: AssemblyCopyright("Copyright © 2020")]
14+
[assembly: AssemblyCopyright("Copyright © .NET Foundation 2020")]
1515
[assembly: AssemblyTrademark("")]
1616
[assembly: AssemblyCulture("")]
1717
[assembly: ComVisible(false)]
18-
19-
// Version information for an assembly consists of the following four values:
20-
//
21-
// Major Version
22-
// Minor Version
23-
// Build Number
24-
// Revision
25-
//
26-
// You can specify all the values or you can default the Build and Revision Numbers
27-
// by using the '*' as shown below:
28-
// [assembly: AssemblyVersion("1.0.*")]
2918
[assembly: AssemblyVersion("1.0.0.0")]
30-
[assembly: AssemblyFileVersion("1.0.0.0")]
19+
[assembly: AssemblyFileVersion("1.0.0.0")]

samples/LoginApp.Avalonia.sln

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.30413.136
55
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3465E22A-2B94-448B-BF5E-37E464BF62D5}"
7+
ProjectSection(SolutionItems) = preProject
8+
..\.editorconfig = ..\.editorconfig
9+
..\.gitignore = ..\.gitignore
10+
..\src\analyzers.ruleset = ..\src\analyzers.ruleset
11+
Directory.build.props = Directory.build.props
12+
..\src\stylecop.json = ..\src\stylecop.json
13+
EndProjectSection
14+
EndProject
615
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoginApp", "LoginApp\LoginApp.csproj", "{A4B47D0D-AA6A-4698-A8FE-612ADE83BBFC}"
716
EndProject
817
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Targets", "Targets", "{ECC07E3E-9E01-410F-A706-37FB5E0F6BEB}"

samples/LoginApp.Avalonia/LoginApp.Avalonia.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@
2323
<EmbeddedResource Include="**\*.xaml">
2424
<SubType>Designer</SubType>
2525
</EmbeddedResource>
26-
<Compile Update="Views\SignUpView.xaml.cs">
27-
<DependentUpon>SignUpView.xaml</DependentUpon>
28-
</Compile>
2926
</ItemGroup>
3027
</Project>

0 commit comments

Comments
 (0)