Skip to content

Instantly share code, notes, and snippets.

View gist:9508013
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Web.Syndication;
namespace App1
{
View MainPage.xaml
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App11"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core" xmlns:Media="using:Microsoft.Xaml.Interactions.Media"
x:Class="App11.MainPage"
mc:Ignorable="d">
<Page.Resources>
View sample.cs
// こんなんどっかで用意して
interface IDloalogService
{
Task<bool> Confirm(string content, string title);
}
class DialogService : IDialogService
{
private static IDialogService instance;
public static IDialogService Instance
View rxvnext.cs
using Codeplex.Reactive;
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Reactive.Linq;
using System.Runtime.CompilerServices;
namespace CSharp_vNext_ConsoleApplication2
{
class Program
View 詰めが甘い
using Codeplex.Reactive.Extensions;
using Codeplex.Reactive.Notifiers;
using System;
using System.Diagnostics;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Subjects;
namespace ConsoleApplication6
View MainActivity.cs
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Codeplex.Reactive.Binding;
using Codeplex.Reactive;
using Codeplex.Reactive.Extensions;
View gist:28118c56e008c592a361
// ネットに接続されてる間はtrueとか
var connected = new BooleanNotifier();
// ダウンロード中はtrueとか
var downloading = new BooleanNotfier();
var command = new[]
{
connected,
downloading.Select(x => !x)
}
View a
// これなら作れるかも
this.Name = model
.ObserveProperty(x => x.Name)
.ToReactiveProperty()
.SetValidateNotifyError(x =>
string.IsNullOrWhiteSpace(x) ? "Name is required" : null)
.Valid(x => model.Name = x);
View NewEvt2Rx.cs
using Codeplex.Reactive;
using System;
using System.Reactive;
using System.Reactive.Subjects;
using System.Windows;
using System.Windows.Interactivity;
using System.Reactive.Linq;
namespace WpfApplication1
{
View rx.cs
IsAnyToBeErased = Profiles
.CollectionChangedAsObservable()
.SelectMany(_ => Observable.Defer<bool>(() =>
{
return Profiles.Select(x => x.ObserveProperty(y => y.IsToBeErased)).Merge();
}))
.Select(_ => Profiles.Any(x => x.IsToBeErased))
.ToReactiveProperty();