mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-12 11:32:33 +02:00
3cd46728f1
- **Shortcuts:** - (Add) (Ctrl + Shift + R) to turn on and cycle the Rotate modes - (Add) (Ctrl + Shift + F) to turn on and cycle the Flip modes - (Add) (Ctrl + Shift + B) to select the build volume as ROI - **GUI:** - (Add) Allow to drag and drop '.uvtop' files into UVtools to sequential show and load operations from files - (Change) Rotate icon on layer preview - (Upgrade) AvaloniaUI from 0.10.3 to 0.10.4 - **Tools:** - (Add) 'Reset to defaults' button on every dialog - (Improvement) Window size and position handling - (Improvement) Constrain profile box width to not stretch the window - (Improvement) ROI section design - **Dynamic lift:** - (Add) View buttons to show the largest/smallest layers - (Add) Light-off mode: Set the light-off with an extra delay - (Add) Light-off mode: Set the light-off without an extra delay - (Add) Light-off mode: Set the light-off to zero - (Improvement) Disable bottom and/or normal layer fields when the selected range is outside - (Add) Settings - Automations: Light-off delay set modes - (Fix) Exposure time finder: Add staircase, bullseye and counter triangles to feature count at thumbnail
65 lines
2.3 KiB
C#
65 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Markup.Xaml;
|
|
using UVtools.Core.FileFormats;
|
|
using UVtools.Core.Operations;
|
|
using UVtools.WPF.Windows;
|
|
|
|
namespace UVtools.WPF.Controls.Tools
|
|
{
|
|
public class ToolRedrawModelControl : ToolControl
|
|
{
|
|
public OperationRedrawModel Operation => BaseOperation as OperationRedrawModel;
|
|
public ToolRedrawModelControl()
|
|
{
|
|
InitializeComponent();
|
|
BaseOperation = new OperationRedrawModel(SlicerFile);
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
|
|
public override void Callback(ToolWindow.Callbacks callback)
|
|
{
|
|
switch (callback)
|
|
{
|
|
case ToolWindow.Callbacks.Init:
|
|
case ToolWindow.Callbacks.Loaded:
|
|
ParentWindow.ButtonOkEnabled = !string.IsNullOrWhiteSpace(Operation.FilePath);
|
|
Operation.PropertyChanged += (sender, e) =>
|
|
{
|
|
if (e.PropertyName == nameof(Operation.FilePath))
|
|
{
|
|
ParentWindow.ButtonOkEnabled = !string.IsNullOrWhiteSpace(Operation.FilePath);
|
|
}
|
|
};
|
|
break;
|
|
}
|
|
}
|
|
|
|
public async void ImportFile()
|
|
{
|
|
var filters = Helpers.ToAvaloniaFileFilter(FileFormat.AllFileFiltersAvalonia);
|
|
var orderedFilters = new List<FileDialogFilter> { filters[UserSettings.Instance.General.DefaultOpenFileExtensionIndex] };
|
|
for (int i = 0; i < filters.Count; i++)
|
|
{
|
|
if (i == UserSettings.Instance.General.DefaultOpenFileExtensionIndex) continue;
|
|
orderedFilters.Add(filters[i]);
|
|
}
|
|
|
|
var dialog = new OpenFileDialog
|
|
{
|
|
AllowMultiple = false,
|
|
Filters = orderedFilters,
|
|
Directory = UserSettings.Instance.General.DefaultDirectoryOpenFile
|
|
};
|
|
var files = await dialog.ShowAsync(ParentWindow);
|
|
if (files is null || files.Length <= 0) return;
|
|
if (FileFormat.FindByExtension(files[0], true) is null) return;
|
|
Operation.FilePath = files[0];
|
|
}
|
|
}
|
|
}
|