using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Xamarin.Forms;
namespace TaxPon.View.Converter
{
public class IntEnumConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Enum)
{
return (int)value;
}
return 0;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int)
{
return Enum.ToObject(targetType, value);
}
return 0;
}
}
}
using Reactive.Bindings;
using Reactive.Bindings.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using TaxPon.Model;
using TaxPon.View.Themes;
using Xamarin.Forms;
namespace TaxPon.ViewModel
{
public class SettingViewModel : IDisposable
{
public ReactiveProperty<ThemeType> SelectedTheme { get; }
private CompositeDisposable Disposable { get; } = new CompositeDisposable();
public List<string> Themes { get; } = Enum.GetNames(typeof(ThemeType)).ToList();
public SettingViewModel()
{
//Enum
this.SelectedTheme = new ReactiveProperty<ThemeType>();
.AddTo(this.Disposable);
//Picker変更
this.SelectedTheme.ObserveProperty(x => x.Value)
.Subscribe(x => { //ここにPickerの選択が変更されたときの処理を書く
Console.WriteLine(x);
})
.AddTo(this.Disposable);
}
public void Dispose()
{
this.Disposable.Dispose();
}
}
}