mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
c800f887d2
- **Core:** - (Add) Getter `FileFormat.DisplayPixelCount` Gets the display total number of pixels (ResolutionX * ResolutionY) - (Add) Getter `Layer.NonZeroPixelRatio` Gets the ratio between non zero pixels and display number of pixels - (Add) Getter `Layer.NonZeroPixelPercentage` Gets the percentage of non zero pixels relative to the display number of pixels - (Add) Getter `Layer.PreviousHeightLayer()` Gets the previous layer with a different height from the current, returns null if no previous layer - (Add) Getter `Layer.NextHeightLayer()` Gets the next layer with a different height from the current, returns null if no next layer - (Add) Method `Layer.GetPreviousLayerWithAtLeastPixelCountOf()` Gets the previous layer matching at least a number of pixels, returns null if no previous layer - (Add) Method `Layer.GetNextLayerWithAtLeastPixelCountOf()` Gets the next layer matching at least a number of pixels, returns null if no next layer - (Add) Method `Operation.GetRoiOrVolumeBounds()` returns the selected ROI rectangle or model volume bounds rectangle - (Add) Documentation around `Operation` methods - (Fix) Open files in partial mode when the resolution is not defined would cause a `NullPointerException` (#474) - **Suggestion: Wait time before cure** - (Add) Proportional maximum time change: Sets the maximum allowed time difference relative to the previous layer (#471) - (Add) Proportional mass get modes: Previous, Average and Maximum relative to a defined height (#471) - (Change) Proportional set type sets fallback time to the first layer - (Fix) Proportional set type was taking current layer mass instead of looking to the previous cured layer (#471) - **Tools:** - **Edit print parameters:** - (Change) Incorporate the unit label into the numeric input box - (Change) Allow TSMC speeds to be 0 as minimum value (#472) - (Fix) PCB Exposure: The thumbnail has random noise around the image - **Settings:** - (Add) Tools: "Always prompt for confirmation before execute the operation" - (Fix) Changing layer compression method when no file is loaded would cause a error - **UI:** - (Add) Holding Shift key while drag and drop a .uvtop file will try to execute the operation without showing the window or prompt - (Add) Drag and drop a .cs or .csx file into UVtools will load and show the scripting dialog with the file selected - (Add) Errors that crash application will now show an report window with the crash information and able to fast report them - (Add) "Version" key and value on registry to tell the current installed version (Windows MSI only) - (Upgrade) AvaloniaUI from 0.10.13 to 0.10.14 - (Upgrade) .NET from 6.0.4 to 6.0.5
116 lines
4.1 KiB
C#
116 lines
4.1 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.Globalization;
|
|
using System.Threading.Tasks;
|
|
using Avalonia;
|
|
using Projektanker.Icons.Avalonia;
|
|
using Projektanker.Icons.Avalonia.FontAwesome;
|
|
using Projektanker.Icons.Avalonia.MaterialDesign;
|
|
using UVtools.Core.SystemOS;
|
|
|
|
namespace UVtools.WPF;
|
|
|
|
#nullable enable
|
|
|
|
public static class Program
|
|
{
|
|
public static string[] Args = Array.Empty<string>();
|
|
public static bool IsCrashReport;
|
|
|
|
public static Stopwatch ProgramStartupTime = null!;
|
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
|
// yet and stuff might break.
|
|
[STAThread]
|
|
public static void Main(string[] args)
|
|
{
|
|
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
|
|
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
|
|
|
|
ProgramStartupTime = Stopwatch.StartNew();
|
|
Args = args;
|
|
try
|
|
{
|
|
if (ConsoleArguments.ParseArgs(args)) return;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine(e);
|
|
return;
|
|
}
|
|
|
|
if (Args.Length > 2 && Args[0] == "--crash-report")
|
|
{
|
|
IsCrashReport = true;
|
|
}
|
|
|
|
/*Slicer slicer = new(Size.Empty, SizeF.Empty, "D:\\Cube100x100x100.stl");
|
|
var slices = slicer.SliceModel(0.05f);
|
|
|
|
foreach (var slice in slices)
|
|
{
|
|
using var mat = EmguExtensions.InitMat(new Size(1000, 1000));
|
|
var contour = slice.Value.ToContour();
|
|
using var vec = new VectorOfPoint(contour);
|
|
CvInvoke.FillPoly(mat, vec, EmguExtensions.WhiteColor, LineType.AntiAlias);
|
|
mat.Save(@$"D:\SLICE\{slice.Key}.png");
|
|
}*/
|
|
|
|
// PrusaSlicer to Machine.cs
|
|
//var machines = Machine.GetMachinesFromPrusaSlicer();
|
|
//var machinesText = Machine.GenerateMachinePresetsFromPrusaSlicer();
|
|
|
|
// Add the event handler for handling non-UI thread exceptions to the event.
|
|
AppDomain.CurrentDomain.UnhandledException += (sender, e) => HandleUnhandledException("Non-UI", (Exception)e.ExceptionObject);
|
|
TaskScheduler.UnobservedTaskException += (sender, e) => HandleUnhandledException("Task", e.Exception);
|
|
//AppDomain.CurrentDomain.FirstChanceException += CurrentDomainOnFirstChanceException;
|
|
|
|
try
|
|
{
|
|
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
HandleUnhandledException("Application", e);
|
|
}
|
|
|
|
|
|
// Closing
|
|
}
|
|
|
|
private static void HandleUnhandledException(string category, Exception ex)
|
|
{
|
|
ErrorLog.AppendLine($"Fatal {category} Error", ex.ToString());
|
|
|
|
if (!IsCrashReport)
|
|
{
|
|
try
|
|
{
|
|
SystemAware.StartThisApplication($"--crash-report \"{category}\" \"{ex}\"");
|
|
//var errorMsg = $"An application error occurred. Please contact the administrator with the following information:\n\n{ex}";
|
|
//await App.MainWindow.MessageBoxError(errorMsg, "Fatal Non-UI Error");
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
Debug.WriteLine(exception);
|
|
Console.WriteLine(exception);
|
|
}
|
|
}
|
|
|
|
Environment.Exit(-1);
|
|
}
|
|
|
|
// Avalonia configuration, don't remove; also used by visual designer.
|
|
public static AppBuilder BuildAvaloniaApp()
|
|
=> AppBuilder.Configure<App>()
|
|
.UsePlatformDetect()
|
|
.With(new Win32PlatformOptions { AllowEglInitialization = false/*, UseWgl = true*/})
|
|
.With(new X11PlatformOptions { UseGpu = true/*, UseEGL = true*/ })
|
|
.With(new MacOSPlatformOptions { ShowInDock = true })
|
|
.With(new AvaloniaNativePlatformOptions { UseGpu = true })
|
|
.WithIcons(container => container
|
|
.Register<FontAwesomeIconProvider>()
|
|
.Register<MaterialDesignIconProvider>())
|
|
//.UseSkia()
|
|
.LogToTrace();
|
|
} |