diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..3d68d53 --- /dev/null +++ b/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..974cd88 --- /dev/null +++ b/App.xaml.cs @@ -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(); + } + } +} diff --git a/AvaloniaMenuIssue.csproj b/AvaloniaMenuIssue.csproj new file mode 100644 index 0000000..08b8f97 --- /dev/null +++ b/AvaloniaMenuIssue.csproj @@ -0,0 +1,61 @@ + + + + net48 + 1.0 + AvaloniaMenuIssue + Description of AvaloniaMenuIssue + .rhp + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + + + MSBuild:Compile + + + + + + App.xaml + + + + MainWindow.xaml + + + + + + + + + + + C:\Program Files\Rhino 7\System\Rhino.exe + + Program + + + \ No newline at end of file diff --git a/AvaloniaMenuIssue.sln b/AvaloniaMenuIssue.sln new file mode 100644 index 0000000..8e0fd79 --- /dev/null +++ b/AvaloniaMenuIssue.sln @@ -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 diff --git a/AvaloniaMenuIssueCommand.cs b/AvaloniaMenuIssueCommand.cs new file mode 100644 index 0000000..c86a405 --- /dev/null +++ b/AvaloniaMenuIssueCommand.cs @@ -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; + } + + ///The only instance of this command. + public static AvaloniaMenuIssueCommand Instance { get; private set; } + + public static void InitAvalonia() + { + try + { + BuildAvaloniaApp().SetupWithoutStarting(); + } + catch(Exception e) + { + + } + + } + + public static AppBuilder BuildAvaloniaApp() + { + return AppBuilder.Configure() + .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(); + } + + ///The command name as it appears on the Rhino command line. + public override string EnglishName => "AvaloniaMenuIssueCommand"; + + protected override Result RunCommand(RhinoDoc doc, RunMode mode) + { + InitAvalonia(); + var mw = new MainWindow(); + mw.Show(); + + return Result.Success; + } + } +} + diff --git a/AvaloniaMenuIssuePlugin.cs b/AvaloniaMenuIssuePlugin.cs new file mode 100644 index 0000000..cf02306 --- /dev/null +++ b/AvaloniaMenuIssuePlugin.cs @@ -0,0 +1,28 @@ +using System; +using Rhino; + +namespace AvaloniaMenuIssue +{ + /// + /// 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. + /// 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). + /// + public class AvaloniaMenuIssuePlugin : Rhino.PlugIns.PlugIn + { + public AvaloniaMenuIssuePlugin() + { + Instance = this; + } + + ///Gets the only instance of the AvaloniaMenuIssuePlugin plug-in. + 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. + } +} diff --git a/EmbeddedResources/plugin-utility.ico b/EmbeddedResources/plugin-utility.ico new file mode 100644 index 0000000..022d1f7 Binary files /dev/null and b/EmbeddedResources/plugin-utility.ico differ diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..60d4a6e --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs new file mode 100644 index 0000000..5c5583e --- /dev/null +++ b/MainWindow.xaml.cs @@ -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 + } + + + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..47bdf48 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -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")] +