This commit is contained in:
Matteo Cominetti
2022-10-26 19:07:08 +01:00
parent 0a092629fd
commit dd8f357cf5
10 changed files with 271 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
<Application
x:Class="AvaloniaMenuIssue.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Styles>
<FluentTheme Mode="Light"/>
</Application.Styles>
</Application>
+21
View File
@@ -0,0 +1,21 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace AvaloniaMenuIssue
{
public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
this.Name = "Speckle";
}
public override void OnFrameworkInitializationCompleted()
{
base.OnFrameworkInitializationCompleted();
}
}
}
+61
View File
@@ -0,0 +1,61 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<Version>1.0</Version>
<Title>AvaloniaMenuIssue</Title>
<Description>Description of AvaloniaMenuIssue</Description>
<TargetExt>.rhp</TargetExt>
<!-- <PlatformTarget>x64</PlatformTarget>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>-->
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="EmbeddedResources\**\*" />
</ItemGroup>
<ItemGroup Condition="'$([MSBuild]::IsOSPlatform(OSX))' == 'true'">
<None Include="$(HOME)/.nuget/packages/avalonia.native/0.10.18/runtimes/osx/native/libAvaloniaNative.dylib" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="RhinoCommon" Version="7.13.21348.13001" IncludeAssets="compile;build" />
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.18" />
</ItemGroup>
<ItemGroup>
<None Remove="App.xaml" />
<None Remove="MainWindow.xaml" />
<AvaloniaXaml Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
</AvaloniaXaml>
<AvaloniaXaml Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</AvaloniaXaml>
</ItemGroup>
<ItemGroup>
<Compile Update="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Update="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Remove="Avalonia" />
<None Remove="Avalonia.Desktop" />
<None Remove="Avalonia.Diagnostics" />
</ItemGroup>
<PropertyGroup Condition="$(Configuration) == 'Debug' AND $([MSBuild]::IsOSPlatform(Windows))">
<StartProgram>C:\Program Files\Rhino 7\System\Rhino.exe</StartProgram>
<StartArguments></StartArguments>
<StartAction>Program</StartAction>
</PropertyGroup>
</Project>
+25
View File
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1703.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaMenuIssue", "AvaloniaMenuIssue.csproj", "{D292ADC2-A672-4065-B4EA-A95262D1538E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D292ADC2-A672-4065-B4EA-A95262D1538E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D292ADC2-A672-4065-B4EA-A95262D1538E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D292ADC2-A672-4065-B4EA-A95262D1538E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D292ADC2-A672-4065-B4EA-A95262D1538E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {16057F3E-D56A-4DA9-B8D3-5390B9EE0E5B}
EndGlobalSection
EndGlobal
+62
View File
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using Avalonia;
using Rhino;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.Input.Custom;
namespace AvaloniaMenuIssue
{
public class AvaloniaMenuIssueCommand : Command
{
public AvaloniaMenuIssueCommand()
{
// Rhino only creates one instance of each command class defined in a
// plug-in, so it is safe to store a refence in a static property.
Instance = this;
}
///<summary>The only instance of this command.</summary>
public static AvaloniaMenuIssueCommand Instance { get; private set; }
public static void InitAvalonia()
{
try
{
BuildAvaloniaApp().SetupWithoutStarting();
}
catch(Exception e)
{
}
}
public static AppBuilder BuildAvaloniaApp()
{
return AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions { UseGpu = false })
.With(new AvaloniaNativePlatformOptions { UseGpu = false, UseDeferredRendering = true })
.With(new MacOSPlatformOptions { ShowInDock = false, DisableDefaultApplicationMenuItems = true, DisableNativeMenus = true })
.With(new Win32PlatformOptions { AllowEglInitialization = true, EnableMultitouch = false })
.With(new SkiaOptions { MaxGpuResourceSizeBytes = 8096000 })
.LogToTrace();
}
///<returns>The command name as it appears on the Rhino command line.</returns>
public override string EnglishName => "AvaloniaMenuIssueCommand";
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
InitAvalonia();
var mw = new MainWindow();
mw.Show();
return Result.Success;
}
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
using Rhino;
namespace AvaloniaMenuIssue
{
///<summary>
/// <para>Every RhinoCommon .rhp assembly must have one and only one PlugIn-derived
/// class. DO NOT create instances of this class yourself. It is the
/// responsibility of Rhino to create an instance of this class.</para>
/// <para>To complete plug-in information, please also see all PlugInDescription
/// attributes in AssemblyInfo.cs (you might need to click "Project" ->
/// "Show All Files" to see it in the "Solution Explorer" window).</para>
///</summary>
public class AvaloniaMenuIssuePlugin : Rhino.PlugIns.PlugIn
{
public AvaloniaMenuIssuePlugin()
{
Instance = this;
}
///<summary>Gets the only instance of the AvaloniaMenuIssuePlugin plug-in.</summary>
public static AvaloniaMenuIssuePlugin Instance { get; private set; }
// You can override methods here to change the plug-in behavior on
// loading and shut down, add options pages to the Rhino _Option command
// and maintain plug-in wide options in a document.
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

+19
View File
@@ -0,0 +1,19 @@
<Window
x:Class="AvaloniaMenuIssue.MainWindow"
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"
Title="I am a test"
Width="400"
Height="650"
mc:Ignorable="d">
<Grid>
<TextBlock
FontSize="24"
Text="Hello I am a test!" />
</Grid>
</Window>
+24
View File
@@ -0,0 +1,24 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using System.ComponentModel;
using Avalonia.Input;
namespace AvaloniaMenuIssue
{
public partial class MainWindow : Window
{
public MainWindow()
{
AvaloniaXamlLoader.Load(this);
#if DEBUG
this.AttachDevTools(KeyGesture.Parse("CTRL+R"));
#endif
}
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Rhino.PlugIns;
// Plug-in Description Attributes - all of these are optional.
// These will show in Rhino's option dialog, in the tab Plug-ins.
[assembly: PlugInDescription(DescriptionType.Address, "")]
[assembly: PlugInDescription(DescriptionType.Country, "")]
[assembly: PlugInDescription(DescriptionType.Email, "")]
[assembly: PlugInDescription(DescriptionType.Phone, "")]
[assembly: PlugInDescription(DescriptionType.Fax, "")]
[assembly: PlugInDescription(DescriptionType.Organization, "")]
[assembly: PlugInDescription(DescriptionType.UpdateUrl, "")]
[assembly: PlugInDescription(DescriptionType.WebSite, "")]
// Icons should be Windows .ico files and contain 32-bit images in the following sizes: 16, 24, 32, 48, and 256.
[assembly: PlugInDescription(DescriptionType.Icon, "AvaloniaMenuIssue.EmbeddedResources.plugin-utility.ico")]
// The following GUID is for the ID of the typelib if this project is exposed to COM
// This will also be the Guid of the Rhino plug-in
[assembly: Guid("0FDA2F52-1B66-44D3-8BC1-8BB967B314A2")]