mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-14 20:06:34 +08:00
添加Avalonia项目的demo
This commit is contained in:
34
Serein.Workbench.Avalonia/Views/MainView.axaml
Normal file
34
Serein.Workbench.Avalonia/Views/MainView.axaml
Normal file
@@ -0,0 +1,34 @@
|
||||
<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="clr-namespace:Serein.Workbench.Avalonia.ViewModels"
|
||||
xmlns:cv="clr-namespace:Serein.Workbench.Avalonia.Custom.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="1024" d:DesignHeight="640"
|
||||
x:Class="Serein.Workbench.Avalonia.Views.MainView"
|
||||
x:DataType="vm:MainViewModel">
|
||||
<Design.DataContext>
|
||||
<vm:MainViewModel />
|
||||
</Design.DataContext>
|
||||
<UserControl.Styles>
|
||||
</UserControl.Styles>
|
||||
<Grid RowDefinitions="auto,0,*" ColumnDefinitions="*">
|
||||
<cv:MainMenuBarView Grid.Row="0" Grid.Column="0" Background="#E2E9EE"/>
|
||||
<!--这里留空,以后放置功能区-->
|
||||
<Grid Grid.Row="2" Grid.Column="0"
|
||||
RowDefinitions="*" ColumnDefinitions="auto,*">
|
||||
<!--依赖信息-->
|
||||
<Grid RowDefinitions="*,auto" HorizontalAlignment="Left">
|
||||
<!--已加载的依赖-->
|
||||
<cv:FlowLibrarysView Grid.Row="0"/>
|
||||
<!--<cv:FlowLibraryMethodInfoView Grid.Row="1" HorizontalAlignment="Left"/>-->
|
||||
<!--当前预览的节点方法信息-->
|
||||
</Grid>
|
||||
|
||||
<!--画布-->
|
||||
<cv:NodeContainerView Grid.Column="1"/>
|
||||
<!--其他视图-->
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
23
Serein.Workbench.Avalonia/Views/MainView.axaml.cs
Normal file
23
Serein.Workbench.Avalonia/Views/MainView.axaml.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Newtonsoft.Json;
|
||||
using Serein.Library;
|
||||
using Serein.NodeFlow.Env;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.Avalonia.Views;
|
||||
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
14
Serein.Workbench.Avalonia/Views/MainWindow.axaml
Normal file
14
Serein.Workbench.Avalonia/Views/MainWindow.axaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Serein.Workbench.Avalonia.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:views="clr-namespace:Serein.Workbench.Avalonia.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Serein.Workbench.Avalonia.Views.MainWindow"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="Serein Flow Edit">
|
||||
<views:MainView />
|
||||
|
||||
|
||||
</Window>
|
||||
36
Serein.Workbench.Avalonia/Views/MainWindow.axaml.cs
Normal file
36
Serein.Workbench.Avalonia/Views/MainWindow.axaml.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Newtonsoft.Json;
|
||||
using Serein.NodeFlow.Env;
|
||||
using System.Threading.Tasks;
|
||||
using Serein.Library;
|
||||
using Serein.Workbench.Avalonia.Services;
|
||||
|
||||
namespace Serein.Workbench.Avalonia.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
IKeyEventService keyEventService = App.GetService<IKeyEventService>();
|
||||
this.Loaded += MainWindow_Loaded;
|
||||
this.KeyDown += (o, e) =>
|
||||
{
|
||||
keyEventService.SetKeyState(e.Key, true);
|
||||
};
|
||||
this.KeyUp += (o, e) =>
|
||||
{
|
||||
keyEventService.SetKeyState(e.Key, false);
|
||||
};
|
||||
}
|
||||
|
||||
private void MainWindow_Loaded(object? sender, global::Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user