Improved UI.
Implemented Icon Provider.
This commit is contained in:
@@ -15,11 +15,12 @@
|
|||||||
<PackageVersion Include="Avalonia.iOS" Version="11.3.9" />
|
<PackageVersion Include="Avalonia.iOS" Version="11.3.9" />
|
||||||
<PackageVersion Include="Avalonia.Browser" Version="11.3.9" />
|
<PackageVersion Include="Avalonia.Browser" Version="11.3.9" />
|
||||||
<PackageVersion Include="Avalonia.Android" Version="11.3.9" />
|
<PackageVersion Include="Avalonia.Android" Version="11.3.9" />
|
||||||
<PackageVersion Include="Devolutions.AvaloniaTheme.DevExpress" Version="2025.12.4" />
|
<!--<PackageVersion Include="Devolutions.AvaloniaTheme.DevExpress" Version="2025.12.4" />
|
||||||
<PackageVersion Include="Devolutions.AvaloniaTheme.MacOS" Version="2025.12.4" />
|
<PackageVersion Include="Devolutions.AvaloniaTheme.MacOS" Version="2025.12.4" />-->
|
||||||
<PackageVersion Include="Jint" Version="4.4.2" />
|
<PackageVersion Include="Jint" Version="4.4.2" />
|
||||||
<PackageVersion Include="Microsoft.Maui.Graphics" Version="10.0.11" />
|
<PackageVersion Include="Microsoft.Maui.Graphics" Version="10.0.11" />
|
||||||
<PackageVersion Include="Microsoft.Maui.Graphics.Skia" Version="10.0.11" />
|
<PackageVersion Include="Microsoft.Maui.Graphics.Skia" Version="10.0.11" />
|
||||||
|
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="3.116.1" />
|
||||||
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.15" />
|
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -3,11 +3,13 @@
|
|||||||
<TargetFramework>net10.0-browser</TargetFramework>
|
<TargetFramework>net10.0-browser</TargetFramework>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<WasmAllowUndefinedSymbols>true</WasmAllowUndefinedSymbols>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia.Browser" />
|
<PackageReference Include="Avalonia.Browser" />
|
||||||
|
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>Progrart</string>
|
<string>Progrart</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>io.creeperlv.CINT</string>
|
<string>io.creeperlv.Progrart</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Avalonia.Data.Core.Plugins;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Progrart.Views;
|
using Progrart.Views;
|
||||||
|
using Progrart.Icons;
|
||||||
|
|
||||||
namespace Progrart;
|
namespace Progrart;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ public partial class App : Application
|
|||||||
// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
|
// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
|
||||||
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
|
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
|
||||||
isDesktop = true;
|
isDesktop = true;
|
||||||
|
IconProvider.Register(new DefaultIconProvider());
|
||||||
DisableAvaloniaDataAnnotationValidation();
|
DisableAvaloniaDataAnnotationValidation();
|
||||||
desktop.MainWindow = new MainWindow();
|
desktop.MainWindow = new MainWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,22 +3,35 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="Progrart.Controls.FileItem">
|
x:Class="Progrart.Controls.FileItem" HorizontalAlignment="Stretch">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Button Name="MainButton" HorizontalAlignment="Stretch">
|
||||||
<ColumnDefinition/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<SplitButton Content="ASD">
|
|
||||||
<SplitButton.Flyout>
|
|
||||||
<MenuFlyout Placement="Bottom">
|
|
||||||
<MenuItem Header="_Open"/>
|
|
||||||
<MenuItem Header="_Export"/>
|
|
||||||
</MenuFlyout>
|
|
||||||
</SplitButton.Flyout>
|
|
||||||
|
|
||||||
</SplitButton>
|
<Button.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="_Open"/>
|
||||||
|
<MenuItem Header="_Delete"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Button.ContextMenu>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<PathIcon Name="FolderIcon" Foreground="#FA0" Data="F1 M 2 7.28 C 2 6.613334 2.246667 6.033334 2.74 5.539999 C 3.233333 5.046665 3.813333 4.799999 4.48 4.799999 L 7 4.799999 C 7.48 4.799999 7.893332 4.973333 8.24 5.32 L 9.52 6.599999 L 7.44 8.639999 C 7.333333 8.746666 7.213333 8.799999 7.08 8.799999 L 2 8.799999 Z M 2 9.799999 L 2 16.279999 C 2 16.973333 2.246667 17.566666 2.74 18.059999 C 3.233333 18.553333 3.826667 18.799999 4.52 18.799999 L 15.52 18.799999 C 16.186666 18.799999 16.766666 18.553333 17.26 18.059999 C 17.753332 17.566666 18 16.986666 18 16.32 L 18 9.28 C 18 8.613334 17.753332 8.033334 17.26 7.54 C 16.766666 7.046667 16.173332 6.8 15.48 6.799999 L 10.719999 6.799999 L 8.16 9.36 C 7.866666 9.653334 7.506666 9.799999 7.08 9.799999 Z " VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
|
<PathIcon Name="GenericFileIcon" Data="F1 M 10 3.799999 L 10 8.28 C 10 8.706667 10.146666 9.066667 10.44 9.36 C 10.733334 9.653334 11.093333 9.799999 11.52 9.799999 L 16 9.799999 L 16 18.279999 C 16 18.706665 15.853333 19.066666 15.559999 19.359999 C 15.266665 19.653332 14.906666 19.799999 14.48 19.799999 L 5.52 19.799999 C 5.093333 19.799999 4.733334 19.653332 4.44 19.359999 C 4.146667 19.066666 4 18.706665 4 18.279999 L 4 5.279999 C 4 4.880001 4.146667 4.533333 4.44 4.24 C 4.733334 3.946667 5.093333 3.799999 5.52 3.799999 Z M 11 4.039999 L 11 8.28 C 11 8.440001 11.046666 8.566667 11.139999 8.66 C 11.233333 8.753333 11.346666 8.799999 11.48 8.799999 L 15.759999 8.799999 Z " VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
|
<Grid Name="IconContainer">
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Column="1" Margin="5,0" Name="NameBlock"/>
|
||||||
|
</Grid>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Border Margin="10,0,0,0" BorderThickness="1,0,0,0" BorderBrush="#8888">
|
||||||
|
|
||||||
|
<StackPanel Name="ItemContainer" Margin="10,0,0,0">
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,13 +1,70 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
|
using Progrart.Icons;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Progrart.Controls;
|
namespace Progrart.Controls;
|
||||||
|
|
||||||
public partial class FileItem : UserControl
|
public partial class FileItem : UserControl
|
||||||
{
|
{
|
||||||
public FileItem()
|
IStorageItem currentItem;
|
||||||
{
|
bool isOpen = false;
|
||||||
InitializeComponent();
|
public FileItem(IStorageItem storageItem)
|
||||||
}
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
currentItem = storageItem;
|
||||||
|
if (storageItem is IStorageFolder folder)
|
||||||
|
{
|
||||||
|
FolderIcon.IsVisible = true;
|
||||||
|
GenericFileIcon.IsVisible = false;
|
||||||
|
IconContainer.IsVisible = false;
|
||||||
|
}
|
||||||
|
else if (storageItem is IStorageFile file)
|
||||||
|
{
|
||||||
|
FolderIcon.IsVisible = false;
|
||||||
|
GenericFileIcon.IsVisible = true;
|
||||||
|
IconContainer.Children.Clear();
|
||||||
|
var dotIndex = file.Name.LastIndexOf('.');
|
||||||
|
if (dotIndex >= 0)
|
||||||
|
{
|
||||||
|
var extension = file.Name[(dotIndex + 1)..];
|
||||||
|
if (IconProvider.TryGetIcon(extension, out var icon))
|
||||||
|
{
|
||||||
|
GenericFileIcon.IsVisible = false;
|
||||||
|
IconContainer.Children.Add(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IconContainer.IsVisible = true;
|
||||||
|
}
|
||||||
|
NameBlock.Text = storageItem.Name;
|
||||||
|
MainButton.DoubleTapped += async (_, _) =>
|
||||||
|
{
|
||||||
|
if (currentItem is IStorageFolder folder)
|
||||||
|
{
|
||||||
|
if (isOpen)
|
||||||
|
{
|
||||||
|
RemoveAll();
|
||||||
|
isOpen = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOpen = true;
|
||||||
|
await LoadAll(folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async Task LoadAll(IStorageFolder folder)
|
||||||
|
{
|
||||||
|
await foreach (var item in folder.GetItemsAsync())
|
||||||
|
{
|
||||||
|
ItemContainer.Children.Add(new FileItem(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void RemoveAll()
|
||||||
|
{
|
||||||
|
ItemContainer.Children.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ public partial class TabHost : UserControl
|
|||||||
this.TabContainer.Children.Add(button);
|
this.TabContainer.Children.Add(button);
|
||||||
if (page is Control pageControl)
|
if (page is Control pageControl)
|
||||||
PageContainer.Children.Add(pageControl);
|
PageContainer.Children.Add(pageControl);
|
||||||
|
page.BindButton(button);
|
||||||
SelectButton(button);
|
SelectButton(button);
|
||||||
}
|
}
|
||||||
public void SelectButton(TabButton button)
|
public void SelectButton(TabButton button)
|
||||||
|
|||||||
44
Progrart/Icons/DefaultIconProvider.cs
Normal file
44
Progrart/Icons/DefaultIconProvider.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Progrart.Icons
|
||||||
|
{
|
||||||
|
public class DefaultIconProvider : IIconProvider
|
||||||
|
{
|
||||||
|
public bool TryGetIcon(string name, [MaybeNullWhen(false)] out Control icon)
|
||||||
|
{
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "c":
|
||||||
|
case "c++":
|
||||||
|
case "cpp":
|
||||||
|
case "cxx":
|
||||||
|
case "cs":
|
||||||
|
case "h":
|
||||||
|
case "h++":
|
||||||
|
case "hpp":
|
||||||
|
case "hxx":
|
||||||
|
{
|
||||||
|
PathIcon _icon = new PathIcon();
|
||||||
|
_icon.Data = PathGeometry.Parse("F1 M 12.96 5.48 C 13.013332 5.346666 13.013332 5.219999 12.96 5.1 C 12.906666 4.98 12.813333 4.893333 12.679999 4.84 C 12.546665 4.786667 12.419999 4.786667 12.3 4.84 C 12.179999 4.893333 12.093332 4.986668 12.04 5.119999 L 7.04 18.119999 C 6.96 18.306665 6.98 18.473333 7.1 18.619999 C 7.22 18.766666 7.38 18.826666 7.58 18.799999 C 7.779999 18.773333 7.906666 18.666666 7.96 18.48 Z M 5.84 7.919999 C 5.946666 8 6 8.113334 6 8.259999 C 6 8.406667 5.96 8.533333 5.88 8.639999 L 3.16 11.799999 L 5.88 14.959999 C 5.96 15.066667 5.993333 15.186666 5.98 15.32 C 5.966666 15.453333 5.906666 15.566667 5.8 15.66 C 5.693333 15.753333 5.573333 15.793333 5.44 15.779999 C 5.306666 15.766666 5.2 15.719999 5.12 15.639999 L 2.12 12.12 C 2.04 12.039999 2 11.933332 2 11.799999 C 2 11.666666 2.04 11.559999 2.12 11.48 L 5.12 7.959999 C 5.2 7.853333 5.313333 7.799999 5.46 7.799999 C 5.606667 7.799999 5.733333 7.839999 5.84 7.919999 Z M 14.16 16.16 C 14.053333 16.08 14 15.973333 14 15.839999 C 14 15.706667 14.04 15.586666 14.12 15.48 L 16.84 12.28 L 14.12 9.12 C 14.04 9.013333 14 8.893333 14 8.759999 C 14 8.626667 14.053333 8.513333 14.16 8.419999 C 14.266666 8.326667 14.393333 8.286667 14.54 8.299999 C 14.686666 8.313334 14.799999 8.373333 14.88 8.48 L 17.879999 11.959999 C 17.959999 12.066667 18 12.18 18 12.299999 C 18 12.42 17.959999 12.533333 17.879999 12.639999 L 14.88 16.119999 C 14.799999 16.226665 14.686666 16.286667 14.54 16.299999 C 14.393333 16.313332 14.266666 16.279999 14.16 16.199999 Z ");
|
||||||
|
icon = _icon;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "sh":
|
||||||
|
case "bash":
|
||||||
|
case "ps1":
|
||||||
|
{
|
||||||
|
PathIcon _icon = new PathIcon();
|
||||||
|
_icon.Data = PathGeometry.Parse("F1 M 5.64 10.959999 C 5.746666 10.853333 5.866666 10.799999 6 10.799999 C 6.133333 10.799999 6.253333 10.853333 6.36 10.959999 L 8.36 12.959999 C 8.466666 13.039999 8.52 13.153333 8.52 13.299999 C 8.52 13.446667 8.466666 13.559999 8.36 13.639999 L 6.36 15.639999 C 6.253333 15.746666 6.133333 15.799999 6 15.799999 C 5.866666 15.799999 5.746666 15.753333 5.64 15.66 C 5.533333 15.566667 5.48 15.446667 5.48 15.299999 C 5.48 15.153333 5.533333 15.04 5.64 14.959999 L 7.28 13.28 L 5.64 11.639999 C 5.533333 11.559999 5.48 11.446667 5.48 11.299999 C 5.48 11.153334 5.533333 11.04 5.64 10.959999 Z M 14.52 14.799999 L 9.52 14.799999 C 9.359999 14.799999 9.233333 14.846666 9.139999 14.94 C 9.046666 15.033333 9 15.153333 9 15.299999 C 9 15.446667 9.046666 15.566667 9.139999 15.66 C 9.233333 15.753333 9.346666 15.799999 9.48 15.799999 L 14.52 15.799999 C 14.653333 15.799999 14.766666 15.753333 14.86 15.66 C 14.953333 15.566667 14.999999 15.446667 15 15.299999 C 14.999999 15.153333 14.953333 15.033333 14.86 14.94 C 14.766666 14.846666 14.653333 14.799999 14.52 14.799999 Z M 3 7.28 C 3 6.613334 3.246666 6.033334 3.74 5.539999 C 4.233333 5.046665 4.813333 4.799999 5.48 4.799999 L 14.48 4.799999 C 15.173332 4.799999 15.766665 5.046665 16.26 5.539999 C 16.753334 6.033334 17 6.626667 17 7.32 L 17 16.279999 C 17 16.973333 16.753334 17.566666 16.26 18.059999 C 15.766665 18.553333 15.173332 18.799999 14.48 18.799999 L 5.48 18.799999 C 4.813333 18.799999 4.233333 18.553333 3.74 18.059999 C 3.246666 17.566666 3 16.973333 3 16.279999 Z M 16 7.799999 L 16 7.28 C 16 6.88 15.853333 6.533334 15.559999 6.24 C 15.266665 5.946667 14.906666 5.799999 14.48 5.799999 L 5.48 5.799999 C 5.08 5.799999 4.733334 5.946667 4.44 6.24 C 4.146667 6.533334 4 6.893333 4 7.32 L 4 7.799999 Z M 4 8.799999 L 4 16.279999 C 4 16.706665 4.146667 17.066666 4.44 17.359999 C 4.733334 17.653332 5.08 17.799999 5.48 17.799999 L 14.48 17.799999 C 14.906666 17.799999 15.266665 17.653332 15.559999 17.359999 C 15.853333 17.066666 16 16.706665 16 16.279999 L 16 8.799999 Z ");
|
||||||
|
icon = _icon;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
icon = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Progrart/Icons/IIconProvider.cs
Normal file
10
Progrart/Icons/IIconProvider.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Progrart.Icons
|
||||||
|
{
|
||||||
|
public interface IIconProvider
|
||||||
|
{
|
||||||
|
bool TryGetIcon(string name, [MaybeNullWhen(false)] out Control icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Progrart/Icons/IconProvider.cs
Normal file
24
Progrart/Icons/IconProvider.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Progrart.Icons
|
||||||
|
{
|
||||||
|
public static class IconProvider
|
||||||
|
{
|
||||||
|
static List<IIconProvider> providers = new List<IIconProvider>();
|
||||||
|
public static void Register(IIconProvider provider)
|
||||||
|
{
|
||||||
|
providers.Add(provider);
|
||||||
|
}
|
||||||
|
public static bool TryGetIcon(string name, [MaybeNullWhen(false)] out Control icon)
|
||||||
|
{
|
||||||
|
foreach (var provider in providers)
|
||||||
|
{
|
||||||
|
if (provider.TryGetIcon(name, out icon)) return true;
|
||||||
|
}
|
||||||
|
icon = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Devolutions.AvaloniaTheme.DevExpress" />
|
<!--<PackageReference Include="Devolutions.AvaloniaTheme.DevExpress" />
|
||||||
<PackageReference Include="Devolutions.AvaloniaTheme.MacOS" />
|
<PackageReference Include="Devolutions.AvaloniaTheme.MacOS" />-->
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Grid.Styles>
|
</Grid.Styles>
|
||||||
<Grid >
|
<Grid >
|
||||||
<Border HorizontalAlignment="Center" CornerRadius="24" Margin="8,8,8,0" Background="#2888">
|
<Border HorizontalAlignment="Center" CornerRadius="14" Margin="8,8,8,0" BorderThickness="1,1,1,0" BorderBrush="#8888" Background="#2888">
|
||||||
<Button Padding="8,2" CornerRadius="24">
|
<Button Padding="16,1" BorderThickness="1,1,1,0" Margin="-1,-1,-1,0" CornerRadius="14">
|
||||||
<Button.Flyout>
|
<Button.Flyout>
|
||||||
<MenuFlyout>
|
<MenuFlyout>
|
||||||
<MenuItem Header="_File">
|
<MenuItem Header="_File">
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<MenuItem Header="_File"/>
|
<MenuItem Header="_File"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_Open">
|
<MenuItem Header="_Open">
|
||||||
<MenuItem Header="_Project"/>
|
<MenuItem Header="_Project" Name="OpenProjectMenuItem"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_Save"/>
|
<MenuItem Header="_Save"/>
|
||||||
<MenuItem Header="Save _As"/>
|
<MenuItem Header="Save _As"/>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<MenuItem Header="_Exit"/>
|
<MenuItem Header="_Exit"/>
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
</Button.Flyout>
|
</Button.Flyout>
|
||||||
<TextBlock Margin="8,4">Progart</TextBlock>
|
<TextBlock Margin="8,2">Progart</TextBlock>
|
||||||
</Button>
|
</Button>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -65,9 +65,11 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Margin="8,4">File Explorer</TextBlock>
|
<Border CornerRadius="12" Margin="8" BorderBrush="#8888" BorderThickness="1,1,1,0" Background="#4888">
|
||||||
<ScrollViewer Grid.Row="1">
|
<TextBlock Margin="8,4">File Explorer</TextBlock>
|
||||||
<StackPanel Name="FileContainer"></StackPanel>
|
</Border>
|
||||||
|
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto">
|
||||||
|
<StackPanel Name="FileContainer" Margin="0,0,0,8"></StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -82,8 +84,8 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Border Margin="16,8,16,0" Background="#2888" CornerRadius="6">
|
<Border Margin="16,8,16,0" Background="#2888" BorderBrush="#4888" BorderThickness="1" CornerRadius="16">
|
||||||
<ScrollViewer Margin="8,0">
|
<ScrollViewer Margin="16,0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Button Name="HomePageButton">
|
<Button Name="HomePageButton">
|
||||||
<Viewbox Width="22" Height="22">
|
<Viewbox Width="22" Height="22">
|
||||||
@@ -104,7 +106,7 @@
|
|||||||
<PathIcon Foreground="#0A0" Data="F1 M 6 3.799999 C 5.44 3.799999 4.966666 3.993334 4.58 4.379999 C 4.193333 4.766666 4 5.24 4 5.799999 L 4 10.999999 C 4.32 10.919999 4.653333 10.866666 5 10.839999 L 5 5.799999 C 5 5.533333 5.099999 5.299999 5.3 5.1 C 5.5 4.9 5.733333 4.799999 6 4.799999 L 10 4.799999 L 10 8.28 C 10 8.706667 10.146666 9.066667 10.44 9.36 C 10.733334 9.653334 11.093333 9.799999 11.52 9.799999 L 15 9.799999 L 15 17.799999 C 14.999999 18.066666 14.9 18.299999 14.7 18.5 C 14.5 18.699999 14.266666 18.799999 14 18.799999 L 10.4 18.799999 C 10.213333 19.146666 10 19.48 9.76 19.799999 L 14 19.799999 C 14.559999 19.799999 15.033333 19.606667 15.42 19.219999 C 15.806666 18.833332 16 18.360001 16 17.799999 L 16 9.2 C 16 8.8 15.853333 8.453333 15.559999 8.16 L 11.639999 4.24 C 11.346666 3.946667 11 3.799999 10.599999 3.799999 Z M 14.799999 8.799999 L 11.52 8.799999 C 11.36 8.799999 11.233333 8.753333 11.139999 8.66 C 11.046666 8.566667 11 8.453333 11 8.32 L 11 5 Z M 10 16.279999 C 10 17.106667 9.799999 17.866667 9.4 18.559999 C 9 19.253332 8.453333 19.799999 7.76 20.199999 C 7.066666 20.599998 6.313333 20.799999 5.5 20.799999 C 4.686666 20.799999 3.933333 20.599998 3.24 20.199999 C 2.546667 19.799999 2 19.253332 1.6 18.559999 C 1.2 17.866667 1 17.113333 1 16.299999 C 1 15.486666 1.2 14.733334 1.6 14.039999 C 2 13.346666 2.546667 12.799999 3.24 12.4 C 3.933333 12 4.686666 11.799999 5.5 11.799999 C 6.313333 11.799999 7.066666 12 7.76 12.4 C 8.453333 12.799999 9 13.346666 9.4 14.039999 C 9.799999 14.733334 10 15.48 10 16.279999 Z M 6 14.279999 C 6 14.146667 5.953333 14.033333 5.86 13.94 C 5.766666 13.846666 5.646667 13.799999 5.5 13.799999 C 5.353333 13.799999 5.233333 13.846666 5.14 13.94 C 5.046666 14.033333 5 14.146667 5 14.279999 L 5 15.799999 L 3.52 15.799999 C 3.36 15.799999 3.233333 15.846666 3.14 15.94 C 3.046667 16.033333 3 16.153332 3 16.299999 C 3 16.446667 3.046667 16.566666 3.14 16.66 C 3.233333 16.753334 3.36 16.799999 3.52 16.799999 L 5 16.799999 L 5 18.279999 C 5 18.439999 5.046666 18.566666 5.14 18.66 C 5.233333 18.753332 5.353333 18.799999 5.5 18.799999 C 5.646667 18.799999 5.766666 18.753332 5.86 18.66 C 5.953333 18.566666 6 18.439999 6 18.279999 L 6 16.799999 L 7.52 16.799999 C 7.653333 16.799999 7.766666 16.753334 7.86 16.66 C 7.953333 16.566666 8 16.446667 8 16.299999 C 8 16.153332 7.953333 16.033333 7.86 15.94 C 7.766666 15.846666 7.653333 15.799999 7.52 15.799999 L 6 15.799999 Z " VerticalAlignment="Center" HorizontalAlignment="Center" />
|
<PathIcon Foreground="#0A0" Data="F1 M 6 3.799999 C 5.44 3.799999 4.966666 3.993334 4.58 4.379999 C 4.193333 4.766666 4 5.24 4 5.799999 L 4 10.999999 C 4.32 10.919999 4.653333 10.866666 5 10.839999 L 5 5.799999 C 5 5.533333 5.099999 5.299999 5.3 5.1 C 5.5 4.9 5.733333 4.799999 6 4.799999 L 10 4.799999 L 10 8.28 C 10 8.706667 10.146666 9.066667 10.44 9.36 C 10.733334 9.653334 11.093333 9.799999 11.52 9.799999 L 15 9.799999 L 15 17.799999 C 14.999999 18.066666 14.9 18.299999 14.7 18.5 C 14.5 18.699999 14.266666 18.799999 14 18.799999 L 10.4 18.799999 C 10.213333 19.146666 10 19.48 9.76 19.799999 L 14 19.799999 C 14.559999 19.799999 15.033333 19.606667 15.42 19.219999 C 15.806666 18.833332 16 18.360001 16 17.799999 L 16 9.2 C 16 8.8 15.853333 8.453333 15.559999 8.16 L 11.639999 4.24 C 11.346666 3.946667 11 3.799999 10.599999 3.799999 Z M 14.799999 8.799999 L 11.52 8.799999 C 11.36 8.799999 11.233333 8.753333 11.139999 8.66 C 11.046666 8.566667 11 8.453333 11 8.32 L 11 5 Z M 10 16.279999 C 10 17.106667 9.799999 17.866667 9.4 18.559999 C 9 19.253332 8.453333 19.799999 7.76 20.199999 C 7.066666 20.599998 6.313333 20.799999 5.5 20.799999 C 4.686666 20.799999 3.933333 20.599998 3.24 20.199999 C 2.546667 19.799999 2 19.253332 1.6 18.559999 C 1.2 17.866667 1 17.113333 1 16.299999 C 1 15.486666 1.2 14.733334 1.6 14.039999 C 2 13.346666 2.546667 12.799999 3.24 12.4 C 3.933333 12 4.686666 11.799999 5.5 11.799999 C 6.313333 11.799999 7.066666 12 7.76 12.4 C 8.453333 12.799999 9 13.346666 9.4 14.039999 C 9.799999 14.733334 10 15.48 10 16.279999 Z M 6 14.279999 C 6 14.146667 5.953333 14.033333 5.86 13.94 C 5.766666 13.846666 5.646667 13.799999 5.5 13.799999 C 5.353333 13.799999 5.233333 13.846666 5.14 13.94 C 5.046666 14.033333 5 14.146667 5 14.279999 L 5 15.799999 L 3.52 15.799999 C 3.36 15.799999 3.233333 15.846666 3.14 15.94 C 3.046667 16.033333 3 16.153332 3 16.299999 C 3 16.446667 3.046667 16.566666 3.14 16.66 C 3.233333 16.753334 3.36 16.799999 3.52 16.799999 L 5 16.799999 L 5 18.279999 C 5 18.439999 5.046666 18.566666 5.14 18.66 C 5.233333 18.753332 5.353333 18.799999 5.5 18.799999 C 5.646667 18.799999 5.766666 18.753332 5.86 18.66 C 5.953333 18.566666 6 18.439999 6 18.279999 L 6 16.799999 L 7.52 16.799999 C 7.653333 16.799999 7.766666 16.753334 7.86 16.66 C 7.953333 16.566666 8 16.446667 8 16.299999 C 8 16.153332 7.953333 16.033333 7.86 15.94 C 7.766666 15.846666 7.653333 15.799999 7.52 15.799999 L 6 15.799999 Z " VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
</Button>
|
</Button>
|
||||||
<Border Margin="4,6" Width="1" Background="#8888"></Border>
|
<Border Margin="4,6" Width="1" Background="#8888"></Border>
|
||||||
<ComboBox VerticalAlignment="Center" SelectedIndex="0" Name="ConfigBox" MinHeight="0" Padding="8,2">
|
<ComboBox VerticalAlignment="Center" SelectedIndex="0" Name="ConfigBox" MinHeight="0" Padding="16,2" BorderThickness="1" BorderBrush="#8888" CornerRadius="12">
|
||||||
<ComboBoxItem>
|
<ComboBoxItem>
|
||||||
All
|
All
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
@@ -123,24 +125,25 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto" MinHeight="0"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ProgrartTabControls:TabHost Name="MainTabHost" VerticalAlignment="Stretch">
|
<ProgrartTabControls:TabHost Name="MainTabHost" VerticalAlignment="Stretch">
|
||||||
|
|
||||||
</ProgrartTabControls:TabHost>
|
</ProgrartTabControls:TabHost>
|
||||||
<!--
|
|
||||||
-->
|
|
||||||
<Grid Grid.Row="1" IsHitTestVisible="False" Name="SplitterVisual" IsVisible="False">
|
<Grid Grid.Row="1" IsHitTestVisible="False" Name="SplitterVisual" IsVisible="False">
|
||||||
<Border HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="2" MaxWidth="150" Background="#8888"/>
|
<Border HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="2" MaxWidth="150" Background="#8888"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<GridSplitter Height="10" Grid.Row="1" IsVisible="False" Background="#01000000" Name="Splitter"></GridSplitter>
|
<GridSplitter Height="10" Grid.Row="1" IsVisible="False" Background="#01000000" Name="Splitter"></GridSplitter>
|
||||||
<Border Grid.Row="2" Name="BottomPanel" IsVisible="False" CornerRadius="12" Background="#2888">
|
<Border Grid.Row="2" Name="BottomPanel" IsVisible="False" CornerRadius="12" MinHeight="32" Background="#2888">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Margin="8,4">Output</TextBlock>
|
|
||||||
|
<Border CornerRadius="12" Margin="8" BorderBrush="#8888" BorderThickness="1,1,1,0" Background="#4888">
|
||||||
|
<TextBlock Margin="8,4">Output</TextBlock>
|
||||||
|
</Border>
|
||||||
<ScrollViewer Grid.Row="1">
|
<ScrollViewer Grid.Row="1">
|
||||||
<TextBlock Name="Output"/>
|
<TextBlock Name="Output"/>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
|
using Progrart.Controls;
|
||||||
using Progrart.Core.JSExecution;
|
using Progrart.Core.JSExecution;
|
||||||
using Progrart.Pages;
|
using Progrart.Pages;
|
||||||
using System;
|
using System;
|
||||||
@@ -31,10 +33,19 @@ public partial class MainView : UserControl
|
|||||||
|
|
||||||
BottomPanelToggle.IsCheckedChanged += (a, b) =>
|
BottomPanelToggle.IsCheckedChanged += (a, b) =>
|
||||||
{
|
{
|
||||||
BottomPanel.IsVisible = BottomPanelToggle.IsChecked == true;
|
bool v = BottomPanelToggle.IsChecked == true;
|
||||||
SplitterVisual.IsVisible = BottomPanelToggle.IsChecked == true;
|
BottomPanel.IsVisible = v;
|
||||||
Splitter.IsVisible = BottomPanelToggle.IsChecked == true;
|
SplitterVisual.IsVisible = v;
|
||||||
|
Splitter.IsVisible = v;
|
||||||
ContentGrid.RowDefinitions[2].Height = GridLength.Auto;
|
ContentGrid.RowDefinitions[2].Height = GridLength.Auto;
|
||||||
|
if (v)
|
||||||
|
{
|
||||||
|
ContentGrid.RowDefinitions[2].MinHeight = 48;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ContentGrid.RowDefinitions[2].MinHeight = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
LeftPanelToggle.IsCheckedChanged += (a, b) =>
|
LeftPanelToggle.IsCheckedChanged += (a, b) =>
|
||||||
@@ -53,6 +64,34 @@ public partial class MainView : UserControl
|
|||||||
{
|
{
|
||||||
MainTabHost.AddPage(new AboutPage());
|
MainTabHost.AddPage(new AboutPage());
|
||||||
};
|
};
|
||||||
|
OpenProjectMenuItem.Click += async (_, _) =>
|
||||||
|
{
|
||||||
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
|
|
||||||
|
if (topLevel == null) return;
|
||||||
|
|
||||||
|
// Open the folder picker
|
||||||
|
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
|
{
|
||||||
|
Title = "Select Folder",
|
||||||
|
AllowMultiple = false
|
||||||
|
});
|
||||||
|
|
||||||
|
if (folders.Count >= 1)
|
||||||
|
{
|
||||||
|
// Get the first selected folder path
|
||||||
|
// Note: TryGetLocalPath() returns null if the file isn't on a local disk (e.g., cloud storage)
|
||||||
|
var folderPath = folders[0].TryGetLocalPath();
|
||||||
|
var folder = folders[0];
|
||||||
|
FileContainer.Children.Add(new FileItem(folder));
|
||||||
|
if (folderPath != null)
|
||||||
|
{
|
||||||
|
// Do something with the path
|
||||||
|
System.Diagnostics.Debug.WriteLine($"Picked: {folderPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
LeftPanelToggle.IsChecked = true;
|
||||||
}
|
}
|
||||||
public void Write(string message)
|
public void Write(string message)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user