Skip to content

Instantly share code, notes, and snippets.

View ufukhawk's full-sized avatar

Ufuk ufukhawk

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:DataTriggersFormsSample"
x:Class="DataTriggersFormsSample.MainPage">
<StackLayout VerticalOptions="StartAndExpand"
Padding="20,60,20,20">
<Entry x:Name="user"
Text=""
@ufukhawk
ufukhawk / ImageEntry.cs
Created February 14, 2019 17:39
ImageEntry bu kısım ortak katmanda yazılmalıdır.
public class ImageEntry : Entry
{
public ImageEntry(){
this.HeightRequest = 50;
}
public static readonly BindableProperty ImageProperty =
BindableProperty.Create(nameof(Image), typeof(string), typeof(ImageEntry), string.Empty);
public static readonly BindableProperty LineColorProperty =
BindableProperty.Create(nameof(LineColor), typeof(Xamarin.Forms.Color), typeof(ImageEntry), Color.White);
@ufukhawk
ufukhawk / EntryRendererAndroid.cs
Created February 14, 2019 17:42
Burada ortak katmanda oluşturduğum Entry'i çağırarak verdiğim özelliklere göre revize edeceğim.
namespace UISampleApp.Droid.Renderers
{
public class ImageEntryRenderer : EntryRenderer
{
ImageEntry element;
public ImageEntryRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
@ufukhawk
ufukhawk / EntryRendereriOS.cs
Created February 14, 2019 17:44
Burada ortak katmanda oluşturduğum Entry'i çağırarak verdiğim özelliklere göre revize edeceğim.
namespace UISampleApp.iOS.Renderers
{
public class ImageEntryRenderer : EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (e.OldElement != null || e.NewElement == null)
return;
@ufukhawk
ufukhawk / EntryRendererUsing.xaml
Created February 14, 2019 17:47
Bu kısımda oluşturduğumuz EntryImagerenderer'ı nasıl kullanacağımız yer alıyor.
<StackLayout Padding="40" Spacing="10">
<local:ImageEntry TextColor="White"
PlaceholderColor="{StaticResource primary}"
Image="user"
Placeholder="Emil"
HorizontalOptions="FillAndExpand"/>
</StackLayout>
public class AudioPlayerService : IAudioPlayerService
{
private AVAudioPlayer _audioPlayer = null;
public Action OnFinishedPlaying { get; set; }
public AudioPlayerService()
{
}
public void Play(string pathToAudioFile)
public class AudioPlayerService : IAudioPlayerService
{
private MediaPlayer _mediaPlayer;
public Action OnFinishedPlaying { get; set; }
public AudioPlayerService()
{
}
public class AudioPlayerViewModel: INotifyPropertyChanged
{
private IAudioPlayerService _audioPlayer;
private bool _isStopped;
public event PropertyChangedEventHandler PropertyChanged;
public AudioPlayerViewModel(IAudioPlayerService audioPlayer)
{
_audioPlayer = audioPlayer;
@ufukhawk
ufukhawk / Android Accelereted
Created April 5, 2019 07:30
Android projesinde bulunan PNG resimleri optimize eder.
<PropertyGroup>
...
<AndroidExplicitCrunch>true</AndroidExplicitCrunch>
</PropertyGroup>
@ufukhawk
ufukhawk / XAMLC
Created April 5, 2019 07:44
XAML tasarımlarınızın derlenme süresini azaltır.
using Xamarin.Forms.Xaml;
...
[assembly: XamlCompilation (XamlCompilationOptions.Compile)]
namespace PhotoApp
{
...
}