diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Assets/AboutAssets.txt b/cross-platform/xamarin-forms/StoreCredentials/Droid/Assets/AboutAssets.txt new file mode 100644 index 0000000..a9b0638 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/CredentialsService.cs b/cross-platform/xamarin-forms/StoreCredentials/Droid/CredentialsService.cs new file mode 100644 index 0000000..b5ba1e3 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/CredentialsService.cs @@ -0,0 +1,50 @@ +using System.Linq; +using StoreCredentials.Droid; +using Xamarin.Auth; +using Xamarin.Forms; + +[assembly: Dependency (typeof(CredentialsService))] +namespace StoreCredentials.Droid +{ + public class CredentialsService : ICredentialsService + { + public string UserName { + get { + var account = AccountStore.Create (Forms.Context).FindAccountsForService (App.AppName).FirstOrDefault (); + return (account != null) ? account.Username : null; + } + } + + public string Password { + get { + var account = AccountStore.Create (Forms.Context).FindAccountsForService (App.AppName).FirstOrDefault (); + return (account != null) ? account.Properties ["Password"] : null; + } + } + + public void SaveCredentials (string userName, string password) + { + if (!string.IsNullOrWhiteSpace (userName) && !string.IsNullOrWhiteSpace (password)) { + Account account = new Account { + Username = userName + }; + account.Properties.Add ("Password", password); + AccountStore.Create (Forms.Context).Save (account, App.AppName); + } + } + + public void DeleteCredentials () + { + var account = AccountStore.Create (Forms.Context).FindAccountsForService (App.AppName).FirstOrDefault (); + if (account != null) { + AccountStore.Create (Forms.Context).Delete (account, App.AppName); + } + } + + + public bool DoCredentialsExist () + { + return AccountStore.Create (Forms.Context).FindAccountsForService (App.AppName).Any () ? true : false; + } + } +} diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/MainActivity.cs b/cross-platform/xamarin-forms/StoreCredentials/Droid/MainActivity.cs new file mode 100644 index 0000000..cb7aae9 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/MainActivity.cs @@ -0,0 +1,26 @@ +using System; + +using Android.App; +using Android.Content; +using Android.Content.PM; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.OS; + +namespace StoreCredentials.Droid +{ + [Activity (Label = "StoreCredentials.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity + { + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + global::Xamarin.Forms.Forms.Init (this, bundle); + + LoadApplication (new App ()); + } + } +} + diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Properties/AndroidManifest.xml b/cross-platform/xamarin-forms/StoreCredentials/Droid/Properties/AndroidManifest.xml new file mode 100644 index 0000000..eef6926 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/Properties/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Properties/AssemblyInfo.cs b/cross-platform/xamarin-forms/StoreCredentials/Droid/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3fd981a --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Android.App; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("StoreCredentials.Droid")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("davidbritch")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/AboutResources.txt b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/AboutResources.txt new file mode 100644 index 0000000..10f52d4 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/AboutResources.txt @@ -0,0 +1,44 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.axml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable/ + icon.png + + layout/ + main.axml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called "R" +(this is an Android convention) that contains the tokens for each one of the resources +included. For example, for the above Resources layout, this is what the R class would expose: + +public class R { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main +to reference the layout/main.axml file, or R.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/Resource.designer.cs b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/Resource.designer.cs new file mode 100644 index 0000000..684ecbb --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/Resource.designer.cs @@ -0,0 +1,82 @@ +#pragma warning disable 1591 +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 4.0.30319.17020 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ + +[assembly: Android.Runtime.ResourceDesignerAttribute("StoreCredentials.Droid.Resource", IsApplication=true)] + +namespace StoreCredentials.Droid +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public static void UpdateIdValues() + { + global::Xamarin.Forms.Platform.Resource.String.ApplicationName = global::StoreCredentials.Droid.Resource.String.ApplicationName; + global::Xamarin.Forms.Platform.Resource.String.Hello = global::StoreCredentials.Droid.Resource.String.Hello; + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class Drawable + { + + // aapt resource value: 0x7f020000 + public const int icon = 2130837504; + + static Drawable() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Drawable() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f030001 + public const int ApplicationName = 2130903041; + + // aapt resource value: 0x7f030000 + public const int Hello = 2130903040; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-hdpi/icon.png b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-hdpi/icon.png new file mode 100644 index 0000000..964f110 Binary files /dev/null and b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-hdpi/icon.png differ diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-xhdpi/icon.png b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-xhdpi/icon.png new file mode 100644 index 0000000..3c01e60 Binary files /dev/null and b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-xhdpi/icon.png differ diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-xxhdpi/icon.png b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-xxhdpi/icon.png new file mode 100644 index 0000000..0d8c1c5 Binary files /dev/null and b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable-xxhdpi/icon.png differ diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable/icon.png b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable/icon.png new file mode 100644 index 0000000..b0ba715 Binary files /dev/null and b/cross-platform/xamarin-forms/StoreCredentials/Droid/Resources/drawable/icon.png differ diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/StoreCredentials.Droid.csproj b/cross-platform/xamarin-forms/StoreCredentials/Droid/StoreCredentials.Droid.csproj new file mode 100644 index 0000000..89f29e4 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/StoreCredentials.Droid.csproj @@ -0,0 +1,103 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {34025984-011D-4FB1-B406-A7286304BABF} + Library + StoreCredentials.Droid + Assets + Resources + Properties\AndroidManifest.xml + Resource + Resources\Resource.designer.cs + True + True + StoreCredentials.Droid + v5.1 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + None + false + + + full + true + bin\Release + prompt + 4 + false + false + + + + + + + + ..\packages\Xamarin.Forms.1.5.0.6447\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll + + + ..\packages\Xamarin.Forms.1.5.0.6447\lib\MonoAndroid10\FormsViewGroup.dll + + + ..\packages\Xamarin.Forms.1.5.0.6447\lib\MonoAndroid10\Xamarin.Forms.Core.dll + + + ..\packages\Xamarin.Forms.1.5.0.6447\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll + + + ..\packages\Xamarin.Forms.1.5.0.6447\lib\MonoAndroid10\Xamarin.Forms.Platform.dll + + + ..\packages\Xamarin.Android.Support.v4.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll + + + ..\Components\xamarin.auth-1.2.3.1\lib\android\Xamarin.Auth.Android.dll + + + + + {39F7BCA7-D6B2-40D6-863A-9C712421A297} + StoreCredentials + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.2.3.1 + False + + + \ No newline at end of file diff --git a/cross-platform/xamarin-forms/StoreCredentials/Droid/packages.config b/cross-platform/xamarin-forms/StoreCredentials/Droid/packages.config new file mode 100644 index 0000000..9fd4338 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/Droid/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/cross-platform/xamarin-forms/StoreCredentials/README.md b/cross-platform/xamarin-forms/StoreCredentials/README.md new file mode 100644 index 0000000..349e761 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/README.md @@ -0,0 +1,3 @@ +This recipe shows how to securely store data in an account store that's backed by Keychain services in iOS, and the `KeyStore` class in Android. + +The full recipe can be found [here](http://developer.xamarin.com/recipes/cross-platform/xamarin-forms/store-credentials/). diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials.sln b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials.sln new file mode 100644 index 0000000..97366cb --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials.sln @@ -0,0 +1,57 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoreCredentials", "StoreCredentials\StoreCredentials.csproj", "{39F7BCA7-D6B2-40D6-863A-9C712421A297}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoreCredentials.iOS", "iOS\StoreCredentials.iOS.csproj", "{0366472A-80F1-41ED-BD2C-8F3A3D0E7662}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoreCredentials.Droid", "Droid\StoreCredentials.Droid.csproj", "{34025984-011D-4FB1-B406-A7286304BABF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhone = Release|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Debug|iPhone.ActiveCfg = Debug|iPhone + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Debug|iPhone.Build.0 = Debug|iPhone + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Release|Any CPU.ActiveCfg = Release|iPhone + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Release|Any CPU.Build.0 = Release|iPhone + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Release|iPhone.ActiveCfg = Release|iPhone + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Release|iPhone.Build.0 = Release|iPhone + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {0366472A-80F1-41ED-BD2C-8F3A3D0E7662}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {34025984-011D-4FB1-B406-A7286304BABF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Debug|iPhone.Build.0 = Debug|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Release|Any CPU.Build.0 = Release|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Release|iPhone.ActiveCfg = Release|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Release|iPhone.Build.0 = Release|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {34025984-011D-4FB1-B406-A7286304BABF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Debug|iPhone.Build.0 = Debug|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Release|Any CPU.Build.0 = Release|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Release|iPhone.ActiveCfg = Release|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Release|iPhone.Build.0 = Release|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {39F7BCA7-D6B2-40D6-863A-9C712421A297}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/App.cs b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/App.cs new file mode 100644 index 0000000..c26e9ed --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/App.cs @@ -0,0 +1,34 @@ +using Xamarin.Forms; + +namespace StoreCredentials +{ + public class App : Application + { + public static string AppName { get { return "StoreAccountInfoApp"; } } + + public App () + { + if (DependencyService.Get ().DoCredentialsExist ()) { + MainPage = new NavigationPage (new HomePage ()); + } else { + MainPage = new NavigationPage (new LoginPage ()); + } + } + + protected override void OnStart () + { + // Handle when your app starts + } + + protected override void OnSleep () + { + // Handle when your app sleeps + } + + protected override void OnResume () + { + // Handle when your app resumes + } + } +} + diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/Constants.cs b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/Constants.cs new file mode 100644 index 0000000..5028888 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/Constants.cs @@ -0,0 +1,8 @@ +namespace StoreCredentials +{ + public static class Constants + { + public static string Username = "Xamarin"; + public static string Password = "password"; + } +} diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePage.xaml b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePage.xaml new file mode 100644 index 0000000..a89fac9 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePage.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePage.xaml.cs b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePage.xaml.cs new file mode 100644 index 0000000..c51d04f --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePage.xaml.cs @@ -0,0 +1,20 @@ +using System; +using Xamarin.Forms; + +namespace StoreCredentials +{ + public partial class HomePage : ContentPage + { + public HomePage () + { + InitializeComponent (); + } + + async void OnLogoutButtonClicked (object sender, EventArgs e) + { + DependencyService.Get ().DeleteCredentials (); + Navigation.InsertPageBefore (new LoginPage (), this); + await Navigation.PopAsync (); + } + } +} diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePageCS.cs b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePageCS.cs new file mode 100644 index 0000000..27c1d97 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/HomePageCS.cs @@ -0,0 +1,35 @@ +using System; +using Xamarin.Forms; + +namespace StoreCredentials +{ + public class HomePageCS : ContentPage + { + public HomePageCS () + { + var toolbarItem = new ToolbarItem { + Text = "Logout" + }; + toolbarItem.Clicked += OnLogoutButtonClicked; + ToolbarItems.Add (toolbarItem); + + Title = "Home Page"; + Content = new StackLayout { + Children = { + new Label { + Text = "Main app content goes here", + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.CenterAndExpand + } + } + }; + } + + async void OnLogoutButtonClicked (object sender, EventArgs e) + { + DependencyService.Get ().DeleteCredentials (); + Navigation.InsertPageBefore (new LoginPage (), this); + await Navigation.PopAsync (); + } + } +} diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/ICredentialsService.cs b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/ICredentialsService.cs new file mode 100644 index 0000000..62e18f1 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/ICredentialsService.cs @@ -0,0 +1,15 @@ +namespace StoreCredentials +{ + public interface ICredentialsService + { + string UserName { get; } + + string Password { get; } + + void SaveCredentials (string userName, string password); + + void DeleteCredentials (); + + bool DoCredentialsExist (); + } +} diff --git a/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/LoginPage.xaml b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/LoginPage.xaml new file mode 100644 index 0000000..2049318 --- /dev/null +++ b/cross-platform/xamarin-forms/StoreCredentials/StoreCredentials/LoginPage.xaml @@ -0,0 +1,16 @@ + + + + +