コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Angeldude/sodium
        public MainWindow()
        {
            this.InitializeComponent();

            this.Container.Children.Add(Transaction.Run(() =>
            {
                FrButton ok = new FrButton(Cell.Constant("OK"));
                FrButton cancel = new FrButton(Cell.Constant("Cancel"));
                IReadOnlyList<Fridget> fridgets = new[] { ok, cancel };
                Fridget dialog = new FrFlow(Orientation.Horizontal, fridgets);
                IListener lOk = ok.SClicked.Listen(_ => this.AddMessage("OK"));
                IListener lCancel = cancel.SClicked.Listen(_ => this.AddMessage("Cancel"));
                return new FrView(this, dialog, new ImmutableCompositeListener(new[] { lOk, lCancel }));
            }));
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Angeldude/sodium
        public MainWindow()
        {
            this.InitializeComponent();

            this.Container.Children.Add(Transaction.Run(() =>
            {
                FrTextField firstName = new FrTextField("Joe");
                FrTextField lastName = new FrTextField("Bloggs");
                FrButton ok = new FrButton(Cell.Constant("OK"));
                FrButton cancel = new FrButton(Cell.Constant("Cancel"));
                IReadOnlyList<Fridget> buttons = new[] { ok, cancel };
                Fridget buttonPanel = new FrFlow(Orientation.Horizontal, buttons);
                IReadOnlyList<Fridget> fridgets = new[] { buttonPanel, firstName, lastName };
                Fridget dialog = new FrFlow(Orientation.Vertical, fridgets);
                IListener lOk = ok.SClicked.Snapshot(firstName.Text, lastName.Text, (_, f, l) => f + " " + l).Listen(n => this.AddMessage("OK: " + n));
                IListener lCancel = cancel.SClicked.Listen(_ => this.AddMessage("Cancel"));
                return new FrView(this, dialog, new ImmutableCompositeListener(new[] { lOk, lCancel }));
            }));
        }