This commit is contained in:
Jöran Malek 2024-02-26 18:08:18 +01:00
parent b1d3ec73c9
commit 693d12b61c
35 changed files with 389 additions and 269 deletions

View file

@ -0,0 +1,14 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:InkForge.Desktop.ViewModels.Documents"
xmlns:inkforge="app:InkForge"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="450"
x:Class="InkForge.Desktop.Views.Documents.WelcomePageDocument"
x:DataType="vm:WelcomePageDocumentViewModel"
inkforge:TopLevels.Register="{CompiledBinding}">
Welcome to Avalonia!
</UserControl>

View file

@ -0,0 +1,13 @@
using Avalonia.ReactiveUI;
using InkForge.Desktop.ViewModels.Documents;
namespace InkForge.Desktop.Views.Documents;
public partial class WelcomePageDocument : ReactiveUserControl<WelcomePageDocumentViewModel>
{
public WelcomePageDocument()
{
InitializeComponent();
}
}

View file

@ -0,0 +1,12 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:inkforge="using:InkForge.Desktop.ViewModels"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="450"
x:Class="InkForge.Desktop.Views.DocumentsView"
x:DataType="inkforge:DocumentsViewModel">
<DockControl Layout="{CompiledBinding Layout}" />
</UserControl>

View file

@ -0,0 +1,24 @@
using Avalonia;
using Avalonia.Controls;
using InkForge.Desktop.ViewModels;
using Microsoft.Extensions.DependencyInjection;
namespace InkForge.Desktop.Views;
public partial class DocumentsView : UserControl
{
public DocumentsView()
{
InitializeComponent();
DataContext = CreateViewModel();
}
private static DocumentsViewModel CreateViewModel()
{
return ActivatorUtilities.CreateInstance<DocumentsViewModel>(
Application.Current!.GetValue(App.ServiceProviderProperty)
);
}
}

View file

@ -1,42 +0,0 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:vm="using:InkForge.Desktop.ViewModels"
xmlns:inkforge="app:InkForge"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="450"
x:Class="InkForge.Desktop.Views.LandingView"
x:DataType="vm:LandingViewModel"
inkforge:TopLevels.Register="{CompiledBinding}">
<Grid RowDefinitions="Auto, *, Auto">
<Label Content="Open Recent"
Grid.Row="0" />
<DataGrid IsEnabled="False"
IsReadOnly="True"
ItemsSource="{CompiledBinding RecentItems}"
Grid.Row="1">
<DataGrid.Columns>
<DataGridTextColumn Header="Created"
Binding="{CompiledBinding Created, StringFormat={}{0:d}}" />
<DataGridTextColumn Header="Name"
Width="*"
Binding="{CompiledBinding Name}" />
<DataGridTextColumn Header="Last Used"
Binding="{CompiledBinding LastUsed, StringFormat={}{0:d}}" />
</DataGrid.Columns>
</DataGrid>
<Menu Grid.Row="2">
<MenuItem Header="Create New"
Command="{CompiledBinding CreateNew}" />
<MenuItem Header="Open"
IsEnabled="False" />
<MenuItem Header="Open File"
Command="{CompiledBinding OpenNew}" />
</Menu>
</Grid>
</UserControl>

View file

@ -1,13 +0,0 @@
using Avalonia.ReactiveUI;
using InkForge.Desktop.ViewModels;
namespace InkForge.Desktop.Views;
public partial class LandingView : ReactiveUserControl<LandingViewModel>
{
public LandingView()
{
InitializeComponent();
}
}

View file

@ -2,19 +2,26 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:inkforge="app:InkForge"
xmlns:vm="using:InkForge.Desktop.ViewModels"
xmlns:local="using:InkForge.Desktop.Views"
mc:Ignorable="d"
Width="800"
Height="450"
x:Class="InkForge.Desktop.Views.MainWindow"
x:DataType="vm:AppViewModel"
Title="MainWindow"
inkforge:TopLevels.Register="{CompiledBinding}">
<DockPanel>
<NativeMenuBar />
Title="MainWindow">
<NativeMenu.Menu>
<NativeMenu />
</NativeMenu.Menu>
<reactiveui:ViewModelViewHost ViewModel="{CompiledBinding View}" />
<DockPanel>
<NativeMenuBar DockPanel.Dock="Top" />
<SplitView IsPaneOpen="true"
DisplayMode="Inline">
<SplitView.Pane>
<local:WorkspacesView />
</SplitView.Pane>
<local:DocumentsView />
</SplitView>
</DockPanel>
</Window>

View file

@ -1,11 +1,8 @@
using Avalonia.Input;
using Avalonia.ReactiveUI;
using InkForge.Desktop.ViewModels;
using Avalonia.Controls;
namespace InkForge.Desktop.Views;
public partial class MainWindow : ReactiveWindow<AppViewModel>
public partial class MainWindow : Window
{
public MainWindow()
{

View file

@ -1,69 +0,0 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:inkforge="app:InkForge"
xmlns:vm="using:InkForge.Desktop.ViewModels"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="450"
x:Class="InkForge.Desktop.Views.WorkspaceView"
x:DataType="vm:WorkspaceViewModel"
inkforge:TopLevels.Register="{CompiledBinding}">
<SplitView IsPaneOpen="true"
DisplayMode="Inline"
OpenPaneLength="300">
<SplitView.Pane>
<DockPanel x:Name="FilesView"
Background="Transparent">
<Grid ColumnDefinitions="*, Auto"
DockPanel.Dock="Top">
<TextBlock Text="Notes"
FontWeight="Bold"
Margin="3"
Grid.Column="0" />
<StackPanel x:Name="ToolBar"
Orientation="Horizontal"
Spacing="3"
Grid.Column="1">
<Button>
<inkforge:FluentSymbolIcon Symbol="document_add" />
</Button>
<Button>
<inkforge:FluentSymbolIcon Symbol="arrow_clockwise" />
</Button>
<Button>
<inkforge:FluentSymbolIcon Symbol="subtract_square_multiple" />
</Button>
<StackPanel.Styles>
<Style Selector="#ToolBar > :is(TemplatedControl)">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Padding"
Value="1" />
<Setter Property="VerticalAlignment"
Value="Center" />
</Style>
<Style Selector="#FilesView:not(:pointerover) StackPanel">
<Setter Property="IsVisible"
Value="False" />
</Style>
</StackPanel.Styles>
</StackPanel>
</Grid>
<TreeView ScrollViewer.VerticalScrollBarVisibility="Visible" />
</DockPanel>
</SplitView.Pane>
<TabControl>
<TabItem Header="Some Note.md">
Hello There!
</TabItem>
</TabControl>
</SplitView>
</UserControl>

View file

@ -1,13 +0,0 @@
using Avalonia.ReactiveUI;
using InkForge.Desktop.ViewModels;
namespace InkForge.Desktop.Views;
public partial class WorkspaceView : ReactiveUserControl<WorkspaceViewModel>
{
public WorkspaceView()
{
InitializeComponent();
}
}

View file

@ -0,0 +1,53 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:InkForge.Desktop.ViewModels.Workspaces"
xmlns:inkforge="app:InkForge"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="450"
x:Class="InkForge.Desktop.Views.Workspaces.WorkspaceViewModel"
x:DataType="vm:WorkspaceViewModel">
<Grid ColumnDefinitions="*, Auto"
RowDefinitions="Auto, *">
<TextBlock Grid.Column="0"
Grid.Row="0" />
<StackPanel Classes="WorkspaceToolbar"
Orientation="Horizontal"
Spacing="3"
Grid.Column="1"
Grid.Row="0">
<Button>
<inkforge:FluentSymbolIcon Symbol="document_add" />
</Button>
<Button>
<inkforge:FluentSymbolIcon Symbol="arrow_clockwise" />
</Button>
<Button>
<inkforge:FluentSymbolIcon Symbol="subtract_square_multiple" />
</Button>
<!-- <StackPanel.Styles>
<Style Selector="#ToolBar > :is(TemplatedControl)">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Padding"
Value="1" />
<Setter Property="VerticalAlignment"
Value="Center" />
</Style>
<Style Selector="#FilesView:not(:pointerover) StackPanel">
<Setter Property="IsVisible"
Value="False" />
</Style>
</StackPanel.Styles> -->
</StackPanel>
<TreeView Grid.ColumnSpan="2"
Grid.Row="1" />
</Grid>
</UserControl>

View file

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace InkForge.Desktop.Views.Workspaces;
public partial class WorkspaceViewModel : UserControl
{
public WorkspaceViewModel()
{
InitializeComponent();
}
}

View file

@ -0,0 +1,33 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net"
xmlns:local="using:InkForge.Desktop.Views"
xmlns:inkforge="app:InkForge"
xmlns:vm="using:InkForge.Desktop.ViewModels"
mc:Ignorable="d"
d:DesignWidth="800"
d:DesignHeight="450"
x:Class="InkForge.Desktop.Views.WorkspacesView"
x:DataType="vm:WorkspacesViewModel"
Classes.HasWorkspace="{CompiledBinding Workspace}">
<UserControl.Styles>
<Style Selector="local|WorkspacesView">
<Style Selector="^:not(.HasWorkspace)">
<Setter Property="Content">
<Template>
<TextBlock>
No workspace selected.
</TextBlock>
</Template>
</Setter>
</Style>
<Style Selector="^.HasWorkspace">
<Setter Property="Content"
Value="{CompiledBinding Workspace}" />
</Style>
</Style>
</UserControl.Styles>
</UserControl>

View file

@ -0,0 +1,16 @@
using Avalonia.Controls;
using InkForge.Desktop.ViewModels;
using Splat;
namespace InkForge.Desktop.Views;
public partial class WorkspacesView : UserControl
{
public WorkspacesView()
{
InitializeComponent();
DataContext = Locator.Current.GetService<WorkspacesViewModel>();
}
}