diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index df21cdfd2..ee57c4987 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -42,9 +42,9 @@ - - - + + + diff --git a/src/Artemis.Core/DryIoc/ContainerExtensions.cs b/src/Artemis.Core/DryIoc/ContainerExtensions.cs index 4f418d453..927f606a9 100644 --- a/src/Artemis.Core/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.Core/DryIoc/ContainerExtensions.cs @@ -13,7 +13,7 @@ namespace Artemis.Core.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class CoreContainerExtensions +public static class ContainerExtensions { /// /// Registers core services into the container. diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 09c2d5479..c8f440c29 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs index cb7baef36..4c4711b02 100644 --- a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs @@ -7,7 +7,7 @@ namespace Artemis.UI.Shared.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class UIContainerExtensions +public static class ContainerExtensions { /// /// Registers shared UI services into the container. diff --git a/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs b/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs index 8c60677b6..62340d3a6 100644 --- a/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs +++ b/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs @@ -56,7 +56,7 @@ public class DuplicateNode : INodeEditorCommand, IDisposable if (targetCollection == null) continue; while (targetCollection.Count() < sourceCollection.Count()) - targetCollection.CreatePin(); + targetCollection.Add(targetCollection.CreatePin()); } // Copy the storage diff --git a/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs b/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs index 79ab75e57..a73bc2f42 100644 --- a/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs +++ b/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs @@ -70,7 +70,9 @@ public class WindowsUpdateNotificationProvider : IUpdateNotificationProvider Dispatcher.UIThread.Post(() => { _mainWindowService.OpenMainWindow(); - + if (_mainWindowService.HostScreen == null) + return; + // TODO: When proper routing has been implemented, use that here // Create a settings VM to navigate to SettingsViewModel settingsViewModel = _getSettingsViewModel(_mainWindowService.HostScreen); diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 502846ca4..258b00486 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -34,8 +34,8 @@ - - + + diff --git a/src/Artemis.UI/ArtemisBootstrapper.cs b/src/Artemis.UI/ArtemisBootstrapper.cs index c1dd988a9..8f783279c 100644 --- a/src/Artemis.UI/ArtemisBootstrapper.cs +++ b/src/Artemis.UI/ArtemisBootstrapper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Reactive; @@ -42,7 +42,6 @@ public static class ArtemisBootstrapper _container.RegisterCore(); _container.RegisterUI(); _container.RegisterSharedUI(); - _container.RegisterUpdatingClient(); _container.RegisterNoStringEvaluating(); configureServices?.Invoke(_container); diff --git a/src/Artemis.UI/DryIoc/ContainerExtensions.cs b/src/Artemis.UI/DryIoc/ContainerExtensions.cs index 0f2ae6862..cd7b167a5 100644 --- a/src/Artemis.UI/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI/DryIoc/ContainerExtensions.cs @@ -17,7 +17,7 @@ namespace Artemis.UI.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class UIContainerExtensions +public static class ContainerExtensions { /// /// Registers UI services into the container. @@ -25,7 +25,7 @@ public static class UIContainerExtensions /// The builder building the current container public static void RegisterUI(this IContainer container) { - Assembly[] thisAssembly = {typeof(UIContainerExtensions).Assembly}; + Assembly[] thisAssembly = {typeof(ContainerExtensions).Assembly}; container.RegisterInstance(new AssetLoader(), IfAlreadyRegistered.Throw); container.Register(Reuse.Singleton); diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml.cs index 20bb00ff2..9922665fc 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml.cs @@ -14,7 +14,7 @@ namespace Artemis.UI.Screens.Debugger.Logs; public class LogsDebugView : ReactiveUserControl { private int _lineCount; - private TextEditor _textEditor; + private TextEditor? _textEditor; public LogsDebugView() { @@ -31,7 +31,7 @@ public class LogsDebugView : ReactiveUserControl protected override void OnInitialized() { base.OnInitialized(); - Dispatcher.UIThread.Post(() => _textEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); + Dispatcher.UIThread.Post(() => _textEditor?.ScrollToEnd(), DispatcherPriority.ApplicationIdle); } private void OnTextChanged(object? sender, EventArgs e) @@ -49,7 +49,7 @@ public class LogsDebugView : ReactiveUserControl //we need this help distance because of rounding. //if we scroll slightly above the end, we still want it //to scroll down to the new lines. - const double graceDistance = 1d; + const double GRACE_DISTANCE = 1d; //if we were at the bottom of the log and //if the last log event was 5 lines long @@ -59,7 +59,7 @@ public class LogsDebugView : ReactiveUserControl //if we are more than that out of sync, //the user scrolled up and we should not //mess with anything. - if (_lineCount == 0 || linesAdded + graceDistance > outOfScreenLines) + if (_lineCount == 0 || linesAdded + GRACE_DISTANCE > outOfScreenLines) { Dispatcher.UIThread.Post(() => _textEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); _lineCount = _textEditor.LineCount; diff --git a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs index c91b33f8f..745ed277a 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs @@ -23,6 +23,7 @@ public class SettingsViewModel : MainScreenViewModel releasesTabViewModel, aboutTabViewModel }; + _selectedTab = generalTabViewModel; } public ObservableCollection SettingTabs { get; } diff --git a/src/Artemis.UI/Services/Updating/ReleaseInstaller.cs b/src/Artemis.UI/Services/Updating/ReleaseInstaller.cs index 9ea59b492..78535ac31 100644 --- a/src/Artemis.UI/Services/Updating/ReleaseInstaller.cs +++ b/src/Artemis.UI/Services/Updating/ReleaseInstaller.cs @@ -30,7 +30,7 @@ public class ReleaseInstaller : CorePropertyChanged private readonly IUpdatingClient _updatingClient; private readonly Progress _progress = new(); private Progress _stepProgress = new(); - private string _status; + private string _status = string.Empty; private float _progress1; public ReleaseInstaller(string releaseId, ILogger logger, IUpdatingClient updatingClient, HttpClient httpClient) diff --git a/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs b/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs index 6e388f30d..0377f56ec 100644 --- a/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs @@ -13,7 +13,7 @@ namespace Artemis.VisualScripting.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class UIContainerExtensions +public static class ContainerExtensions { /// /// Registers NoStringEvaluating services into the container. diff --git a/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs b/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs index cba686c38..15ce66d84 100644 --- a/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs +++ b/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs @@ -3,7 +3,7 @@ using SkiaSharp; namespace Artemis.VisualScripting.Nodes.Color; -[Node("HSL Color", "Creates a color from hue, saturation and lightness values", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))] +[Node("HSL Color", "Creates a color from hue, saturation and lightness numbers", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))] public class HslSKColorNode : Node { public HslSKColorNode() diff --git a/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs b/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs new file mode 100644 index 000000000..2544ccec2 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs @@ -0,0 +1,31 @@ +using Artemis.Core; +using SkiaSharp; + +namespace Artemis.VisualScripting.Nodes.Color; + +[Node("HSV Color", "Creates a color from hue, saturation and value numbers", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))] +public class HsvSKColorNode : Node +{ + public HsvSKColorNode() + { + H = CreateInputPin("H"); + S = CreateInputPin("S"); + V = CreateInputPin("V"); + Output = CreateOutputPin(); + } + + public InputPin H { get; set; } + public InputPin S { get; set; } + public InputPin V { get; set; } + public OutputPin Output { get; } + + #region Overrides of Node + + /// + public override void Evaluate() + { + Output.Value = SKColor.FromHsv(H.Value, S.Value, V.Value); + } + + #endregion +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs new file mode 100644 index 000000000..aaa1c6e26 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs @@ -0,0 +1,36 @@ +using Artemis.Core; +using SkiaSharp; + +namespace Artemis.VisualScripting.Nodes.Color; + +[Node("Color to HSL", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))] +public class SkColorHsl : Node +{ + + public SkColorHsl() + { + Input = CreateInputPin(); + H = CreateOutputPin("H"); + S = CreateOutputPin("S"); + L = CreateOutputPin("L"); + } + + public InputPin Input { get; } + public OutputPin H { get; } + public OutputPin S { get; } + public OutputPin L { get; } + + #region Overrides of Node + + /// + public override void Evaluate() + { + Input.Value.ToHsl(out float h, out float s, out float l); + + H.Value = h; + S.Value = s; + L.Value = l; + } + + #endregion +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs new file mode 100644 index 000000000..a0e448cf4 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs @@ -0,0 +1,36 @@ +using Artemis.Core; +using SkiaSharp; + +namespace Artemis.VisualScripting.Nodes.Color; + +[Node("Color to HSV", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))] +public class SkColorHsv : Node +{ + + public SkColorHsv() + { + Input = CreateInputPin(); + H = CreateOutputPin("H"); + S = CreateOutputPin("S"); + V = CreateOutputPin("V"); + } + + public InputPin Input { get; } + public OutputPin H { get; } + public OutputPin S { get; } + public OutputPin V { get; } + + #region Overrides of Node + + /// + public override void Evaluate() + { + Input.Value.ToHsv(out float h, out float s, out float v); + + H.Value = h; + S.Value = s; + V.Value = v; + } + + #endregion +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs b/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs index 8a4190098..0dcfb6e1b 100644 --- a/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs +++ b/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs @@ -1,4 +1,4 @@ -using Artemis.Core; +using Artemis.Core; namespace Artemis.VisualScripting.Nodes.Conversion; @@ -33,6 +33,7 @@ public class ConvertToNumericNode : Node double input => new Numeric(input), float input => new Numeric(input), byte input => new Numeric(input), + bool input => new Numeric(input ? 1 : 0), _ => TryParse(Input.Value) }; } @@ -44,4 +45,4 @@ public class ConvertToNumericNode : Node } #endregion -} \ No newline at end of file +}