Skip to content

Commit

Permalink
Changed Fountain interface, made simple and fewer xaml elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed May 27, 2024
1 parent 2081f26 commit aa70b94
Show file tree
Hide file tree
Showing 12 changed files with 519 additions and 428 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@

using EpoxyHello.Models;
using EpoxyHello.Avalonia11.Controls;
using Avalonia.Input;

namespace EpoxyHello.Avalonia11.ViewModels;

[ViewModel]
public sealed class MainWindowViewModel
{
//public Command Ready { get; }
public Well ReadyWell { get; }
public Well<Window> MainWindowWell { get; } = Well.Factory.Create<Window>();

public bool IsEnabled { get; private set; }

Expand All @@ -49,12 +50,13 @@ public sealed class MainWindowViewModel
public MainWindowViewModel()
{
// A handler for window opened
//this.Ready = Command.Factory.Create(() =>
this.ReadyWell = Well.Factory.Create<Window>("Opened", () =>
{
this.IsEnabled = true;
return default;
});
this.MainWindowWell.Add(
Window.WindowOpenedEvent,
() =>
{
this.IsEnabled = true;
return default;
});

// A handler for fetch button
this.Fetch = Command.Factory.Create(async () =>
Expand Down
12 changes: 2 additions & 10 deletions playground/EpoxyHello.Avalonia11/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,13 @@
xmlns:converters="clr-namespace:EpoxyHello.Avalonia11.Views.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="EpoxyHello.Avalonia11.Views.MainWindow"
Title="EpoxyHello.Avalonia11">
Title="EpoxyHello.Avalonia11"
epoxy:Fountain.Well="{Binding MainWindowWell}">

<Window.DataContext>
<viewmodels:MainWindowViewModel />
</Window.DataContext>

<!--
<epoxy:EventBinder.Events>
<epoxy:Event EventName="Opened" Command="{Binding Ready}" />
</epoxy:EventBinder.Events>
-->
<epoxy:Fountain.Ducts>
<epoxy:Duct Well="{Binding ReadyWell}" />
</epoxy:Fountain.Ducts>

<DockPanel>
<Button DockPanel.Dock="Top"
Height="30" Foreground="White" Background="Red"
Expand Down
4 changes: 2 additions & 2 deletions src/Epoxy.Core/Anchor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
using Avalonia;
using System.Reactive;
using DependencyObject = Avalonia.IAvaloniaObject;
using UIElement = Avalonia.Controls.IControl;
using UIElement = Avalonia.Interactivity.Interactive;
#endif

#if AVALONIA11
using Avalonia;
using Avalonia.Reactive;
using DependencyObject = Avalonia.AvaloniaObject;
using UIElement = Avalonia.Controls.Control;
using UIElement = Avalonia.Interactivity.Interactive;
#endif

namespace Epoxy;
Expand Down
Loading

0 comments on commit aa70b94

Please sign in to comment.