Skip to content

Instantly share code, notes, and snippets.

Angelo Luis Rodrigues Da Silva angelobelchior

Block or report user

Report or block angelobelchior

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CreatePolicy.cs
private AsyncRetryPolicy CreatePolicy(RetryPolicyConfiguration retryPolicyConfiguration)
=> Policy.Handle<Exception>(e => true)
.WaitAndRetryAsync(retryCount: retryPolicyConfiguration.RetryCount,
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryPolicyConfiguration.RetryAttemptFactor))
);
View get_retry.cs
protected async Task<Result<T>> Get<T>(string url)
{
return await this._asyncRetryPolicy.ExecuteAsync(async () =>
{
var response = await this._httpClient.GetAsync(url);
return await this.GetRequestContent<T>(response);
});
}
View servicebase.cs
public abstract class ServiceBase
{
private readonly HttpClient _httpClient;
private readonly AsyncRetryPolicy _asyncRetryPolicy;
public ServiceBase(HttpClient httpClient, RetryPolicyConfiguration retryPolicyConfiguration)
{
this._httpClient = httpClient;
this._asyncRetryPolicy = this.CreatePolicy(retryPolicyConfiguration);
}
View platform_specifics_ios.cs
// Adiciona-se o namespace
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
// E no método OnAppearing...
protected override void OnAppearing()
{
base.OnAppearing();
this.On<iOS>().SetUseSafeArea(true);
this.On<iOS>().SetPrefersLargeTitles(true);
}
View platform_specifics_xaml.xaml
<?xml version="1.0" encoding="utf-8"?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:TabbedPage.ToolbarPlacement="Bottom"
View platform_specifics_code_behind.cs
// Adiciona-se o namespace
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
// E no método OnAppearing...
protected override void OnAppearing()
{
base.OnAppearing();
this.On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
}
View FontImageMarkupExtension_after.xaml
<ImageButton Source="{FontImage FontFamily={StaticResource MyFontFamily},
Glyph={StaticResource SmileFace},
Color={StaticResource White}" />
View FontImageMarkupExtension_Before.xaml
<ImageButton>
<ImageButton.Source>
<FontImageSource
FontFamily="{StaticResource MyFontFamily}"
Glyph="{StaticResource SmileFace}"
Color="{StaticResource PrimaryColor}" />
</Image.Source>
</ImageButton>
View welcome-message-bot-framework.cs
private async Task ShowWelcomeMessage(Activity activity)
{
if (activity is IConversationUpdateActivity conversationUpdated)
{
var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
foreach (var member in conversationUpdated.MembersAdded ?? Array.Empty<ChannelAccount>())
{
if (member.Id == conversationUpdated.Recipient.Id)
{
var reply = Actions.WelcomeMessage(activity);
View BotActivityLogger.cs
public sealed class BotActivityLogger : Microsoft.Bot.Builder.History.IActivityLogger
{
public async Task LogAsync(IActivity activity)
{
var message = activity.AsMessageActivity();
var text = message.Text;
}
}
[BotAuthentication]
You can’t perform that action at this time.