diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-08-22 01:39:20 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-08-22 01:39:20 +0300 |
commit | e550fdc2668177fd70ecc730bd70ad5e6003fa17 (patch) | |
tree | 873082afc9e2b914aaeb98ac6027dfddad6fd9c4 | |
parent | 50fcb396383721d9d97e2645fa8799e20a4c9700 (diff) |
v3.6.2v3.6.2
- (Add) Debug sub menu to test some behaviours (Only when compiled in debug mode, not visible on public release)
- (Add) Utility method `LayerExists` to the file formats to know if specific layer index exists in the collection
- (Improvement) Add loaded file information to the crash dialog message
- (Fix) Message dialog height do not expand with text (#537)
- (Fix) Crash when all layers get removed and UI attempt to show a layer (#538)
27 files changed, 278 insertions, 311 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 36aa75a..c258400 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 21/08/2022 - v3.6.2 + +- (Add) Debug sub menu to test some behaviours (Only when compiled in debug mode, not visible on public release) +- (Add) Utility method `LayerExists` to the file formats to know if specific layer index exists in the collection +- (Improvement) Add loaded file information to the crash dialog message +- (Fix) Message dialog height do not expand with text (#537) +- (Fix) Crash when all layers get removed and UI attempt to show a layer (#538) + ## 19/08/2022 - v3.6.1 - (Fix) GCode: Improve the regex for parsing layer index from comments, also fixes chitubox zip format layer parsing @@ -72,4 +72,5 @@ - Ed Wagaman - Marcin Chomiczuk - Patrick Hofmann -- Ajilus
\ No newline at end of file +- Ajilus +- James F Hammond
\ No newline at end of file diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index f84e033..1d470b9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ -- (Fix) GCode: Improve the regex for parsing layer index from comments, also fixes chitubox zip format layer parsing -- (Fix) MacOS: Auto updater was not copying the files to the right location, leading to not upgrade the program. However this version still need to update manually +- (Add) Debug sub menu to test some behaviours (Only when compiled in debug mode, not visible on public release) +- (Add) Utility method `LayerExists` to the file formats to know if specific layer index exists in the collection +- (Improvement) Add loaded file information to the crash dialog message +- (Fix) Message dialog height do not expand with text (#537) +- (Fix) Crash when all layers get removed and UI attempt to show a layer (#538) diff --git a/UVtools.Cmd/UVtools.Cmd.csproj b/UVtools.Cmd/UVtools.Cmd.csproj index 448c116..6889d5e 100644 --- a/UVtools.Cmd/UVtools.Cmd.csproj +++ b/UVtools.Cmd/UVtools.Cmd.csproj @@ -21,7 +21,7 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1" /> + <PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" /> </ItemGroup> <ItemGroup> diff --git a/UVtools.Core/FileFormats/FileFormat.cs b/UVtools.Core/FileFormats/FileFormat.cs index d1796be..fd7481d 100644 --- a/UVtools.Core/FileFormats/FileFormat.cs +++ b/UVtools.Core/FileFormats/FileFormat.cs @@ -1294,7 +1294,7 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable<FileFor /// <summary> /// Gets the last layer index /// </summary> - public uint LastLayerIndex => LayerCount - 1; + public uint LastLayerIndex => LayerCount > 0 ? LayerCount - 1 : 0; /// <summary> /// Gets the first layer @@ -5415,7 +5415,25 @@ public abstract class FileFormat : BindableBase, IDisposable, IEquatable<FileFor return layers; } + /// <summary> + /// Checks if a layer index exists in the collection + /// </summary> + /// <param name="layerIndex">Layer index to check</param> + /// <returns></returns> + public bool LayerExists(int layerIndex) + { + return layerIndex >= 0 && layerIndex < LayerCount; + } + /// <summary> + /// Checks if a layer index exists in the collection + /// </summary> + /// <param name="layerIndex">Layer index to check</param> + /// <returns></returns> + public bool LayerExists(uint layerIndex) + { + return layerIndex < LayerCount; + } #endregion #region Layer methods diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 11f6740..ad1e2e3 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl> <Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description> - <Version>3.6.1</Version> + <Version>3.6.2</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> diff --git a/UVtools.InstallerMM/UVtools.InstallerMM.wxs b/UVtools.InstallerMM/UVtools.InstallerMM.wxs index 8203d5c..8807e58 100644 --- a/UVtools.InstallerMM/UVtools.InstallerMM.wxs +++ b/UVtools.InstallerMM/UVtools.InstallerMM.wxs @@ -2,7 +2,7 @@ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?define ComponentRules="OneToOne"?> <!-- SourceDir instructs IsWiX the location of the directory that contains files for this merge module --> - <?define SourceDir="..\publish\UVtools_win-x64_v3.6.1"?> + <?define SourceDir="..\publish\UVtools_win-x64_v3.6.2"?> <Module Id="UVtools" Language="1033" Version="1.0.0.0"> <Package Id="12aaa1cf-ff06-4a02-abd5-2ac01ac4f83b" Manufacturer="PTRTECH" InstallerVersion="200" Keywords="MSLA, DLP" Description="MSLA/DLP, file analysis, repair, conversion and manipulation" InstallScope="perMachine" Platform="x64" /> <Directory Id="TARGETDIR" Name="SourceDir"> @@ -1286,9 +1286,6 @@ <Component Id="owc8370BED3D17A58E88E193350B14A5450" Guid="cc521992-26e9-bf12-e777-68f8e2102405"> <File Id="owf8370BED3D17A58E88E193350B14A5450" Source="$(var.SourceDir)\cs\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owcCB98727B387246ECB61E92C565A1472C" Guid="CB98727B-3872-46EC-B61E-92C565A1472C"> - <File Id="owfCB98727B387246ECB61E92C565A1472C" Source="$(var.SourceDir)\cs\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owd17C6A2D314297F8FF3C608803909F7BE" Name="de"> <Component Id="owc6A8D7823467C066EA1EC2F740C66084D" Guid="82c152c6-97bf-f75d-44fc-294474d9a7cb"> @@ -1303,9 +1300,6 @@ <Component Id="owcF790A17350C2437C0E1E354B9D980161" Guid="627f2dc4-5b88-d3f7-3acf-7630111e30e8"> <File Id="owfF790A17350C2437C0E1E354B9D980161" Source="$(var.SourceDir)\de\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owc433CD233B1E34988900522E9DFA584DE" Guid="433CD233-B1E3-4988-9005-22E9DFA584DE"> - <File Id="owf433CD233B1E34988900522E9DFA584DE" Source="$(var.SourceDir)\de\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owdF542F1E9B1CF46F5EC5BF0998941ED93" Name="es"> <Component Id="owcDD2F3A9E1BC6C55110A95C76B075BB2A" Guid="1082627f-113d-241a-abee-cb25d4b696fe"> @@ -1320,9 +1314,6 @@ <Component Id="owcB59CB618361B113CFA57D75E883608EA" Guid="ddc56db3-e6a2-c7aa-dc21-3b247964758c"> <File Id="owfB59CB618361B113CFA57D75E883608EA" Source="$(var.SourceDir)\es\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owc6BF60AD9179E41168945B6C42CFF2D8B" Guid="6BF60AD9-179E-4116-8945-B6C42CFF2D8B"> - <File Id="owf6BF60AD9179E41168945B6C42CFF2D8B" Source="$(var.SourceDir)\es\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owdA426C3729D5D59516430C8F667ED8DE8" Name="fr"> <Component Id="owcFECC4FDE99CBE3816D982D1FF8E5E196" Guid="703ebe68-adaa-3f9c-606b-b42fec5159e8"> @@ -1337,9 +1328,6 @@ <Component Id="owcE8E57F27B5A0C2D7A27A164639AA95F9" Guid="caac4561-da90-4c7b-02cd-bdfca5be1694"> <File Id="owfE8E57F27B5A0C2D7A27A164639AA95F9" Source="$(var.SourceDir)\fr\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owcBC3C3AAC6D3840F88E5C8D6C7B754E1E" Guid="BC3C3AAC-6D38-40F8-8E5C-8D6C7B754E1E"> - <File Id="owfBC3C3AAC6D3840F88E5C8D6C7B754E1E" Source="$(var.SourceDir)\fr\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owd74DAE01CDA8C981B3918AC92ED360AA1" Name="it"> <Component Id="owc4DD3418A4620DABCBBB6CCAA8ECA2707" Guid="421c92b6-85d7-3733-b9a5-ed10229c89a5"> @@ -1354,9 +1342,6 @@ <Component Id="owc8B74032559230C1C0C2B5082475A5CD4" Guid="39eabb54-8dd8-65e8-fe00-359ad09cae2a"> <File Id="owf8B74032559230C1C0C2B5082475A5CD4" Source="$(var.SourceDir)\it\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owcC5BDCB6F102D450F8A077E8772BA5337" Guid="C5BDCB6F-102D-450F-8A07-7E8772BA5337"> - <File Id="owfC5BDCB6F102D450F8A077E8772BA5337" Source="$(var.SourceDir)\it\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owd939A7C952EF97FFE1E5F44BC8281E343" Name="ja"> <Component Id="owc51FE3ECF820BD499CDE7DBB22A69167D" Guid="3201321c-b8c7-5cbb-2ad8-f8bf5b451b3d"> @@ -1371,9 +1356,6 @@ <Component Id="owc0A9733AEBD37AD14413D6F786BB5FA8A" Guid="f57405c2-169e-0504-01db-e115d156226b"> <File Id="owf0A9733AEBD37AD14413D6F786BB5FA8A" Source="$(var.SourceDir)\ja\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owc336210A1AB1A4F1D9E15297121711688" Guid="336210A1-AB1A-4F1D-9E15-297121711688"> - <File Id="owf336210A1AB1A4F1D9E15297121711688" Source="$(var.SourceDir)\ja\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owd26824DD7BA688994CEC324C96033C66B" Name="ko"> <Component Id="owc82B969E8D4D535732FCF01718B7E606D" Guid="993f9efe-f89f-7b95-8443-2341e293e7a6"> @@ -1388,9 +1370,6 @@ <Component Id="owc49136EC48B42F29310D5FAB96EB39C77" Guid="7d59fb12-e36d-3b98-1b54-8182dc102913"> <File Id="owf49136EC48B42F29310D5FAB96EB39C77" Source="$(var.SourceDir)\ko\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owcF366C6A34BC246A4BCAAC960B9CE4D51" Guid="F366C6A3-4BC2-46A4-BCAA-C960B9CE4D51"> - <File Id="owfF366C6A34BC246A4BCAAC960B9CE4D51" Source="$(var.SourceDir)\ko\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owdC3B37D0EB36BEDA1B06A324A062DC94D" Name="pl"> <Component Id="owc4D2D720AD4B25046F5C3A8337C58558F" Guid="f9f595eb-39b5-e326-d983-3aca9a6bb500"> @@ -1405,9 +1384,6 @@ <Component Id="owc01C7CE26E845E06F3A50D520FB278BCF" Guid="d1ddafed-c698-3973-d2a4-4c4d00620030"> <File Id="owf01C7CE26E845E06F3A50D520FB278BCF" Source="$(var.SourceDir)\pl\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owc201ED0FBC5634A63B276744A6A4568C4" Guid="201ED0FB-C563-4A63-B276-744A6A4568C4"> - <File Id="owf201ED0FBC5634A63B276744A6A4568C4" Source="$(var.SourceDir)\pl\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owdE3101CE52C8B10FCC8A2CC81C4C96F39" Name="pt-BR"> <Component Id="owc66101D80AE2357408A5C5CDB0D87BEB0" Guid="9fa0b68e-9b5f-699d-79d5-b93a4344d2eb"> @@ -1422,9 +1398,6 @@ <Component Id="owc233F59943A3FA33488E78259D09163C6" Guid="e99cb644-a268-a6af-face-e2e7834333cb"> <File Id="owf233F59943A3FA33488E78259D09163C6" Source="$(var.SourceDir)\pt-BR\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owc0AE0796E0CC041FBA07B4073EC80B7B9" Guid="0AE0796E-0CC0-41FB-A07B-4073EC80B7B9"> - <File Id="owf0AE0796E0CC041FBA07B4073EC80B7B9" Source="$(var.SourceDir)\pt-BR\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owdEAE4E7B6D44EEB507A9E5B7539B1C34A" Name="ru"> <Component Id="owcB065F45686216D7224FE9E57071535B1" Guid="e96c2dc1-7b2a-91cf-dfb2-add81e62ac2b"> @@ -1439,9 +1412,6 @@ <Component Id="owc53575A00E0697BB0E07983D26C103FEA" Guid="64e7fa95-8227-2c96-6a82-e914b6ce047c"> <File Id="owf53575A00E0697BB0E07983D26C103FEA" Source="$(var.SourceDir)\ru\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owc843CF10750AE4D3482AFE6C0EF22BAB1" Guid="843CF107-50AE-4D34-82AF-E6C0EF22BAB1"> - <File Id="owf843CF10750AE4D3482AFE6C0EF22BAB1" Source="$(var.SourceDir)\ru\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owdFCC3FD9F99A4D5BEDEAC61F3322D2D93" Name="tr"> <Component Id="owcEC06D7EB1988F1B550C8B3569B0261D3" Guid="07379a43-cb0f-ea5f-0cfe-d71fddfe14e6"> @@ -1456,9 +1426,6 @@ <Component Id="owc91567B2B4E8154089395D1A78358BE89" Guid="1c327c0f-a510-b334-7130-5c9e6609dc7b"> <File Id="owf91567B2B4E8154089395D1A78358BE89" Source="$(var.SourceDir)\tr\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owcA539F189A0C84A9F8E802FEE9FDEBEDD" Guid="A539F189-A0C8-4A9F-8E80-2FEE9FDEBEDD"> - <File Id="owfA539F189A0C84A9F8E802FEE9FDEBEDD" Source="$(var.SourceDir)\tr\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owd7142663FADDFFB05CCE01DC370DE4995" Name="zh-Hans"> <Component Id="owc28B8853BEB28067D4AB79B73216A3AC8" Guid="f6b6af15-bb3a-3eda-972d-47cb28af6c03"> @@ -1473,9 +1440,6 @@ <Component Id="owc5371E4C6A9B06D411E8EAC3E5A48E7EA" Guid="a7649dfb-52b9-08d3-6f03-f7aed4d2cce3"> <File Id="owf5371E4C6A9B06D411E8EAC3E5A48E7EA" Source="$(var.SourceDir)\zh-Hans\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owcC563AB6969004ECC97A8859CCEE8A25A" Guid="C563AB69-6900-4ECC-97A8-859CCEE8A25A"> - <File Id="owfC563AB6969004ECC97A8859CCEE8A25A" Source="$(var.SourceDir)\zh-Hans\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Directory Id="owdA86DB5E08AB73906A10F69BC4AA81DE2" Name="zh-Hant"> <Component Id="owc18EA70FFACC7303C11A678723F8E1919" Guid="71c1ee6c-af04-89be-a2f7-20205b5f371e"> @@ -1490,9 +1454,6 @@ <Component Id="owc505D5854210A555AEF782935C164E813" Guid="778f403b-5deb-df93-7dc7-44b5fa099c25"> <File Id="owf505D5854210A555AEF782935C164E813" Source="$(var.SourceDir)\zh-Hant\Microsoft.CodeAnalysis.Scripting.resources.dll" KeyPath="yes" /> </Component> - <Component Id="owcC2225AC993F14DADA08B59442159798E" Guid="C2225AC9-93F1-4DAD-A08B-59442159798E"> - <File Id="owfC2225AC993F14DADA08B59442159798E" Source="$(var.SourceDir)\zh-Hant\System.CommandLine.resources.dll" KeyPath="yes" /> - </Component> </Directory> <Component Id="owc2B1C136C44C740F48CDFE91A80F48B4B" Guid="2B1C136C-44C7-40F4-8CDF-E91A80F48B4B"> <File Id="owf2B1C136C44C740F48CDFE91A80F48B4B" Source="$(var.SourceDir)\opencv_videoio_ffmpeg455_64.dll" KeyPath="yes" /> @@ -1536,24 +1497,6 @@ <Component Id="owc2DE24885E97D4FD3AB633AA53F125FED" Guid="2DE24885-E97D-4FD3-AB63-3AA53F125FED"> <File Id="owf2DE24885E97D4FD3AB633AA53F125FED" Source="$(var.SourceDir)\UVtools.sh" KeyPath="yes" /> </Component> - <Component Id="owcEF2C9ED70B264423B1145D94F760DF42" Guid="EF2C9ED7-0B26-4423-B114-5D94F760DF42"> - <File Id="owfEF2C9ED70B264423B1145D94F760DF42" Source="$(var.SourceDir)\System.CommandLine.dll" KeyPath="yes" /> - </Component> - <Component Id="owcED313361637349C1B3515192A64FDE80" Guid="ED313361-6373-49C1-B351-5192A64FDE80"> - <File Id="owfED313361637349C1B3515192A64FDE80" Source="$(var.SourceDir)\UVtoolsCmd.deps.json" KeyPath="yes" /> - </Component> - <Component Id="owcE8F653F9E34A4D0FA5A5A0D3B7C353F3" Guid="E8F653F9-E34A-4D0F-A5A5-A0D3B7C353F3"> - <File Id="owfE8F653F9E34A4D0FA5A5A0D3B7C353F3" Source="$(var.SourceDir)\UVtoolsCmd.dll" KeyPath="yes" /> - </Component> - <Component Id="owc524AFA435EB94D5B84D9A52E96983FF5" Guid="524AFA43-5EB9-4D5B-84D9-A52E96983FF5"> - <File Id="owf524AFA435EB94D5B84D9A52E96983FF5" Source="$(var.SourceDir)\UVtoolsCmd.exe" KeyPath="yes" /> - </Component> - <Component Id="owc7739FB911743477F89DF57A0A2503357" Guid="7739FB91-1743-477F-89DF-57A0A2503357"> - <File Id="owf7739FB911743477F89DF57A0A2503357" Source="$(var.SourceDir)\UVtoolsCmd.pdb" KeyPath="yes" /> - </Component> - <Component Id="owcD2245B900E5C448485AD96FE57629D9D" Guid="D2245B90-0E5C-4484-85AD-96FE57629D9D"> - <File Id="owfD2245B900E5C448485AD96FE57629D9D" Source="$(var.SourceDir)\UVtoolsCmd.runtimeconfig.json" KeyPath="yes" /> - </Component> <Component Id="owc1AE8795C4CF24718B9BFE67B19A54931" Guid="1AE8795C-4CF2-4718-B9BF-E67B19A54931"> <File Id="owf1AE8795C4CF24718B9BFE67B19A54931" Source="$(var.SourceDir)\CommunityToolkit.HighPerformance.dll" KeyPath="yes" /> </Component> diff --git a/UVtools.WPF/App.axaml.cs b/UVtools.WPF/App.axaml.cs index d959c17..674362a 100644 --- a/UVtools.WPF/App.axaml.cs +++ b/UVtools.WPF/App.axaml.cs @@ -48,6 +48,19 @@ public class App : Application [Description("Default dark")] DefaultDark } + + public static bool IsDebug + { + get + { +#if DEBUG + return true; +#else + return false; +#endif + } + } + //public static ThemeSelector ThemeSelector { get; set; } public static MainWindow MainWindow = null!; public static FileFormat? SlicerFile = null; @@ -207,10 +220,15 @@ public class App : Application if (Program.IsCrashReport) { //Program.Args = new[] {"--crash-report", "Debug", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." }; + if (Program.Args.Length < 3) return; if (string.IsNullOrWhiteSpace(Program.Args[1])) return; - if(string.IsNullOrWhiteSpace(Program.Args[2])) return; + if (string.IsNullOrWhiteSpace(Program.Args[2])) return; var category = Program.Args[1]; var message = $"{Program.Args[2]}\nCategory: {category}"; + if (Program.Args.Length >= 4 && !string.IsNullOrWhiteSpace(Program.Args[3])) + { + message += $"\nFile: {Program.Args[3]}"; + } var bugReportMessageMk = $"# Report\n```\n{message}\n```"; @@ -227,7 +245,7 @@ public class App : Application var append2 = $"\n\nMachine date time: {DateTime.Now}\n UTC date time: {DateTime.UtcNow}"; message += append2; - bugReportMessageMk += $"{append2}\n\n# Additional information and Workflow\nComplete with additional information and the workflow that caused this crash."; + bugReportMessageMk += $"{append2}\n\n# Additional information and Workflow\nComplete with additional information and the workflow that caused this crash with the file as well."; try { @@ -237,40 +255,18 @@ public class App : Application { // ignored } + - - var reportButton = MessageWindow.CreateButton("Report", "fa-solid fa-bug"); - reportButton.Click += (sender, e) => - { - Current?.Clipboard?.SetTextAsync(bugReportMessageMk); - using var reader = new StringReader(message); - SystemAware.OpenBrowser($"https://github.com/sn4k3/UVtools/issues/new?assignees=sn4k3&labels=&template=bug_report.md&title={HttpUtility.UrlEncode($"[Crash] {reader.ReadLine()}")}&body={HttpUtility.UrlEncode("<!--\n# Instructions:\n1. Click on this box;\n2. Select all it text (Ctrl + A);\n3. Paste the report content (Ctrl + V);\n4. Review the content;\n5. Submit the issue.\n!-->")}"); - e.Handled = true; - }; - - var helpButton = MessageWindow.CreateButton("Help", "fa-solid fa-question"); - helpButton.Click += (sender, e) => - { - Current?.Clipboard?.SetTextAsync(bugReportMessageMk); - SystemAware.OpenBrowser("https://github.com/sn4k3/UVtools/discussions/categories/q-a"); - e.Handled = true; - }; - - var restartButton = MessageWindow.CreateButton("Restart", "fa-solid fa-redo-alt"); - restartButton.Click += (sender, e) => - { - SystemAware.StartThisApplication(); - }; - + using var reader = new StringReader(message); desktop.MainWindow = new MessageWindow($"{About.SoftwareWithVersion} - Crash report", "fa-regular fa-frown", $"{About.Software} crashed due an unexpected {category.ToLowerInvariant()} error.\nYou can report this error if you find necessary.\nFind more details below:\n", message, new[] { - reportButton, - helpButton, - restartButton, + MessageWindow.CreateLinkButtonAction("Report", "fa-solid fa-bug", $"https://github.com/sn4k3/UVtools/issues/new?assignees=sn4k3&labels=&template=bug_report.md&title={HttpUtility.UrlEncode($"[Crash] {reader.ReadLine()}")}&body={HttpUtility.UrlEncode("<!--\n# Instructions:\n1. Click on this box;\n2. Select all it text (Ctrl + A);\n3. Paste the report content (Ctrl + V);\n4. Review the content;\n5. Submit the issue.\n!-->")}", () => Current?.Clipboard?.SetTextAsync(bugReportMessageMk)), + MessageWindow.CreateLinkButtonAction("Help", "fa-solid fa-question", "https://github.com/sn4k3/UVtools/discussions/categories/q-a", () => Current?.Clipboard?.SetTextAsync(bugReportMessageMk)), + MessageWindow.CreateButtonAction("Restart", "fa-solid fa-redo-alt", () => SystemAware.StartThisApplication()), MessageWindow.CreateCloseButton("fa-solid fa-sign-out-alt") }); } @@ -280,12 +276,38 @@ public class App : Application { if (!CvInvoke.Init()) { - desktop.MainWindow = new CantRunWindow(); + desktop.MainWindow = new MessageWindow($"{About.SoftwareWithVersion} is unable to run", + "fa-regular fa-frown", + $"{About.SoftwareWithVersionArch} [{SystemAware.OperatingSystemName}]\nUnable to run due one or more missing dependencies.\nTriggered by: libcvextern (OpenCV)", + "Your system doesn't have the required dependencies in order to run.\n" + + "Those dependencies are required at libcvextern/OpenCV library.\n" + + "UVtools is built on top of the OpenCV and therefore cannot run.\n\n" + + "Please install or build the dependencies in order to run the software.\n" + + "Check the manual page at 'Requirements' section for help.", + new[] + { + MessageWindow.CreateLinkButton("Open manual", "fa-brands fa-edge", "https://github.com/sn4k3/UVtools#requirements"), + MessageWindow.CreateLinkButton("Ask for help", "fa-solid fa-question", "https://github.com/sn4k3/UVtools/discussions/categories/q-a"), + MessageWindow.CreateCloseButton("fa-solid fa-sign-out-alt") + }); } } catch (Exception e) { - desktop.MainWindow = new CantRunWindow(); + desktop.MainWindow = new MessageWindow($"{About.SoftwareWithVersion} is unable to run", + "fa-regular fa-frown", + $"{About.SoftwareWithVersionArch} [{SystemAware.OperatingSystemName}]\nUnable to run due one or more missing dependencies.\nTriggered by: libcvextern (OpenCV)", + "Your system doesn't have the required dependencies in order to run.\n" + + "Those dependencies are required at libcvextern/OpenCV library.\n" + + "UVtools is built on top of the OpenCV and therefore cannot run.\n\n" + + "Please install or build the dependencies in order to run the software.\n" + + "Check the manual page at 'Requirements' section for help.", + new[] + { + MessageWindow.CreateLinkButton("Open manual", "fa-brands fa-edge", "https://github.com/sn4k3/UVtools#requirements"), + MessageWindow.CreateLinkButton("Ask for help", "fa-solid fa-question", "https://github.com/sn4k3/UVtools/discussions/categories/q-a"), + MessageWindow.CreateCloseButton("fa-solid fa-sign-out-alt") + }); Console.WriteLine(e.ToString()); } @@ -321,7 +343,7 @@ public class App : Application base.OnFrameworkInitializationCompleted(); } - #region Utilities +#region Utilities public static string ApplicationPath => AppContext.BaseDirectory; public static readonly string AppExecutable = Environment.ProcessPath!; public static readonly string AppExecutableQuoted = $"\"{AppExecutable}\""; @@ -403,9 +425,9 @@ public class App : Application return null; } - #endregion +#endregion - #region Assembly properties +#region Assembly properties public static Assembly WpfAssembly => Assembly.GetExecutingAssembly(); public static string AssemblyVersion => WpfAssembly.GetName().Version?.ToString()!; @@ -471,5 +493,5 @@ public class App : Application return attributes.Length == 0 ? string.Empty : ((AssemblyCompanyAttribute)attributes[0]).Company; } } - #endregion +#endregion }
\ No newline at end of file diff --git a/UVtools.WPF/Assets/Styles/Styles.xaml b/UVtools.WPF/Assets/Styles/Styles.xaml index 144009a..d74492a 100644 --- a/UVtools.WPF/Assets/Styles/Styles.xaml +++ b/UVtools.WPF/Assets/Styles/Styles.xaml @@ -42,13 +42,47 @@ </Style> <Style Selector="TextBox.TransparentReadOnly"> + <Setter Property="IsReadOnly" Value="True" /> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="CaretBrush" Value="Transparent" /> + <Setter Property="BorderBrush" Value="Transparent" /> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> + </Style> + + <Style Selector="TextBox.TransparentReadOnlyMultiLine"> <Setter Property="TextWrapping" Value="Wrap" /> <Setter Property="IsReadOnly" Value="True" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="CaretBrush" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="AcceptsReturn" Value="True" /> - <Setter Property="AcceptsTab" Value="True" /> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> + </Style> + + <Style Selector="TextBox.TransparentReadOnlyMultiLineNoBorder"> + <Setter Property="BorderThickness" Value="0" /> + <Setter Property="TextWrapping" Value="Wrap" /> + <Setter Property="IsReadOnly" Value="True" /> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="CaretBrush" Value="Transparent" /> + <Setter Property="BorderBrush" Value="Transparent" /> + <Setter Property="AcceptsReturn" Value="True" /> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> + </Style> + + <Style Selector="TextBox.TransparentReadOnlyMultiLineNoBorder:pointerover /template/ Border#border"> + <Setter Property="Background" Value="Transparent" /> + </Style> + <Style Selector="TextBox.TransparentReadOnlyMultiLineNoBorder:pointerover /template/ Border#PART_BorderElement"> + <Setter Property="Background" Value="Transparent" /> + </Style> + <Style Selector="TextBox.TransparentReadOnlyMultiLineNoBorder:focus /template/ Border#border"> + <Setter Property="BorderThickness" Value="0" /> + <Setter Property="Background" Value="Transparent" /> + </Style> + <Style Selector="TextBox.TransparentReadOnlyMultiLineNoBorder:focus /template/ Border#PART_BorderElement"> + <Setter Property="BorderThickness" Value="0" /> + <Setter Property="Background" Value="Transparent" /> </Style> <Style Selector="NumericUpDown.ReadOnly"> diff --git a/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml b/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml index 4d06407..2568d9a 100644 --- a/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml +++ b/UVtools.WPF/Controls/Tools/ToolCalculatorControl.axaml @@ -12,7 +12,7 @@ Background="{DynamicResource LightBackground}" BorderBrush="Black" BorderThickness="1"> <TextBox VerticalAlignment="Center" - Classes="TransparentReadOnly" + Classes="TransparentReadOnlyMultiLineNoBorder" Padding="10"> <TextBox.Text> <MultiBinding StringFormat="\{0\}

Formula: \{1\}"> @@ -174,7 +174,7 @@ Background="{DynamicResource LightBackground}" BorderBrush="Black" BorderThickness="1"> <TextBox VerticalAlignment="Center" - Classes="TransparentReadOnly" + Classes="TransparentReadOnlyMultiLineNoBorder" Padding="10"> <TextBox.Text> <MultiBinding StringFormat="\{0\}

Formula: \{1\}"> @@ -403,7 +403,7 @@ <Border Background="{DynamicResource LightBackground}" BorderBrush="Black" BorderThickness="1"> - <TextBox VerticalAlignment="Center" Classes="TransparentReadOnly" Padding="10"> + <TextBox VerticalAlignment="Center" Classes="TransparentReadOnlyMultiLineNoBorder" Padding="10"> <TextBox.Text> <MultiBinding StringFormat="\{0\}

Formula: \{1\}"> <Binding Path="Operation.CalcOptimalModelTilt.Description"/> diff --git a/UVtools.WPF/Controls/WindowEx.cs b/UVtools.WPF/Controls/WindowEx.cs index 940bc6a..49c76d5 100644 --- a/UVtools.WPF/Controls/WindowEx.cs +++ b/UVtools.WPF/Controls/WindowEx.cs @@ -104,6 +104,8 @@ public class WindowEx : Window, INotifyPropertyChanged, IStyleable public double WindowsWidthMaxSizeRatio { get; set; } = 1; public double WindowsHeightMaxSizeRatio { get; set; } = 1; + public bool IsDebug => App.IsDebug; + public UserSettings Settings => UserSettings.Instance; public virtual FileFormat SlicerFile diff --git a/UVtools.WPF/MainWindow.LayerPreview.cs b/UVtools.WPF/MainWindow.LayerPreview.cs index 37e697e..1ece76d 100644 --- a/UVtools.WPF/MainWindow.LayerPreview.cs +++ b/UVtools.WPF/MainWindow.LayerPreview.cs @@ -465,9 +465,9 @@ public partial class MainWindow public string MinimumLayerString => SlicerFile is null ? "???" : $"{SlicerFile.LayerHeight}mm\n0"; public string MaximumLayerString => SlicerFile is null ? "???" : $"{SlicerFile.PrintHeight}mm\n{SlicerFile.LastLayerIndex}"; - public string ActualLayerTooltip => SlicerFile is null ? "???" : $"{Layer.ShowHeight(SlicerFile[_actualLayer]?.PositionZ ?? 0)}mm\n" + - $"{ActualLayer}\n" + - $"{(ActualLayer + 1) * 100 / SlicerFile.LayerCount}%"; + public string ActualLayerTooltip => SlicerFile is null || !SlicerFile.LayerExists(_actualLayer) ? "???" : $"{Layer.ShowHeight(SlicerFile[_actualLayer]?.PositionZ ?? 0)}mm\n" + + $"{_actualLayer}\n" + + $"{(_actualLayer + 1) * 100 / SlicerFile.LayerCount}%"; public uint SliderMaximumValue => SlicerFile?.LastLayerIndex ?? 0; @@ -845,6 +845,14 @@ public partial class MainWindow InvalidateLayerNavigation(); } + if (_actualLayer >= SlicerFile.LayerCount) // No valid layer + { + CurrentLayerProperties.Clear(); + LayerImageBox.Image = null; + LayerCache.Clear(); + return; + } + var watch = Stopwatch.StartNew(); LayerCache.Layer = SlicerFile[_actualLayer]; if (LayerCache.Image is null) diff --git a/UVtools.WPF/MainWindow.axaml b/UVtools.WPF/MainWindow.axaml index 9aeb018..2223d30 100644 --- a/UVtools.WPF/MainWindow.axaml +++ b/UVtools.WPF/MainWindow.axaml @@ -230,7 +230,24 @@ CommandParameter="https://github.com/sn4k3/UVtools/discussions/categories/ideas" i:MenuItem.Icon="fa-solid fa-lightbulb"/> - </MenuItem> + <Separator IsVisible="{Binding IsDebug}"/> + + <MenuItem Header="_Debug tools" + i:MenuItem.Icon="fa-solid fa-bug-slash"> + + <MenuItem Header="Throw exception" + IsVisible="{Binding IsDebug}" + Command="{Binding MenuHelpDebugThrowExceptionClicked}" + i:MenuItem.Icon="fa-solid fa-explosion"/> + + <MenuItem Header="Show long message box" + IsVisible="{Binding IsDebug}" + Command="{Binding MenuHelpDebugLongMessageBoxClicked}" + i:MenuItem.Icon="fa-solid fa-message"/> + + </MenuItem> + + </MenuItem> <MenuItem Background="LimeGreen" IsVisible="{Binding VersionChecker.HaveNewVersion}" diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index 2227fad..50f1229 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -1176,6 +1176,16 @@ public partial class MainWindow : WindowEx await new PrusaSlicerManagerWindow().ShowDialog(this); } + public void MenuHelpDebugThrowExceptionClicked() + { + var i = 1 / new Random().Next(0, 0); + } + + public async void MenuHelpDebugLongMessageBoxClicked() + { + await this.MessageBoxError(string.Concat(Enumerable.Repeat("Informative message:\n\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\n", 100))); + } + public async void MenuNewVersionClicked() { if (string.IsNullOrWhiteSpace(VersionChecker.DownloadLink)) diff --git a/UVtools.WPF/Program.cs b/UVtools.WPF/Program.cs index b72d439..c611593 100644 --- a/UVtools.WPF/Program.cs +++ b/UVtools.WPF/Program.cs @@ -86,7 +86,12 @@ public static class Program { try { - SystemAware.StartThisApplication($"--crash-report \"{category}\" \"{ex}\""); + string? file = null; + if (App.SlicerFile is not null) + { + file = $"{App.SlicerFile.Filename} [Version: {App.SlicerFile.Version}] [Class: {App.SlicerFile.GetType().Name}]"; + } + SystemAware.StartThisApplication($"--crash-report \"{category}\" \"{ex}\" \"{file}\""); //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"); } diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index 164a10f..4764524 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ <PackageLicenseFile>LICENSE</PackageLicenseFile> <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <RepositoryType>Git</RepositoryType> - <Version>3.6.1</Version> + <Version>3.6.2</Version> <Platforms>AnyCPU;x64</Platforms> <PackageIcon>UVtools.png</PackageIcon> <PackageReadmeFile>README.md</PackageReadmeFile> @@ -43,7 +43,7 @@ <PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" /> <PackageReference Include="Avalonia.Desktop" Version="0.10.18" /> <PackageReference Include="Avalonia.Diagnostics" Version="0.10.18" /> - <PackageReference Include="MessageBox.Avalonia" Version="2.0.2" /> + <PackageReference Include="MessageBox.Avalonia" Version="2.1.0" /> <PackageReference Include="Projektanker.Icons.Avalonia" Version="5.3.0" /> <PackageReference Include="Projektanker.Icons.Avalonia.FontAwesome" Version="5.3.0" /> <PackageReference Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="5.3.0" /> diff --git a/UVtools.WPF/Windows/AboutWindow.axaml b/UVtools.WPF/Windows/AboutWindow.axaml index b727d97..1e93377 100644 --- a/UVtools.WPF/Windows/AboutWindow.axaml +++ b/UVtools.WPF/Windows/AboutWindow.axaml @@ -56,17 +56,13 @@ Width="256"/> <TextBox Text="{Binding OSDescription}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="Operative System:" UseFloatingWatermark="True"/> <TextBox Text="{Binding ProcessorName}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="Processor:" UseFloatingWatermark="True"/> @@ -74,18 +70,14 @@ <TextBox Grid.Column="0" Text="{Binding ProcessorCount}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="Processor cores:" UseFloatingWatermark="True"/> <TextBox Grid.Column="1" Text="{Binding MemoryRAMDescription}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="Memory RAM:" UseFloatingWatermark="True"/> </Grid> @@ -94,18 +86,14 @@ <TextBox Grid.Column="0" Text="{Binding RuntimeDescription}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="Runtime:" UseFloatingWatermark="True"/> <TextBox Grid.Column="1" Text="{Binding OpenCVVersion}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="OpenCV:" UseFloatingWatermark="True"/> </Grid> @@ -114,27 +102,21 @@ <TextBox Grid.Column="0" Text="{Binding FrameworkDescription}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="Framework:" UseFloatingWatermark="True"/> <TextBox Grid.Column="1" Text="{Binding AvaloniaUIDescription}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="AvaloniaUI:" UseFloatingWatermark="True"/> </Grid> <TextBox Text="{Binding ScreensDescription}" - IsReadOnly="True" - BorderBrush="Transparent" - CaretBrush="Transparent" + Classes="TransparentReadOnly" Watermark="Screens, resolution, working area, usable area:" UseFloatingWatermark="True"/> </StackPanel> @@ -161,24 +143,24 @@ <TabItem Header="Description"> <TextBox IsReadOnly="True" - ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" + ScrollViewer.HorizontalScrollBarVisibility="Auto" Text="{Binding Source={x:Static core:About.AssemblyDescription}}"/> </TabItem> <TabItem Header="OpenCV"> <TextBox IsReadOnly="True" - ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" + ScrollViewer.HorizontalScrollBarVisibility="Auto" Text="{Binding OpenCVBuildInformation}"/> </TabItem> <TabItem Header="Assemblies"> <TextBox IsReadOnly="True" - ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" + ScrollViewer.HorizontalScrollBarVisibility="Auto" Text="{Binding LoadedAssemblies}"/> </TabItem> </TabControl> diff --git a/UVtools.WPF/Windows/BenchmarkWindow.axaml b/UVtools.WPF/Windows/BenchmarkWindow.axaml index f86e71c..0e5d9f3 100644 --- a/UVtools.WPF/Windows/BenchmarkWindow.axaml +++ b/UVtools.WPF/Windows/BenchmarkWindow.axaml @@ -23,7 +23,7 @@ Padding="10" BorderBrush="Black" BorderThickness="1"> - <TextBox Classes="TransparentReadOnly" Text="{Binding Description}"/> + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="{Binding Description}"/> </Border> diff --git a/UVtools.WPF/Windows/CantRunWindow.axaml b/UVtools.WPF/Windows/CantRunWindow.axaml deleted file mode 100644 index b784b5f..0000000 --- a/UVtools.WPF/Windows/CantRunWindow.axaml +++ /dev/null @@ -1,102 +0,0 @@ -<uc:WindowEx 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" - xmlns:i="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia" - xmlns:core="clr-namespace:UVtools.Core;assembly=UVtools.Core" - xmlns:uc="clr-namespace:UVtools.WPF.Controls" - xmlns:systemOs="clr-namespace:UVtools.Core.SystemOS;assembly=UVtools.Core" - mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="UVtools.WPF.Windows.CantRunWindow" - Icon="/Assets/Icons/UVtools.ico" - WindowStartupLocation="CenterScreen" - CanResize="False" - SizeToContent="WidthAndHeight" - Title="{Binding Source={x:Static core:About.SoftwareWithVersion}, StringFormat={}{0} is unable to run}}"> - <Grid RowDefinitions="Auto,*,Auto"> - <Border Grid.Row="0" - Padding="20" - Classes="Header"> - <StackPanel Orientation="Horizontal" - Spacing="10"> - <i:Icon FontSize="64" - FontWeight="Bold" - Value="fa-regular fa-frown" - Foreground="{StaticResource LogoColor}" - HorizontalAlignment="Center"/> - - <TextBox Classes="TransparentReadOnly" - FontWeight="Bold"> - <TextBlock.Text> - <MultiBinding StringFormat="{}{0} [{1}] -
Unable to run due one or more missing dependencies. -
Triggered by: libcvextern (OpenCV)"> - <Binding Source="{x:Static core:About.SoftwareWithVersionArch}"/> - <Binding Source="{x:Static systemOs:SystemAware.OperatingSystemName}"/> - </MultiBinding> - </TextBlock.Text> - </TextBox> - - </StackPanel> - </Border> - - - <TextBox Grid.Row="1" - Classes="TransparentReadOnly" - Padding="20" - Text="Your system doesn't have the required dependencies in order to run. -
Those dependencies are required at libcvextern/OpenCV library. -
UVtools is built on top of the OpenCV and therefore cannot run. -
 -
Please install or build the dependencies in order to run the software. -
Check the manual page at 'Requirements' section for help."/> - - <Border Grid.Row="2" - Margin="0" - Classes="FooterActions"> - - <Grid ColumnDefinitions="Auto,*"> - <Button Grid.Column="0" - Command="{Binding OpenAboutWindow}"> - <StackPanel Orientation="Horizontal" Spacing="10"> - <Image Source="/Assets/Icons/UVtools.ico" - Height="26"/> - - <TextBlock VerticalAlignment="Center" - Text="About"/> - </StackPanel> - </Button> - - <StackPanel Grid.Column="1" Orientation="Horizontal" - Spacing="5" - HorizontalAlignment="Right"> - - <uc:ButtonWithIcon Padding="10" - VerticalContentAlignment="Center" - Icon="fa-brands fa-edge" - Text="Open manual" - Command="{Binding OpenBrowser}" - CommandParameter="https://github.com/sn4k3/UVtools#requirements"/> - - <uc:ButtonWithIcon Padding="10" - VerticalContentAlignment="Center" - Icon="fa-solid fa-question" - Text="Ask for help" - Command="{Binding OpenBrowser}" - CommandParameter="https://github.com/sn4k3/UVtools/discussions/categories/q-a"/> - - <uc:ButtonWithIcon Command="{Binding Close}" - IsCancel="True" - Padding="10" - VerticalContentAlignment="Center" - Icon="fa-solid fa-sign-out-alt" - Text="Exit"/> - </StackPanel> - </Grid> - - - - - </Border> - </Grid> -</uc:WindowEx> diff --git a/UVtools.WPF/Windows/CantRunWindow.axaml.cs b/UVtools.WPF/Windows/CantRunWindow.axaml.cs deleted file mode 100644 index c3612ca..0000000 --- a/UVtools.WPF/Windows/CantRunWindow.axaml.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 Avalonia; -using Avalonia.Markup.Xaml; -using UVtools.Core.SystemOS; -using UVtools.WPF.Controls; - -namespace UVtools.WPF.Windows -{ - public partial class CantRunWindow : WindowEx - { - public CantRunWindow() - { - InitializeComponent(); - DataContext = this; - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - - public void OpenBrowser(string url) - { - SystemAware.OpenBrowser(url); - } - - public async void OpenAboutWindow() - { - await new AboutWindow().ShowDialog(this); - } - } -} diff --git a/UVtools.WPF/Windows/MaterialManagerWindow.axaml b/UVtools.WPF/Windows/MaterialManagerWindow.axaml index 5a66243..7ac5ab2 100644 --- a/UVtools.WPF/Windows/MaterialManagerWindow.axaml +++ b/UVtools.WPF/Windows/MaterialManagerWindow.axaml @@ -21,39 +21,39 @@ <WrapPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Bottles in stock:" VerticalAlignment="Center" FontWeight="Bold"/> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="{Binding Manager.BottlesInStock, StringFormat=\{0:N0\}}"/> </StackPanel> <StackPanel Margin="10,0,0,0" Orientation="Horizontal"> <TextBlock Text="Owned bottles:" VerticalAlignment="Center" FontWeight="Bold"/> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="{Binding Manager.OwnedBottles, StringFormat=\{0:N0\}}"/> </StackPanel> <StackPanel Margin="10,0,0,0" Orientation="Horizontal"> <TextBlock Text="Consumed volume:" VerticalAlignment="Center" FontWeight="Bold"/> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="{Binding Manager.ConsumedVolumeLiters, StringFormat=\{0:N4\}}"/> <TextBlock Text="liters" VerticalAlignment="Center"/> </StackPanel> <StackPanel Margin="10,0,0,0" Orientation="Horizontal"> <TextBlock Text="Volume in stock:" VerticalAlignment="Center" FontWeight="Bold"/> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="{Binding Manager.VolumeInStockLiters, StringFormat=\{0:N4\}}"/> <TextBlock Text="liters" VerticalAlignment="Center"/> </StackPanel> <StackPanel Margin="10,0,0,0" Orientation="Horizontal"> <TextBlock Text="Spent:" VerticalAlignment="Center" FontWeight="Bold"/> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="{Binding Manager.TotalCost, StringFormat=\{0:N2\}}"/> </StackPanel> <StackPanel Margin="10,0,0,0" Orientation="Horizontal"> <TextBlock Text="Print time:" VerticalAlignment="Center" FontWeight="Bold"/> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="{Binding Manager.PrintTimeSpan.TotalDays, StringFormat=\{0:N4\}}"/> <TextBlock Text="days" VerticalAlignment="Center"/> </StackPanel> diff --git a/UVtools.WPF/Windows/MessageWindow.axaml b/UVtools.WPF/Windows/MessageWindow.axaml index c58e7fe..35be6d5 100644 --- a/UVtools.WPF/Windows/MessageWindow.axaml +++ b/UVtools.WPF/Windows/MessageWindow.axaml @@ -32,7 +32,7 @@ HorizontalAlignment="Center"/> <TextBox Grid.Column="2" - Classes="TransparentReadOnly" + Classes="TransparentReadOnlyMultiLineNoBorder" FontWeight="Bold" IsVisible="{Binding HeaderTitle, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Text="{Binding HeaderTitle}"/> @@ -41,7 +41,7 @@ <TextBox Grid.Row="1" - Classes="TransparentReadOnly" + Classes="TransparentReadOnlyMultiLineNoBorder" Padding="20" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" diff --git a/UVtools.WPF/Windows/MessageWindow.axaml.cs b/UVtools.WPF/Windows/MessageWindow.axaml.cs index 718721c..da22e4d 100644 --- a/UVtools.WPF/Windows/MessageWindow.axaml.cs +++ b/UVtools.WPF/Windows/MessageWindow.axaml.cs @@ -1,13 +1,16 @@ +using System; using Avalonia; using Avalonia.Controls; using Avalonia.Layout; using Avalonia.Markup.Xaml; +using UVtools.Core.SystemOS; using UVtools.WPF.Controls; namespace UVtools.WPF.Windows { public partial class MessageWindow : WindowEx { + #region Members private string? _headerIcon; private ushort _headerIconSize = 64; private string _headerTitle; @@ -15,6 +18,13 @@ namespace UVtools.WPF.Windows private string _message; private readonly StackPanel _buttonsRightPanel; + #endregion + + #region Properties + /// <summary> + /// Gets the pressed button + /// </summary> + public ButtonWithIcon? PressedButton { get; private set; } public string? HeaderIcon { @@ -55,7 +65,9 @@ namespace UVtools.WPF.Windows get => _aboutButtonIsVisible; set => RaiseAndSetIfChanged(ref _aboutButtonIsVisible, value); } + #endregion + #region Constructor public MessageWindow() { InitializeComponent(); @@ -66,22 +78,23 @@ namespace UVtools.WPF.Windows DataContext = this; } - public MessageWindow(string title, string? headerIcon, string? headerTitle, string message, ButtonWithIcon[]? buttons = null) : this() + public MessageWindow(string title, string? headerIcon, string? headerTitle, string message, ButtonWithIcon[]? rightButtons = null) : this() { Title = title; HeaderIcon = headerIcon; HeaderTitle = headerTitle; Message = message; - if (buttons is not null && buttons.Length > 0) + if (rightButtons is not null && rightButtons.Length > 0) { _buttonsRightPanel.Children.Clear(); - _buttonsRightPanel.Children.AddRange(buttons); + _buttonsRightPanel.Children.AddRange(rightButtons); - foreach (var button in buttons) + foreach (var button in rightButtons) { button.Click += (sender, e) => { + PressedButton = button; if (e.Handled) return; Close(button); e.Handled = true; @@ -91,33 +104,73 @@ namespace UVtools.WPF.Windows } public MessageWindow(string title, string message, ButtonWithIcon[]? buttons = null) : this(title, null, null, message, buttons) { } - - /*protected override void OnOpened(EventArgs e) - { - base.OnOpened(e); - }*/ + private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } + #endregion + #region Methods public async void OpenAboutWindow() { await new AboutWindow().ShowDialog(this); } + #endregion - public static ButtonWithIcon CreateButton(string? text, string? icon, int padding = 10) => - new() - { - Icon = icon, - Text = text, - VerticalAlignment = VerticalAlignment.Center, - Padding = new Thickness(padding) - }; + #region Static methods + public static ButtonWithIcon CreateButtonFunc(string? text, string? icon, Func<bool> customAction, int padding = 10) + { + var button = CreateButton(text, icon, padding); + button.Click += (sender, e) => e.Handled = customAction.Invoke(); + return button; + } + + public static ButtonWithIcon CreateButtonAction(string? text, string? icon, Action customAction, int padding = 10) + { + var button = CreateButton(text, icon, padding); + button.Click += (sender, e) => customAction.Invoke(); + return button; + } + + public static ButtonWithIcon CreateButtonFunc(string? text, Func<bool> customAction, int padding = 10) => CreateButtonFunc(text, null, customAction, padding); + public static ButtonWithIcon CreateButtonAction(string? text, Action customAction, int padding = 10) => CreateButtonAction(text, null, customAction, padding); + + public static ButtonWithIcon CreateButton(string? text, string? icon, int padding = 10) => new() + { + Icon = icon, + Text = text, + VerticalAlignment = VerticalAlignment.Center, + Padding = new Thickness(padding) + }; public static ButtonWithIcon CreateButton(string? text, int padding = 10) => CreateButton(text, null, padding); + + public static ButtonWithIcon CreateLinkButtonAction(string? text, string? icon, string url, Action customAction, int padding = 10) + { + var button = CreateButtonFunc(text, icon, () => + { + customAction.Invoke(); + SystemAware.OpenBrowser(url); + return true; + }, padding); + return button; + } + + public static ButtonWithIcon CreateLinkButton(string? text, string? icon, string url, int padding = 10) + { + var button = CreateButtonFunc(text, icon, () => + { + SystemAware.OpenBrowser(url); + return true; + }, padding); + return button; + } + public static ButtonWithIcon CreateLinkButtonAction(string? text, string url, Action customAction, int padding = 10) => CreateLinkButtonAction(text, null, url, customAction, padding); + public static ButtonWithIcon CreateLinkButton(string? text, string url, int padding = 10) => CreateLinkButton(text, null, url, padding); + public static ButtonWithIcon CreateCancelButton(string? icon = null, int padding = 10) { var btn = CreateButton("Cancel", icon, padding); @@ -131,5 +184,6 @@ namespace UVtools.WPF.Windows btn.IsCancel = true; return btn; } + #endregion } } diff --git a/UVtools.WPF/Windows/MissingInformationWindow.axaml b/UVtools.WPF/Windows/MissingInformationWindow.axaml index 7923aa9..d7a806a 100644 --- a/UVtools.WPF/Windows/MissingInformationWindow.axaml +++ b/UVtools.WPF/Windows/MissingInformationWindow.axaml @@ -13,7 +13,7 @@ Title="Missing information on the file"> <StackPanel Orientation="Vertical" Spacing="10"> <Border Classes="Header"> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Text="There are crucial information missing on this file in order to UVtools work properly and/or provide the correct information. 
Fill in the missing information only if you know the correct values, otherwise leave it unchanged if unsure. 
In most cases the missing information is not required by the printer. diff --git a/UVtools.WPF/Windows/SuggestionSettingsWindow.axaml b/UVtools.WPF/Windows/SuggestionSettingsWindow.axaml index b9fb429..d9a856b 100644 --- a/UVtools.WPF/Windows/SuggestionSettingsWindow.axaml +++ b/UVtools.WPF/Windows/SuggestionSettingsWindow.axaml @@ -71,7 +71,7 @@ CommandParameter="{Binding ActiveSuggestion.InformationUrl}"/> </StackPanel> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" Margin="-10,0,0,5" Text="{Binding ActiveSuggestion.Description}" TextWrapping="Wrap" diff --git a/UVtools.WPF/Windows/ToolWindow.axaml b/UVtools.WPF/Windows/ToolWindow.axaml index 73f9abd..9afdc06 100644 --- a/UVtools.WPF/Windows/ToolWindow.axaml +++ b/UVtools.WPF/Windows/ToolWindow.axaml @@ -23,7 +23,7 @@ IsExpanded="{Binding Settings.Tools.ExpandDescriptions}" HorizontalContentAlignment="Stretch" Header="Description (Click to toggle)"> - <TextBox Classes="TransparentReadOnly" + <TextBox Classes="TransparentReadOnlyMultiLineNoBorder" MaxWidth="{Binding DescriptionMaxWidth}" FontSize="16" Margin="-10" diff --git a/UVtools.WPF/Windows/ToolWindow.axaml.cs b/UVtools.WPF/Windows/ToolWindow.axaml.cs index ca7abda..1991b3f 100644 --- a/UVtools.WPF/Windows/ToolWindow.axaml.cs +++ b/UVtools.WPF/Windows/ToolWindow.axaml.cs @@ -139,7 +139,7 @@ public class ToolWindow : WindowEx } } - public float LayerStartMM => SlicerFile[_layerIndexStart].PositionZ; + public float LayerStartMM => SlicerFile.LayerExists(_layerIndexStart) ? SlicerFile[_layerIndexStart].PositionZ : 0; public uint LayerIndexEnd { @@ -162,7 +162,7 @@ public class ToolWindow : WindowEx } } - public float LayerEndMM => SlicerFile[_layerIndexEnd].PositionZ; + public float LayerEndMM => SlicerFile.LayerExists(_layerIndexEnd) ? SlicerFile[_layerIndexEnd].PositionZ : 0; public bool LayerIndexEndEnabled { |