Giter VIP home page Giter VIP logo

reactiveui.samples's Introduction

ReactiveUI.Samples

This repository will contain all of ReactiveUI samples.

Xamarin Forms

Example in Xamarin Forms (Android and iOS) shows you the upcoming movies from the movie api

Provides examples about:

  1. App's bootstrapping
  2. ViewModel first routing
  3. ListView integration
  4. ReactiveCommands
  5. ObservableAsPropertyHelper

Xamarin Native

Examples provided:

  1. Reactive Recycler View

Avalonia

To read navigation stack from disk, a suspension driver is required to support deserializing IRoutableViewModel interface implementations into more specific view model types, for Newtonsoft.Json this can be achieved by using TypeNameHandling.All json serialization setting. In the App.OnFrameworkInitializationCompleted method we initialize suspension stuff specific to our app. Don't forget to add .UseReactiveUI() and .StartWithClassicDesktopLifetime() to your app builder inside the Program.cs file.

Provides examples about:

  1. Suspension and Data Persistence
  2. ViewModel first routing
  3. ReactiveCommands

Note: Avalonia produce and support the ReactiveUI plugin. You can get support on their Gitter

Testing

Illustrates how to write testable and maintainable view models using ReactiveUI.Testing, XUnit and Microsoft.Reactive.Testing libraries. See related documentation. Contains immediate scheduling examples to make the tests run even faster by mocking long-running operations.

new TestScheduler().With(scheduler =>
{
    var fixture = new WebCallViewModel(new ImmediateWebService());
    fixture.InputText = "hi";

    // Run the clock forward to 800 ms. 
    // At that point, nothing should have happened.
    scheduler.AdvanceToMs(799);
    Assert.Equal(string.Empty, fixture.ResultText);

    // Run the clock 1 tick past and the result should show up.
    scheduler.AdvanceToMs(801);
    Assert.Equal("result hi", fixture.ResultText);
});

Universal Windows Platform

Provides examples about ReactiveUI routing for Universal Windows Platform.

Razor

Building a web app with ReactiveUI and Razor Components.

Follow the Razor Components tutorial on MSDN to get started. Heavily based on @akourbat's work.

More Avalonia samples

Self-contained multiplatform samples to help understanding: ReactiveX, ReactiveUI, Avalonia UI. Featuring links to original reference material for each fresh chunk of code, e.g.

// https://reactiveui.net/docs/handbook/events/#how-do-i-convert-my-own-c-events-into-observables
Observable
    .FromEventPattern(wndMain, nameof(wndMain.Closing))
    .Subscribe(_ => Console.WriteLine("Main window closing..."))
    .DisposeWith(disposables);

Uses a finite observable stream of timer ticks. At each tick a new greeting is displayed. The sample can be a template for ReactiveUI + Avalonia applications.

Topics: View, ViewModel, (de)activation, reactive property, type-safe bindings, WhenAnyValue, observable timer, UI thread and schedulers, window event.

Shows how to use async/await in a ReactiveUI context. It calls a dummy (but real) RESTful API.

Topics: command binding, ReactiveUI.Fody, Rx event pattern, async/await, timeout, json, Flurl.

reactiveui.samples's People

Contributors

anaisbetts avatar arielbh avatar denisivan0v avatar dependabot-preview[bot] avatar dr1rrb avatar genejo avatar ghuntley avatar glennawatson avatar gordonwatts avatar johnduhart avatar mishfit avatar mrxx99 avatar phenomx2 avatar rlittlesii avatar suvjunmd avatar tamirdresher avatar teadrivendev avatar worldbeater avatar zerhacken avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.