Skip to content

Instantly share code, notes, and snippets.

View ytabuchi's full-sized avatar
😊
Always happy

Yoshito Tabuchi ytabuchi

😊
Always happy
  • XLsoft-Corporation
  • Tokyo, Japan
  • X @ytabuchi
View GitHub Profile
@ytabuchi
ytabuchi / file0.txt
Last active August 29, 2015 14:22
Nexus 5 に Android M Developer Preview をインストール (sig がない旨のエラーを乗り越えて) ref: http://qiita.com/ytabuchi/items/28d66b7e69146086fe13
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
failed to allocate 1046915228 bytes
error: update package missing system.img
@ytabuchi
ytabuchi / BottomBarRender.cs
Created June 16, 2015 02:57
BottomBar Renderer
using System;
using System.Collections.Generic;
using MonoTouch.UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using CustomFormsSample.Views;
using CustomFormsSample.iOS.Views;
@ytabuchi
ytabuchi / file0.xml
Last active August 29, 2015 14:23
Xamarin.Forms で IValueConverter を使う ref: http://qiita.com/ytabuchi/items/623eca74c4377d8afba1
<ContentPage.Resources>
<ResourceDictionary>
<cv:StringCaseConverter x:Key="scConverter" />
<cv:StringToLengthConverter x:Key="s2lConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout>
<Editor x:Name="editor" Text="test" />
<!-- ConverterParameter は "True" で UpperCase、"False" で LowerCase になります。
@ytabuchi
ytabuchi / program.cs
Last active August 29, 2015 14:23
住所から都道府県と地域を特定するクラスとメソッド
class Program
{
static void Main(string[] args)
{
// http://hogehoge.tk/personal/ で作成
var address = new List<Address> {
new Address { FullAddress = "沖縄県那覇市田原3-16-3" },
new Address { FullAddress = "愛媛県西条市天神2-1" },
...
...
@ytabuchi
ytabuchi / App.cs
Created July 25, 2015 05:21
ContentPage 用のスタイルです。
Application.Current.Resources = new ResourceDictionary();
var cpStyle = new Style(typeof(ContentPage))
{
Setters =
{
new Setter{ Property = ContentPage.BackgroundColorProperty, Value = Color.FromHex("333399") },
}
};
Application.Current.Resources.Add(cpStyle);
@ytabuchi
ytabuchi / AddUnlimitedListViewData.cs
Last active August 29, 2015 14:27
ListViewに延々とデータを追加するサンプル
// ItemsSource に ObservableCollection を使用すると Collection を更新するだけで自動的に ListView の表示も更新してくれます。
// これは ListView の ItemsSource に List<T> を使用した場合の悪例です。
// List を更新しても ListView の表示が更新されないため、手動で ItemsSource と ItemTemplate を再指定する必要があります。
// 標準の TextCell を new DataTemplate(typeof(TextCell)) してしまうと都度 SetBinding もしないといけないので、MyTextCell に SetBinding を内包しました。。
// 正しいやり方を
// http://ytabuchi.hatenablog.com/entry/2015/08/12/010522
// に記載しました。
class MainPageCS : ContentPage
{
@ytabuchi
ytabuchi / FlexibleListView.cs
Created September 3, 2015 06:04
ListViewの要素を動的に増したい場合はどうする?
var listItems = new ObservableCollection<CellItems>();
foreach (var i in Enumerable.Range(0, 10))
{
listItems.Add(new CellItems { StringItem = "StringItem-" + i });
}
var list = new ListView
{
HasUnevenRows = true,
ItemsSource = listItems,
@ytabuchi
ytabuchi / MainActivity.cs
Last active September 15, 2015 06:21
この例はAndroidですが他のOSでも一緒ですね。TextBlock/EditText(Decimalに入力制限済み) から Text を引っ張ってきて、数値に変換して計算に投げて結果を得る。
Spinner spinner;
EditText tbX;
EditText tbY;
TextView tvResult;
button.Click += (sender, e) => {
double xValue;
double yValue;
double resValue;
double number;
using System;
using Xamarin.Forms;
namespace Forms1
{
public class App : Application
{
public App ()
{
@ytabuchi
ytabuchi / xf_absolutelayout_move_object.cs
Last active November 30, 2015 10:05
AbsoluteLayout でオブジェクトを動かしたい
using DeviceMotion.Plugin;
using DeviceMotion.Plugin.Abstractions;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Xamarin.Forms;