blob: c40ec55d47319383179743da10b9c108c4f0b706 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System.Linq;
using System.Text;
using UVtools.Core.FileFormats;
using UVtools.Core.Objects;
namespace UVtools.Core.Operations
{
public class OperationEditParameters : Operation
{
public override Enumerations.LayerRangeSelection LayerRangeSelection => Enumerations.LayerRangeSelection.None;
public override bool CanROI { get; set; } = false;
public override string Title => "Edit print parameters";
public override string Description =>
"Edits the available print parameters.";
public override string ConfirmationText
{
get
{
var sb = new StringBuilder();
foreach (var modifier in Modifiers)
{
if(!modifier.HasChanged) continue;
sb.AppendLine($"{modifier.Name}: {modifier.OldValue}{modifier.ValueUnit} » {modifier.NewValue}{modifier.ValueUnit}");
}
return $"commit print parameter changes?\n{sb}";
}
}
public override string ProgressTitle => "Change print parameters";
public override string ProgressAction => "Changing print parameters";
public override StringTag Validate(params object[] parameters)
{
var sb = new StringBuilder();
var changed = Modifiers.Any(modifier => modifier.HasChanged);
if (!changed)
{
sb.AppendLine("Nothing changed\nDo some changes or cancel the operation.");
}
return new StringTag(sb.ToString());
}
public FileFormat.PrintParameterModifier[] Modifiers { get; set; }
public OperationEditParameters()
{
}
public OperationEditParameters(FileFormat.PrintParameterModifier[] modifiers)
{
Modifiers = modifiers;
}
}
}
|