This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace TipCalc | |
open FSharp.ViewModule | |
open System | |
type TipCalcModel() as self = | |
inherit ViewModelBase() | |
// Create our backing fields | |
let subTotal = self.Factory.Backing(<@ self.SubTotal @>, 0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region | |
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using Cmc.Core.ComponentModel; | |
using Cmc.Core.Diagnostics; | |
using Cmc.Installer.Core.Tasks; | |
#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Learn more about F# at http://fsharp.net | |
// See the 'F# Tutorial' project for more help. | |
open System.Diagnostics | |
[<EntryPoint>] | |
let main argv = | |
let sequ = seq [ 1 .. 10000000 ] | |
let cach = ResizeArray<_>(sequ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
public sealed class RwLock : IDisposable | |
{ | |
private readonly ReaderWriterLockSlim _innerLock = new ReaderWriterLockSlim(); | |
private bool _disposed = false; | |
public IDisposable Read() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// An <see cref="ICommand"/> whose delegates do not take any parameters for <see cref="Execute"/> and <see cref="CanExecute"/>. | |
/// </summary> | |
public class ActionCommand : DelegateCommandBase | |
{ | |
/// <summary> | |
/// Initializes a new instance of the <see cref="ActionCommand"/> class with the <see cref="Action"/> to invoke on execution. | |
/// </summary> | |
/// <param name="executeMethod">The execute method.</param> | |
/// <param name="useCommandManager">if set to <c>true</c> use the command manager instead of our own event process for CanExecuteChanged Tracking.</param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ForestUpdate = | |
| Add of Tree * Forest | |
| Decorate of Tree * Forest | |
type ForestUpdateResult = | |
| Success of Forest | |
| Pruned of Forest | |
| Error of string | |
module ForestManager = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let application = | |
// Create our forest, wrapped in a mutable with an atomic update function | |
let forest = new AsyncMutable<_>(Forest.empty) | |
// Create our 3 functions for the application framework | |
// Start with the function to create our model (as an ISignal<'a>) | |
let createModel () : ISignal<_> = forest :> _ | |
// Create a function that updates our state given a message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
IMsg test = new S2("foo", "bar"); | |
switch (test) | |
{ | |
// How do I simplify this??? I'd like to "match and deconstruct" as a oneliner if possible | |
case S1 s1: | |
{ | |
int foo = s1.Data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let application nav = | |
// Start pruning "loop" via Executor type | |
let prune = new Executor<_,_>(pruneHandler) | |
prune.Start() | |
// Start our application, and attach the executor so messages dispatch to the application | |
Framework.application Forest.empty Forest.update forestComponent nav | |
|> Framework.withDispatcher prune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<STAThread>] | |
[<EntryPoint>] | |
let main _ = | |
let app () = | |
AppBuilder.Configure<App>().UsePlatformDetect().LogToDebug().SetupWithoutStarting().Instance | |
let nav = Gjallarhorn.Avalonia.Navigation.singleView app MainWindow | |
let app' = Program.application nav.Navigate | |
Gjallarhorn.Avalonia.Framework.RunApplication<Forest,unit,ForestMessage> (nav, app') |
OlderNewer