question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Static View submodel sample

See original GitHub issue

I don’t understand I it function of Binding.subModel and how binding names correspond. Is there any sample available? For parameter binding it would be very helpful too

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

2reactions
xperiandricommented, Mar 15, 2020
module Biblioteko.Mobile.Program

open System
open Elmish
open Elmish.Uno

type Model =
  { Count: int
    StepSize: int }

let init () =
  { Count = 0
    StepSize = 1 }

type Msg =
  | Increment
  | Decrement
  | SetStepSize of int
  | Reset

let update msg m =
  match msg with
  | Increment -> { m with Count = m.Count + m.StepSize }
  | Decrement -> { m with Count = m.Count - m.StepSize }
  | SetStepSize x -> { m with StepSize = x }
  | Reset -> init ()

let bindings model dispatch =
  [
    "CounterValue" |> Binding.oneWay (fun m -> m.Count)
    "Increment" |> Binding.cmd (fun m -> Increment)
    "Decrement" |> Binding.cmd (fun m -> Decrement)
    "StepSize" |> Binding.twoWay
      (fun m -> float m.StepSize)
      (fun v m -> int v |> SetStepSize)
    "Reset" |> Binding.cmdIf (fun _ -> Reset) (fun m -> m <> init ())
  ]

let createApp windowBuilder =
    let program = Program.mkSimple init update bindings
    program |> Program.createApp ElmConfig.Default windowBuilder
namespace Frebo.Biblioteko.Mobile

open System

open Android.App
open Com.Nostra13.Universalimageloader.Core
open Windows.UI.Xaml
open Windows.UI.Xaml.Media

open Elmish.Uno

open Microsoft.AppCenter
open Microsoft.AppCenter.Analytics
open Microsoft.AppCenter.Crashes

open Biblioteko.Mobile
open Biblioteko.Mobile.Constants

[<Application(
#if DEBUG
    Debuggable = true,
#else
    Debuggable = false,
#endif
    Label = "@string/ApplicationName",
    LargeHeap = true,
    HardwareAccelerated = true,
    Theme = "@style/AppTheme"
    )>]
type MainApplication private (windowBuilder, javaReference, transer) =
    inherit NativeApplication (Program.createApp windowBuilder, javaReference, transer)

    new (javaReference, transer) as this =
        let builder () = new MainPage() :> FrameworkElement
        new MainApplication (builder, javaReference, transer)
        then
            do this.ConfigureUniversalImageLoader()

    member private this.ConfigureUniversalImageLoader () =
        // Create global configuration and initialize ImageLoader with this config
        let config =
            (new ImageLoaderConfiguration
                .Builder(NativeApplication.Context))
                .Build();
        ImageLoader.Instance.Init (config)
        ImageSource.DefaultImageLoader <-
            ImageSource.ImageLoaderHandler(fun ct uri imageView targetSize ->  ImageLoader.Instance.LoadImageAsync (ct, uri, imageView, targetSize))
        ()

This is how it looks: C# Views projects reference shared project (because XAML must be rewritten to C# by Uno code generation package). Then F# Android and F# iOS apps reference views projects

image

0reactions
Yakimychcommented, Mar 15, 2020

Elmish.Uno looks interesting - can it be used for iOS/Android app development? The static-view branch is fully functional, at least when it comes to AboutPage.xaml - it binds to the text and re-renders correctly after the SetSomeText command gets dispatched.

What I didn’t manage to get to work is the MVU loop inside a page shown via shell.Navigation.PushModalAsync, but maybe you don’t need this scenario in your case?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Submodeling in ANSYS Mechanical: Easy, Efficient, and ...
We called the refined model a zoom model or a submodel. ... our course model as an equivalent static deflection load and the...
Read more >
Creating a Submodeling Study - 2021
A submodeling study is created from an eligible static or nonlinear static study. You refine the mesh of the submodel to get more...
Read more >
ABAQUS Analysis User's Manual (v6.6)
For example, a static analysis performed in ABAQUS/Standard can drive a quasi-static ABAQUS/Explicit analysis in the submodel. The step time used in these ......
Read more >
What Can I Do With a SubModel?
With SubModels, you could simulate this by inserting a SubModel (e.g., a static optimization) within an outer model (e.g., a dynamic simulation). Example...
Read more >
About submodeling
For example, a static analysis performed in Abaqus/Standard can drive a quasi-static Abaqus/Explicit analysis in the submodel. The step time used in these ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found