Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
Thinking

Tuğçe Arar stugcearar

🐼
Thinking
View GitHub Profile
@stugcearar
stugcearar / gist:a0bf9eaa92925e77da2141f2209cc15c
Created Feb 5, 2017 — forked from brianmed/gist:4e458d9116889b798a8c
Xamarin Forms custom webView renderer with activity load
View gist:a0bf9eaa92925e77da2141f2209cc15c
***
In Shared code:
public class WebViewPage : ContentPage
{
}
...
await Navigation.PushAsync (new WebViewPage());
View slider.xaml
<StackLayout VerticalOptions="Center">
<Label x:Name="lblText" Text="0" HorizontalOptions="Start" FontSize="Micro" HorizontalTextAlignment="Center" VerticalOptions="EndAndExpand" >
<Label.Margin>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS" Value="15,0" />
<On Platform="Android" Value="10,0" />
</OnPlatform>
</Label.Margin>
</Label>
<Slider x:Name="mySlider" Maximum="10000" Minimum="100" HorizontalOptions="FillAndExpand" ValueChanged="Handle_ValueChanged" >
View EmptyCollectionContractResolver.cs
class EmptyCollectionContractResolver : DefaultContractResolver {
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) {
JsonProperty property = base.CreateProperty(member, memberSerialization);
Predicate<object> shouldSerialize = property.ShouldSerialize;
property.ShouldSerialize = obj => (shouldSerialize == null || shouldSerialize(obj)) && !IsEmptyCollection(property, obj);
return property;
}
private bool IsEmptyCollection(JsonProperty property, object target) {
View LayoutPage.xmal
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.LayoutPage">
<ContentPage.Content>
<StackLayout>
<Image Source="icon.png" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
View slider.cs
void Slider_ValueChanged(object sender, Xamarin.Forms.ValueChangedEventArgs e)
{
var newStep = Math.Round(e.NewValue / 100);
mySlider.Value = newStep * 100;
lblText.Text = mySlider.Value.ToString();
lblText.TranslateTo(mySlider.Value * ((mySlider.Width - 40) / mySlider.Maximum) , 0, 100);
}
@stugcearar
stugcearar / Badge.cs
Created Apr 11, 2018 — forked from rudyryk/Badge.cs
C# — Xamarin.Forms custom simple badge view + rounded box view via custom renderer
View Badge.cs
//
// Badge.cs
// Created by Alexey Kinev on 19 Jan 2015.
//
// Licensed under The MIT License (MIT)
// http://opensource.org/licenses/MIT
//
// Copyright (c) 2015 Alexey Kinev <alexey.rudy@gmail.com>
//
using System;
View swagger1.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyWebAPI Helper Page");
});
View swagger2.cs
public void ConfigureServices(IServiceCollection services)
{
//Helper için
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
{
Version = "v1",
Title = "My Web API",
Description = "Awesome WEB API",
View ListViewPage.xaml
<?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:control="clr-namespace:XFEmptyViewSample.Controls"
xmlns:helper="clr-namespace:XFEmptyViewSample.Helpers"
xmlns:viewmodel="clr-namespace:XFEmptyViewSample.ViewModels"
x:Class="XFEmptyViewSample.Views.ListViewPage" Title="Birds">
<ContentPage.BindingContext>
<viewmodel:ListViewPageViewModel/>
</ContentPage.BindingContext>
View ListViewPageViewModel.cs
public class ListViewPageViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName]string propertyName = "") => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private IList<Birds> birdsList;
bool isRefreshing;
private bool isEmpty;
public bool IsEmpty
You can’t perform that action at this time.