Skip to content

Instantly share code, notes, and snippets.

View sjehutch's full-sized avatar

scott hutchinson sjehutch

View GitHub Profile
@sjehutch
sjehutch / Log.cs
Created May 6, 2023 18:16
C# Logging - Move this to a service
public void Log(string message, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0)
{
Console.WriteLine($"[{memberName}({lineNumber}) in {filePath}]: {message}");
}
@sjehutch
sjehutch / android-icon.sh
Created January 5, 2023 14:02
android-icons.sh
#!/bin/bash
# Check if the required tools are installed
if ! [ -x "$(command -v convert)" ]; then
echo "Error: convert tool is not installed." >&2
exit 1
fi
if ! [ -x "$(command -v androidsdkmanager)" ]; then
echo "Error: Android SDK Manager is not installed." >&2
@sjehutch
sjehutch / add_ios_iconset.sh
Created January 4, 2023 23:34
add_iconset.sh
#Check if the convert and iconutil tools are installed. These tools are part of the ImageMagick suite and are required to create the iconset and icns file.
#!/bin/bash
# Check if the required tools are installed
if ! [ -x "$(command -v convert)" ]; then
echo "Error: convert tool is not installed." >&2
exit 1
fi
@sjehutch
sjehutch / CheckForUpdates.cs
Created December 1, 2022 14:45
Check for app update Xamarin Prism
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using HOApp.Core;
using HOApp.Core.Localization;
using Newtonsoft.Json.Linq;
using Prism;
using Xamarin.Essentials;
@sjehutch
sjehutch / AppStoreVersion.cs
Created November 29, 2022 19:28
Looking up App Store version Xamarin Forms
public static async Task<Version> GetITunesAppVersion()
{
try
{
string ITunesStoreURL = @"https://itunes.apple.com";
string route = @"lookup?bundleId=com.cinc.hoapp";
Version ITunesVersion = null;
using (var client = new HttpClient())
{
private void ScrollToTop()
{
if (app.Query(editButton).Any() && app.Query(editButton).FirstOrDefault().Text == "Done") //edit mode
{
if (!app.Query(addButton).Any())
app.ScrollUpTo("Gravity point");
}
else
{
var topItem = "";
@sjehutch
sjehutch / setting.xaml
Created March 18, 2022 09:00
toolbar item android Xamarin
<ToolbarItem
Order="Primary"
AutomationId="EmailButton"
Command="{Binding MailCommand}"
Priority="1" >
<ToolbarItem.IconImageSource>
<FontImageSource
FontFamily="{StaticResource FontAwesomeSolidFontFamily}"
Glyph="{x:Static constants:AppConstant.MailIcon}"
Color="{DynamicResource TertiaryTextColor}"
@sjehutch
sjehutch / Program.cs
Created December 2, 2021 05:50
IsPasswordVlid
private static bool IsPasswordValid(string password)
{
return password.Any(char.IsUpper) && password.Any(char.IsLower) && password.Any(char.IsDigit) && password.Length is >= 8 and <= 16;
}
<StackLayout Orientation="Vertical" Padding="30" Spacing="40">  
            <BoxView HeightRequest="10"/>  
            <Image HorizontalOptions="Center" WidthRequest="300" Source="maco.jpg"/>  
            <Frame BackgroundColor="#BF043055" HasShadow="False">  
                <StackLayout Orientation="Vertical" Spacing="10">  
                    <Entry x:Name="Email" Text="{Binding Email}" Placeholder="Email"   
                           PlaceholderColor="White" HeightRequest="40"   
                           Keyboard="Email"  
                           TextColor="White"/>  
                    <Entry x:Name="Password" Text="{Binding Password}" Placeholder="Senha"   
@sjehutch
sjehutch / PageService.cs
Created January 14, 2021 16:28
Page Navigation Xamarin Forms
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace NewYoutube.Services
{
public class PageService : IPageService
{
public async Task<bool> DisplayAlert(string title, string message, string ok, string cancel)
{