davidbritch / xamarin-forms Goto Github PK
View Code? Open in Web Editor NEWSamples for Xamarin.Forms
License: MIT License
Samples for Xamarin.Forms
License: MIT License
Enterprise-Application-Patterns-using-XamarinForms.pdf
Is there a Chinese version of this document?
do you have a plan to translate this document into Chinese? Thank you!
Hello David,
The AnimationDemoPage throws an exception when clicking on the button during animation:
System.InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
I found how to inactivate the button during the animation:
<Button.Behaviors>
<behaviors:EventHandlerBehavior EventName="Clicked">
<behaviors:SetPropertyAction TargetObject="{x:Reference runAnimationButton}" PropertyName="IsEnabled" Value="false" />
<behaviors:SetPropertyAction TargetObject="{x:Reference stopAnimationButton}" PropertyName="IsEnabled" Value="true" />
<behaviors:SetPropertyAction TargetObject="{x:Reference stopAnimationButton}" PropertyName="IsVisible" Value="true" />
...
<behaviors:SetPropertyAction TargetObject="{x:Reference runAnimationButton}" PropertyName="IsEnabled" Value="true" />
<behaviors:SetPropertyAction TargetObject="{x:Reference stopAnimationButton}" PropertyName="IsEnabled" Value="false" />
But I did not find how to cancel the animation by clicking on the "Stop animation" button.
Here what I tried out:
Above code for stopAnimationButton plus:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:behaviors="clr-namespace:Behaviors;assembly=Behaviors"
x:Class="Behaviors.Sample.AnimationDemoPage"
x:Name="animationPage"
Title="Animation Demo"
Icon="xaml.png">
<Button x:Name="stopAnimationButton" Text="Stop animation (ineffective)" IsVisible="true" IsEnabled="false">
<Button.Behaviors>
<behaviors:EventHandlerBehavior EventName="Clicked">
<behaviors:InvokeMethodAction TargetObject="{x:Reference animationPage}" MethodName="OnStopAnimation" />
<behaviors:SetPropertyAction TargetObject="{x:Reference runAnimationButton}" PropertyName="IsEnabled" Value="true" />
</behaviors:EventHandlerBehavior>
</Button.Behaviors>
</Button>
public void **OnStopAnimation**(object sender, EventArgs args)
{
//KO no animation.Commit(.., "animationID", ...) defined: this.AbortAnimation("animationID";
//KO still same runtime exception: ViewExtensions.**CancelAnimations**(image);
ViewExtensions.**CancelAnimations**(this); //KO: no effect (but no exception neither)
}
Any idea?
Thanks.
Best regards,
Nikolas
@davidbritch
Do you have an example of how your Duende (IdentityServer) is configured for the folder demo 'WebAuthenticatorDemo'?
Thanks!
Hello David,
This look great! I am searching now for a week to get a solutions like the Azure app for IOS.. you get only a cancel button.. i try many options but nothings is working like that.. to hide the default buttons, do you have some tips ?
The codes works well. My issue is, it never goes back to the app after logging in.
[Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop)]
[IntentFilter(new[] { Android.Content.Intent.ActionView },
Categories = new[] { Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable },
DataScheme = Constants.DataScheme,
DataHost = Constants.DataHost
)]
public class WebAuthenticationCallbackActivity : Xamarin.Essentials.WebAuthenticatorCallbackActivity
{
public WebAuthenticationCallbackActivity()
{
}
}
public static class Constants
{
public const string DataScheme = "oauth2test";
public const string DataHost = "callback";
//public static string AuthorityUri = "https://demo.identityserver.io";
//public static string AuthorizeUri = "https://staging-xoxo.se/Account/login";
public static string AuthorizeUri = "https://id-staging-xoxo.se/Account/login";
public static string TokenUri = "https://id-staging-xoxo.se";
public static string ApiUri = "https://api-staging-xoxo.se";
public static string RedirectUri = "oauth2test://callback";
public static string ClientId = "xoxo";
//public static string ClientSecret = "xoxo";
public static string Scope = "openid profile api roles userinfo";
}
private async void Button_Clicked(object sender, EventArgs e)
{
identityService = new IdentityService(new RequestProvider());
string url = identityService.CreateAuthorizationRequest();
Debug.WriteLine(url);
var authresult = await WebAuthenticator.AuthenticateAsync(
new Uri(url),
new Uri(Constants.RedirectUri)
);
string raw = ParseAuthenticatorResult(authresult);
authorizeResponse = new AuthorizeResponse(raw);
if (authorizeResponse.IsError)
{
Console.WriteLine("ERROR: {0}", authorizeResponse.Error);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.