From 81e83e59f640ecbec910d97c2b61a1a2418c43df Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 29 Mar 2023 21:36:56 +0200 Subject: [PATCH 01/18] Fixed Artemis.UI.Shared compile errors --- src/Artemis.Core/Artemis.Core.csproj | 3 +- src/Artemis.Core/Properties/Annotations.cs | 1382 ----------------- src/Artemis.UI.Linux/Artemis.UI.Linux.csproj | 10 +- src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj | 10 +- .../Artemis.UI.Shared.csproj | 18 +- .../LostFocusNumericUpDownBindingBehavior.cs | 4 +- .../Controls/ArtemisIcon.axaml.cs | 34 +- .../DataModelPicker/DataModelPickerButton.cs | 6 +- .../Controls/DeviceVisualizer.cs | 23 +- .../Controls/DeviceVisualizerLed.cs | 9 +- .../Controls/DraggableNumberBox.axaml.cs | 30 +- .../Controls/EnumComboBox.axaml.cs | 17 +- .../Controls/GradientPicker/GradientPicker.cs | 24 +- .../GradientPicker/GradientPickerButton.cs | 15 +- .../GradientPicker/GradientPickerColorStop.cs | 32 +- .../Controls/HotkeyBox.axaml.cs | 22 +- .../ProfileConfigurationIcon.axaml.cs | 6 +- .../Controls/SelectionRectangle.cs | 27 +- .../ParentWidthPercentageConverter.cs | 4 +- .../DefaultDataModelDisplayView.axaml.cs | 2 +- .../SKColorDataModelDisplayView.axaml.cs | 2 +- .../Extensions/VisualExtensions.cs | 14 +- ...tiveCoreWindow.cs => ReactiveAppWindow.cs} | 10 +- .../Services/Builders/NotificationBuilder.cs | 4 +- .../Window/ExceptionDialogView.axaml.cs | 2 +- .../Styles/ColorPickerButton.axaml | 18 +- src/Artemis.UI.Shared/Styles/Condensed.axaml | 2 +- .../Controls/DataModelPickerButton.axaml | 20 +- .../Styles/Controls/GradientPicker.axaml | 16 +- .../Controls/GradientPickerButton.axaml | 20 +- src/Artemis.UI.Shared/Styles/TreeView.axaml | 93 +- .../Artemis.UI.Windows.csproj | 14 +- src/Artemis.UI/Artemis.UI.csproj | 26 +- .../Behaviors/SimpleContextDragBehavior.cs | 2 +- .../Behaviors/TreeItemDragBehavior.cs | 69 +- src/Artemis.UI/Controls/TimelineHeader.cs | 39 +- .../BoolPropertyInputView.axaml.cs | 2 +- .../BrushPropertyInputView.axaml.cs | 2 +- .../BrushPropertyInputViewModel.cs | 2 +- .../ColorGradientPropertyInputView.axaml.cs | 2 +- .../EnumPropertyInputView.axaml.cs | 2 +- .../FloatPropertyInputView.axaml.cs | 2 +- .../FloatRangePropertyInputView.axaml.cs | 2 +- .../IntPropertyInputView.axaml.cs | 2 +- .../IntRangePropertyInputView.axaml.cs | 2 +- .../SKColorPropertyInputView.axaml.cs | 2 +- .../SKPointPropertyInputView.axaml.cs | 2 +- .../SKSizePropertyInputView.axaml.cs | 2 +- .../StringPropertyInputView.axaml.cs | 2 +- src/Artemis.UI/MainWindow.axaml.cs | 2 +- .../Screens/Debugger/DebugView.axaml.cs | 2 +- .../Device/DevicePropertiesView.axaml.cs | 2 +- .../Plugins/PluginSettingsWindowView.axaml.cs | 2 +- .../Dialogs/LayerHintsDialogView.axaml.cs | 2 +- .../BrushConfigurationWindowView.axaml.cs | 2 +- .../EffectConfigurationWindowView.axaml.cs | 2 +- .../Scripting/ScriptsDialogView.axaml.cs | 2 +- .../ProfileConfigurationEditView.axaml.cs | 2 +- .../StartupWizard/StartupWizardView.axaml.cs | 2 +- .../NodeScriptWindowView.axaml.cs | 2 +- .../Artemis.VisualScripting.csproj | 12 +- 61 files changed, 343 insertions(+), 1746 deletions(-) delete mode 100644 src/Artemis.Core/Properties/Annotations.cs rename src/Artemis.UI.Shared/{ReactiveCoreWindow.cs => ReactiveAppWindow.cs} (90%) diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index 67138efdd..db11e2724 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -39,6 +39,7 @@ + @@ -49,7 +50,7 @@ - + diff --git a/src/Artemis.Core/Properties/Annotations.cs b/src/Artemis.Core/Properties/Annotations.cs deleted file mode 100644 index c7e8987a1..000000000 --- a/src/Artemis.Core/Properties/Annotations.cs +++ /dev/null @@ -1,1382 +0,0 @@ -/* MIT License - -Copyright (c) 2016 JetBrains http://www.jetbrains.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. */ - -using System; - -#pragma warning disable 1591 -#pragma warning disable 8618 - -// ReSharper disable InheritdocConsiderUsage -// ReSharper disable UnusedMember.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedAutoPropertyAccessor.Global -// ReSharper disable IntroduceOptionalParameters.Global -// ReSharper disable MemberCanBeProtected.Global -// ReSharper disable InconsistentNaming - -namespace Artemis.Core.Properties; - -/// -/// Indicates that the value of the marked element could be null sometimes, -/// so checking for null is required before its usage. -/// -/// -/// -/// [CanBeNull] object Test() => null; -/// -/// void UseTest() { -/// var p = Test(); -/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] -public sealed class CanBeNullAttribute : Attribute -{ -} - -/// -/// Indicates that the value of the marked element can never be null. -/// -/// -/// -/// [NotNull] object Foo() { -/// return null; // Warning: Possible 'null' assignment -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] -public sealed class NotNullAttribute : Attribute -{ -} - -/// -/// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task -/// and Lazy classes to indicate that the value of a collection item, of the Task.Result property -/// or of the Lazy.Value property can never be null. -/// -/// -/// -/// public void Foo([ItemNotNull]List<string> books) -/// { -/// foreach (var book in books) { -/// if (book != null) // Warning: Expression is always true -/// Console.WriteLine(book.ToUpper()); -/// } -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field)] -public sealed class ItemNotNullAttribute : Attribute -{ -} - -/// -/// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task -/// and Lazy classes to indicate that the value of a collection item, of the Task.Result property -/// or of the Lazy.Value property can be null. -/// -/// -/// -/// public void Foo([ItemCanBeNull]List<string> books) -/// { -/// foreach (var book in books) -/// { -/// // Warning: Possible 'System.NullReferenceException' -/// Console.WriteLine(book.ToUpper()); -/// } -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field)] -public sealed class ItemCanBeNullAttribute : Attribute -{ -} - -/// -/// Indicates that the marked method builds string by the format pattern and (optional) arguments. -/// The parameter, which contains the format string, should be given in constructor. The format string -/// should be in -like form. -/// -/// -/// -/// [StringFormatMethod("message")] -/// void ShowError(string message, params object[] args) { /* do something */ } -/// -/// void Foo() { -/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Constructor | AttributeTargets.Method | - AttributeTargets.Property | AttributeTargets.Delegate)] -public sealed class StringFormatMethodAttribute : Attribute -{ - /// - /// Specifies which parameter of an annotated method should be treated as the format string - /// - public StringFormatMethodAttribute([NotNull] string formatParameterName) - { - FormatParameterName = formatParameterName; - } - - [NotNull] - public string FormatParameterName { get; } -} - -/// -/// Use this annotation to specify a type that contains static or const fields -/// with values for the annotated property/field/parameter. -/// The specified type will be used to improve completion suggestions. -/// -/// -/// -/// namespace TestNamespace -/// { -/// public class Constants -/// { -/// public static int INT_CONST = 1; -/// public const string STRING_CONST = "1"; -/// } -/// -/// public class Class1 -/// { -/// [ValueProvider("TestNamespace.Constants")] public int myField; -/// public void Foo([ValueProvider("TestNamespace.Constants")] string str) { } -/// -/// public void Test() -/// { -/// Foo(/*try completion here*/);// -/// myField = /*try completion here*/ -/// } -/// } -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field, - AllowMultiple = true)] -public sealed class ValueProviderAttribute : Attribute -{ - public ValueProviderAttribute([NotNull] string name) - { - Name = name; - } - - [NotNull] - public string Name { get; } -} - -/// -/// Indicates that the function argument should be a string literal and match one -/// of the parameters of the caller function. For example, ReSharper annotates -/// the parameter of . -/// -/// -/// -/// void Foo(string param) { -/// if (param == null) -/// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol -/// } -/// -/// -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class InvokerParameterNameAttribute : Attribute -{ -} - -/// -/// Indicates that the method is contained in a type that implements -/// System.ComponentModel.INotifyPropertyChanged interface and this method -/// is used to notify that some property value changed. -/// -/// -/// The method should be non-static and conform to one of the supported signatures: -/// -/// -/// NotifyChanged(string) -/// -/// -/// NotifyChanged(params string[]) -/// -/// -/// NotifyChanged{T}(Expression{Func{T}}) -/// -/// -/// NotifyChanged{T,U}(Expression{Func{T,U}}) -/// -/// -/// SetProperty{T}(ref T, T, string) -/// -/// -/// -/// -/// -/// public class Foo : INotifyPropertyChanged { -/// public event PropertyChangedEventHandler PropertyChanged; -/// -/// [NotifyPropertyChangedInvocator] -/// protected virtual void NotifyChanged(string propertyName) { ... } -/// -/// string _name; -/// -/// public string Name { -/// get { return _name; } -/// set { _name = value; NotifyChanged("LastName"); /* Warning */ } -/// } -/// } -/// -/// Examples of generated notifications: -/// -/// -/// NotifyChanged("Property") -/// -/// -/// NotifyChanged(() => Property) -/// -/// -/// NotifyChanged((VM x) => x.Property) -/// -/// -/// SetProperty(ref myField, value, "Property") -/// -/// -/// -[AttributeUsage(AttributeTargets.Method)] -public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute -{ - public NotifyPropertyChangedInvocatorAttribute() - { - } - - public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) - { - ParameterName = parameterName; - } - - [CanBeNull] - public string ParameterName { get; } -} - -/// -/// Describes dependency between method input and output. -/// -/// -///

Function Definition Table syntax:

-/// -/// FDT ::= FDTRow [;FDTRow]* -/// FDTRow ::= Input => Output | Output <= Input -/// Input ::= ParameterName: Value [, Input]* -/// Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value} -/// Value ::= true | false | null | notnull | canbenull -/// -/// If the method has a single input parameter, its name could be omitted.
-/// Using halt (or void/nothing, which is the same) for the method output -/// means that the method doesn't return normally (throws or terminates the process).
-/// Value canbenull is only applicable for output parameters.
-/// You can use multiple [ContractAnnotation] for each FDT row, or use single attribute -/// with rows separated by semicolon. There is no notion of order rows, all rows are checked -/// for applicability and applied per each program state tracked by the analysis engine.
-///
-/// -/// -/// -/// -/// [ContractAnnotation("=> halt")] -/// public void TerminationMethod() -/// -/// -/// -/// -/// [ContractAnnotation("null <= param:null")] // reverse condition syntax -/// public string GetName(string surname) -/// -/// -/// -/// -/// [ContractAnnotation("s:null => true")] -/// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() -/// -/// -/// -/// -/// // A method that returns null if the parameter is null, -/// // and not null if the parameter is not null -/// [ContractAnnotation("null => null; notnull => notnull")] -/// public object Transform(object data) -/// -/// -/// -/// -/// [ContractAnnotation("=> true, result: notnull; => false, result: null")] -/// public bool TryParse(string s, out Person result) -/// -/// -/// -/// -[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] -public sealed class ContractAnnotationAttribute : Attribute -{ - public ContractAnnotationAttribute([NotNull] string contract) - : this(contract, false) - { - } - - public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) - { - Contract = contract; - ForceFullStates = forceFullStates; - } - - [NotNull] - public string Contract { get; } - - public bool ForceFullStates { get; } -} - -/// -/// Indicates whether the marked element should be localized. -/// -/// -/// -/// [LocalizationRequiredAttribute(true)] -/// class Foo { -/// string str = "my string"; // Warning: Localizable string -/// } -/// -/// -[AttributeUsage(AttributeTargets.All)] -public sealed class LocalizationRequiredAttribute : Attribute -{ - public LocalizationRequiredAttribute() : this(true) - { - } - - public LocalizationRequiredAttribute(bool required) - { - Required = required; - } - - public bool Required { get; } -} - -/// -/// Indicates that the value of the marked type (or its derivatives) -/// cannot be compared using '==' or '!=' operators and Equals() -/// should be used instead. However, using '==' or '!=' for comparison -/// with null is always permitted. -/// -/// -/// -/// [CannotApplyEqualityOperator] -/// class NoEquality { } -/// -/// class UsesNoEquality { -/// void Test() { -/// var ca1 = new NoEquality(); -/// var ca2 = new NoEquality(); -/// if (ca1 != null) { // OK -/// bool condition = ca1 == ca2; // Warning -/// } -/// } -/// } -/// -/// -[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] -public sealed class CannotApplyEqualityOperatorAttribute : Attribute -{ -} - -/// -/// When applied to a target attribute, specifies a requirement for any type marked -/// with the target attribute to implement or inherit specific type or types. -/// -/// -/// -/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement -/// class ComponentAttribute : Attribute { } -/// -/// [Component] // ComponentAttribute requires implementing IComponent interface -/// class MyComponent : IComponent { } -/// -/// -[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] -[BaseTypeRequired(typeof(Attribute))] -public sealed class BaseTypeRequiredAttribute : Attribute -{ - public BaseTypeRequiredAttribute([NotNull] Type baseType) - { - BaseType = baseType; - } - - [NotNull] - public Type BaseType { get; } -} - -/// -/// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), -/// so this symbol will not be reported as unused (as well as by other usage inspections). -/// -[AttributeUsage(AttributeTargets.All, Inherited = false)] -public sealed class UsedImplicitlyAttribute : Attribute -{ - public UsedImplicitlyAttribute() - : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) - { - } - - public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) - : this(useKindFlags, ImplicitUseTargetFlags.Default) - { - } - - public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) - : this(ImplicitUseKindFlags.Default, targetFlags) - { - } - - public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) - { - UseKindFlags = useKindFlags; - TargetFlags = targetFlags; - } - - public ImplicitUseKindFlags UseKindFlags { get; } - - public ImplicitUseTargetFlags TargetFlags { get; } -} - -/// -/// Can be applied to attributes, type parameters, and parameters of a type assignable from -/// . -/// When applied to an attribute, the decorated attribute behaves the same as . -/// When applied to a type parameter or to a parameter of type , indicates that the -/// corresponding type -/// is used implicitly. -/// -[AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)] -public sealed class MeansImplicitUseAttribute : Attribute -{ - public MeansImplicitUseAttribute() - : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) - { - } - - public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) - : this(useKindFlags, ImplicitUseTargetFlags.Default) - { - } - - public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) - : this(ImplicitUseKindFlags.Default, targetFlags) - { - } - - public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) - { - UseKindFlags = useKindFlags; - TargetFlags = targetFlags; - } - - [UsedImplicitly] - public ImplicitUseKindFlags UseKindFlags { get; } - - [UsedImplicitly] - public ImplicitUseTargetFlags TargetFlags { get; } -} - -/// -/// Specify the details of implicitly used symbol when it is marked -/// with or . -/// -[Flags] -public enum ImplicitUseKindFlags -{ - Default = Access | Assign | InstantiatedWithFixedConstructorSignature, - - /// Only entity marked with attribute considered used. - Access = 1, - - /// Indicates implicit assignment to a member. - Assign = 2, - - /// - /// Indicates implicit instantiation of a type with fixed constructor signature. - /// That means any unused constructor parameters won't be reported as such. - /// - InstantiatedWithFixedConstructorSignature = 4, - - /// Indicates implicit instantiation of a type. - InstantiatedNoFixedConstructorSignature = 8 -} - -/// -/// Specify what is considered to be used implicitly when marked -/// with or . -/// -[Flags] -public enum ImplicitUseTargetFlags -{ - Default = Itself, - Itself = 1, - - /// Members of entity marked with attribute are considered used. - Members = 2, - - /// Entity marked with attribute and all its members considered used. - WithMembers = Itself | Members -} - -/// -/// This attribute is intended to mark publicly available API -/// which should not be removed and so is treated as used. -/// -[MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] -[AttributeUsage(AttributeTargets.All, Inherited = false)] -public sealed class PublicAPIAttribute : Attribute -{ - public PublicAPIAttribute() - { - } - - public PublicAPIAttribute([NotNull] string comment) - { - Comment = comment; - } - - [CanBeNull] - public string Comment { get; } -} - -/// -/// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. -/// If the parameter is a delegate, indicates that delegate is executed while the method is executed. -/// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. -/// -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class InstantHandleAttribute : Attribute -{ -} - -/// -/// Indicates that a method does not make any observable state changes. -/// The same as System.Diagnostics.Contracts.PureAttribute. -/// -/// -/// -/// [Pure] int Multiply(int x, int y) => x * y; -/// -/// void M() { -/// Multiply(123, 42); // Waring: Return value of pure method is not used -/// } -/// -/// -[AttributeUsage(AttributeTargets.Method)] -public sealed class PureAttribute : Attribute -{ -} - -/// -/// Indicates that the return value of the method invocation must be used. -/// -/// -/// Methods decorated with this attribute (in contrast to pure methods) might change state, -/// but make no sense without using their return value.
-/// Similarly to , this attribute -/// will help detecting usages of the method when the return value in not used. -/// Additionally, you can optionally specify a custom message, which will be used when showing warnings, e.g. -/// [MustUseReturnValue("Use the return value to...")]. -///
-[AttributeUsage(AttributeTargets.Method)] -public sealed class MustUseReturnValueAttribute : Attribute -{ - public MustUseReturnValueAttribute() - { - } - - public MustUseReturnValueAttribute([NotNull] string justification) - { - Justification = justification; - } - - [CanBeNull] - public string Justification { get; } -} - -/// -/// Indicates the type member or parameter of some type, that should be used instead of all other ways -/// to get the value of that type. This annotation is useful when you have some "context" value evaluated -/// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. -/// -/// -/// -/// class Foo { -/// [ProvidesContext] IBarService _barService = ...; -/// -/// void ProcessNode(INode node) { -/// DoSomething(node, node.GetGlobalServices().Bar); -/// // ^ Warning: use value of '_barService' field -/// } -/// } -/// -/// -[AttributeUsage( - AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.GenericParameter)] -public sealed class ProvidesContextAttribute : Attribute -{ -} - -/// -/// Indicates that a parameter is a path to a file or a folder within a web project. -/// Path can be relative or absolute, starting from web root (~). -/// -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class PathReferenceAttribute : Attribute -{ - public PathReferenceAttribute() - { - } - - public PathReferenceAttribute([NotNull] [PathReference] string basePath) - { - BasePath = basePath; - } - - [CanBeNull] - public string BasePath { get; } -} - -/// -/// An extension method marked with this attribute is processed by code completion -/// as a 'Source Template'. When the extension method is completed over some expression, its source code -/// is automatically expanded like a template at call site. -/// -/// -/// Template method body can contain valid source code and/or special comments starting with '$'. -/// Text inside these comments is added as source code when the template is applied. Template parameters -/// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. -/// Use the attribute to specify macros for parameters. -/// -/// -/// In this example, the 'forEach' method is a source template available over all values -/// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: -/// -/// [SourceTemplate] -/// public static void forEach<T>(this IEnumerable<T> xs) { -/// foreach (var x in xs) { -/// //$ $END$ -/// } -/// } -/// -/// -[AttributeUsage(AttributeTargets.Method)] -public sealed class SourceTemplateAttribute : Attribute -{ -} - -/// -/// Allows specifying a macro for a parameter of a source template. -/// -/// -/// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression -/// is defined in the property. When applied on a method, the target -/// template parameter is defined in the property. To apply the macro silently -/// for the parameter, set the property value = -1. -/// -/// -/// Applying the attribute on a source template method: -/// -/// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] -/// public static void forEach<T>(this IEnumerable<T> collection) { -/// foreach (var item in collection) { -/// //$ $END$ -/// } -/// } -/// -/// Applying the attribute on a template method parameter: -/// -/// [SourceTemplate] -/// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { -/// /*$ var $x$Id = "$newguid$" + x.ToString(); -/// x.DoSomething($x$Id); */ -/// } -/// -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] -public sealed class MacroAttribute : Attribute -{ - /// - /// Allows specifying a macro that will be executed for a source template - /// parameter when the template is expanded. - /// - [CanBeNull] - public string Expression { get; set; } - - /// - /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. - /// - /// - /// If the target parameter is used several times in the template, only one occurrence becomes editable; - /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, - /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. - /// - public int Editable { get; set; } - - /// - /// Identifies the target parameter of a source template if the - /// is applied on a template method. - /// - [CanBeNull] - public string Target { get; set; } -} - -[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute -{ - public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] - public string Format { get; } -} - -[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute -{ - public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] - public string Format { get; } -} - -[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute -{ - public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] - public string Format { get; } -} - -[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -public sealed class AspMvcMasterLocationFormatAttribute : Attribute -{ - public AspMvcMasterLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] - public string Format { get; } -} - -[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute -{ - public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] - public string Format { get; } -} - -[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -public sealed class AspMvcViewLocationFormatAttribute : Attribute -{ - public AspMvcViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] - public string Format { get; } -} - -/// -/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter -/// is an MVC action. If applied to a method, the MVC action name is calculated -/// implicitly from the context. Use this attribute for custom wrappers similar to -/// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcActionAttribute : Attribute -{ - public AspMvcActionAttribute() - { - } - - public AspMvcActionAttribute([NotNull] string anonymousProperty) - { - AnonymousProperty = anonymousProperty; - } - - [CanBeNull] - public string AnonymousProperty { get; } -} - -/// -/// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC area. -/// Use this attribute for custom wrappers similar to -/// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcAreaAttribute : Attribute -{ - public AspMvcAreaAttribute() - { - } - - public AspMvcAreaAttribute([NotNull] string anonymousProperty) - { - AnonymousProperty = anonymousProperty; - } - - [CanBeNull] - public string AnonymousProperty { get; } -} - -/// -/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is -/// an MVC controller. If applied to a method, the MVC controller name is calculated -/// implicitly from the context. Use this attribute for custom wrappers similar to -/// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcControllerAttribute : Attribute -{ - public AspMvcControllerAttribute() - { - } - - public AspMvcControllerAttribute([NotNull] string anonymousProperty) - { - AnonymousProperty = anonymousProperty; - } - - [CanBeNull] - public string AnonymousProperty { get; } -} - -/// -/// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC Master. Use this attribute -/// for custom wrappers similar to System.Web.Mvc.Controller.View(String, String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcMasterAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC model type. Use this attribute -/// for custom wrappers similar to System.Web.Mvc.Controller.View(String, Object). -/// -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class AspMvcModelTypeAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC -/// partial view. If applied to a method, the MVC partial view name is calculated implicitly -/// from the context. Use this attribute for custom wrappers similar to -/// System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcPartialViewAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. -/// -[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] -public sealed class AspMvcSuppressViewErrorAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. -/// Use this attribute for custom wrappers similar to -/// System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcDisplayTemplateAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC editor template. -/// Use this attribute for custom wrappers similar to -/// System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcEditorTemplateAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC template. -/// Use this attribute for custom wrappers similar to -/// System.ComponentModel.DataAnnotations.UIHintAttribute(System.String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcTemplateAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter -/// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly -/// from the context. Use this attribute for custom wrappers similar to -/// System.Web.Mvc.Controller.View(Object). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcViewAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter -/// is an MVC view component name. -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcViewComponentAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter -/// is an MVC view component view. If applied to a method, the MVC view component view name is default. -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class AspMvcViewComponentViewAttribute : Attribute -{ -} - -/// -/// ASP.NET MVC attribute. When applied to a parameter of an attribute, -/// indicates that this parameter is an MVC action name. -/// -/// -/// -/// [ActionName("Foo")] -/// public ActionResult Login(string returnUrl) { -/// ViewBag.ReturnUrl = Url.Action("Foo"); // OK -/// return RedirectToAction("Bar"); // Error: Cannot resolve action -/// } -/// -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] -public sealed class AspMvcActionSelectorAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] -public sealed class HtmlElementAttributesAttribute : Attribute -{ - public HtmlElementAttributesAttribute() - { - } - - public HtmlElementAttributesAttribute([NotNull] string name) - { - Name = name; - } - - [CanBeNull] - public string Name { get; } -} - -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -public sealed class HtmlAttributeValueAttribute : Attribute -{ - public HtmlAttributeValueAttribute([NotNull] string name) - { - Name = name; - } - - [NotNull] - public string Name { get; } -} - -/// -/// Razor attribute. Indicates that the marked parameter or method is a Razor section. -/// Use this attribute for custom wrappers similar to -/// System.Web.WebPages.WebPageBase.RenderSection(String). -/// -[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] -public sealed class RazorSectionAttribute : Attribute -{ -} - -/// -/// Indicates how method, constructor invocation, or property access -/// over collection type affects the contents of the collection. -/// Use to specify the access type. -/// -/// -/// Using this attribute only makes sense if all collection methods are marked with this attribute. -/// -/// -/// -/// public class MyStringCollection : List<string> -/// { -/// [CollectionAccess(CollectionAccessType.Read)] -/// public string GetFirstString() -/// { -/// return this.ElementAt(0); -/// } -/// } -/// class Test -/// { -/// public void Foo() -/// { -/// // Warning: Contents of the collection is never updated -/// var col = new MyStringCollection(); -/// string x = col.GetFirstString(); -/// } -/// } -/// -/// -[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] -public sealed class CollectionAccessAttribute : Attribute -{ - public CollectionAccessAttribute(CollectionAccessType collectionAccessType) - { - CollectionAccessType = collectionAccessType; - } - - public CollectionAccessType CollectionAccessType { get; } -} - -/// -/// Provides a value for the to define -/// how the collection method invocation affects the contents of the collection. -/// -[Flags] -public enum CollectionAccessType -{ - /// Method does not use or modify content of the collection. - None = 0, - - /// Method only reads content of the collection but does not modify it. - Read = 1, - - /// Method can change content of the collection but does not add new elements. - ModifyExistingContent = 2, - - /// Method can add new elements to the collection. - UpdatedContent = ModifyExistingContent | 4 -} - -/// -/// Indicates that the marked method is assertion method, i.e. it halts the control flow if -/// one of the conditions is satisfied. To set the condition, mark one of the parameters with -/// attribute. -/// -[AttributeUsage(AttributeTargets.Method)] -public sealed class AssertionMethodAttribute : Attribute -{ -} - -/// -/// Indicates the condition parameter of the assertion method. The method itself should be -/// marked by attribute. The mandatory argument of -/// the attribute is the assertion type. -/// -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class AssertionConditionAttribute : Attribute -{ - public AssertionConditionAttribute(AssertionConditionType conditionType) - { - ConditionType = conditionType; - } - - public AssertionConditionType ConditionType { get; } -} - -/// -/// Specifies assertion type. If the assertion method argument satisfies the condition, -/// then the execution continues. Otherwise, execution is assumed to be halted. -/// -public enum AssertionConditionType -{ - /// Marked parameter should be evaluated to true. - IS_TRUE = 0, - - /// Marked parameter should be evaluated to false. - IS_FALSE = 1, - - /// Marked parameter should be evaluated to null value. - IS_NULL = 2, - - /// Marked parameter should be evaluated to not null value. - IS_NOT_NULL = 3 -} - -/// -/// Indicates that the marked method unconditionally terminates control flow execution. -/// For example, it could unconditionally throw exception. -/// -[Obsolete("Use [ContractAnnotation('=> halt')] instead")] -[AttributeUsage(AttributeTargets.Method)] -public sealed class TerminatesProgramAttribute : Attribute -{ -} - -/// -/// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, -/// .Where). This annotation allows inference of [InstantHandle] annotation for parameters -/// of delegate type by analyzing LINQ method chains. -/// -[AttributeUsage(AttributeTargets.Method)] -public sealed class LinqTunnelAttribute : Attribute -{ -} - -/// -/// Indicates that IEnumerable passed as a parameter is not enumerated. -/// Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection. -/// -/// -/// -/// static void ThrowIfNull<T>([NoEnumeration] T v, string n) where T : class -/// { -/// // custom check for null but no enumeration -/// } -/// -/// void Foo(IEnumerable<string> values) -/// { -/// ThrowIfNull(values, nameof(values)); -/// var x = values.ToList(); // No warnings about multiple enumeration -/// } -/// -/// -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class NoEnumerationAttribute : Attribute -{ -} - -/// -/// Indicates that the marked parameter is a regular expression pattern. -/// -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class RegexPatternAttribute : Attribute -{ -} - -/// -/// Prevents the Member Reordering feature from tossing members of the marked class. -/// -/// -/// The attribute must be mentioned in your member reordering patterns. -/// -[AttributeUsage( - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] -public sealed class NoReorderAttribute : Attribute -{ -} - -/// -/// XAML attribute. Indicates the type that has ItemsSource property and should be treated -/// as ItemsControl-derived type, to enable inner items DataContext type resolve. -/// -[AttributeUsage(AttributeTargets.Class)] -public sealed class XamlItemsControlAttribute : Attribute -{ -} - -/// -/// XAML attribute. Indicates the property of some BindingBase-derived type, that -/// is used to bind some item of ItemsControl-derived type. This annotation will -/// enable the DataContext type resolve for XAML bindings for such properties. -/// -/// -/// Property should have the tree ancestor of the ItemsControl type or -/// marked with the attribute. -/// -[AttributeUsage(AttributeTargets.Property)] -public sealed class XamlItemBindingOfItemsControlAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] -public sealed class AspChildControlTypeAttribute : Attribute -{ - public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) - { - TagName = tagName; - ControlType = controlType; - } - - [NotNull] - public string TagName { get; } - - [NotNull] - public Type ControlType { get; } -} - -[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] -public sealed class AspDataFieldAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] -public sealed class AspDataFieldsAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Property)] -public sealed class AspMethodPropertyAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] -public sealed class AspRequiredAttributeAttribute : Attribute -{ - public AspRequiredAttributeAttribute([NotNull] string attribute) - { - Attribute = attribute; - } - - [NotNull] - public string Attribute { get; } -} - -[AttributeUsage(AttributeTargets.Property)] -public sealed class AspTypePropertyAttribute : Attribute -{ - public AspTypePropertyAttribute(bool createConstructorReferences) - { - CreateConstructorReferences = createConstructorReferences; - } - - public bool CreateConstructorReferences { get; } -} - -[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -public sealed class RazorImportNamespaceAttribute : Attribute -{ - public RazorImportNamespaceAttribute([NotNull] string name) - { - Name = name; - } - - [NotNull] - public string Name { get; } -} - -[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -public sealed class RazorInjectionAttribute : Attribute -{ - public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) - { - Type = type; - FieldName = fieldName; - } - - [NotNull] - public string Type { get; } - - [NotNull] - public string FieldName { get; } -} - -[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -public sealed class RazorDirectiveAttribute : Attribute -{ - public RazorDirectiveAttribute([NotNull] string directive) - { - Directive = directive; - } - - [NotNull] - public string Directive { get; } -} - -[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -public sealed class RazorPageBaseTypeAttribute : Attribute -{ - public RazorPageBaseTypeAttribute([NotNull] string baseType) - { - BaseType = baseType; - } - - public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName) - { - BaseType = baseType; - PageName = pageName; - } - - [NotNull] - public string BaseType { get; } - - [CanBeNull] - public string PageName { get; } -} - -[AttributeUsage(AttributeTargets.Method)] -public sealed class RazorHelperCommonAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Property)] -public sealed class RazorLayoutAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Method)] -public sealed class RazorWriteLiteralMethodAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Method)] -public sealed class RazorWriteMethodAttribute : Attribute -{ -} - -[AttributeUsage(AttributeTargets.Parameter)] -public sealed class RazorWriteMethodParameterAttribute : Attribute -{ -} \ No newline at end of file diff --git a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj index 7d19d5e97..86ccbb134 100644 --- a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj +++ b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj @@ -16,12 +16,12 @@ - - + + - - - + + + diff --git a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj index 65ef347d2..f5f4606ce 100644 --- a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj +++ b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj @@ -15,12 +15,12 @@ - - + + - - - + + + diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 047d9906f..af6424e4c 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -10,18 +10,18 @@ - + - - - - - + + + + + - - + + - + diff --git a/src/Artemis.UI.Shared/Behaviors/LostFocusNumericUpDownBindingBehavior.cs b/src/Artemis.UI.Shared/Behaviors/LostFocusNumericUpDownBindingBehavior.cs index 23e2bdbdb..1b6da7178 100644 --- a/src/Artemis.UI.Shared/Behaviors/LostFocusNumericUpDownBindingBehavior.cs +++ b/src/Artemis.UI.Shared/Behaviors/LostFocusNumericUpDownBindingBehavior.cs @@ -15,7 +15,7 @@ public class LostFocusNumericUpDownBindingBehavior : Behavior /// /// Gets or sets the value of the binding. /// - public static readonly StyledProperty ValueProperty = AvaloniaProperty.Register( + public static readonly StyledProperty ValueProperty = AvaloniaProperty.Register( nameof(Value), defaultBindingMode: BindingMode.TwoWay); static LostFocusNumericUpDownBindingBehavior() @@ -26,7 +26,7 @@ public class LostFocusNumericUpDownBindingBehavior : Behavior /// /// Gets or sets the value of the binding. /// - public double Value + public decimal? Value { get => GetValue(ValueProperty); set => SetValue(ValueProperty, value); diff --git a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs index 1e3e47a1d..04aa74a0d 100644 --- a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs @@ -2,12 +2,12 @@ using System; using System.Text.RegularExpressions; using Avalonia; using Avalonia.Controls; +using Avalonia.Controls.Documents; using Avalonia.Layout; using Avalonia.LogicalTree; using Avalonia.Markup.Xaml; using Avalonia.Media; using Avalonia.Media.Imaging; -using Avalonia.Visuals.Media.Imaging; using Material.Icons; using Material.Icons.Avalonia; @@ -16,9 +16,9 @@ namespace Artemis.UI.Shared; /// /// Represents a control that can display an arbitrary kind of icon. /// -public class ArtemisIcon : UserControl +public partial class ArtemisIcon : UserControl { - private static readonly Regex _imageRegex = new(@"[\/.](gif|jpg|jpeg|tiff|png)$", RegexOptions.Compiled); + private static readonly Regex ImageRegex = new(@"[\/.](gif|jpg|jpeg|tiff|png)$", RegexOptions.Compiled); /// /// Creates a new instance of the class. @@ -30,12 +30,6 @@ public class ArtemisIcon : UserControl LayoutUpdated += OnLayoutUpdated; } - private static void IconChanging(IAvaloniaObject sender, bool before) - { - if (before) - ((ArtemisIcon) sender).Update(); - } - private void Update() { try @@ -54,7 +48,7 @@ public class ArtemisIcon : UserControl Content = new MaterialIcon {Kind = parsedIcon, Width = Bounds.Width, Height = Bounds.Height}; } // An URI pointing to an image - else if (_imageRegex.IsMatch(iconString)) + else if (ImageRegex.IsMatch(iconString)) { if (!Fill) Content = new Image @@ -66,7 +60,7 @@ public class ArtemisIcon : UserControl else Content = new Border { - Background = TextBlock.GetForeground(this), + Background = TextElement.GetForeground(this), VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, OpacityMask = new ImageBrush(new Bitmap(iconString)) {BitmapInterpolationMode = BitmapInterpolationMode.MediumQuality} @@ -110,8 +104,7 @@ public class ArtemisIcon : UserControl /// Gets or sets the currently displayed icon as either a or an /// pointing to an SVG /// - public static readonly StyledProperty IconProperty = - AvaloniaProperty.Register(nameof(Icon), notifying: IconChanging); + public static readonly StyledProperty IconProperty = AvaloniaProperty.Register(nameof(Icon)); /// @@ -121,15 +114,18 @@ public class ArtemisIcon : UserControl public object? Icon { get => GetValue(IconProperty); - set => SetValue(IconProperty, value); + set + { + SetValue(IconProperty, value); + Update(); + } } /// /// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the /// theme /// - public static readonly StyledProperty FillProperty = - AvaloniaProperty.Register(nameof(Icon), false, notifying: IconChanging); + public static readonly StyledProperty FillProperty = AvaloniaProperty.Register(nameof(Icon)); /// /// Gets or sets a boolean indicating whether or not the icon should be filled in with the primary text color of the @@ -138,7 +134,11 @@ public class ArtemisIcon : UserControl public bool Fill { get => GetValue(FillProperty); - set => SetValue(FillProperty, value); + set + { + SetValue(FillProperty, value); + Update(); + } } #endregion diff --git a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs index 1535569cc..eb8ab30a4 100644 --- a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs +++ b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPickerButton.cs @@ -46,8 +46,8 @@ public class DataModelPickerButton : TemplatedControl /// /// Gets or sets the desired flyout placement. /// - public static readonly StyledProperty PlacementProperty = - AvaloniaProperty.Register(nameof(Placement)); + public static readonly StyledProperty PlacementProperty = + AvaloniaProperty.Register(nameof(Placement)); /// /// Gets or sets data model path. @@ -133,7 +133,7 @@ public class DataModelPickerButton : TemplatedControl /// /// Gets or sets the desired flyout placement. /// - public FlyoutPlacementMode Placement + public PlacementMode Placement { get => GetValue(PlacementProperty); set => SetValue(PlacementProperty, value); diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index 1632f25a7..72189df57 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -15,7 +15,6 @@ using Avalonia.Media.Imaging; using Avalonia.Platform; using Avalonia.Rendering; using Avalonia.Threading; -using Avalonia.Visuals.Media.Imaging; namespace Artemis.UI.Shared; @@ -123,7 +122,7 @@ public class DeviceVisualizer : Control private Rect MeasureDevice() { if (Device == null) - return Rect.Empty; + return new Rect(0, 0, 0, 0); Rect deviceRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height); Geometry geometry = new RectangleGeometry(deviceRect); @@ -171,21 +170,19 @@ public class DeviceVisualizer : Control /// Gets or sets the to display /// public static readonly StyledProperty DeviceProperty = - AvaloniaProperty.Register(nameof(Device), notifying: DeviceUpdated); - - private static void DeviceUpdated(IAvaloniaObject sender, bool before) - { - if (!before) - ((DeviceVisualizer) sender).SetupForDevice(); - } - + AvaloniaProperty.Register(nameof(Device)); + /// /// Gets or sets the to display /// public ArtemisDevice? Device { get => GetValue(DeviceProperty); - set => SetValue(DeviceProperty, value); + set + { + SetValue(DeviceProperty, value); + SetupForDevice(); + } } /// @@ -302,9 +299,9 @@ public class DeviceVisualizer : Control // Render 4 times the actual size of the device to make sure things look sharp when zoomed in RenderTargetBitmap renderTargetBitmap = new(new PixelSize((int) device.RgbDevice.ActualSize.Width * 2, (int) device.RgbDevice.ActualSize.Height * 2)); - using IDrawingContextImpl context = renderTargetBitmap.CreateDrawingContext(new ImmediateRenderer(this)); + using DrawingContext context = renderTargetBitmap.CreateDrawingContext(); using Bitmap bitmap = new(device.Layout.Image.LocalPath); - context.DrawBitmap(bitmap.PlatformImpl, 1, new Rect(bitmap.Size), new Rect(renderTargetBitmap.Size), BitmapInterpolationMode.HighQuality); + context.DrawImage(bitmap, new Rect(bitmap.Size), new Rect(renderTargetBitmap.Size), BitmapInterpolationMode.HighQuality); lock (_deviceVisualizerLeds) { diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs index f1d762431..30bb72b76 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs @@ -4,8 +4,6 @@ using Artemis.Core; using Avalonia; using Avalonia.Media; using Avalonia.Media.Imaging; -using Avalonia.Platform; -using Avalonia.Visuals.Media.Imaging; using RGB.NET.Core; using Color = Avalonia.Media.Color; using Point = Avalonia.Point; @@ -40,7 +38,7 @@ internal class DeviceVisualizerLed public Rect LedRect { get; set; } public Geometry? DisplayGeometry { get; private set; } - public void DrawBitmap(IDrawingContextImpl drawingContext, double scale) + public void DrawBitmap(DrawingContext drawingContext, double scale) { if (Led.Layout?.Image == null || !File.Exists(Led.Layout.Image.LocalPath)) return; @@ -48,9 +46,8 @@ internal class DeviceVisualizerLed try { using Bitmap bitmap = new(Led.Layout.Image.LocalPath); - drawingContext.DrawBitmap( - bitmap.PlatformImpl, - 1, + drawingContext.DrawImage( + bitmap, new Rect(bitmap.Size), new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, Led.RgbLed.Size.Width * scale, Led.RgbLed.Size.Height * scale), BitmapInterpolationMode.HighQuality diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs index c6a7ca8f7..cec9f62bb 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs @@ -14,12 +14,12 @@ namespace Artemis.UI.Shared.Controls; /// /// Represents a number box that can be mutated by dragging over it horizontally /// -public class DraggableNumberBox : UserControl +public partial class DraggableNumberBox : UserControl { /// /// Defines the property. /// - public static readonly StyledProperty ValueProperty = AvaloniaProperty.Register(nameof(Value), defaultBindingMode: BindingMode.TwoWay, notifying: ValueChanged); + public static readonly StyledProperty ValueProperty = AvaloniaProperty.Register(nameof(Value), defaultBindingMode: BindingMode.TwoWay); /// /// Defines the property. @@ -85,7 +85,11 @@ public class DraggableNumberBox : UserControl public double Value { get => GetValue(ValueProperty); - set => SetValue(ValueProperty, value); + set + { + SetValue(ValueProperty, value); + SetNumberBoxValue(value); + } } /// @@ -160,25 +164,21 @@ public class DraggableNumberBox : UserControl /// Occurs when the user finishes dragging over the control. /// public event TypedEventHandler? DragFinished; - - private static void ValueChanged(IAvaloniaObject sender, bool before) + + private void SetNumberBoxValue(double value) { - if (before) + if (!(Math.Abs(_numberBox.Value - Value) > 0.00001)) return; - DraggableNumberBox draggable = (DraggableNumberBox) sender; - if (!(Math.Abs(draggable._numberBox.Value - draggable.Value) > 0.00001)) - return; - - draggable._updating = true; - draggable._numberBox.Value = draggable.Value; - draggable._updating = false; + _updating = true; + _numberBox.Value = Value; + _updating = false; } private void HandleKeyUp(object? sender, KeyEventArgs e) { if (e.Key == Key.Enter || e.Key == Key.Escape) - Parent?.Focus(); + FocusManager.Instance?.Focus(Parent as IInputElement); } private void InitializeComponent() @@ -211,7 +211,7 @@ public class DraggableNumberBox : UserControl if (!_moved) { // Let our parent take focus, it would make more sense to take focus ourselves but that hides the collider - Parent?.Focus(); + FocusManager.Instance?.Focus(Parent as IInputElement); _moved = true; e.Pointer.Capture(this); DragStarted?.Invoke(this, EventArgs.Empty); diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs index f264b595e..d7ecc43c6 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs @@ -13,13 +13,12 @@ namespace Artemis.UI.Shared; /// /// Represents a combobox that can display the values of an enum. /// -public class EnumComboBox : UserControl +public partial class EnumComboBox : UserControl { /// /// Gets or sets the currently selected value /// - public static readonly StyledProperty ValueProperty = - AvaloniaProperty.Register(nameof(Value), defaultBindingMode: BindingMode.TwoWay, notifying: ValueChanged); + public static readonly StyledProperty ValueProperty = AvaloniaProperty.Register(nameof(Value), defaultBindingMode: BindingMode.TwoWay); private readonly ObservableCollection<(Enum, string)> _currentValues = new(); private Type? _currentType; @@ -40,15 +39,11 @@ public class EnumComboBox : UserControl public object? Value { get => GetValue(ValueProperty); - set => SetValue(ValueProperty, value); - } - - private static void ValueChanged(IAvaloniaObject sender, bool before) - { - if (sender is EnumComboBox enumCombo && !before) + set { - enumCombo.UpdateValues(); - enumCombo.UpdateSelection(); + SetValue(ValueProperty, value); + UpdateValues(); + UpdateSelection(); } } diff --git a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs index 5bc9eebd5..7edb8e13b 100644 --- a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs +++ b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs @@ -27,7 +27,7 @@ public class GradientPicker : TemplatedControl /// Gets or sets the color gradient. /// public static readonly StyledProperty ColorGradientProperty = - AvaloniaProperty.Register(nameof(ColorGradient), notifying: ColorGradientChanged, defaultValue: ColorGradient.GetUnicornBarf()); + AvaloniaProperty.Register(nameof(ColorGradient), defaultValue: ColorGradient.GetUnicornBarf()); /// /// Gets or sets the currently selected color stop. @@ -45,7 +45,7 @@ public class GradientPicker : TemplatedControl /// Gets or sets a storage provider to use for storing and loading gradients. /// public static readonly StyledProperty StorageProviderProperty = - AvaloniaProperty.Register(nameof(StorageProvider), notifying: StorageProviderChanged); + AvaloniaProperty.Register(nameof(StorageProvider)); /// /// Gets the linear gradient brush representing the color gradient. @@ -66,7 +66,7 @@ public class GradientPicker : TemplatedControl AvaloniaProperty.RegisterDirect(nameof(EditingColorGradient), g => g.EditingColorGradient); private readonly ICommand _deleteStop; - private ColorPicker? _colorPicker; + private FAColorPicker? _colorPicker; private Button? _flipStops; private Border? _gradient; private Button? _randomize; @@ -102,7 +102,11 @@ public class GradientPicker : TemplatedControl public ColorGradient ColorGradient { get => GetValue(ColorGradientProperty); - set => SetValue(ColorGradientProperty, value); + set + { + SetValue(ColorGradientProperty, value); + ApplyToField(); + } } /// @@ -176,7 +180,7 @@ public class GradientPicker : TemplatedControl if (_randomize != null) _randomize.Click -= RandomizeOnClick; - _colorPicker = e.NameScope.Find("ColorPicker"); + _colorPicker = e.NameScope.Find("ColorPicker"); _gradient = e.NameScope.Find("Gradient"); _spreadStops = e.NameScope.Find public static readonly StyledProperty ColorGradientProperty = - AvaloniaProperty.Register(nameof(ColorGradient), notifying: ColorGradientChanged); + AvaloniaProperty.Register(nameof(ColorGradient)); /// /// Gets or sets a boolean indicating whether the gradient picker should be in compact mode or not. @@ -54,7 +53,11 @@ public class GradientPickerButton : TemplatedControl public ColorGradient? ColorGradient { get => GetValue(ColorGradientProperty); - set => SetValue(ColorGradientProperty, value); + set + { + SetValue(ColorGradientProperty, value); + Subscribe(); + } } /// @@ -105,12 +108,6 @@ public class GradientPickerButton : TemplatedControl #endregion - private static void ColorGradientChanged(IAvaloniaObject sender, bool before) - { - if (!before) - (sender as GradientPickerButton)?.Subscribe(); - } - private void Subscribe() { Unsubscribe(); diff --git a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerColorStop.cs b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerColorStop.cs index 4e4502288..4bb8aa8e2 100644 --- a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerColorStop.cs +++ b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerColorStop.cs @@ -16,7 +16,7 @@ internal class GradientPickerColorStop : TemplatedControl /// Gets or sets the gradient picker. /// public static readonly StyledProperty GradientPickerProperty = - AvaloniaProperty.Register(nameof(GradientPicker), notifying: Notifying); + AvaloniaProperty.Register(nameof(GradientPicker)); /// /// Gets or sets the color stop. @@ -28,8 +28,8 @@ internal class GradientPickerColorStop : TemplatedControl /// Gets or sets the position reference to use when positioning and dragging this color stop. /// If then dragging is not enabled. /// - public static readonly StyledProperty PositionReferenceProperty = - AvaloniaProperty.Register(nameof(PositionReference)); + public static readonly StyledProperty PositionReferenceProperty = + AvaloniaProperty.Register(nameof(PositionReference)); /// /// Gets the linear gradient brush representing the color gradient. @@ -47,7 +47,16 @@ internal class GradientPickerColorStop : TemplatedControl public GradientPicker? GradientPicker { get => GetValue(GradientPickerProperty); - set => SetValue(GradientPickerProperty, value); + set + { + if (GradientPicker != null) + GradientPicker.PropertyChanged -= GradientPickerOnPropertyChanged; + SetValue(GradientPickerProperty, value); + if (GradientPicker != null) + GradientPicker.PropertyChanged += GradientPickerOnPropertyChanged; + + IsSelected = ReferenceEquals(GradientPicker?.SelectedColorStop, ColorStop); + } } /// @@ -63,7 +72,7 @@ internal class GradientPickerColorStop : TemplatedControl /// Gets or sets the position reference to use when positioning and dragging this color stop. /// If then dragging is not enabled. /// - public IControl? PositionReference + public Control? PositionReference { get => GetValue(PositionReferenceProperty); set => SetValue(PositionReferenceProperty, value); @@ -85,19 +94,6 @@ internal class GradientPickerColorStop : TemplatedControl } } - private static void Notifying(IAvaloniaObject sender, bool before) - { - if (sender is not GradientPickerColorStop self) - return; - - if (before && self.GradientPicker != null) - self.GradientPicker.PropertyChanged -= self.GradientPickerOnPropertyChanged; - else if (self.GradientPicker != null) - self.GradientPicker.PropertyChanged += self.GradientPickerOnPropertyChanged; - - self.IsSelected = ReferenceEquals(self.GradientPicker?.SelectedColorStop, self.ColorStop); - } - private void GradientPickerOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { if (GradientPicker != null && e.Property == GradientPicker.SelectedColorStopProperty) diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs index 0c50e69e4..e9e2ce0b3 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs @@ -17,7 +17,7 @@ namespace Artemis.UI.Shared; /// /// Represents a control that can be used to display or edit instances. /// -public class HotkeyBox : UserControl +public partial class HotkeyBox : UserControl { private readonly TextBox _displayTextBox; @@ -34,11 +34,6 @@ public class HotkeyBox : UserControl UpdateDisplayTextBox(); } - private static void HotkeyChanging(IAvaloniaObject sender, bool before) - { - ((HotkeyBox) sender).UpdateDisplayTextBox(); - } - private void DisplayTextBoxOnKeyDown(object? sender, KeyEventArgs e) { if (e.Key >= Key.LeftShift && e.Key <= Key.RightAlt) @@ -92,20 +87,17 @@ public class HotkeyBox : UserControl /// Gets or sets the currently displayed icon as either a or an /// pointing to an SVG /// - public static readonly StyledProperty HotkeyProperty = - AvaloniaProperty.Register(nameof(Hotkey), defaultBindingMode: BindingMode.TwoWay, notifying: HotkeyChanging); + public static readonly StyledProperty HotkeyProperty = AvaloniaProperty.Register(nameof(Hotkey), defaultBindingMode: BindingMode.TwoWay); /// /// Gets or sets the watermark of the hotkey box when it is empty. /// - public static readonly StyledProperty WatermarkProperty = - AvaloniaProperty.Register(nameof(Watermark)); + public static readonly StyledProperty WatermarkProperty = AvaloniaProperty.Register(nameof(Watermark)); /// /// Gets or sets a boolean indicating whether the watermark should float above the hotkey box when it is not empty. /// - public static readonly StyledProperty UseFloatingWatermarkProperty = - AvaloniaProperty.Register(nameof(UseFloatingWatermark)); + public static readonly StyledProperty UseFloatingWatermarkProperty = AvaloniaProperty.Register(nameof(UseFloatingWatermark)); /// /// Gets or sets the currently displayed icon as either a or an @@ -114,7 +106,11 @@ public class HotkeyBox : UserControl public Hotkey? Hotkey { get => GetValue(HotkeyProperty); - set => SetValue(HotkeyProperty, value); + set + { + SetValue(HotkeyProperty, value); + UpdateDisplayTextBox(); + } } /// diff --git a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs index c119f0ab2..5313522d9 100644 --- a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs @@ -3,13 +3,13 @@ using System.IO; using Artemis.Core; using Avalonia; using Avalonia.Controls; +using Avalonia.Controls.Documents; using Avalonia.Layout; using Avalonia.LogicalTree; using Avalonia.Markup.Xaml; using Avalonia.Media; using Avalonia.Media.Imaging; using Avalonia.Threading; -using Avalonia.Visuals.Media.Imaging; using Material.Icons; using Material.Icons.Avalonia; @@ -18,7 +18,7 @@ namespace Artemis.UI.Shared; /// /// Represents a control that can display the icon of a specific . /// -public class ProfileConfigurationIcon : UserControl, IDisposable +public partial class ProfileConfigurationIcon : UserControl, IDisposable { private Stream? _stream; @@ -72,7 +72,7 @@ public class ProfileConfigurationIcon : UserControl, IDisposable Content = new Border { - Background = TextBlock.GetForeground(this), + Background = TextElement.GetForeground(this), VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, OpacityMask = new ImageBrush(new Bitmap(stream)) {BitmapInterpolationMode = BitmapInterpolationMode.MediumQuality} diff --git a/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs b/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs index d869a5730..5da12bd99 100644 --- a/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs +++ b/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs @@ -40,8 +40,8 @@ public class SelectionRectangle : Control /// /// Defines the property. /// - public static readonly StyledProperty InputElementProperty = - AvaloniaProperty.Register(nameof(InputElement), notifying: OnInputElementChanged); + public static readonly StyledProperty InputElementProperty = + AvaloniaProperty.Register(nameof(InputElement)); /// /// Defines the property. @@ -61,7 +61,7 @@ public class SelectionRectangle : Control private Rect? _displayRect; private bool _isSelecting; private Point _lastPosition; - private IControl? _oldInputElement; + private InputElement? _oldInputElement; private Point _startPosition; /// @@ -110,10 +110,14 @@ public class SelectionRectangle : Control /// /// Gets or sets the element that captures input for the selection rectangle. /// - public IControl? InputElement + public InputElement? InputElement { get => GetValue(InputElementProperty); - set => SetValue(InputElementProperty, value); + set + { + SetValue(InputElementProperty, value); + SubscribeToInputElement(); + } } /// @@ -162,11 +166,6 @@ public class SelectionRectangle : Control SelectionFinished?.Invoke(this, e); } - private static void OnInputElementChanged(IAvaloniaObject sender, bool before) - { - ((SelectionRectangle) sender).SubscribeToInputElement(); - } - private void ParentOnPointerMoved(object? sender, PointerEventArgs e) { // Point moved seems to trigger when the element under the mouse changes? @@ -185,13 +184,13 @@ public class SelectionRectangle : Control { e.Pointer.Capture(this); - _startPosition = e.GetPosition(Parent); - _absoluteStartPosition = e.GetPosition(VisualRoot); + _startPosition = e.GetPosition(Parent as Visual); + _absoluteStartPosition = e.GetPosition(VisualRoot as Visual); _displayRect = null; } - Point currentPosition = e.GetPosition(Parent); - Point absoluteCurrentPosition = e.GetPosition(VisualRoot); + Point currentPosition = e.GetPosition(Parent as Visual); + Point absoluteCurrentPosition = e.GetPosition(VisualRoot as Visual); _displayRect = new Rect( new Point(Math.Min(_startPosition.X, currentPosition.X), Math.Min(_startPosition.Y, currentPosition.Y)), diff --git a/src/Artemis.UI.Shared/Converters/ParentWidthPercentageConverter.cs b/src/Artemis.UI.Shared/Converters/ParentWidthPercentageConverter.cs index 2d8219d0e..4af9f7c86 100644 --- a/src/Artemis.UI.Shared/Converters/ParentWidthPercentageConverter.cs +++ b/src/Artemis.UI.Shared/Converters/ParentWidthPercentageConverter.cs @@ -15,7 +15,7 @@ public class ParentWidthPercentageConverter : IValueConverter /// public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { - if (parameter is not IControl parent || value is not double percentage) + if (parameter is not Control parent || value is not double percentage) return value; return parent.Width / 100.0 * percentage; @@ -24,7 +24,7 @@ public class ParentWidthPercentageConverter : IValueConverter /// public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { - if (parameter is not IControl parent || value is not double real) + if (parameter is not Control parent || value is not double real) return value; return real / parent.Width * 100.0; diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs index 74bffd403..685f6eade 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs @@ -6,7 +6,7 @@ namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display; /// /// Represents a default data model display view. /// -public class DefaultDataModelDisplayView : UserControl +public partial class DefaultDataModelDisplayView : UserControl { /// /// Creates a new instance of the class. diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs index 548987c18..4951fcc44 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs @@ -7,7 +7,7 @@ namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display; /// /// Represents a data model display view used to display values. /// -public class SKColorDataModelDisplayView : UserControl +public partial class SKColorDataModelDisplayView : UserControl { /// /// Creates a new instance of the class. diff --git a/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs b/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs index d01649eb0..45e97e130 100644 --- a/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs +++ b/src/Artemis.UI.Shared/Extensions/VisualExtensions.cs @@ -6,7 +6,7 @@ using Avalonia.VisualTree; namespace Artemis.UI.Shared.Extensions; /// -/// Provides extension methods for Avalonia's type +/// Provides extension methods for Avalonia's type /// public static class VisualExtensions { @@ -16,15 +16,15 @@ public static class VisualExtensions /// The type the children should have. /// The root visual at which to start searching. /// A recursive list of all visual children of type . - public static List GetVisualChildrenOfType(this IVisual root) + public static List GetVisualChildrenOfType(this Visual root) { List result = new(); - List? visualChildren = root.GetVisualChildren()?.ToList(); + List? visualChildren = root.GetVisualChildren()?.ToList(); if (visualChildren == null || !visualChildren.Any()) return result; - foreach (IVisual visualChild in visualChildren) + foreach (Visual visualChild in visualChildren) { if (visualChild is T toFind) result.Add(toFind); @@ -41,15 +41,15 @@ public static class VisualExtensions /// The type of data context the children should have. /// The root visual at which to start searching. /// A recursive list of all visual children with a data context of type . - public static List GetVisualChildrenOfDataContextType(this IVisual root) + public static List GetVisualChildrenOfDataContextType(this Visual root) { List result = new(); - List? visualChildren = root.GetVisualChildren()?.ToList(); + List? visualChildren = root.GetVisualChildren()?.ToList(); if (visualChildren == null || !visualChildren.Any()) return result; - foreach (IVisual visualChild in visualChildren) + foreach (Visual visualChild in visualChildren) { if (visualChild is IDataContextProvider dataContextProvider && dataContextProvider.DataContext is T toFind) result.Add(toFind); diff --git a/src/Artemis.UI.Shared/ReactiveCoreWindow.cs b/src/Artemis.UI.Shared/ReactiveAppWindow.cs similarity index 90% rename from src/Artemis.UI.Shared/ReactiveCoreWindow.cs rename to src/Artemis.UI.Shared/ReactiveAppWindow.cs index 295f4e6bb..36483f57c 100644 --- a/src/Artemis.UI.Shared/ReactiveCoreWindow.cs +++ b/src/Artemis.UI.Shared/ReactiveAppWindow.cs @@ -4,8 +4,8 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.Immutable; -using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Media; +using FluentAvalonia.UI.Windowing; using ReactiveUI; namespace Artemis.UI.Shared; @@ -17,18 +17,18 @@ namespace Artemis.UI.Shared; /// and vice versa. /// /// ViewModel type. -public class ReactiveCoreWindow : CoreWindow, IViewFor where TViewModel : class +public class ReactiveAppWindow : AppWindow, IViewFor where TViewModel : class { /// /// The ViewModel. /// public static readonly StyledProperty ViewModelProperty = AvaloniaProperty - .Register, TViewModel?>(nameof(ViewModel)); + .Register, TViewModel?>(nameof(ViewModel)); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public ReactiveCoreWindow() + public ReactiveAppWindow() { // This WhenActivated block calls ViewModel's WhenActivated // block if the ViewModel implements IActivatableViewModel. diff --git a/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs index ccf3c741f..5ba268315 100644 --- a/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs @@ -116,7 +116,7 @@ public class NotificationBuilder /// public Action Show() { - IPanel? panel = _parent.Find("NotificationContainer"); + Panel? panel = _parent.Find("NotificationContainer"); if (panel == null) throw new ArtemisSharedUIException("Can't display a notification on a window without a NotificationContainer."); @@ -202,7 +202,7 @@ public class NotificationButtonBuilder return this; } - internal IControl Build() + internal Control Build() { if (_action != null) return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action()), Classes = new Classes("AppBarButton")}; diff --git a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs index a80786d99..8b6fe08d7 100644 --- a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs +++ b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Shared.Services; -internal class ExceptionDialogView : ReactiveWindow +internal partial class ExceptionDialogView : ReactiveWindow { public ExceptionDialogView() { diff --git a/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml b/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml index 411d5649e..19fdc882e 100644 --- a/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml +++ b/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml @@ -3,13 +3,13 @@ xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"> - + + ShowAcceptDismissButtons="False" /> @@ -27,19 +27,19 @@ - + @@ -48,4 +48,4 @@ - + \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Styles/Condensed.axaml b/src/Artemis.UI.Shared/Styles/Condensed.axaml index 7b9f44d08..f1afaf384 100644 --- a/src/Artemis.UI.Shared/Styles/Condensed.axaml +++ b/src/Artemis.UI.Shared/Styles/Condensed.axaml @@ -102,7 +102,7 @@ - diff --git a/src/Artemis.UI.Shared/Styles/Controls/DataModelPickerButton.axaml b/src/Artemis.UI.Shared/Styles/Controls/DataModelPickerButton.axaml index cd5bc317e..3308fedc9 100644 --- a/src/Artemis.UI.Shared/Styles/Controls/DataModelPickerButton.axaml +++ b/src/Artemis.UI.Shared/Styles/Controls/DataModelPickerButton.axaml @@ -27,20 +27,20 @@ - + diff --git a/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml b/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml index 9909d32ac..680168261 100644 --- a/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml +++ b/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml @@ -168,14 +168,14 @@ BorderBrush="{DynamicResource ButtonBorderBrush}" BorderThickness="0 0 1 0" Padding="0 0 10 0"> - + diff --git a/src/Artemis.UI.Shared/Styles/Controls/GradientPickerButton.axaml b/src/Artemis.UI.Shared/Styles/Controls/GradientPickerButton.axaml index b3f3b6213..13f5ae0a5 100644 --- a/src/Artemis.UI.Shared/Styles/Controls/GradientPickerButton.axaml +++ b/src/Artemis.UI.Shared/Styles/Controls/GradientPickerButton.axaml @@ -1,15 +1,13 @@  - + - @@ -31,14 +29,14 @@ - + Padding="0 0 12 0" + CornerRadius="{TemplateBinding CornerRadius}" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" + HorizontalContentAlignment="Stretch" + VerticalContentAlignment="Stretch"> - + diff --git a/src/Artemis.UI.Shared/Styles/TreeView.axaml b/src/Artemis.UI.Shared/Styles/TreeView.axaml index feaf8b6a6..1543c0ef6 100644 --- a/src/Artemis.UI.Shared/Styles/TreeView.axaml +++ b/src/Artemis.UI.Shared/Styles/TreeView.axaml @@ -1,15 +1,15 @@  - + Test - + - + @@ -21,7 +21,7 @@ - + Test @@ -32,17 +32,17 @@ - + - + + + + - - - - - - - - + + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj index 96d6d57fb..9d6fc1088 100644 --- a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj +++ b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj @@ -21,18 +21,18 @@ - - + + - - - + + + - - + + diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index e2619345d..799eb4dff 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -15,28 +15,28 @@ - - - - - + + + + + - - - + + + - - + + - - + + - + diff --git a/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs b/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs index 940527c75..bd3845bfa 100644 --- a/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs +++ b/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs @@ -106,7 +106,7 @@ public class SimpleContextDragBehavior : Behavior PointerPointProperties properties = e.GetCurrentPoint(AssociatedObject).Properties; if (!properties.IsLeftButtonPressed || FocusManager.Instance?.Current is TextBox) return; - if (e.Source is not IControl control || AssociatedObject?.DataContext != control.DataContext) + if (e.Source is not Control control || AssociatedObject?.DataContext != control.DataContext) return; _dragStartPoint = e.GetPosition(null); diff --git a/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs b/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs index d06518912..912803902 100644 --- a/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs +++ b/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs @@ -2,7 +2,6 @@ using System.Collections; using Avalonia; using Avalonia.Controls; -using Avalonia.Controls.Generators; using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Interactivity; @@ -14,7 +13,7 @@ namespace Artemis.UI.Behaviors; /// /// -public class TreeItemDragBehavior : Behavior +public class TreeItemDragBehavior : Behavior { /// /// @@ -31,7 +30,7 @@ public class TreeItemDragBehavior : Behavior public static readonly StyledProperty VerticalDragThresholdProperty = AvaloniaProperty.Register(nameof(VerticalDragThreshold), 3); - private IControl? _draggedContainer; + private Control? _draggedContainer; private int _draggedIndex; private bool _dragStarted; private bool _enableDrag; @@ -69,12 +68,12 @@ public class TreeItemDragBehavior : Behavior { base.OnAttached(); - if (AssociatedObject is { }) + if (AssociatedObject is not null) { - AssociatedObject.AddHandler(InputElement.PointerReleasedEvent, Released, RoutingStrategies.Tunnel); - AssociatedObject.AddHandler(InputElement.PointerPressedEvent, Pressed, RoutingStrategies.Tunnel); - AssociatedObject.AddHandler(InputElement.PointerMovedEvent, Moved, RoutingStrategies.Tunnel); - AssociatedObject.AddHandler(InputElement.PointerCaptureLostEvent, CaptureLost, RoutingStrategies.Tunnel); + AssociatedObject.AddHandler(InputElement.PointerReleasedEvent, ReleasedHandler, RoutingStrategies.Tunnel); + AssociatedObject.AddHandler(InputElement.PointerPressedEvent, PressedHandler, RoutingStrategies.Tunnel); + AssociatedObject.AddHandler(InputElement.PointerMovedEvent, MovedHandler, RoutingStrategies.Tunnel); + AssociatedObject.AddHandler(InputElement.PointerCaptureLostEvent, CaptureLostHandler, RoutingStrategies.Tunnel); } } @@ -84,16 +83,16 @@ public class TreeItemDragBehavior : Behavior { base.OnDetaching(); - if (AssociatedObject is { }) + if (AssociatedObject is not null) { - AssociatedObject.RemoveHandler(InputElement.PointerReleasedEvent, Released); - AssociatedObject.RemoveHandler(InputElement.PointerPressedEvent, Pressed); - AssociatedObject.RemoveHandler(InputElement.PointerMovedEvent, Moved); - AssociatedObject.RemoveHandler(InputElement.PointerCaptureLostEvent, CaptureLost); + AssociatedObject.RemoveHandler(InputElement.PointerReleasedEvent, ReleasedHandler); + AssociatedObject.RemoveHandler(InputElement.PointerPressedEvent, PressedHandler); + AssociatedObject.RemoveHandler(InputElement.PointerMovedEvent, MovedHandler); + AssociatedObject.RemoveHandler(InputElement.PointerCaptureLostEvent, CaptureLostHandler); } } - private void Pressed(object? sender, PointerPressedEventArgs e) + private void PressedHandler(object? sender, PointerPressedEventArgs e) { PointerPointProperties properties = e.GetCurrentPoint(AssociatedObject).Properties; if (properties.IsLeftButtonPressed @@ -101,20 +100,20 @@ public class TreeItemDragBehavior : Behavior { _enableDrag = true; _dragStarted = false; - _start = e.GetPosition(AssociatedObject.Parent); + _start = e.GetPosition(AssociatedObject.Parent as Visual); _draggedIndex = -1; _targetIndex = -1; _itemsControl = itemsControl; _draggedContainer = AssociatedObject; - if (_draggedContainer is { }) + if (_draggedContainer is not null) SetDraggingPseudoClasses(_draggedContainer, true); AddTransforms(_itemsControl); } } - private void Released(object? sender, PointerReleasedEventArgs e) + private void ReleasedHandler(object? sender, PointerReleasedEventArgs e) { if (_dragStarted) { @@ -125,7 +124,7 @@ public class TreeItemDragBehavior : Behavior } } - private void CaptureLost(object? sender, PointerCaptureLostEventArgs e) + private void CaptureLostHandler(object? sender, PointerCaptureLostEventArgs e) { Released(); } @@ -137,19 +136,21 @@ public class TreeItemDragBehavior : Behavior RemoveTransforms(_itemsControl); - if (_itemsControl is { }) - foreach (ItemContainerInfo? container in _itemsControl.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(container.ContainerControl, true); + if (_itemsControl is not null) + { + for (int i = 0; i < _itemsControl.ItemCount; i++) + SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), true); + } if (_dragStarted) if (_draggedIndex >= 0 && _targetIndex >= 0 && _draggedIndex != _targetIndex) MoveDraggedItem(_itemsControl, _draggedIndex, _targetIndex); - if (_itemsControl is { }) - foreach (ItemContainerInfo? container in _itemsControl.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(container.ContainerControl, false); + if (_itemsControl is not null) + for (int i = 0; i < _itemsControl.ItemCount; i++) + SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), false); - if (_draggedContainer is { }) + if (_draggedContainer is not null) SetDraggingPseudoClasses(_draggedContainer, false); _draggedIndex = -1; @@ -170,7 +171,7 @@ public class TreeItemDragBehavior : Behavior foreach (object? _ in itemsControl.Items) { - IControl? container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i); + Control? container = itemsControl.ContainerFromIndex(i); if (container is not null) SetTranslateTransform(container, 0, 0); @@ -187,7 +188,7 @@ public class TreeItemDragBehavior : Behavior foreach (object? _ in itemsControl.Items) { - IControl? container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i); + Control? container = itemsControl.ContainerFromIndex(i); if (container is not null) SetTranslateTransform(container, 0, 0); @@ -208,7 +209,7 @@ public class TreeItemDragBehavior : Behavior selectingItemsControl.SelectedIndex = targetIndex; } - private void Moved(object? sender, PointerEventArgs e) + private void MovedHandler(object? sender, PointerEventArgs e) { PointerPointProperties properties = e.GetCurrentPoint(AssociatedObject).Properties; if (properties.IsLeftButtonPressed) @@ -249,7 +250,7 @@ public class TreeItemDragBehavior : Behavior else SetTranslateTransform(_draggedContainer, 0, delta); - _draggedIndex = _itemsControl.ItemContainerGenerator.IndexFromContainer(_draggedContainer); + _draggedIndex = _itemsControl.IndexFromContainer(_draggedContainer); _targetIndex = -1; Rect draggedBounds = _draggedContainer.Bounds; @@ -268,7 +269,7 @@ public class TreeItemDragBehavior : Behavior foreach (object? _ in _itemsControl.Items) { - IControl? targetContainer = _itemsControl.ItemContainerGenerator.ContainerFromIndex(i); + Control? targetContainer = _itemsControl.ContainerFromIndex(i); if (targetContainer?.RenderTransform is null || ReferenceEquals(targetContainer, _draggedContainer)) { i++; @@ -321,16 +322,20 @@ public class TreeItemDragBehavior : Behavior } } - private void SetDraggingPseudoClasses(IControl control, bool isDragging) + private void SetDraggingPseudoClasses(Control? control, bool isDragging) { + if (control == null) + return; if (isDragging) ((IPseudoClasses) control.Classes).Add(":dragging"); else ((IPseudoClasses) control.Classes).Remove(":dragging"); } - private void SetTranslateTransform(IControl control, double x, double y) + private void SetTranslateTransform(Control? control, double x, double y) { + if (control == null) + return; TransformOperations.Builder transformBuilder = new(1); transformBuilder.AppendTranslate(x, y); control.RenderTransform = transformBuilder.Build(); diff --git a/src/Artemis.UI/Controls/TimelineHeader.cs b/src/Artemis.UI/Controls/TimelineHeader.cs index e0ecc3593..03968b234 100644 --- a/src/Artemis.UI/Controls/TimelineHeader.cs +++ b/src/Artemis.UI/Controls/TimelineHeader.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using Avalonia; using Avalonia.Controls; using Avalonia.Media; @@ -137,47 +138,47 @@ public class TimelineHeader : Control private void RenderLabel(DrawingContext drawingContext, string text, double x) { Typeface typeFace = new(FontFamily); - FormattedText formattedText = new(text, typeFace, 9, TextAlignment.Left, TextWrapping.NoWrap, Bounds.Size); + FormattedText formattedText = new(text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeFace, 9, Foreground); if (x == 0 && OffsetFirstValue) - drawingContext.DrawText(Foreground, new Point(2, 5), formattedText); + drawingContext.DrawText(formattedText, new Point(2, 5)); else - drawingContext.DrawText(Foreground, new Point(x - formattedText.Bounds.Width / 2, 5), formattedText); + drawingContext.DrawText(formattedText, new Point(x - formattedText.Width / 2, 5)); } private void UpdateTimeScale() { - object[] subds; + double[] subds; if (PixelsPerSecond > 350) - subds = new object[] {12d, 12d, 60d}; + subds = new[] {12d, 12d, 60d}; else if (PixelsPerSecond > 250) - subds = new object[] {6d, 12d, 60d}; + subds = new[] {6d, 12d, 60d}; else if (PixelsPerSecond > 200) - subds = new object[] {6d, 6d, 30d}; + subds = new[] {6d, 6d, 30d}; else if (PixelsPerSecond > 150) - subds = new object[] {4d, 4d, 20d}; + subds = new[] {4d, 4d, 20d}; else if (PixelsPerSecond > 140) - subds = new object[] {4d, 4d, 20d}; + subds = new[] {4d, 4d, 20d}; else if (PixelsPerSecond > 90) - subds = new object[] {2d, 4d, 20d}; + subds = new[] {2d, 4d, 20d}; else if (PixelsPerSecond > 60) - subds = new object[] {2d, 4d, 8d}; + subds = new[] {2d, 4d, 8d}; else if (PixelsPerSecond > 40) - subds = new object[] {1d, 2d, 10d}; + subds = new[] {1d, 2d, 10d}; else if (PixelsPerSecond > 30) - subds = new object[] {1d, 2d, 10d}; + subds = new[] {1d, 2d, 10d}; else if (PixelsPerSecond > 10) - subds = new object[] {1d / 2d, 1d / 2d, 1d / 2d}; + subds = new[] {1d / 2d, 1d / 2d, 1d / 2d}; else if (PixelsPerSecond > 4) - subds = new object[] {1d / 5d, 1d / 5d, 1d / 5d}; + subds = new[] {1d / 5d, 1d / 5d, 1d / 5d}; else if (PixelsPerSecond > 3) - subds = new object[] {1d / 10d, 1d / 10d, 1d / 5d}; + subds = new[] {1d / 10d, 1d / 10d, 1d / 5d}; else if (PixelsPerSecond > 1) - subds = new object[] {1d / 20d, 1d / 20d, 1d / 10d}; + subds = new[] {1d / 20d, 1d / 20d, 1d / 10d}; else if (PixelsPerSecond >= 1) - subds = new object[] {1d / 30d, 1d / 30d, 1d / 15d}; + subds = new[] {1d / 30d, 1d / 30d, 1d / 15d}; else // 1s per pixel - subds = new object[] {1d / 60d, 1d / 60d, 1d / 15d}; + subds = new[] {1d / 60d, 1d / 60d, 1d / 15d}; _subd1 = (double) subds[0]; // big ticks / labels _subd2 = (double) subds[1]; // medium ticks diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs index 624ba9770..bc6e253bb 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class BoolPropertyInputView : ReactiveUserControl +public partial class BoolPropertyInputView : ReactiveUserControl { public BoolPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml.cs index 636515d99..8e9b25b32 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class BrushPropertyInputView : ReactiveUserControl +public partial class BrushPropertyInputView : ReactiveUserControl { public BrushPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputViewModel.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputViewModel.cs index 8f9ae6277..92321d8a0 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputViewModel.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.ObjectModel; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.LayerBrushes; @@ -11,7 +12,6 @@ using Artemis.UI.Shared.Services.Builders; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Artemis.UI.Shared.Services.PropertyInput; -using Avalonia.Controls.Mixins; using Avalonia.Threading; using ReactiveUI; diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.axaml.cs index 2288a4821..7d42d2b3e 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class ColorGradientPropertyInputView : ReactiveUserControl +public partial class ColorGradientPropertyInputView : ReactiveUserControl { public ColorGradientPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.axaml.cs index 60eab4443..321d65741 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class EnumPropertyInputView : ReactiveUserControl +public partial class EnumPropertyInputView : ReactiveUserControl { public EnumPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.axaml.cs index 631a05329..4ad37019d 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class FloatPropertyInputView : ReactiveUserControl +public partial class FloatPropertyInputView : ReactiveUserControl { public FloatPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.axaml.cs index a297da606..4ff901f9d 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class FloatRangePropertyInputView : ReactiveUserControl +public partial class FloatRangePropertyInputView : ReactiveUserControl { public FloatRangePropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.axaml.cs index e1afcd555..686ba8f13 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class IntPropertyInputView : ReactiveUserControl +public partial class IntPropertyInputView : ReactiveUserControl { public IntPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.axaml.cs index 6aff0155f..4ba0cbebd 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class IntRangePropertyInputView : ReactiveUserControl +public partial class IntRangePropertyInputView : ReactiveUserControl { public IntRangePropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml.cs index 50b3c150e..5e1300687 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using FluentAvalonia.UI.Controls; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class SKColorPropertyInputView : ReactiveUserControl +public partial class SKColorPropertyInputView : ReactiveUserControl { public SKColorPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.axaml.cs index 4cfeefd97..ab1664aa5 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class SKPointPropertyInputView : ReactiveUserControl +public partial class SKPointPropertyInputView : ReactiveUserControl { public SKPointPropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.axaml.cs index 9773b8daa..c118405bc 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class SKSizePropertyInputView : ReactiveUserControl +public partial class SKSizePropertyInputView : ReactiveUserControl { public SKSizePropertyInputView() { diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs index 53d0c00b0..9e5f365fe 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.DefaultTypes.PropertyInput; -public class StringPropertyInputView : ReactiveUserControl +public partial class StringPropertyInputView : ReactiveUserControl { public StringPropertyInputView() { diff --git a/src/Artemis.UI/MainWindow.axaml.cs b/src/Artemis.UI/MainWindow.axaml.cs index 336bfb46a..a8a49b6b2 100644 --- a/src/Artemis.UI/MainWindow.axaml.cs +++ b/src/Artemis.UI/MainWindow.axaml.cs @@ -13,7 +13,7 @@ using ReactiveUI; namespace Artemis.UI; -public class MainWindow : ReactiveCoreWindow +public class MainWindow : ReactiveAppWindow { private readonly Panel _rootPanel; private readonly ContentControl _sidebarContentControl; diff --git a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs index ed16843c9..37f190fff 100644 --- a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs @@ -10,7 +10,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Debugger; -public class DebugView : ReactiveCoreWindow +public class DebugView : ReactiveAppWindow { public DebugView() { diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs index a67e142e5..a26b2a9c9 100644 --- a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs @@ -7,7 +7,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Device; -public class DevicePropertiesView : ReactiveCoreWindow +public class DevicePropertiesView : ReactiveAppWindow { public DevicePropertiesView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs index 0ab658d66..626105c3e 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs @@ -8,7 +8,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginSettingsWindowView : ReactiveCoreWindow +public class PluginSettingsWindowView : ReactiveAppWindow { public PluginSettingsWindowView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs index 4bb0db390..e3454e44e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs; -public class LayerHintsDialogView : ReactiveCoreWindow +public class LayerHintsDialogView : ReactiveAppWindow { public LayerHintsDialogView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs index 5c6049bf7..8df8901f9 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows; -public class BrushConfigurationWindowView : ReactiveCoreWindow +public class BrushConfigurationWindowView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs index dc9cfb0cd..0fc36eefd 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows; -public class EffectConfigurationWindowView : ReactiveCoreWindow +public class EffectConfigurationWindowView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs index 706a9a5b5..fc6a8787b 100644 --- a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Scripting; -public class ScriptsDialogView : ReactiveCoreWindow +public class ScriptsDialogView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs index 1ad04cdd4..14d01bd26 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs @@ -8,7 +8,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class ProfileConfigurationEditView : ReactiveCoreWindow +public class ProfileConfigurationEditView : ReactiveAppWindow { public ProfileConfigurationEditView() { diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs index 82229ac93..6e74c706e 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs @@ -11,7 +11,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.StartupWizard; -public class StartupWizardView : ReactiveCoreWindow +public class StartupWizardView : ReactiveAppWindow { private readonly Frame _frame; diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs index 1c58fe868..43e3736d0 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.VisualScripting; -public class NodeScriptWindowView : ReactiveCoreWindow +public class NodeScriptWindowView : ReactiveAppWindow { public NodeScriptWindowView() { diff --git a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj index ac5bb81ea..fedc59d0a 100644 --- a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj +++ b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj @@ -8,14 +8,14 @@ - - - + + + - - - + + + From d171b947b7da77ece4c623b3a81917a24a1cbf1b Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 30 Mar 2023 23:13:39 +0200 Subject: [PATCH 02/18] Fixed compile errors in Artemis.UI --- src/Artemis.Core/MVVM/CorePropertyChanged.cs | 2 +- .../Plugins/Settings/PluginSetting.cs | 6 +- .../VisualScripting/NodeScript.cs | 2 +- .../Controls/DeviceVisualizer.cs | 2 +- .../Controls/DraggableNumberBox.axaml.cs | 18 ++-- .../Behaviors/TreeItemDragBehavior.cs | 52 ++++-------- src/Artemis.UI/DryIoc/ContainerExtensions.cs | 2 - .../Screens/Debugger/DebugView.axaml | 5 +- .../Screens/Debugger/DebugView.axaml.cs | 2 +- .../DataModel/DataModelDebugView.axaml.cs | 2 +- .../Debugger/Tabs/Logs/LogsDebugView.axaml | 2 +- .../Debugger/Tabs/Logs/LogsDebugView.axaml.cs | 26 ++---- .../PerformanceDebugPluginView.axaml.cs | 2 +- .../PerformanceDebugProfilerView.axaml.cs | 2 +- .../Performance/PerformanceDebugView.axaml.cs | 2 +- .../Tabs/Render/RenderDebugView.axaml.cs | 2 +- .../Tabs/Settings/DebugSettingsView.axaml.cs | 2 +- .../Device/DeviceDetectInputView.axaml.cs | 2 +- .../Screens/Device/DevicePropertiesView.axaml | 11 ++- .../Device/DevicePropertiesView.axaml.cs | 2 +- .../Screens/Device/DeviceSettingsView.axaml | 8 +- .../Device/DeviceSettingsView.axaml.cs | 2 +- .../Device/Tabs/DeviceInfoTabView.axaml.cs | 2 +- .../Device/Tabs/DeviceLedsTabView.axaml.cs | 2 +- .../DeviceLogicalLayoutDialogView.axaml.cs | 8 +- .../DevicePhysicalLayoutDialogView.axaml.cs | 2 +- .../Tabs/DevicePropertiesTabView.axaml.cs | 2 +- .../Device/Tabs/InputMappingsTabView.axaml.cs | 2 +- src/Artemis.UI/Screens/Home/HomeView.axaml.cs | 2 +- ...ginPrerequisitesInstallDialogView.axaml.cs | 2 +- ...uginPrerequisitesInstallDialogViewModel.cs | 3 +- ...nPrerequisitesUninstallDialogView.axaml.cs | 2 +- ...inPrerequisitesUninstallDialogViewModel.cs | 3 +- .../Plugins/PluginFeatureView.axaml.cs | 2 +- .../Plugins/PluginPlatformView.axaml.cs | 2 +- .../PluginPrerequisiteActionView.axaml.cs | 2 +- .../Plugins/PluginPrerequisiteView.axaml.cs | 2 +- .../Plugins/PluginSettingsView.axaml.cs | 2 +- .../Plugins/PluginSettingsWindowView.axaml | 32 +++---- .../Plugins/PluginSettingsWindowView.axaml.cs | 2 +- .../Screens/Plugins/PluginView.axaml | 8 +- .../Screens/Plugins/PluginView.axaml.cs | 7 +- .../AlwaysOnConditionView.axaml.cs | 2 +- .../EventConditionView.axaml.cs | 2 +- .../ConditionTypes/EventConditionViewModel.cs | 2 +- .../PlayOnceConditionView.axaml.cs | 2 +- .../StaticConditionView.axaml.cs | 2 +- .../DisplayConditionScriptView.axaml.cs | 2 +- .../DisplayConditionScriptViewModel.cs | 2 +- .../Panels/MenuBar/MenuBarView.axaml.cs | 2 +- .../Panels/Playback/PlaybackView.axaml.cs | 2 +- .../Behaviors/ProfileTreeViewDropHandler.cs | 20 ++--- .../CategoryAdaptionHintView.axaml.cs | 2 +- .../DeviceAdaptionHintView.axaml.cs | 2 +- .../KeyboardSectionAdaptionHintView.axaml.cs | 2 +- .../Dialogs/LayerHintsDialogView.axaml | 13 +-- .../Dialogs/LayerHintsDialogView.axaml.cs | 2 +- .../Dialogs/LayerHintsDialogViewModel.cs | 2 +- .../ProfileTree/FolderTreeItemView.axaml.cs | 6 +- .../ProfileTree/LayerTreeItemView.axaml.cs | 6 +- .../ProfileTree/ProfileTreeView.axaml.cs | 8 +- .../DataBinding/DataBindingView.axaml.cs | 2 +- .../Properties/Dialogs/AddEffectView.axaml.cs | 2 +- .../Dialogs/TimelineSegmentEditView.axaml.cs | 2 +- .../Panels/Properties/PropertiesView.axaml.cs | 18 ++-- .../Keyframes/TimelineEasingView.axaml.cs | 2 +- .../Keyframes/TimelineKeyframeView.axaml.cs | 2 +- .../Keyframes/TimelineKeyframeViewModel.cs | 2 +- .../Timeline/Segments/EndSegmentView.axaml.cs | 10 +-- .../Timeline/Segments/EndSegmentViewModel.cs | 2 +- .../Segments/MainSegmentView.axaml.cs | 10 +-- .../Timeline/Segments/MainSegmentViewModel.cs | 2 +- .../Segments/StartSegmentView.axaml.cs | 10 +-- .../Segments/StartSegmentViewModel.cs | 1 + .../Segments/TimelineSegmentViewModel.cs | 1 + .../Timeline/TimelineGroupView.axaml.cs | 2 +- .../Timeline/TimelineGroupViewModel.cs | 2 +- .../Timeline/TimelinePropertyView.axaml.cs | 2 +- .../Timeline/TimelinePropertyViewModel.cs | 2 +- .../Properties/Timeline/TimelineView.axaml.cs | 11 ++- .../Properties/Timeline/TimelineViewModel.cs | 2 +- .../LayerEffectRenameView.axaml.cs | 7 +- .../Dialogs/LayerBrushPresetView.axaml.cs | 2 +- .../Properties/Tree/TreeGroupView.axaml.cs | 2 +- .../Properties/Tree/TreePropertyView.axaml.cs | 7 +- .../Properties/Tree/TreePropertyViewModel.cs | 2 +- .../BrushConfigurationWindowView.axaml | 6 +- .../BrushConfigurationWindowView.axaml.cs | 2 +- .../EffectConfigurationWindowView.axaml | 6 +- .../EffectConfigurationWindowView.axaml.cs | 2 +- .../Panels/StatusBar/StatusBarView.axaml.cs | 2 +- .../Panels/StatusBar/StatusBarViewModel.cs | 2 +- .../Tools/SelectionAddToolView.axaml.cs | 2 +- .../Tools/SelectionAddToolViewModel.cs | 2 +- .../Tools/SelectionRemoveToolView.axaml.cs | 2 +- .../Tools/SelectionRemoveToolViewModel.cs | 2 +- .../Tools/TransformToolView.axaml.cs | 85 +++++++------------ .../Tools/TransformToolViewModel.cs | 2 +- .../VisualEditor/VisualEditorView.axaml.cs | 25 +++--- .../LayerShapeVisualizerView.axaml.cs | 17 ++-- .../LayerShapeVisualizerViewModel.cs | 2 +- .../Visualizers/LayerVisualizerView.axaml.cs | 6 +- .../Visualizers/LayerVisualizerViewModel.cs | 2 +- .../ProfileEditorTitleBarView.axaml.cs | 6 +- .../ProfileEditor/ProfileEditorView.axaml.cs | 6 +- .../Screens/Root/DefaultTitleBarView.axaml.cs | 2 +- src/Artemis.UI/Screens/Root/RootView.axaml.cs | 2 +- .../Screens/Root/SplashView.axaml.cs | 2 +- .../ScriptConfigurationCreateView.axaml.cs | 2 +- .../ScriptConfigurationEditView.axaml.cs | 9 +- .../Screens/Scripting/ScriptsDialogView.axaml | 6 +- .../Scripting/ScriptsDialogView.axaml.cs | 2 +- .../Screens/Settings/SettingsView.axaml.cs | 2 +- .../Settings/Tabs/AboutTabView.axaml.cs | 2 +- .../Settings/Tabs/DevicesTabView.axaml.cs | 2 +- .../Settings/Tabs/GeneralTabView.axaml.cs | 2 +- .../Settings/Tabs/PluginsTabView.axaml.cs | 2 +- .../Settings/Tabs/PluginsTabViewModel.cs | 1 + .../Settings/Tabs/ReleasesTabView.axaml.cs | 2 +- .../Settings/Tabs/ReleasesTabViewModel.cs | 2 +- .../Settings/Updating/ReleaseView.axaml.cs | 2 +- .../ProfileConfigurationDropHandler.cs | 29 ++++--- .../SidebarCategoryEditView.axaml.cs | 2 +- .../ModuleActivationRequirementView.axaml.cs | 2 +- .../ModuleActivationRequirementsView.axaml.cs | 2 +- .../ProfileConfigurationEditView.axaml | 7 +- .../ProfileConfigurationEditView.axaml.cs | 4 +- .../Screens/Sidebar/SidebarCategoryView.axaml | 3 +- .../Sidebar/SidebarCategoryView.axaml.cs | 7 +- .../SidebarProfileConfigurationView.axaml.cs | 2 +- .../Sidebar/SidebarScreenView.axaml.cs | 2 +- .../Screens/Sidebar/SidebarView.axaml.cs | 2 +- .../Screens/Sidebar/SidebarViewModel.cs | 2 +- .../StartupWizard/StartupWizardView.axaml.cs | 16 ++-- .../StartupWizard/Steps/DevicesStep.axaml.cs | 2 +- .../StartupWizard/Steps/FinishStep.axaml.cs | 2 +- .../StartupWizard/Steps/LayoutStep.axaml.cs | 2 +- .../StartupWizard/Steps/SettingsStep.axaml.cs | 2 +- .../StartupWizard/Steps/WelcomeStep.axaml.cs | 2 +- .../SurfaceEditor/ListDeviceView.axaml.cs | 2 +- .../SurfaceEditor/SurfaceDeviceView.axaml.cs | 2 +- .../SurfaceEditor/SurfaceEditorView.axaml.cs | 29 ++----- .../Screens/VisualScripting/CableView.axaml | 4 +- .../VisualScripting/CableView.axaml.cs | 23 +++-- .../VisualScripting/DragCableView.axaml.cs | 12 +-- .../VisualScripting/NodePickerView.axaml | 18 ++-- .../VisualScripting/NodePickerView.axaml.cs | 5 +- .../VisualScripting/NodeScriptView.axaml.cs | 62 ++++++-------- .../VisualScripting/NodeScriptViewModel.cs | 2 +- .../NodeScriptWindowView.axaml | 5 +- .../NodeScriptWindowView.axaml.cs | 2 +- .../Screens/VisualScripting/NodeView.axaml.cs | 2 +- .../Screens/VisualScripting/NodeViewModel.cs | 2 +- .../Pins/InputPinCollectionView.axaml.cs | 2 +- .../Pins/InputPinView.axaml.cs | 2 +- .../Pins/OutputPinCollectionView.axaml.cs | 2 +- .../Pins/OutputPinView.axaml.cs | 2 +- .../Pins/PinCollectionViewModel.cs | 2 +- .../VisualScripting/Pins/PinViewModel.cs | 2 +- .../Screens/Workshop/WorkshopView.axaml.cs | 2 +- 160 files changed, 407 insertions(+), 521 deletions(-) diff --git a/src/Artemis.Core/MVVM/CorePropertyChanged.cs b/src/Artemis.Core/MVVM/CorePropertyChanged.cs index 5e7b6b417..507d09a52 100644 --- a/src/Artemis.Core/MVVM/CorePropertyChanged.cs +++ b/src/Artemis.Core/MVVM/CorePropertyChanged.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; -using Artemis.Core.Properties; +using JetBrains.Annotations; namespace Artemis.Core; diff --git a/src/Artemis.Core/Plugins/Settings/PluginSetting.cs b/src/Artemis.Core/Plugins/Settings/PluginSetting.cs index a29022959..cd94e48d6 100644 --- a/src/Artemis.Core/Plugins/Settings/PluginSetting.cs +++ b/src/Artemis.Core/Plugins/Settings/PluginSetting.cs @@ -1,6 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; -using Artemis.Core.Properties; using Artemis.Storage.Entities.Plugins; using Artemis.Storage.Repositories.Interfaces; using Newtonsoft.Json; @@ -36,9 +34,7 @@ public class PluginSetting : CorePropertyChanged, IPluginSetting /// /// The value of the setting /// - [AllowNull] - [CanBeNull] - public T Value + public T? Value { get => _value; set diff --git a/src/Artemis.Core/VisualScripting/NodeScript.cs b/src/Artemis.Core/VisualScripting/NodeScript.cs index 7a02555ac..7672f3504 100644 --- a/src/Artemis.Core/VisualScripting/NodeScript.cs +++ b/src/Artemis.Core/VisualScripting/NodeScript.cs @@ -4,8 +4,8 @@ using System.Collections.ObjectModel; using System.Linq; using Artemis.Core.Events; using Artemis.Core.Internal; -using Artemis.Core.Properties; using Artemis.Storage.Entities.Profile.Nodes; +using JetBrains.Annotations; namespace Artemis.Core; diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index 72189df57..b751bc6cb 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -122,7 +122,7 @@ public class DeviceVisualizer : Control private Rect MeasureDevice() { if (Device == null) - return new Rect(0, 0, 0, 0); + return new Rect(); Rect deviceRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height); Geometry geometry = new RectangleGeometry(deviceRect); diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs index cec9f62bb..d2737744f 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs @@ -56,7 +56,6 @@ public partial class DraggableNumberBox : UserControl /// public static readonly StyledProperty SuffixProperty = AvaloniaProperty.Register(nameof(Suffix)); - private readonly NumberBox _numberBox; private TextBox? _inputTextBox; private double _lastX; private bool _moved; @@ -69,8 +68,7 @@ public partial class DraggableNumberBox : UserControl public DraggableNumberBox() { InitializeComponent(); - _numberBox = this.Get("NumberBox"); - _numberBox.Value = Value; + NumberBox.Value = Value; PointerPressed += OnPointerPressed; PointerMoved += OnPointerMoved; @@ -167,11 +165,11 @@ public partial class DraggableNumberBox : UserControl private void SetNumberBoxValue(double value) { - if (!(Math.Abs(_numberBox.Value - Value) > 0.00001)) + if (!(Math.Abs(NumberBox.Value - Value) > 0.00001)) return; _updating = true; - _numberBox.Value = Value; + NumberBox.Value = Value; _updating = false; } @@ -189,7 +187,7 @@ public partial class DraggableNumberBox : UserControl private void OnPointerPressed(object? sender, PointerPressedEventArgs e) { PointerPoint point = e.GetCurrentPoint(this); - _inputTextBox = _numberBox.FindDescendantOfType(); + _inputTextBox = NumberBox.FindDescendantOfType(); _moved = false; _startX = point.Position.X; _lastX = point.Position.X; @@ -261,17 +259,17 @@ public partial class DraggableNumberBox : UserControl if (args.NewValue < Minimum) { - _numberBox.Value = Minimum; + NumberBox.Value = Minimum; return; } if (args.NewValue > Maximum) { - _numberBox.Value = Maximum; + NumberBox.Value = Maximum; return; } - if (Math.Abs(Value - _numberBox.Value) > 0.00001) - Value = _numberBox.Value; + if (Math.Abs(Value - NumberBox.Value) > 0.00001) + Value = NumberBox.Value; } } \ No newline at end of file diff --git a/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs b/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs index 912803902..3276d8d17 100644 --- a/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs +++ b/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs @@ -138,8 +138,8 @@ public class TreeItemDragBehavior : Behavior if (_itemsControl is not null) { - for (int i = 0; i < _itemsControl.ItemCount; i++) - SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), true); + foreach (Control realizedContainer in _itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(realizedContainer, true); } if (_dragStarted) @@ -147,8 +147,10 @@ public class TreeItemDragBehavior : Behavior MoveDraggedItem(_itemsControl, _draggedIndex, _targetIndex); if (_itemsControl is not null) - for (int i = 0; i < _itemsControl.ItemCount; i++) - SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), false); + { + foreach (Control realizedContainer in _itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(realizedContainer, false); + } if (_draggedContainer is not null) SetDraggingPseudoClasses(_draggedContainer, false); @@ -166,17 +168,9 @@ public class TreeItemDragBehavior : Behavior { if (itemsControl?.Items is null) return; - - int i = 0; - - foreach (object? _ in itemsControl.Items) - { - Control? container = itemsControl.ContainerFromIndex(i); - if (container is not null) - SetTranslateTransform(container, 0, 0); - - i++; - } + + foreach (Control container in itemsControl.GetRealizedContainers()) + SetTranslateTransform(container, 0, 0); } private void RemoveTransforms(ItemsControl? itemsControl) @@ -184,16 +178,8 @@ public class TreeItemDragBehavior : Behavior if (itemsControl?.Items is null) return; - int i = 0; - - foreach (object? _ in itemsControl.Items) - { - Control? container = itemsControl.ContainerFromIndex(i); - if (container is not null) - SetTranslateTransform(container, 0, 0); - - i++; - } + foreach (Control container in itemsControl.GetRealizedContainers()) + SetTranslateTransform(container, 0, 0); } private void MoveDraggedItem(ItemsControl? itemsControl, int draggedIndex, int targetIndex) @@ -264,17 +250,11 @@ public class TreeItemDragBehavior : Behavior double draggedDeltaEnd = orientation == Orientation.Horizontal ? draggedBounds.X + delta + draggedBounds.Width : draggedBounds.Y + delta + draggedBounds.Height; - - int i = 0; - - foreach (object? _ in _itemsControl.Items) + + foreach (Control targetContainer in _itemsControl.GetRealizedContainers()) { - Control? targetContainer = _itemsControl.ContainerFromIndex(i); - if (targetContainer?.RenderTransform is null || ReferenceEquals(targetContainer, _draggedContainer)) - { - i++; + if (targetContainer.RenderTransform is null || ReferenceEquals(targetContainer, _draggedContainer)) continue; - } // If the target container has children, there are two options // Move into the top of the container @@ -287,7 +267,7 @@ public class TreeItemDragBehavior : Behavior ? targetBounds.X + targetBounds.Width / 2 : targetBounds.Y + targetBounds.Height / 2; - int targetIndex = _itemsControl.ItemContainerGenerator.IndexFromContainer(targetContainer); + int targetIndex = _itemsControl.IndexFromContainer(targetContainer); if (targetStart > draggedStart && draggedDeltaEnd >= targetMid) { @@ -316,8 +296,6 @@ public class TreeItemDragBehavior : Behavior else SetTranslateTransform(targetContainer, 0, 0); } - - i++; } } } diff --git a/src/Artemis.UI/DryIoc/ContainerExtensions.cs b/src/Artemis.UI/DryIoc/ContainerExtensions.cs index 9a4095b20..9d63bb539 100644 --- a/src/Artemis.UI/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI/DryIoc/ContainerExtensions.cs @@ -1,7 +1,6 @@ using System.Reflection; using Artemis.UI.DryIoc.Factories; using Artemis.UI.DryIoc.InstanceProviders; -using Artemis.UI.Screens; using Artemis.UI.Screens.VisualScripting; using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Updating; @@ -9,7 +8,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.ProfileEditor; using Avalonia.Platform; -using Avalonia.Shared.PlatformSupport; using DryIoc; namespace Artemis.UI.DryIoc; diff --git a/src/Artemis.UI/Screens/Debugger/DebugView.axaml b/src/Artemis.UI/Screens/Debugger/DebugView.axaml index 6387ce994..2bc369cab 100644 --- a/src/Artemis.UI/Screens/Debugger/DebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/DebugView.axaml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs index 37f190fff..b201fca80 100644 --- a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs @@ -10,7 +10,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Debugger; -public class DebugView : ReactiveAppWindow +public partial class DebugView : ReactiveAppWindow { public DebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs index 0e304fc6e..11ae2e1e1 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.DataModel; -public class DataModelDebugView : ReactiveUserControl +public partial class DataModelDebugView : ReactiveUserControl { public DataModelDebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml index db82a857f..bffe6621c 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml @@ -8,7 +8,7 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.Debugger.Logs.LogsDebugView" x:DataType="logs:LogsDebugViewModel"> - +public partial class LogsDebugView : ReactiveUserControl { private int _lineCount; - private TextEditor? _textEditor; public LogsDebugView() { @@ -25,25 +18,22 @@ public class LogsDebugView : ReactiveUserControl private void InitializeComponent() { AvaloniaXamlLoader.Load(this); - _textEditor = this.FindControl("log"); } protected override void OnInitialized() { base.OnInitialized(); - Dispatcher.UIThread.Post(() => _textEditor?.ScrollToEnd(), DispatcherPriority.ApplicationIdle); + Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); } private void OnTextChanged(object? sender, EventArgs e) { - if (_textEditor is null) - return; - if (_textEditor.ExtentHeight == 0) + if (LogTextEditor.ExtentHeight == 0) return; - int linesAdded = _textEditor.LineCount - _lineCount; - double lineHeight = _textEditor.ExtentHeight / _textEditor.LineCount; - double outOfScreenTextHeight = _textEditor.ExtentHeight - _textEditor.VerticalOffset - _textEditor.ViewportHeight; + int linesAdded = LogTextEditor.LineCount - _lineCount; + double lineHeight = LogTextEditor.ExtentHeight / LogTextEditor.LineCount; + double outOfScreenTextHeight = LogTextEditor.ExtentHeight - LogTextEditor.VerticalOffset - LogTextEditor.ViewportHeight; double outOfScreenLines = outOfScreenTextHeight / lineHeight; //we need this help distance because of rounding. @@ -61,8 +51,8 @@ public class LogsDebugView : ReactiveUserControl //mess with anything. if (_lineCount == 0 || linesAdded + GRACE_DISTANCE > outOfScreenLines) { - Dispatcher.UIThread.Post(() => _textEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); - _lineCount = _textEditor.LineCount; + Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); + _lineCount = LogTextEditor.LineCount; } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs index bbf87d5e8..230f1b7bb 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Debugger.Performance; -public class PerformanceDebugPluginView : UserControl +public partial class PerformanceDebugPluginView : UserControl { public PerformanceDebugPluginView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs index d94cb0ea3..2f0e76a86 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Debugger.Performance; -public class PerformanceDebugProfilerView : UserControl +public partial class PerformanceDebugProfilerView : UserControl { public PerformanceDebugProfilerView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs index 572e1b766..9f5da4e78 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.Performance; -public class PerformanceDebugView : ReactiveUserControl +public partial class PerformanceDebugView : ReactiveUserControl { public PerformanceDebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs index 0029dbaa5..90cebc19c 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.Render; -public class RenderDebugView : ReactiveUserControl +public partial class RenderDebugView : ReactiveUserControl { public RenderDebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs index c146008aa..e9eddd054 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.Settings; -public class DebugSettingsView : ReactiveUserControl +public partial class DebugSettingsView : ReactiveUserControl { public DebugSettingsView() { diff --git a/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs b/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs index 680126890..d9fdba4a3 100644 --- a/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceDetectInputView : ReactiveUserControl +public partial class DeviceDetectInputView : ReactiveUserControl { public DeviceDetectInputView() { diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml index 4cc1f6a55..e883d00a6 100644 --- a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml +++ b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml @@ -1,10 +1,10 @@ - - + - + @@ -71,5 +71,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs index a26b2a9c9..ace12c0f7 100644 --- a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs @@ -7,7 +7,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Device; -public class DevicePropertiesView : ReactiveAppWindow +public partial class DevicePropertiesView : ReactiveAppWindow { public DevicePropertiesView() { diff --git a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml index 0cd809679..b3f5fe049 100644 --- a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml +++ b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml @@ -36,8 +36,8 @@ - - + + @@ -50,8 +50,8 @@ - - + + diff --git a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs index 50881c918..ee9a638e4 100644 --- a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceSettingsView : ReactiveUserControl +public partial class DeviceSettingsView : ReactiveUserControl { public DeviceSettingsView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs index ce1b36821..069905527 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceInfoTabView : ReactiveUserControl +public partial class DeviceInfoTabView : ReactiveUserControl { public DeviceInfoTabView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs index 540f47f26..79d4a99ac 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceLedsTabView : ReactiveUserControl +public partial class DeviceLedsTabView : ReactiveUserControl { public DeviceLedsTabView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs index 6a7374f55..1c3632b0f 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs @@ -8,17 +8,15 @@ using Avalonia.Threading; namespace Artemis.UI.Screens.Device; -public class DeviceLogicalLayoutDialogView : ReactiveUserControl +public partial class DeviceLogicalLayoutDialogView : ReactiveUserControl { private readonly AutoCompleteBox _autoCompleteBox; public DeviceLogicalLayoutDialogView() { InitializeComponent(); - - _autoCompleteBox = this.Get("RegionsAutoCompleteBox"); - _autoCompleteBox.ItemFilter += SearchRegions; - + + RegionsAutoCompleteBox.ItemFilter += SearchRegions; Dispatcher.UIThread.InvokeAsync(DelayedAutoFocus); } diff --git a/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs index 06de8bbc0..516f68a2f 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DevicePhysicalLayoutDialogView : ReactiveUserControl +public partial class DevicePhysicalLayoutDialogView : ReactiveUserControl { public DevicePhysicalLayoutDialogView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs index 44cb3cf46..aed405ee1 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DevicePropertiesTabView : ReactiveUserControl +public partial class DevicePropertiesTabView : ReactiveUserControl { public DevicePropertiesTabView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs index da7275845..329426b27 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class InputMappingsTabView : ReactiveUserControl +public partial class InputMappingsTabView : ReactiveUserControl { public InputMappingsTabView() { diff --git a/src/Artemis.UI/Screens/Home/HomeView.axaml.cs b/src/Artemis.UI/Screens/Home/HomeView.axaml.cs index 43f3bf653..462c033fe 100644 --- a/src/Artemis.UI/Screens/Home/HomeView.axaml.cs +++ b/src/Artemis.UI/Screens/Home/HomeView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Home; -public class HomeView : ReactiveUserControl +public partial class HomeView : ReactiveUserControl { public HomeView() { diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs index b46a9cd9d..4b8efec20 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisitesInstallDialogView : ReactiveUserControl +public partial class PluginPrerequisitesInstallDialogView : ReactiveUserControl { public PluginPrerequisitesInstallDialogView() { diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs index b2a698040..a8de70fbd 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs @@ -11,6 +11,7 @@ using Artemis.UI.DryIoc.Factories; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Avalonia.Threading; +using FluentAvalonia.Core; using FluentAvalonia.UI.Controls; using ReactiveUI; using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton; @@ -98,7 +99,7 @@ public class PluginPrerequisitesInstallDialogViewModel : ContentDialogViewModelB private async Task ExecuteInstall() { - ContentDialogClosingDeferral? deferral = null; + Deferral? deferral = null; if (ContentDialog != null) ContentDialog.Closing += (_, args) => deferral = args.GetDeferral(); diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs index ee9196f83..83ede62ab 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisitesUninstallDialogView : ReactiveUserControl +public partial class PluginPrerequisitesUninstallDialogView : ReactiveUserControl { public PluginPrerequisitesUninstallDialogView() { diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs index 5bbd3e44d..b65e72d23 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs @@ -12,6 +12,7 @@ using Artemis.UI.DryIoc.Factories; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Avalonia.Threading; +using FluentAvalonia.Core; using FluentAvalonia.UI.Controls; using ReactiveUI; using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton; @@ -83,7 +84,7 @@ public class PluginPrerequisitesUninstallDialogViewModel : ContentDialogViewMode private async Task ExecuteUninstall() { - ContentDialogClosingDeferral? deferral = null; + Deferral? deferral = null; if (ContentDialog != null) ContentDialog.Closing += (_, args) => deferral = args.GetDeferral(); diff --git a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs index 3b8f761eb..5f032736e 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginFeatureView : ReactiveUserControl +public partial class PluginFeatureView : ReactiveUserControl { public PluginFeatureView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs index 20e155f36..fe8bbc354 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Plugins; -public class PluginPlatformView : UserControl +public partial class PluginPlatformView : UserControl { public PluginPlatformView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs index e8a86a27e..1d52f9350 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisiteActionView : UserControl +public partial class PluginPrerequisiteActionView : UserControl { public PluginPrerequisiteActionView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs index 3ba622127..dd0d0f3e6 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisiteView : ReactiveUserControl +public partial class PluginPrerequisiteView : ReactiveUserControl { public PluginPrerequisiteView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs index 7f0608689..47c7d5b99 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginSettingsView : ReactiveUserControl +public partial class PluginSettingsView : ReactiveUserControl { public PluginSettingsView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml index f653027b5..12dd5b763 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml @@ -1,17 +1,17 @@ - - + + - - - + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs index 626105c3e..8b1bf702f 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs @@ -8,7 +8,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginSettingsWindowView : ReactiveAppWindow +public partial class PluginSettingsWindowView : ReactiveAppWindow { public PluginSettingsWindowView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginView.axaml b/src/Artemis.UI/Screens/Plugins/PluginView.axaml index b16c1fd06..27c47a631 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginView.axaml @@ -47,8 +47,8 @@ - - + + @@ -81,8 +81,8 @@ - - + + +public partial class PluginView : ReactiveUserControl { - private readonly CheckBox _enabledToggle; - public PluginView() { InitializeComponent(); - _enabledToggle = this.Find("EnabledToggle"); - _enabledToggle.Click += EnabledToggleOnClick; + EnabledToggle.Click += EnabledToggleOnClick; } private void InitializeComponent() diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs index 99520854f..d9875515d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class AlwaysOnConditionView : UserControl +public partial class AlwaysOnConditionView : UserControl { public AlwaysOnConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs index b9bfdfd71..c4a74eed0 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class EventConditionView : ReactiveUserControl +public partial class EventConditionView : ReactiveUserControl { public EventConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs index 7333571c8..fbd8eea25 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs @@ -1,4 +1,5 @@ using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; @@ -8,7 +9,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs index 39b606054..8e756172c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class PlayOnceConditionView : UserControl +public partial class PlayOnceConditionView : UserControl { public PlayOnceConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs index 83855685c..fe6a7262f 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class StaticConditionView : ReactiveUserControl +public partial class StaticConditionView : ReactiveUserControl { public StaticConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs index 730ad046a..fbd7e2c41 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition; -public class DisplayConditionScriptView : ReactiveUserControl +public partial class DisplayConditionScriptView : ReactiveUserControl { public DisplayConditionScriptView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs index 87b0a3104..edc771a93 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs @@ -1,12 +1,12 @@ using System.Collections.ObjectModel; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.DryIoc.Factories; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs index eedb4560a..f60548ce3 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.MenuBar; -public class MenuBarView : ReactiveUserControl +public partial class MenuBarView : ReactiveUserControl { public MenuBarView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs index d94c76117..0c3cec9a2 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Playback; -public class PlaybackView : ReactiveUserControl +public partial class PlaybackView : ReactiveUserControl { public PlaybackView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs index 79c456926..740da8dc6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs @@ -15,7 +15,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase { public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { - if (e.Source is IControl && sender is TreeView treeView) + if (e.Source is Control && sender is TreeView treeView) return Validate(treeView, e, sourceContext, targetContext, false); return false; @@ -24,7 +24,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { bool result = false; - if (e.Source is IControl && sender is TreeView treeView) + if (e.Source is Control && sender is TreeView treeView) result = Validate(treeView, e, sourceContext, targetContext, true); if (sender is ItemsControl itemsControl) @@ -46,8 +46,8 @@ public class ProfileTreeViewDropHandler : DropHandlerBase private bool Validate(TreeView treeView, DragEventArgs e, object? sourceContext, object? targetContext, bool bExecute) where T : TreeItemViewModel { Point position = e.GetPosition(treeView); - IVisual? targetVisual = treeView.GetVisualAt(position).FindAncestorOfType(); - if (sourceContext is not T sourceNode || targetContext is not ProfileTreeViewModel vm || targetVisual is not IControl {DataContext: T targetNode}) + TreeViewItem? targetVisual = treeView.GetVisualAt(position).FindAncestorOfType(); + if (sourceContext is not T sourceNode || targetContext is not ProfileTreeViewModel vm || targetVisual is not Control {DataContext: T targetNode}) return false; if (bExecute && targetNode == sourceNode) return false; @@ -69,7 +69,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase } else { - IVisual? header = targetVisual.GetVisualDescendants().FirstOrDefault(d => d is Border b && b.Name == "PART_LayoutRoot"); + Visual? header = targetVisual.GetVisualDescendants().FirstOrDefault(d => d is Border b && b.Name == "PART_LayoutRoot"); if (header != null) { position = e.GetPosition(header); @@ -119,7 +119,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase } else { - SetDraggingPseudoClasses((IControl) targetVisual, dropType); + SetDraggingPseudoClasses(targetVisual, dropType); } return true; @@ -129,12 +129,12 @@ public class ProfileTreeViewDropHandler : DropHandlerBase { List result = new(); - foreach (ItemContainerInfo containerInfo in currentNode.ItemContainerGenerator.Containers) + foreach (Control containerControl in currentNode.GetRealizedContainers()) { - if (containerInfo.ContainerControl is TreeViewItem treeViewItem && containerInfo.Item is TreeItemViewModel) + if (containerControl is TreeViewItem treeViewItem && containerControl.DataContext is TreeItemViewModel) { result.Add(treeViewItem); - if (treeViewItem.ItemContainerGenerator.Containers.Any()) + if (treeViewItem.ItemCount > 0) result.AddRange(GetFlattenedTreeView(treeViewItem)); } } @@ -142,7 +142,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase return result; } - private void SetDraggingPseudoClasses(IControl control, TreeDropType type) + private void SetDraggingPseudoClasses(TreeViewItem control, TreeDropType type) { if (type == TreeDropType.None) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs index 884346e0b..bb65355de 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; -public class CategoryAdaptionHintView : UserControl +public partial class CategoryAdaptionHintView : UserControl { public CategoryAdaptionHintView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs index f2ec263d3..68ab025ba 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; -public class DeviceAdaptionHintView : UserControl +public partial class DeviceAdaptionHintView : UserControl { public DeviceAdaptionHintView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs index 1fcb02a6d..e7db0abdd 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; -public class KeyboardSectionAdaptionHintView : UserControl +public partial class KeyboardSectionAdaptionHintView : UserControl { public KeyboardSectionAdaptionHintView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml index 50afd41b8..1ff26bba4 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml @@ -1,10 +1,11 @@ - - - + + @@ -87,12 +88,12 @@ - + Add hint - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs index e3454e44e..a406a063c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs; -public class LayerHintsDialogView : ReactiveAppWindow +public partial class LayerHintsDialogView : ReactiveAppWindow { public LayerHintsDialogView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs index bb33b620b..41514aa0e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs @@ -1,13 +1,13 @@ using System; using System.Collections.ObjectModel; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.DryIoc.Factories; using Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; using Artemis.UI.Shared; -using Avalonia.Controls.Mixins; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs index 43f36534b..5fed64811 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs @@ -9,7 +9,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree; -public class FolderTreeItemView : ReactiveUserControl +public partial class FolderTreeItemView : ReactiveUserControl { public FolderTreeItemView() { @@ -18,8 +18,8 @@ public class FolderTreeItemView : ReactiveUserControl { ViewModel?.Rename.Subscribe(_ => { - this.Get("Input").Focus(); - this.Get("Input").SelectAll(); + Input.Focus(); + Input.SelectAll(); }).DisposeWith(d); }); } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs index e34cef5cb..c912738fb 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs @@ -9,7 +9,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree; -public class LayerTreeItemView : ReactiveUserControl +public partial class LayerTreeItemView : ReactiveUserControl { public LayerTreeItemView() { @@ -18,8 +18,8 @@ public class LayerTreeItemView : ReactiveUserControl { ViewModel?.Rename.Subscribe(_ => { - this.Get("Input").Focus(); - this.Get("Input").SelectAll(); + Input.Focus(); + Input.SelectAll(); }).DisposeWith(d); }); } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs index d519466b3..101a9dd1f 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs @@ -13,9 +13,8 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree; -public class ProfileTreeView : ReactiveUserControl +public partial class ProfileTreeView : ReactiveUserControl { - private readonly TreeView _treeView; private Image? _dragAdorner; private Point _dragStartPosition; private Point _elementDragOffset; @@ -23,11 +22,10 @@ public class ProfileTreeView : ReactiveUserControl public ProfileTreeView() { InitializeComponent(); - _treeView = this.Get("ProfileTreeView"); AddHandler(DragDrop.DragEnterEvent, HandleDragEnterEvent, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); AddHandler(DragDrop.DragOverEvent, HandleDragOver, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - AddHandler(PointerEnterEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + AddHandler(PointerEnteredEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); } private void HandlePointerEnter(object? sender, PointerEventArgs e) @@ -122,6 +120,6 @@ public class ProfileTreeView : ReactiveUserControl private void ProfileTreeView_OnSelectionChanged(object? sender, SelectionChangedEventArgs e) { - _treeView.Focus(); + ProfileTreeView.Focus(); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs index d38d4272f..2888b4271 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.DataBinding; -public class DataBindingView : ReactiveUserControl +public partial class DataBindingView : ReactiveUserControl { public DataBindingView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs index 77b18f314..40782dd0d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Dialogs; -public class AddEffectView : ReactiveUserControl +public partial class AddEffectView : ReactiveUserControl { public AddEffectView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs index fb0f6d893..72e19028c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Dialogs; -public class TimelineSegmentEditView : ReactiveUserControl +public partial class TimelineSegmentEditView : ReactiveUserControl { public TimelineSegmentEditView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs index 602eb1424..e2a45f734 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Avalonia.Controls; -using Avalonia.Controls.Shapes; +using Avalonia; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; @@ -10,16 +9,11 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.Properties; -public class PropertiesView : ReactiveUserControl +public partial class PropertiesView : ReactiveUserControl { - private readonly Polygon _timelineCaret; - private readonly Line _timelineLine; - public PropertiesView() { InitializeComponent(); - _timelineCaret = this.Get("TimelineCaret"); - _timelineLine = this.Get("TimelineLine"); } private void InitializeComponent() @@ -58,12 +52,12 @@ public class PropertiesView : ReactiveUserControl if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed || ViewModel == null) return; - IInputElement? senderElement = (IInputElement?) sender; + Visual? senderElement = (Visual?) sender; if (senderElement == null) return; // Get the parent grid, need that for our position - IVisual? parent = senderElement.VisualParent; + Visual? parent = senderElement.GetVisualParent(); double x = Math.Max(0, e.GetPosition(parent).X); TimeSpan newTime = TimeSpan.FromSeconds(x / ViewModel.PixelsPerSecond); newTime = RoundTime(newTime); @@ -84,11 +78,11 @@ public class PropertiesView : ReactiveUserControl private void TimelineHeader_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || sender is not IInputElement senderElement) + if (ViewModel == null || sender is not Visual senderElement) return; // Get the parent grid, need that for our position - double x = Math.Max(0, e.GetPosition(senderElement.VisualParent).X); + double x = Math.Max(0, e.GetPosition(senderElement.GetVisualParent()).X); TimeSpan newTime = TimeSpan.FromSeconds(x / ViewModel.PixelsPerSecond); ViewModel.TimelineViewModel.ChangeTime(RoundTime(newTime)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs index fa1d2f160..3f44be6ea 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes; -public class TimelineEasingView : UserControl +public partial class TimelineEasingView : UserControl { public TimelineEasingView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs index ea1a6c5ff..307b8bc43 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes; -public class TimelineKeyframeView : ReactiveUserControl +public partial class TimelineKeyframeView : ReactiveUserControl { private bool _moved; private TimelinePropertyView? _timelinePropertyView; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs index 0f5b9607c..712db5216 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; @@ -13,7 +14,6 @@ using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Input; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs index 17ec9c101..b298d9315 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs @@ -6,15 +6,13 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; -public class EndSegmentView : ReactiveUserControl +public partial class EndSegmentView : ReactiveUserControl { - private readonly Rectangle _keyframeDragAnchor; private double _dragOffset; public EndSegmentView() { InitializeComponent(); - _keyframeDragAnchor = this.Get("KeyframeDragAnchor"); } private void InitializeComponent() @@ -26,7 +24,7 @@ public class EndSegmentView : ReactiveUserControl { if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; - e.Pointer.Capture(_keyframeDragAnchor); + e.Pointer.Capture(KeyframeDragAnchor); _dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X; ViewModel.StartResize(); @@ -34,14 +32,14 @@ public class EndSegmentView : ReactiveUserControl private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; e.Pointer.Capture(null); ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs index 7e10e7999..1d556bb59 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs @@ -1,10 +1,10 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs index 8c09b98dc..6ec76a3b7 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs @@ -6,15 +6,13 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; -public class MainSegmentView : ReactiveUserControl +public partial class MainSegmentView : ReactiveUserControl { - private readonly Rectangle _keyframeDragAnchor; private double _dragOffset; public MainSegmentView() { InitializeComponent(); - _keyframeDragAnchor = this.Get("KeyframeDragAnchor"); } private void InitializeComponent() @@ -26,7 +24,7 @@ public class MainSegmentView : ReactiveUserControl { if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; - e.Pointer.Capture(_keyframeDragAnchor); + e.Pointer.Capture(KeyframeDragAnchor); _dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X; ViewModel.StartResize(); @@ -34,14 +32,14 @@ public class MainSegmentView : ReactiveUserControl private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; e.Pointer.Capture(null); ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs index 15ebb371c..a122bbb56 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs @@ -1,10 +1,10 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs index 9876e5c6c..37c6b24fa 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs @@ -6,15 +6,13 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; -public class StartSegmentView : ReactiveUserControl +public partial class StartSegmentView : ReactiveUserControl { - private readonly Rectangle _keyframeDragAnchor; private double _dragOffset; public StartSegmentView() { InitializeComponent(); - _keyframeDragAnchor = this.Get("KeyframeDragAnchor"); } private void InitializeComponent() @@ -26,7 +24,7 @@ public class StartSegmentView : ReactiveUserControl { if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; - e.Pointer.Capture(_keyframeDragAnchor); + e.Pointer.Capture(KeyframeDragAnchor); _dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X; ViewModel.StartResize(); @@ -34,14 +32,14 @@ public class StartSegmentView : ReactiveUserControl private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; e.Pointer.Capture(null); ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs index fcff6ebc4..de289fb17 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs @@ -1,4 +1,5 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs index b2d7687f4..f5e39b592 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs index 8999b791a..233cb59ce 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; -public class TimelineGroupView : ReactiveUserControl +public partial class TimelineGroupView : ReactiveUserControl { public TimelineGroupView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs index 5370999e3..620be7f41 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs @@ -1,8 +1,8 @@ using System; using System.Collections.ObjectModel; +using System.Reactive.Disposables; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Controls.Mixins; using DynamicData; using DynamicData.Binding; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs index 082ad8d15..e025639d6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; -public class TimelinePropertyView : ReactiveUserControl +public partial class TimelinePropertyView : ReactiveUserControl { public TimelinePropertyView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs index 211c91130..4ae156667 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs @@ -2,12 +2,12 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Controls.Mixins; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs index 9b1d11f85..37cf942b9 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs @@ -9,17 +9,15 @@ using Avalonia.Controls; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; +using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; -public class TimelineView : ReactiveUserControl +public partial class TimelineView : ReactiveUserControl { - private readonly SelectionRectangle _selectionRectangle; - public TimelineView() { InitializeComponent(); - _selectionRectangle = this.Get("SelectionRectangle"); } private void InitializeComponent() @@ -34,7 +32,8 @@ public class TimelineView : ReactiveUserControl List keyframeViews = this.GetVisualChildrenOfType().Where(k => { - Rect hitTestRect = k.TransformedBounds != null ? k.TransformedBounds.Value.Bounds.TransformToAABB(k.TransformedBounds.Value.Transform) : Rect.Empty; + TransformedBounds? transformedBounds = k.GetTransformedBounds(); + Rect hitTestRect = transformedBounds != null ? transformedBounds.Value.Bounds.TransformToAABB(transformedBounds.Value.Transform) : new Rect(); return e.AbsoluteRectangle.Intersects(hitTestRect); }).ToList(); @@ -43,7 +42,7 @@ public class TimelineView : ReactiveUserControl private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (_selectionRectangle.IsSelecting) + if (SelectionRectangle.IsSelecting) return; ViewModel?.SelectKeyframes(new List(), false); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs index cc7e0dd4d..ec06ddc2b 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; @@ -14,7 +15,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Avalonia; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs index 425743459..8b8cb3d54 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using Artemis.UI.Shared.Extensions; -using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using Avalonia.Threading; @@ -8,7 +7,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree.ContentDialogs; -public class LayerEffectRenameView : ReactiveUserControl +public partial class LayerEffectRenameView : ReactiveUserControl { public LayerEffectRenameView() { @@ -24,8 +23,8 @@ public class LayerEffectRenameView : ReactiveUserControl("NameTextBox").SelectAll(); - this.Get("NameTextBox").Focus(); + NameTextBox.SelectAll(); + NameTextBox.Focus(); } private void InitializeComponent() diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs index 50927e5d5..7792b8bba 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree.Dialogs; -public class LayerBrushPresetView : ReactiveUserControl +public partial class LayerBrushPresetView : ReactiveUserControl { public LayerBrushPresetView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs index 2e6219049..645d52262 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree; -public class TreeGroupView : ReactiveUserControl +public partial class TreeGroupView : ReactiveUserControl { public TreeGroupView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs index 4e0354fcf..ce31aec8d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs @@ -1,9 +1,8 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Avalonia.Controls; -using Avalonia.Controls.Mixins; -using Avalonia.Controls.Primitives; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; @@ -11,7 +10,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree; -public class TreePropertyView : ReactiveUserControl +public partial class TreePropertyView : ReactiveUserControl { public TreePropertyView() { @@ -32,6 +31,6 @@ public class TreePropertyView : ReactiveUserControl private void DataBindingToggleButton_OnClick(object? sender, RoutedEventArgs e) { ViewModel?.ToggleCurrentLayerProperty(); - this.Find("DataBindingToggleButton").IsChecked = !this.Find("DataBindingToggleButton").IsChecked; + DataBindingToggleButton.IsChecked = !DataBindingToggleButton.IsChecked; } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs index 983c476ab..ecceb942b 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs @@ -1,5 +1,6 @@ using System; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Extensions; @@ -7,7 +8,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Artemis.UI.Shared.Services.PropertyInput; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml index 863c6d768..9395cb9a5 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml @@ -1,8 +1,8 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs index 8df8901f9..d01dc274c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows; -public class BrushConfigurationWindowView : ReactiveAppWindow +public partial class BrushConfigurationWindowView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml index 6e6289fd7..a6ef2ccd7 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml @@ -1,8 +1,8 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs index 0fc36eefd..ddee1ec69 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows; -public class EffectConfigurationWindowView : ReactiveAppWindow +public partial class EffectConfigurationWindowView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs index 7ada29b7d..c5a82ff9c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.StatusBar; -public class StatusBarView : ReactiveUserControl +public partial class StatusBarView : ReactiveUserControl { public StatusBarView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs index 341aef64c..73327e70a 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs @@ -1,9 +1,9 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.StatusBar; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs index b8938f4f5..77d850ec2 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.Skia; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools; -public class SelectionAddToolView : ReactiveUserControl +public partial class SelectionAddToolView : ReactiveUserControl { public SelectionAddToolView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs index 72da9f522..b1bdf7297 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using Material.Icons; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs index 4a618dd3f..1b14d986c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Skia; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools; -public class SelectionRemoveToolView : ReactiveUserControl +public partial class SelectionRemoveToolView : ReactiveUserControl { public SelectionRemoveToolView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs index 7fde8511e..2c7d0a995 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using Material.Icons; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs index 26bf273cc..eede83c42 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Disposables; using Artemis.Core; using Artemis.UI.Shared.Extensions; using Avalonia; @@ -21,19 +22,9 @@ using SkiaSharp; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools; -public class TransformToolView : ReactiveUserControl +public partial class TransformToolView : ReactiveUserControl { - private readonly Grid _handleGrid; private readonly List _handles = new(); - private readonly Panel _resizeBottomCenter; - private readonly Panel _resizeBottomLeft; - private readonly Panel _resizeBottomRight; - private readonly Panel _resizeLeftCenter; - private readonly Panel _resizeRightCenter; - private readonly Panel _resizeTopCenter; - private readonly Panel _resizeTopLeft; - private readonly Panel _resizeTopRight; - private SKPoint _dragOffset; private ZoomBorder? _zoomBorder; @@ -41,31 +32,21 @@ public class TransformToolView : ReactiveUserControl { InitializeComponent(); - _handleGrid = this.Get("HandleGrid"); + _handles.Add(RotateTopLeft); + _handles.Add(RotateTopRight); + _handles.Add(RotateBottomRight); + _handles.Add(RotateBottomLeft); - _handles.Add(this.Get("RotateTopLeft")); - _handles.Add(this.Get("RotateTopRight")); - _handles.Add(this.Get("RotateBottomRight")); - _handles.Add(this.Get("RotateBottomLeft")); + _handles.Add(ResizeTopCenter); + _handles.Add(ResizeRightCenter); + _handles.Add(ResizeBottomCenter); + _handles.Add(ResizeLeftCenter); + _handles.Add(ResizeTopLeft); + _handles.Add(ResizeTopRight); + _handles.Add(ResizeBottomRight); + _handles.Add(ResizeBottomLeft); - _resizeTopCenter = this.Get("ResizeTopCenter"); - _handles.Add(_resizeTopCenter); - _resizeRightCenter = this.Get("ResizeRightCenter"); - _handles.Add(_resizeRightCenter); - _resizeBottomCenter = this.Get("ResizeBottomCenter"); - _handles.Add(_resizeBottomCenter); - _resizeLeftCenter = this.Get("ResizeLeftCenter"); - _handles.Add(_resizeLeftCenter); - _resizeTopLeft = this.Get("ResizeTopLeft"); - _handles.Add(_resizeTopLeft); - _resizeTopRight = this.Get("ResizeTopRight"); - _handles.Add(_resizeTopRight); - _resizeBottomRight = this.Get("ResizeBottomRight"); - _handles.Add(_resizeBottomRight); - _resizeBottomLeft = this.Get("ResizeBottomLeft"); - _handles.Add(_resizeBottomLeft); - - _handles.Add(this.Get("AnchorPoint")); + _handles.Add(AnchorPoint); this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.Rotation).Subscribe(_ => UpdateTransforms()).DisposeWith(d)); } @@ -83,10 +64,10 @@ public class TransformToolView : ReactiveUserControl RotateTransform counterRotate = new(ViewModel.Rotation * -1); // Apply the counter rotation to the containers - foreach (Panel panel in _handleGrid.Children.Where(c => c is Panel and not Canvas).Cast()) + foreach (Panel panel in HandleGrid.Children.Where(c => c is Panel and not Canvas).Cast()) panel.RenderTransform = counterRotate; - foreach (Control control in _handleGrid.GetVisualDescendants().Where(d => d is Control c && c.Classes.Contains("unscaled")).Cast()) + foreach (Control control in HandleGrid.GetVisualDescendants().Where(d => d is Control c && c.Classes.Contains("unscaled")).Cast()) control.RenderTransform = counterScale; } @@ -117,21 +98,21 @@ public class TransformToolView : ReactiveUserControl private TransformToolViewModel.ResizeSide GetResizeDirection(Ellipse element) { - if (ReferenceEquals(element.Parent, _resizeTopLeft)) + if (ReferenceEquals(element.Parent, ResizeTopLeft)) return TransformToolViewModel.ResizeSide.Top | TransformToolViewModel.ResizeSide.Left; - if (ReferenceEquals(element.Parent, _resizeTopRight)) + if (ReferenceEquals(element.Parent, ResizeTopRight)) return TransformToolViewModel.ResizeSide.Top | TransformToolViewModel.ResizeSide.Right; - if (ReferenceEquals(element.Parent, _resizeBottomRight)) + if (ReferenceEquals(element.Parent, ResizeBottomRight)) return TransformToolViewModel.ResizeSide.Bottom | TransformToolViewModel.ResizeSide.Right; - if (ReferenceEquals(element.Parent, _resizeBottomLeft)) + if (ReferenceEquals(element.Parent, ResizeBottomLeft)) return TransformToolViewModel.ResizeSide.Bottom | TransformToolViewModel.ResizeSide.Left; - if (ReferenceEquals(element.Parent, _resizeTopCenter)) + if (ReferenceEquals(element.Parent, ResizeTopCenter)) return TransformToolViewModel.ResizeSide.Top; - if (ReferenceEquals(element.Parent, _resizeRightCenter)) + if (ReferenceEquals(element.Parent, ResizeRightCenter)) return TransformToolViewModel.ResizeSide.Right; - if (ReferenceEquals(element.Parent, _resizeBottomCenter)) + if (ReferenceEquals(element.Parent, ResizeBottomCenter)) return TransformToolViewModel.ResizeSide.Bottom; - if (ReferenceEquals(element.Parent, _resizeLeftCenter)) + if (ReferenceEquals(element.Parent, ResizeLeftCenter)) return TransformToolViewModel.ResizeSide.Left; throw new ArgumentException("Given element is not a child of a resize container"); @@ -310,14 +291,14 @@ public class TransformToolView : ReactiveUserControl private void UpdateCursors() { - _resizeTopCenter.Cursor = GetCursorAtAngle(0f); - _resizeTopRight.Cursor = GetCursorAtAngle(45f); - _resizeRightCenter.Cursor = GetCursorAtAngle(90f); - _resizeBottomRight.Cursor = GetCursorAtAngle(135f); - _resizeBottomCenter.Cursor = GetCursorAtAngle(180f); - _resizeBottomLeft.Cursor = GetCursorAtAngle(225f); - _resizeLeftCenter.Cursor = GetCursorAtAngle(270f); - _resizeTopLeft.Cursor = GetCursorAtAngle(315f); + ResizeTopCenter.Cursor = GetCursorAtAngle(0f); + ResizeTopRight.Cursor = GetCursorAtAngle(45f); + ResizeRightCenter.Cursor = GetCursorAtAngle(90f); + ResizeBottomRight.Cursor = GetCursorAtAngle(135f); + ResizeBottomCenter.Cursor = GetCursorAtAngle(180f); + ResizeBottomLeft.Cursor = GetCursorAtAngle(225f); + ResizeLeftCenter.Cursor = GetCursorAtAngle(270f); + ResizeTopLeft.Cursor = GetCursorAtAngle(315f); } private Cursor GetCursorAtAngle(float angle, bool includeLayerRotation = true) diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs index b5f737603..7475f15eb 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs @@ -1,5 +1,6 @@ using System; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Exceptions; @@ -7,7 +8,6 @@ using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Material.Icons; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs index 28696008f..78c76513a 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs @@ -2,7 +2,6 @@ using System; using System.Linq; using System.Reactive.Disposables; using Avalonia; -using Avalonia.Controls; using Avalonia.Controls.PanAndZoom; using Avalonia.Input; using Avalonia.Markup.Xaml; @@ -13,19 +12,17 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor; -public class VisualEditorView : ReactiveUserControl +public partial class VisualEditorView : ReactiveUserControl { - private readonly ZoomBorder _zoomBorder; private bool _movedByUser; public VisualEditorView() { InitializeComponent(); - - _zoomBorder = this.Find("ZoomBorder"); - _zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; - _zoomBorder.PointerMoved += ZoomBorderOnPointerMoved; - _zoomBorder.PointerWheelChanged += ZoomBorderOnPointerWheelChanged; + + ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + ZoomBorder.PointerMoved += ZoomBorderOnPointerMoved; + ZoomBorder.PointerWheelChanged += ZoomBorderOnPointerWheelChanged; UpdateZoomBorderBackground(); this.WhenActivated(d => @@ -48,7 +45,7 @@ public class VisualEditorView : ReactiveUserControl private void ZoomBorderOnPointerMoved(object? sender, PointerEventArgs e) { - if (e.GetCurrentPoint(_zoomBorder).Properties.IsMiddleButtonPressed) + if (e.GetCurrentPoint(ZoomBorder).Properties.IsMiddleButtonPressed) _movedByUser = true; } @@ -59,14 +56,14 @@ public class VisualEditorView : ReactiveUserControl private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property.Name == nameof(_zoomBorder.Background)) + if (e.Property.Name == nameof(ZoomBorder.Background)) UpdateZoomBorderBackground(); } private void UpdateZoomBorderBackground() { - if (_zoomBorder.Background is VisualBrush visualBrush) - visualBrush.DestinationRect = new RelativeRect(_zoomBorder.OffsetX * -1, _zoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); + if (ZoomBorder.Background is VisualBrush visualBrush) + visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } private void InitializeComponent() @@ -96,8 +93,8 @@ public class VisualEditorView : ReactiveUserControl double scale = Math.Min(3, Math.Min(Bounds.Width / scriptRect.Width, Bounds.Height / scriptRect.Height)); // Pan and zoom to make the script fit - _zoomBorder.Zoom(scale, 0, 0, skipTransitions); - _zoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); + ZoomBorder.Zoom(scale, 0, 0, skipTransitions); + ZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); _movedByUser = false; } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs index 3c35220b9..95cc4eca6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs @@ -1,8 +1,8 @@ using System; using System.Linq; +using System.Reactive.Disposables; using Avalonia; using Avalonia.Controls; -using Avalonia.Controls.Mixins; using Avalonia.Controls.PanAndZoom; using Avalonia.Controls.Shapes; using Avalonia.LogicalTree; @@ -12,18 +12,13 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Visualizers; -public class LayerShapeVisualizerView : ReactiveUserControl +public partial class LayerShapeVisualizerView : ReactiveUserControl { - private readonly Path _layerVisualizer; - private readonly Path _layerVisualizerUnbound; private ZoomBorder? _zoomBorder; public LayerShapeVisualizerView() { InitializeComponent(); - _layerVisualizer = this.Get("LayerVisualizer"); - _layerVisualizerUnbound = this.Get("LayerVisualizerUnbound"); - this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.Selected).Subscribe(_ => UpdateStrokeThickness()).DisposeWith(d)); } @@ -66,13 +61,13 @@ public class LayerShapeVisualizerView : ReactiveUserControl +public partial class LayerVisualizerView : ReactiveUserControl { - private readonly Path _layerVisualizer; private ZoomBorder? _zoomBorder; public LayerVisualizerView() { InitializeComponent(); - _layerVisualizer = this.Get("LayerVisualizer"); } private void InitializeComponent() @@ -49,7 +47,7 @@ public class LayerVisualizerView : ReactiveUserControl { if (e.Property != ZoomBorder.ZoomXProperty || _zoomBorder == null) return; - _layerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX); + LayerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX); } #endregion diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs index 60203a62f..fd6044730 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs @@ -1,11 +1,11 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared; using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Avalonia; -using Avalonia.Controls.Mixins; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs index 9ac61e1f6..54e33fa6e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor; -public class ProfileEditorTitleBarView : UserControl +public partial class ProfileEditorTitleBarView : UserControl { public ProfileEditorTitleBarView() { @@ -15,8 +15,4 @@ public class ProfileEditorTitleBarView : UserControl { AvaloniaXamlLoader.Load(this); } - - private void MenuItem_OnSubmenuOpened(object? sender, RoutedEventArgs e) - { - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs index e745f4d2f..ecdc2dfb8 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor; -public class ProfileEditorView : ReactiveUserControl +public partial class ProfileEditorView : ReactiveUserControl { public ProfileEditorView() { @@ -27,8 +27,4 @@ public class ProfileEditorView : ReactiveUserControl { AvaloniaXamlLoader.Load(this); } - - private void MenuItem_OnSubmenuOpened(object? sender, RoutedEventArgs e) - { - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs index a4aa18dfc..30a0f787f 100644 --- a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs +++ b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Root; -public class DefaultTitleBarView : UserControl +public partial class DefaultTitleBarView : UserControl { public DefaultTitleBarView() { diff --git a/src/Artemis.UI/Screens/Root/RootView.axaml.cs b/src/Artemis.UI/Screens/Root/RootView.axaml.cs index a39ad9af7..b0b5cbf2c 100644 --- a/src/Artemis.UI/Screens/Root/RootView.axaml.cs +++ b/src/Artemis.UI/Screens/Root/RootView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Root; -public class RootView : ReactiveUserControl +public partial class RootView : ReactiveUserControl { public RootView() { diff --git a/src/Artemis.UI/Screens/Root/SplashView.axaml.cs b/src/Artemis.UI/Screens/Root/SplashView.axaml.cs index a48cd245f..954265d1d 100644 --- a/src/Artemis.UI/Screens/Root/SplashView.axaml.cs +++ b/src/Artemis.UI/Screens/Root/SplashView.axaml.cs @@ -9,7 +9,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Root; -public class SplashView : ReactiveWindow +public partial class SplashView : ReactiveWindow { public SplashView() { diff --git a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs index 06c18583a..56dc931c5 100644 --- a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Scripting.Dialogs; -public class ScriptConfigurationCreateView : ReactiveUserControl +public partial class ScriptConfigurationCreateView : ReactiveUserControl { public ScriptConfigurationCreateView() { diff --git a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs index df99ad942..291cbaa3b 100644 --- a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs @@ -1,19 +1,18 @@ -using Avalonia.Controls; -using Avalonia.Markup.Xaml; +using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using ReactiveUI; namespace Artemis.UI.Screens.Scripting.Dialogs; -public class ScriptConfigurationEditView : ReactiveUserControl +public partial class ScriptConfigurationEditView : ReactiveUserControl { public ScriptConfigurationEditView() { InitializeComponent(); this.WhenActivated(_ => { - this.Get("Input").Focus(); - this.Get("Input").SelectAll(); + Input.Focus(); + Input.SelectAll(); }); } diff --git a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml index 68975d579..22f4d5c00 100644 --- a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml +++ b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml @@ -1,11 +1,11 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs index fc6a8787b..dd6e5150b 100644 --- a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Scripting; -public class ScriptsDialogView : ReactiveAppWindow +public partial class ScriptsDialogView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs b/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs index f7f6c2781..7d34789ae 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class SettingsView : ReactiveUserControl +public partial class SettingsView : ReactiveUserControl { public SettingsView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs index a06753974..27f8c0075 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class AboutTabView : ReactiveUserControl +public partial class AboutTabView : ReactiveUserControl { public AboutTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs index a1d270474..a5031d9f6 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class DevicesTabView : ReactiveUserControl +public partial class DevicesTabView : ReactiveUserControl { public DevicesTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs index 00ce4e09f..4b1c2b693 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class GeneralTabView : ReactiveUserControl +public partial class GeneralTabView : ReactiveUserControl { public GeneralTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs index 1ac622fc7..b5428a68a 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class PluginsTabView : ReactiveUserControl +public partial class PluginsTabView : ReactiveUserControl { public PluginsTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs index b45ea27cb..d55406113 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs @@ -12,6 +12,7 @@ using Artemis.UI.Screens.Plugins; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; +using Avalonia.ReactiveUI; using Avalonia.Threading; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs index 3421db5a7..7d0304e75 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class ReleasesTabView : ReactiveUserControl +public partial class ReleasesTabView : ReactiveUserControl { public ReleasesTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs index de7f7cdd5..4e8baa0d2 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs @@ -12,7 +12,7 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; using Artemis.WebClient.Updating; -using Avalonia.Threading; +using Avalonia.ReactiveUI; using DynamicData; using DynamicData.Binding; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs index 6bdcd52e7..d4670e37b 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings.Updating; -public class ReleaseView : ReactiveUserControl +public partial class ReleaseView : ReactiveUserControl { public ReleaseView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs b/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs index 815710dca..7d6977eb8 100644 --- a/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs +++ b/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs @@ -12,10 +12,12 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { if (sender is ItemsControl itemsControl) - foreach (ItemContainerInfo? item in itemsControl.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(item.ContainerControl, false, false); + { + foreach (Control container in itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(container, false, false); + } - if (e.Source is IControl && sender is ListBox listBox) + if (e.Source is Control && sender is ListBox listBox) return Validate(listBox, e, sourceContext, targetContext, false); return false; @@ -24,10 +26,12 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { if (sender is ItemsControl itemsControl) - foreach (ItemContainerInfo? item in itemsControl.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(item.ContainerControl, false, false); + { + foreach (Control container in itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(container, false, false); + } - if (e.Source is IControl && sender is ListBox listBox) + if (e.Source is Control && sender is ListBox listBox) return Validate(listBox, e, sourceContext, targetContext, true); return false; @@ -36,7 +40,7 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase private bool Validate(ListBox listBox, DragEventArgs e, object? sourceContext, object? targetContext, bool bExecute) { if (sourceContext is not SidebarProfileConfigurationViewModel sourceItem || targetContext is not SidebarCategoryViewModel vm || - listBox.GetVisualAt(e.GetPosition(listBox)) is not IControl targetControl) + listBox.GetVisualAt(e.GetPosition(listBox)) is not Control targetControl) return false; if (e.DragEffects != DragDropEffects.Move) return false; @@ -55,9 +59,9 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase before = false; } } - - foreach (ItemContainerInfo? item in listBox.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(item.ContainerControl, false, false); + + foreach (Control container in listBox.GetRealizedContainers()) + SetDraggingPseudoClasses(container, false, false); if (bExecute) { @@ -81,8 +85,11 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase return true; } - private void SetDraggingPseudoClasses(IControl control, bool dragging, bool before) + private void SetDraggingPseudoClasses(Control? control, bool dragging, bool before) { + if (control == null) + return; + if (!dragging) { ((IPseudoClasses) control.Classes).Remove(":dragging"); diff --git a/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs index d43ccf664..d29132e7e 100644 --- a/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs @@ -5,7 +5,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class SidebarCategoryEditView : ReactiveUserControl +public partial class SidebarCategoryEditView : ReactiveUserControl { public SidebarCategoryEditView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs index 248296f5d..6e404be76 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class ModuleActivationRequirementView : ReactiveUserControl +public partial class ModuleActivationRequirementView : ReactiveUserControl { public ModuleActivationRequirementView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs index 8ddca2456..7467d8ba9 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Sidebar; -public class ModuleActivationRequirementsView : UserControl +public partial class ModuleActivationRequirementsView : UserControl { public ModuleActivationRequirementsView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml index a127cdc14..bbf4b964b 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs index 14d01bd26..0b134ddc5 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs @@ -8,12 +8,12 @@ using ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class ProfileConfigurationEditView : ReactiveAppWindow +public partial class ProfileConfigurationEditView : ReactiveAppWindow { public ProfileConfigurationEditView() { InitializeComponent(); - this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.SelectedBitmapSource).Subscribe(_ => this.Get("FillPreview").InvalidateVisual()).DisposeWith(d)); + this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.SelectedBitmapSource).Subscribe(_ => FillPreview.InvalidateVisual()).DisposeWith(d)); #if DEBUG this.AttachDevTools(); diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml index e347ebd32..fb725cfb1 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml @@ -5,7 +5,6 @@ xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:local="clr-namespace:Artemis.UI.Screens.Sidebar" xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity" - xmlns:idd="clr-namespace:Avalonia.Xaml.Interactions.DragAndDrop;assembly=Avalonia.Xaml.Interactions" xmlns:sb="clr-namespace:Artemis.UI.Screens.Sidebar.Behaviors" xmlns:converters="clr-namespace:Artemis.UI.Converters" xmlns:b="clr-namespace:Artemis.UI.Behaviors" @@ -93,7 +92,7 @@ - + diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs index 6feeff883..1097b2567 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs @@ -14,21 +14,18 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.Sidebar; -public class SidebarCategoryView : ReactiveUserControl +public partial class SidebarCategoryView : ReactiveUserControl { private static Image? _dragAdorner; private Point _dragStartPosition; private Point _elementDragOffset; - private ListBox _listBox; public SidebarCategoryView() { InitializeComponent(); - _listBox = this.Get("SidebarListBox"); - AddHandler(DragDrop.DragEnterEvent, HandleDragEnterEvent, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); AddHandler(DragDrop.DragOverEvent, HandleDragOver, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - AddHandler(PointerEnterEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + AddHandler(PointerEnteredEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); } private void InitializeComponent() diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs index 005773daf..9222e5a5c 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class SidebarProfileConfigurationView : ReactiveUserControl +public partial class SidebarProfileConfigurationView : ReactiveUserControl { public SidebarProfileConfigurationView() { diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs index 48106762a..ecfe9ddcc 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Sidebar; -public class SidebarScreenView : UserControl +public partial class SidebarScreenView : UserControl { public SidebarScreenView() { diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs index a505680dd..4d3bff167 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class SidebarView : ReactiveUserControl +public partial class SidebarView : ReactiveUserControl { public SidebarView() { diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs index 7e1756384..ca13abff0 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs @@ -17,7 +17,7 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Threading; +using Avalonia.ReactiveUI; using DryIoc; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs index 6e74c706e..a4f4e9c04 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs @@ -11,10 +11,8 @@ using ReactiveUI; namespace Artemis.UI.Screens.StartupWizard; -public class StartupWizardView : ReactiveAppWindow +public partial class StartupWizardView : ReactiveAppWindow { - private readonly Frame _frame; - public StartupWizardView() { InitializeComponent(); @@ -22,8 +20,6 @@ public class StartupWizardView : ReactiveAppWindow this.AttachDevTools(); #endif - _frame = this.Get("Frame"); - this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.CurrentStep).Subscribe(ApplyCurrentStep).DisposeWith(d)); } @@ -35,14 +31,14 @@ public class StartupWizardView : ReactiveAppWindow private void ApplyCurrentStep(int step) { if (step == 1) - _frame.NavigateToType(typeof(WelcomeStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(WelcomeStep), null, new FrameNavigationOptions()); else if (step == 2) - _frame.NavigateToType(typeof(DevicesStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(DevicesStep), null, new FrameNavigationOptions()); else if (step == 3) - _frame.NavigateToType(typeof(LayoutStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(LayoutStep), null, new FrameNavigationOptions()); else if (step == 4) - _frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions()); else if (step == 5) - _frame.NavigateToType(typeof(FinishStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(FinishStep), null, new FrameNavigationOptions()); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs index b043d8950..d385e9452 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class DevicesStep : UserControl +public partial class DevicesStep : UserControl { public DevicesStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs index 0c6b6555b..aed3014f1 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class FinishStep : UserControl +public partial class FinishStep : UserControl { public FinishStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs index a91f5e6db..dae2f4bec 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class LayoutStep : UserControl +public partial class LayoutStep : UserControl { public LayoutStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs index ebd3f5855..343b11526 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class SettingsStep : UserControl +public partial class SettingsStep : UserControl { public SettingsStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs index 1c75395cb..8a2ed216c 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class WelcomeStep : UserControl +public partial class WelcomeStep : UserControl { public WelcomeStep() { diff --git a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs index 8d06e454c..878e3ad91 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.SurfaceEditor; -public class ListDeviceView : UserControl +public partial class ListDeviceView : UserControl { public ListDeviceView() { diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs index 1de325892..ec1653427 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs @@ -7,7 +7,7 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.SurfaceEditor; -public class SurfaceDeviceView : ReactiveUserControl +public partial class SurfaceDeviceView : ReactiveUserControl { private bool _dragging; diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs index e7f12f075..5f46c2860 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs @@ -13,29 +13,18 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.SurfaceEditor; -public class SurfaceEditorView : ReactiveUserControl +public partial class SurfaceEditorView : ReactiveUserControl { - private readonly ItemsControl _deviceContainer; - private readonly SelectionRectangle _selectionRectangle; - private readonly Border _surfaceBounds; - private readonly ZoomBorder _zoomBorder; - public SurfaceEditorView() { InitializeComponent(); - - _zoomBorder = this.Find("ZoomBorder"); - _deviceContainer = this.Find("DeviceContainer"); - _selectionRectangle = this.Find("SelectionRectangle"); - _surfaceBounds = this.Find("SurfaceBounds"); - - _zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; UpdateZoomBorderBackground(); } private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property.Name == nameof(_zoomBorder.Background)) + if (e.Property.Name == nameof(ZoomBorder.Background)) UpdateZoomBorderBackground(); } @@ -47,25 +36,25 @@ public class SurfaceEditorView : ReactiveUserControl private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e) { UpdateZoomBorderBackground(); - _surfaceBounds.BorderThickness = new Thickness(2 / _zoomBorder.ZoomX); + SurfaceBounds.BorderThickness = new Thickness(2 / ZoomBorder.ZoomX); } private void SelectionRectangle_OnSelectionUpdated(object? sender, SelectionRectangleEventArgs e) { - List itemContainerInfos = _deviceContainer.ItemContainerGenerator.Containers.Where(c => c.ContainerControl.Bounds.Intersects(e.Rectangle)).ToList(); - List viewModels = itemContainerInfos.Where(c => c.Item is SurfaceDeviceViewModel).Select(c => (SurfaceDeviceViewModel) c.Item).ToList(); + List containers = DeviceContainer.GetRealizedContainers().Where(c => c.Bounds.Intersects(e.Rectangle)).ToList(); + List viewModels = containers.Where(c => c.DataContext is SurfaceDeviceViewModel).Select(c => (SurfaceDeviceViewModel) c.DataContext!).ToList(); ViewModel?.UpdateSelection(viewModels, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void ZoomBorder_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (!_selectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) + if (!SelectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) ViewModel?.ClearSelection(); } private void UpdateZoomBorderBackground() { - if (_zoomBorder.Background is VisualBrush visualBrush) - visualBrush.DestinationRect = new RelativeRect(_zoomBorder.OffsetX * -1, _zoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); + if (ZoomBorder.Background is VisualBrush visualBrush) + visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml index e18230f6f..30a6a4af5 100644 --- a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml @@ -18,8 +18,8 @@ - + +public partial class CableView : ReactiveUserControl { private const double CABLE_OFFSET = 24 * 4; - private readonly Path _cablePath; - private readonly Border _valueBorder; public CableView() { InitializeComponent(); - _cablePath = this.Get("CablePath"); - _valueBorder = this.Get("ValueBorder"); // Not using bindings here to avoid a warnings this.WhenActivated(d => { - _valueBorder.GetObservable(BoundsProperty).Subscribe(rect => _valueBorder.RenderTransform = new TranslateTransform(rect.Width / 2 * -1, rect.Height / 2 * -1)).DisposeWith(d); + ValueBorder.GetObservable(BoundsProperty).Subscribe(rect => ValueBorder.RenderTransform = new TranslateTransform(rect.Width / 2 * -1, rect.Height / 2 * -1)).DisposeWith(d); ViewModel.WhenAnyValue(vm => vm.FromPoint).Subscribe(_ => Update(true)).DisposeWith(d); ViewModel.WhenAnyValue(vm => vm.ToPoint).Subscribe(_ => Update(false)).DisposeWith(d); @@ -43,21 +40,21 @@ public class CableView : ReactiveUserControl private void Update(bool from) { // Workaround for https://github.com/AvaloniaUI/Avalonia/issues/4748 - _cablePath.Margin = new Thickness(_cablePath.Margin.Left + 1, _cablePath.Margin.Top + 1, 0, 0); - if (_cablePath.Margin.Left > 2) - _cablePath.Margin = new Thickness(0, 0, 0, 0); + CablePath.Margin = new Thickness(CablePath.Margin.Left + 1, CablePath.Margin.Top + 1, 0, 0); + if (CablePath.Margin.Left > 2) + CablePath.Margin = new Thickness(0, 0, 0, 0); - PathFigure pathFigure = ((PathGeometry) _cablePath.Data).Figures.First(); + PathFigure pathFigure = ((PathGeometry) CablePath.Data).Figures.First(); BezierSegment segment = (BezierSegment) pathFigure.Segments!.First(); pathFigure.StartPoint = ViewModel!.FromPoint; segment.Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y); segment.Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y); segment.Point3 = new Point(ViewModel.ToPoint.X, ViewModel.ToPoint.Y); - Canvas.SetLeft(_valueBorder, ViewModel.FromPoint.X + (ViewModel.ToPoint.X - ViewModel.FromPoint.X) / 2); - Canvas.SetTop(_valueBorder, ViewModel.FromPoint.Y + (ViewModel.ToPoint.Y - ViewModel.FromPoint.Y) / 2); + Canvas.SetLeft(ValueBorder, ViewModel.FromPoint.X + (ViewModel.ToPoint.X - ViewModel.FromPoint.X) / 2); + Canvas.SetTop(ValueBorder, ViewModel.FromPoint.Y + (ViewModel.ToPoint.Y - ViewModel.FromPoint.Y) / 2); - _cablePath.InvalidateVisual(); + CablePath.InvalidateVisual(); } private void OnPointerEnter(object? sender, PointerEventArgs e) diff --git a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs index 243576bb9..50bf07f77 100644 --- a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Reactive.Disposables; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Mixins; @@ -11,15 +12,13 @@ using ReactiveUI; namespace Artemis.UI.Screens.VisualScripting; -public class DragCableView : ReactiveUserControl +public partial class DragCableView : ReactiveUserControl { private const double CABLE_OFFSET = 24 * 4; - private readonly Path _cablePath; public DragCableView() { InitializeComponent(); - _cablePath = this.Get("CablePath"); // Not using bindings here to avoid warnings this.WhenActivated(d => @@ -37,8 +36,11 @@ public class DragCableView : ReactiveUserControl private void Update() { - PathFigure pathFigure = ((PathGeometry) _cablePath.Data).Figures.First(); - BezierSegment segment = (BezierSegment) pathFigure.Segments!.First(); + PathFigure? pathFigure = ((PathGeometry) CablePath.Data).Figures?.FirstOrDefault(); + if (pathFigure?.Segments == null) + return; + + BezierSegment segment = (BezierSegment) pathFigure.Segments.First(); pathFigure.StartPoint = ViewModel!.FromPoint; segment.Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y); segment.Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y); diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml index ce5f36c37..73065876d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml @@ -17,15 +17,15 @@ diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs index 82dd2cbb4..7e58be954 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs @@ -1,4 +1,5 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Avalonia; @@ -13,7 +14,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.VisualScripting; -public class NodePickerView : ReactiveUserControl +public partial class NodePickerView : ReactiveUserControl { public NodePickerView() { @@ -21,7 +22,7 @@ public class NodePickerView : ReactiveUserControl this.WhenActivated(d => { ViewModel?.WhenAnyValue(vm => vm.IsVisible).Where(visible => visible == false).Subscribe(_ => this.FindLogicalAncestorOfType()?.ContextFlyout?.Hide()).DisposeWith(d); - this.Get("SearchBox").SelectAll(); + SearchBox.SelectAll(); }); } diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs index 787f3fdca..1a395b871 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs @@ -19,28 +19,19 @@ using ReactiveUI; namespace Artemis.UI.Screens.VisualScripting; -public class NodeScriptView : ReactiveUserControl +public partial class NodeScriptView : ReactiveUserControl { - private readonly Grid _grid; - private readonly ItemsControl _nodesContainer; - private readonly SelectionRectangle _selectionRectangle; - private readonly ZoomBorder _zoomBorder; - public NodeScriptView() { InitializeComponent(); - _grid = this.Find("ContainerGrid"); - _zoomBorder = this.Find("ZoomBorder"); - _nodesContainer = this.Find("NodesContainer"); - _selectionRectangle = this.Find("SelectionRectangle"); - _zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; UpdateZoomBorderBackground(); - _zoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - _zoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - _zoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - + ZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + ZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + ZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + this.WhenActivated(d => { ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested; @@ -65,22 +56,22 @@ public class NodeScriptView : ReactiveUserControl private void ZoomOnPointerWheelChanged(object? sender, PointerWheelEventArgs e) { // If scroll events aren't handled here the ZoomBorder does some random panning when at the zoom limit - if (e.Delta.Y > 0 && _zoomBorder.ZoomX >= 1) + if (e.Delta.Y > 0 && ZoomBorder.ZoomX >= 1) e.Handled = true; } private void ZoomOnPointerMoved(object? sender, PointerEventArgs e) { if (ViewModel != null) - ViewModel.PastePosition = e.GetPosition(_grid); + ViewModel.PastePosition = e.GetPosition(ContainerGrid); } - + private void ShowPickerAt(Point point) { if (ViewModel == null) return; ViewModel.NodePickerViewModel.Position = point; - _zoomBorder?.ContextFlyout?.ShowAt(_zoomBorder, true); + ZoomBorder?.ContextFlyout?.ShowAt(ZoomBorder); } private void AutoFitIfPreview() @@ -91,7 +82,7 @@ public class NodeScriptView : ReactiveUserControl private void BoundsPropertyChanged(AvaloniaPropertyChangedEventArgs obj) { - if (_nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl).Contains(obj.Sender)) + if (NodesContainer.GetRealizedContainers().Contains(obj.Sender)) AutoFitIfPreview(); } @@ -99,18 +90,19 @@ public class NodeScriptView : ReactiveUserControl { // If the flyout handled the click, update the position of the node picker if (e.Handled && ViewModel != null) - ViewModel.NodePickerViewModel.Position = e.GetPosition(_grid); + ViewModel.NodePickerViewModel.Position = e.GetPosition(ContainerGrid); } private void AutoFit(bool skipTransitions) { - if (!_nodesContainer.ItemContainerGenerator.Containers.Any()) + List containers = NodesContainer.GetRealizedContainers().ToList(); + if (!containers.Any()) return; - double left = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Left).Min(); - double top = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Top).Min(); - double bottom = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Bottom).Max(); - double right = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Right).Max(); + double left = containers.Select(c => c.Bounds.Left).Min(); + double top = containers.Select(c => c.Bounds.Top).Min(); + double bottom = containers.Select(c => c.Bounds.Bottom).Max(); + double right = containers.Select(c => c.Bounds.Right).Max(); // Add a 10 pixel margin around the rect Rect scriptRect = new(new Point(left - 10, top - 10), new Point(right + 10, bottom + 10)); @@ -119,8 +111,8 @@ public class NodeScriptView : ReactiveUserControl double scale = Math.Min(1, Math.Min(Bounds.Width / scriptRect.Width, Bounds.Height / scriptRect.Height)); // Pan and zoom to make the script fit - _zoomBorder.Zoom(scale, 0, 0, skipTransitions); - _zoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); + ZoomBorder.Zoom(scale, 0, 0, skipTransitions); + ZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); } private void ViewModelOnAutoFitRequested(object? sender, EventArgs e) @@ -130,14 +122,14 @@ public class NodeScriptView : ReactiveUserControl private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property.Name == nameof(_zoomBorder.Background)) + if (e.Property.Name == nameof(ZoomBorder.Background)) UpdateZoomBorderBackground(); } private void UpdateZoomBorderBackground() { - if (_zoomBorder.Background is VisualBrush visualBrush) - visualBrush.DestinationRect = new RelativeRect(_zoomBorder.OffsetX * -1, _zoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); + if (ZoomBorder.Background is VisualBrush visualBrush) + visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } private void InitializeComponent() @@ -148,14 +140,14 @@ public class NodeScriptView : ReactiveUserControl private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e) { if (ViewModel != null) - ViewModel.PanMatrix = _zoomBorder.Matrix; + ViewModel.PanMatrix = ZoomBorder.Matrix; UpdateZoomBorderBackground(); } private void SelectionRectangle_OnSelectionUpdated(object? sender, SelectionRectangleEventArgs e) { - List itemContainerInfos = _nodesContainer.ItemContainerGenerator.Containers.Where(c => c.ContainerControl.Bounds.Intersects(e.Rectangle)).ToList(); - List nodes = itemContainerInfos.Where(c => c.Item is NodeViewModel).Select(c => (NodeViewModel) c.Item).ToList(); + List itemContainerInfos = NodesContainer.GetRealizedContainers().Where(c => c.Bounds.Intersects(e.Rectangle)).ToList(); + List nodes = itemContainerInfos.Where(c => c.DataContext is NodeViewModel).Select(c => (NodeViewModel) c.DataContext!).ToList(); ViewModel?.UpdateNodeSelection(nodes, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } @@ -166,7 +158,7 @@ public class NodeScriptView : ReactiveUserControl private void ZoomBorder_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (!_selectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) + if (!SelectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) ViewModel?.ClearNodeSelection(); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs index 5628da274..c7d2a8815 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Text; @@ -17,7 +18,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Input; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml index aa862508f..b55439e50 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs index 43e3736d0..a5ad7196d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.VisualScripting; -public class NodeScriptWindowView : ReactiveAppWindow +public partial class NodeScriptWindowView : ReactiveAppWindow { public NodeScriptWindowView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs index 66f1804f3..8d0ba79e3 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs @@ -9,7 +9,7 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.VisualScripting; -public class NodeView : ReactiveUserControl +public partial class NodeView : ReactiveUserControl { private bool _dragging; diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs index 17b73778e..a033a271f 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; @@ -12,7 +13,6 @@ using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Layout; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs index 3f5afccb6..f7f3359c2 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class InputPinCollectionView : ReactiveUserControl +public partial class InputPinCollectionView : ReactiveUserControl { public InputPinCollectionView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs index b8cd39f09..8b5f106b0 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class InputPinView : PinView +public partial class InputPinView : PinView { public InputPinView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs index b3411fe31..bb9a4a73d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class OutputPinCollectionView : ReactiveUserControl +public partial class OutputPinCollectionView : ReactiveUserControl { public OutputPinCollectionView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs index 3f721ddd9..a05817005 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class OutputPinView : PinView +public partial class OutputPinView : PinView { public OutputPinView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs index d6e160dc4..a956380e1 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs @@ -2,13 +2,13 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; -using Avalonia.Controls.Mixins; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs index 37542daca..5a29c6301 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; @@ -10,7 +11,6 @@ using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Media; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs index c60987a56..7f8fac500 100644 --- a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs +++ b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Workshop; -public class WorkshopView : ReactiveUserControl +public partial class WorkshopView : ReactiveUserControl { public WorkshopView() { From 5b5acf2f76356046bbb961b8e988a45fd3acac44 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 31 Mar 2023 20:52:38 +0200 Subject: [PATCH 03/18] Fixed remaining compile errors --- src/Artemis.Core/Artemis.Core.csproj | 2 +- src/Artemis.Core/Constants.cs | 1 - src/Artemis.Core/Events/UpdateEventArgs.cs | 1 - .../WebServer/WebModuleRegistration.cs | 1 - src/Artemis.Storage/Artemis.Storage.csproj | 2 +- src/Artemis.UI.Linux/App.axaml.cs | 2 +- src/Artemis.UI.Linux/Artemis.UI.Linux.csproj | 2 +- src/Artemis.UI.MacOS/App.axaml.cs | 2 +- src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj | 2 +- .../Artemis.UI.Shared.csproj | 4 +- .../Controls/DeviceVisualizer.cs | 2 - .../Controls/EnumComboBox.axaml | 2 +- .../Controls/EnumComboBox.axaml.cs | 2 +- src/Artemis.UI.Shared/ReactiveAppWindow.cs | 32 ++- .../Services/Builders/ContentDialogBuilder.cs | 1 - src/Artemis.UI.Windows/App.axaml.cs | 2 +- .../Artemis.UI.Windows.csproj | 2 +- .../DryIoc/ContainerExtensions.cs | 2 +- .../Properties/launchSettings.json | 2 +- .../Providers/Input/SpongeWindow.cs | 25 --- .../Providers/Input/SpongeWindowEventArgs.cs | 19 -- .../Providers/Input/WindowsInputProvider.cs | 30 ++- .../WindowsUpdateNotificationProvider.cs | 1 - .../SkiaSharp/Vulkan/Win32VkContext.cs | 9 +- src/Artemis.UI/Artemis.UI.csproj | 6 +- src/Artemis.UI/MainWindow.axaml | 5 +- src/Artemis.UI/MainWindow.axaml.cs | 19 +- .../PerformanceDebugProfilerView.axaml | 1 - src/Artemis.UI/Screens/Home/HomeView.axaml | 2 +- .../Plugins/PluginPrerequisiteView.axaml | 2 +- .../Screens/Plugins/PluginView.axaml.cs | 1 - .../Screens/Plugins/PluginViewModel.cs | 1 - .../Behaviors/ProfileTreeViewDropHandler.cs | 1 - .../ProfileTree/FolderTreeItemView.axaml.cs | 1 - .../ProfileTree/LayerTreeItemView.axaml.cs | 1 - .../Panels/ProfileTree/ProfileTreeView.axaml | 14 +- .../ProfileTree/ProfileTreeView.axaml.cs | 2 +- .../Timeline/Segments/EndSegmentView.axaml.cs | 2 - .../Segments/MainSegmentView.axaml.cs | 2 - .../Segments/StartSegmentView.axaml.cs | 2 - .../Segments/StartSegmentViewModel.cs | 1 - .../Segments/TimelineSegmentViewModel.cs | 1 - .../Properties/Timeline/TimelineView.axaml.cs | 2 - .../Tools/TransformToolView.axaml.cs | 1 - .../LayerShapeVisualizerView.axaml.cs | 2 - .../Visualizers/LayerVisualizerView.axaml.cs | 2 - .../ProfileEditorTitleBarView.axaml.cs | 1 - .../ProfileEditor/ProfileEditorView.axaml | 3 +- .../ProfileEditor/ProfileEditorView.axaml.cs | 1 - .../Screens/Settings/Tabs/AboutTabView.axaml | 2 +- .../Settings/Tabs/PluginsTabView.axaml | 2 +- .../Settings/Updating/ReleaseView.axaml | 161 +-------------- .../ProfileConfigurationDropHandler.cs | 1 - .../ProfileConfigurationEditView.axaml.cs | 1 - .../Screens/Sidebar/SidebarView.axaml | 7 +- .../StartupWizard/StartupWizardView.axaml.cs | 2 - .../StartupWizard/StartupWizardViewModel.cs | 3 - .../StartupWizard/Steps/WelcomeStep.axaml | 2 +- .../SurfaceEditor/SurfaceEditorView.axaml | 2 +- .../SurfaceEditor/SurfaceEditorView.axaml.cs | 10 +- .../VisualScripting/CableView.axaml.cs | 2 - .../VisualScripting/DragCableView.axaml.cs | 3 - .../VisualScripting/NodePickerView.axaml.cs | 2 - .../VisualScripting/NodeScriptView.axaml | 4 +- .../VisualScripting/NodeScriptView.axaml.cs | 58 +++--- .../Services/Updating/UpdateService.cs | 7 +- src/Artemis.UI/Styles/Artemis.axaml | 7 +- src/Artemis.UI/Styles/Markdown.axaml | 191 ------------------ src/Artemis.UI/ViewLocator.cs | 2 +- .../Artemis.VisualScripting.csproj | 2 +- .../ColorGradientNodeCustomView.axaml.cs | 2 +- .../RampSKColorNodeCustomView.axaml.cs | 2 +- ...DataModelEventCycleNodeCustomView.axaml.cs | 2 +- .../DataModelEventNodeCustomView.axaml.cs | 2 +- .../Screens/DataModelNodeCustomView.axaml.cs | 2 +- .../LayerPropertyNodeCustomView.axaml.cs | 2 +- .../LayerPropertyNodeCustomViewModel.cs | 2 +- ...HotkeyEnableDisableNodeCustomView.axaml.cs | 2 - .../HotkeyEnableDisableNodeCustomViewModel.cs | 2 +- .../HotkeyPressNodeCustomView.axaml.cs | 2 - .../Screens/HotkeyPressNodeCustomViewModel.cs | 2 +- .../HotkeyToggleNodeCustomView.axaml.cs | 2 - .../HotkeyToggleNodeCustomViewModel.cs | 2 +- .../PressedKeyPositionNodeCustomViewModel.cs | 2 +- .../MathExpressionNodeCustomView.axaml.cs | 2 +- .../MathExpressionNodeCustomViewModel.cs | 4 +- .../Screens/EnumEqualsNodeCustomView.axaml | 1 - .../Screens/EnumEqualsNodeCustomView.axaml.cs | 2 +- .../Screens/EnumEqualsNodeCustomViewModel.cs | 2 +- .../DisplayValueNodeCustomView.axaml.cs | 2 +- .../StaticNumericValueNodeCustomView.axaml.cs | 2 +- .../StaticSKColorValueNodeCustomView.axaml.cs | 2 +- .../StaticStringValueNodeCustomView.axaml.cs | 2 +- .../EasingFunctionNodeCustomView.axaml.cs | 2 +- .../Screens/EasingFunctionView.axaml.cs | 2 +- .../Artemis.WebClient.Updating.csproj | 2 +- 96 files changed, 167 insertions(+), 583 deletions(-) delete mode 100644 src/Artemis.UI.Windows/Providers/Input/SpongeWindow.cs delete mode 100644 src/Artemis.UI.Windows/Providers/Input/SpongeWindowEventArgs.cs delete mode 100644 src/Artemis.UI/Styles/Markdown.axaml diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index db11e2724..b864770d7 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 false false Artemis.Core diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs index fd0300579..b5341f3e5 100644 --- a/src/Artemis.Core/Constants.cs +++ b/src/Artemis.Core/Constants.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Reflection; using Artemis.Core.JsonConverters; using Artemis.Core.Services; -using Artemis.Core.Services.Core; using Artemis.Core.SkiaSharp; using Newtonsoft.Json; diff --git a/src/Artemis.Core/Events/UpdateEventArgs.cs b/src/Artemis.Core/Events/UpdateEventArgs.cs index d513bae5e..977e4fe91 100644 --- a/src/Artemis.Core/Events/UpdateEventArgs.cs +++ b/src/Artemis.Core/Events/UpdateEventArgs.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; namespace Artemis.Core; diff --git a/src/Artemis.Core/Services/WebServer/WebModuleRegistration.cs b/src/Artemis.Core/Services/WebServer/WebModuleRegistration.cs index 450ac7435..270a5ec4d 100644 --- a/src/Artemis.Core/Services/WebServer/WebModuleRegistration.cs +++ b/src/Artemis.Core/Services/WebServer/WebModuleRegistration.cs @@ -1,6 +1,5 @@ using System; using EmbedIO; -using DryIoc; namespace Artemis.Core.Services; diff --git a/src/Artemis.Storage/Artemis.Storage.csproj b/src/Artemis.Storage/Artemis.Storage.csproj index 2e7bb99ae..a8606b171 100644 --- a/src/Artemis.Storage/Artemis.Storage.csproj +++ b/src/Artemis.Storage/Artemis.Storage.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 false x64 diff --git a/src/Artemis.UI.Linux/App.axaml.cs b/src/Artemis.UI.Linux/App.axaml.cs index 7040f8183..1a6cd64a5 100644 --- a/src/Artemis.UI.Linux/App.axaml.cs +++ b/src/Artemis.UI.Linux/App.axaml.cs @@ -5,7 +5,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -using Avalonia.Threading; +using Avalonia.ReactiveUI; using DryIoc; using ReactiveUI; diff --git a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj index 86ccbb134..fb6d0c80e 100644 --- a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj +++ b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj @@ -1,7 +1,7 @@ WinExe - net6.0 + net7.0 enable x64 x64 diff --git a/src/Artemis.UI.MacOS/App.axaml.cs b/src/Artemis.UI.MacOS/App.axaml.cs index f1aed23d3..0d81b318d 100644 --- a/src/Artemis.UI.MacOS/App.axaml.cs +++ b/src/Artemis.UI.MacOS/App.axaml.cs @@ -1,7 +1,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; -using Avalonia.Threading; +using Avalonia.ReactiveUI; using DryIoc; using ReactiveUI; diff --git a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj index f5f4606ce..000fe864e 100644 --- a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj +++ b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj @@ -1,7 +1,7 @@  WinExe - net6.0 + net7.0 enable x64 x64 diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index af6424e4c..275ab7f87 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -1,7 +1,7 @@  Library - net6.0 + net7.0 enable bin\ x64 @@ -17,7 +17,7 @@ - + diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index b751bc6cb..b995da975 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -12,8 +12,6 @@ using Avalonia.Input; using Avalonia.LogicalTree; using Avalonia.Media; using Avalonia.Media.Imaging; -using Avalonia.Platform; -using Avalonia.Rendering; using Avalonia.Threading; namespace Artemis.UI.Shared; diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml index 59195d73a..1849c97e5 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Shared.EnumComboBox"> - + diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs index d7ecc43c6..3048f239b 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs @@ -90,7 +90,7 @@ public partial class EnumComboBox : UserControl /// protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) { - _enumComboBox = this.Get("EnumComboBox"); + _enumComboBox = this.Get("ChildEnumComboBox"); _enumComboBox.Items = _currentValues; UpdateValues(); diff --git a/src/Artemis.UI.Shared/ReactiveAppWindow.cs b/src/Artemis.UI.Shared/ReactiveAppWindow.cs index 36483f57c..58f4ad820 100644 --- a/src/Artemis.UI.Shared/ReactiveAppWindow.cs +++ b/src/Artemis.UI.Shared/ReactiveAppWindow.cs @@ -4,6 +4,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.Immutable; +using Avalonia.Styling; using FluentAvalonia.UI.Media; using FluentAvalonia.UI.Windowing; using ReactiveUI; @@ -46,13 +47,9 @@ public class ReactiveAppWindow : AppWindow, IViewFor whe if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || !IsWindows11) return; - // Enable Mica on Windows 11, based on the FluentAvalonia sample application TransparencyBackgroundFallback = Brushes.Transparent; TransparencyLevelHint = WindowTransparencyLevel.Mica; - - Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", out object? value) ? (Color) value! : new Color2(32, 32, 32); - color = color.LightenPercent(-0.5f); - Background = new ImmutableSolidColorBrush(color, 0.82); + TryEnableMicaEffect(); } private void OnDataContextChanged(object? value) @@ -70,6 +67,31 @@ public class ReactiveAppWindow : AppWindow, IViewFor whe else if (DataContext != value) DataContext = value; } + private void TryEnableMicaEffect() + { + // The background colors for the Mica brush are still based around SolidBackgroundFillColorBase resource + // BUT since we can't control the actual Mica brush color, we have to use the window background to create + // the same effect. However, we can't use SolidBackgroundFillColorBase directly since its opaque, and if + // we set the opacity the color become lighter than we want. So we take the normal color, darken it and + // apply the opacity until we get the roughly the correct color + // NOTE that the effect still doesn't look right, but it suffices. Ideally we need access to the Mica + // CompositionBrush to properly change the color but I don't know if we can do that or not + if (ActualThemeVariant == ThemeVariant.Dark) + { + Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", ThemeVariant.Dark, out object? value) ? (Color) value : new Color2(32, 32, 32); + color = color.LightenPercent(-0.5f); + + Background = new ImmutableSolidColorBrush(color, 0.78); + } + else if (ActualThemeVariant == ThemeVariant.Light) + { + // Similar effect here + Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", ThemeVariant.Light, out object? value) ? (Color) value : new Color2(243, 243, 243); + color = color.LightenPercent(0.5f); + + Background = new ImmutableSolidColorBrush(color, 0.9); + } + } /// /// The ViewModel. diff --git a/src/Artemis.UI.Shared/Services/Builders/ContentDialogBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/ContentDialogBuilder.cs index 275345b0e..92e681433 100644 --- a/src/Artemis.UI.Shared/Services/Builders/ContentDialogBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/ContentDialogBuilder.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Threading.Tasks; using System.Windows.Input; using Avalonia.Controls; diff --git a/src/Artemis.UI.Windows/App.axaml.cs b/src/Artemis.UI.Windows/App.axaml.cs index 9444327c6..617858fb9 100644 --- a/src/Artemis.UI.Windows/App.axaml.cs +++ b/src/Artemis.UI.Windows/App.axaml.cs @@ -13,7 +13,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -using Avalonia.Threading; +using Avalonia.ReactiveUI; using DryIoc; using ReactiveUI; diff --git a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj index 9d6fc1088..c06b62687 100644 --- a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj +++ b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj @@ -1,7 +1,7 @@  WinExe - net6.0-windows10.0.17763.0 + net7.0-windows10.0.17763.0 enable x64 bin diff --git a/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs index 337e21744..de6fb01df 100644 --- a/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs @@ -20,7 +20,7 @@ public static class UIContainerExtensions public static void RegisterProviders(this IContainer container) { container.Register(Reuse.Singleton); - container.Register(Reuse.Singleton); + // container.Register(Reuse.Singleton); container.Register(); container.Register(serviceKey: WindowsInputProvider.Id); container.Register(); diff --git a/src/Artemis.UI.Windows/Properties/launchSettings.json b/src/Artemis.UI.Windows/Properties/launchSettings.json index a1588c6f9..cb8118713 100644 --- a/src/Artemis.UI.Windows/Properties/launchSettings.json +++ b/src/Artemis.UI.Windows/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Artemis.UI.Windows": { "commandName": "Project", - "commandLineArgs": "--force-elevation --disable-forced-shutdown --pcmr" + "commandLineArgs": "--disable-forced-shutdown --pcmr" } } } \ No newline at end of file diff --git a/src/Artemis.UI.Windows/Providers/Input/SpongeWindow.cs b/src/Artemis.UI.Windows/Providers/Input/SpongeWindow.cs deleted file mode 100644 index ec8f6d04b..000000000 --- a/src/Artemis.UI.Windows/Providers/Input/SpongeWindow.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using Avalonia.Win32; - -namespace Artemis.UI.Windows.Providers.Input; - -public class SpongeWindow : WindowImpl -{ - public event EventHandler? WndProcCalled; - - #region Overrides of WindowImpl - - /// - protected override IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) - { - OnWndProcCalled(new SpongeWindowEventArgs(hWnd, msg, wParam, lParam)); - return base.WndProc(hWnd, msg, wParam, lParam); - } - - #endregion - - protected virtual void OnWndProcCalled(SpongeWindowEventArgs e) - { - WndProcCalled?.Invoke(this, e); - } -} \ No newline at end of file diff --git a/src/Artemis.UI.Windows/Providers/Input/SpongeWindowEventArgs.cs b/src/Artemis.UI.Windows/Providers/Input/SpongeWindowEventArgs.cs deleted file mode 100644 index 507b42d8c..000000000 --- a/src/Artemis.UI.Windows/Providers/Input/SpongeWindowEventArgs.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace Artemis.UI.Windows.Providers.Input; - -public class SpongeWindowEventArgs : EventArgs -{ - public SpongeWindowEventArgs(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) - { - HWnd = hWnd; - Msg = msg; - WParam = wParam; - LParam = lParam; - } - - public IntPtr HWnd { get; } - public uint Msg { get; } - public IntPtr WParam { get; } - public IntPtr LParam { get; } -} \ No newline at end of file diff --git a/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs b/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs index ef8f168ec..cd3004b69 100644 --- a/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs +++ b/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs @@ -5,6 +5,8 @@ using System.Timers; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Windows.Utilities; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Platform; using Linearstar.Windows.RawInput; using Linearstar.Windows.RawInput.Native; using Serilog; @@ -17,7 +19,6 @@ public class WindowsInputProvider : InputProvider private readonly IInputService _inputService; private readonly ILogger _logger; - private readonly SpongeWindow _sponge; private readonly Timer _taskManagerTimer; private int _lastProcessId; @@ -25,16 +26,24 @@ public class WindowsInputProvider : InputProvider { _logger = logger; _inputService = inputService; - - _sponge = new SpongeWindow(); - _sponge.WndProcCalled += SpongeOnWndProcCalled; - + _taskManagerTimer = new Timer(500); _taskManagerTimer.Elapsed += TaskManagerTimerOnElapsed; _taskManagerTimer.Start(); - RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, _sponge.Handle.Handle); - RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, _sponge.Handle.Handle); + // if (Avalonia.Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + // { + // IWindowImpl window = desktop.MainWindow!.PlatformImpl!; + // + // // https://github.com/sanjay900/guitar-configurator/blob/master/Notify/WindowsDeviceNotifierAvalonia.cs + // // _hWndProcHook = GetWindowLongPtr(window.Handle.Handle, GwlWndproc); + // // _fnWndProcHook = CustomWndProc; + // // var newLong = Marshal.GetFunctionPointerForDelegate(_fnWndProcHook); + // // SetWindowLongPtr(window.Handle.Handle, GwlWndproc, newLong); + // + // RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, window.Handle.Handle); + // RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, window.Handle.Handle); + // } } public static Guid Id { get; } = new("6737b204-ffb1-4cd9-8776-9fb851db303a"); @@ -55,19 +64,18 @@ public class WindowsInputProvider : InputProvider { if (disposing) { - _sponge.Dispose(); _taskManagerTimer.Dispose(); } base.Dispose(disposing); } - private void SpongeOnWndProcCalled(object? sender, SpongeWindowEventArgs message) + private void OnWndProcCalled(nint hWnd, uint msg, nint wParam, nint lParam) { - if (message.Msg != WM_INPUT) + if (msg != WM_INPUT) return; - RawInputData data = RawInputData.FromHandle(message.LParam); + RawInputData data = RawInputData.FromHandle(lParam); switch (data) { case RawInputMouseData mouse: diff --git a/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs b/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs index 7af9d6927..f77ee9226 100644 --- a/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs +++ b/src/Artemis.UI.Windows/Providers/WindowsUpdateNotificationProvider.cs @@ -9,7 +9,6 @@ using Artemis.UI.Screens.Settings; using Artemis.UI.Services.Updating; using Artemis.UI.Shared.Services.MainWindow; using Avalonia.Threading; -using DryIoc.ImTools; using Microsoft.Toolkit.Uwp.Notifications; using ReactiveUI; diff --git a/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs b/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs index 7c95696c3..01a2f92d2 100644 --- a/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs +++ b/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using Avalonia.Controls; using Avalonia.Win32; using SharpVk; using SharpVk.Khronos; @@ -10,10 +11,10 @@ internal sealed class Win32VkContext : VkContext { public Win32VkContext() { - Window = new WindowImpl(); + Window = new Window(); Instance = Instance.Create(null, new[] {"VK_KHR_surface", "VK_KHR_win32_surface"}); PhysicalDevice = Instance.EnumeratePhysicalDevices().First(); - Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.Handle.Handle); + Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.PlatformImpl!.Handle.Handle); (GraphicsFamily, PresentFamily) = FindQueueFamilies(); @@ -43,12 +44,12 @@ internal sealed class Win32VkContext : VkContext }; } - public WindowImpl Window { get; } + public Window Window { get; } public override void Dispose() { base.Dispose(); - Window.Dispose(); + Window.Close(); } private IntPtr Proc(string name, IntPtr instanceHandle, IntPtr deviceHandle) diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 799eb4dff..cffb4d57c 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -1,7 +1,7 @@ Library - net6.0 + net7.0 enable bin/ x64 @@ -29,8 +29,8 @@ - - + + diff --git a/src/Artemis.UI/MainWindow.axaml b/src/Artemis.UI/MainWindow.axaml index 7be2a5e6e..a0db3275e 100644 --- a/src/Artemis.UI/MainWindow.axaml +++ b/src/Artemis.UI/MainWindow.axaml @@ -1,8 +1,9 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/MainWindow.axaml.cs b/src/Artemis.UI/MainWindow.axaml.cs index a8a49b6b2..4cc1d9fe5 100644 --- a/src/Artemis.UI/MainWindow.axaml.cs +++ b/src/Artemis.UI/MainWindow.axaml.cs @@ -7,13 +7,12 @@ using Artemis.UI.Shared; using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; -using Avalonia.Threading; -using FluentAvalonia.Core.ApplicationModel; +using Avalonia.ReactiveUI; using ReactiveUI; namespace Artemis.UI; -public class MainWindow : ReactiveAppWindow +public partial class MainWindow : ReactiveAppWindow { private readonly Panel _rootPanel; private readonly ContentControl _sidebarContentControl; @@ -25,7 +24,7 @@ public class MainWindow : ReactiveAppWindow Activated += OnActivated; Deactivated += OnDeactivated; - ApplyWindowSize(); + // ApplyWindowSize(); InitializeComponent(); _rootPanel = this.Get("RootPanel"); @@ -67,12 +66,12 @@ public class MainWindow : ReactiveAppWindow private void OnOpened(object? sender, EventArgs e) { Opened -= OnOpened; - ICoreApplicationView coreAppTitleBar = this; - if (coreAppTitleBar.TitleBar != null) - { - coreAppTitleBar.TitleBar.ExtendViewIntoTitleBar = true; - SetTitleBar(this.Get("DragHandle")); - } + // ICoreApplicationView coreAppTitleBar = this; + // if (coreAppTitleBar.TitleBar != null) + // { + // coreAppTitleBar.TitleBar.ExtendViewIntoTitleBar = true; + // SetTitleBar(this.Get("DragHandle")); + // } } private void OnActivated(object? sender, EventArgs e) diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml index d9f712498..27c44a856 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml @@ -9,7 +9,6 @@ Feel like making a donation? It would be gratefully received. Click the button to donate via PayPal. diff --git a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml index 54996af62..af5ac19bf 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml @@ -18,7 +18,7 @@ - + diff --git a/src/Artemis.UI/Screens/Plugins/PluginView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginView.axaml.cs index 4d217c623..2f2db039a 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginView.axaml.cs @@ -1,5 +1,4 @@ using System; -using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/Plugins/PluginViewModel.cs b/src/Artemis.UI/Screens/Plugins/PluginViewModel.cs index 24102dc8c..35d37aa0e 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginViewModel.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginViewModel.cs @@ -13,7 +13,6 @@ using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; using Avalonia.Controls; using Avalonia.Threading; -using DryIoc; using Material.Icons; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs index 740da8dc6..0a7ba090f 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs @@ -3,7 +3,6 @@ using System.Collections.ObjectModel; using System.Linq; using Avalonia; using Avalonia.Controls; -using Avalonia.Controls.Generators; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.VisualTree; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs index 5fed64811..90957212b 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs @@ -1,6 +1,5 @@ using System; using System.Reactive.Disposables; -using Avalonia.Controls; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs index c912738fb..4f730bd43 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs @@ -1,6 +1,5 @@ using System; using System.Reactive.Disposables; -using Avalonia.Controls; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml index f2438acb5..286b33c93 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml @@ -23,8 +23,8 @@ - - - - - - - diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs index 101a9dd1f..cc0e31197 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs @@ -120,6 +120,6 @@ public partial class ProfileTreeView : ReactiveUserControl private void ProfileTreeView_OnSelectionChanged(object? sender, SelectionChangedEventArgs e) { - ProfileTreeView.Focus(); + Profile.Focus(); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs index b298d9315..846da1b66 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs @@ -1,5 +1,3 @@ -using Avalonia.Controls; -using Avalonia.Controls.Shapes; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs index 6ec76a3b7..db6cb5928 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs @@ -1,5 +1,3 @@ -using Avalonia.Controls; -using Avalonia.Controls.Shapes; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs index 37c6b24fa..2f567292c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs @@ -1,5 +1,3 @@ -using Avalonia.Controls; -using Avalonia.Controls.Shapes; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs index de289fb17..38acf3c31 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs @@ -5,7 +5,6 @@ using Artemis.Core; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs index f5e39b592..be9c471d4 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs @@ -12,7 +12,6 @@ using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs index 37cf942b9..f9b994284 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs @@ -1,11 +1,9 @@ using System.Collections.Generic; using System.Linq; using Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes; -using Artemis.UI.Shared; using Artemis.UI.Shared.Events; using Artemis.UI.Shared.Extensions; using Avalonia; -using Avalonia.Controls; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs index eede83c42..bfca6c46a 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs @@ -6,7 +6,6 @@ using Artemis.Core; using Artemis.UI.Shared.Extensions; using Avalonia; using Avalonia.Controls; -using Avalonia.Controls.Mixins; using Avalonia.Controls.PanAndZoom; using Avalonia.Controls.Shapes; using Avalonia.Input; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs index 95cc4eca6..aa1e6eda4 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs @@ -2,9 +2,7 @@ using System; using System.Linq; using System.Reactive.Disposables; using Avalonia; -using Avalonia.Controls; using Avalonia.Controls.PanAndZoom; -using Avalonia.Controls.Shapes; using Avalonia.LogicalTree; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs index a7d19a23d..6882addb0 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs @@ -1,9 +1,7 @@ using System; using System.Linq; using Avalonia; -using Avalonia.Controls; using Avalonia.Controls.PanAndZoom; -using Avalonia.Controls.Shapes; using Avalonia.LogicalTree; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs index 54e33fa6e..abce2bd21 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs @@ -1,5 +1,4 @@ using Avalonia.Controls; -using Avalonia.Interactivity; using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor; diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml index 3f857f1d2..2e6af4e05 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml @@ -8,8 +8,7 @@ xmlns:shared="clr-namespace:Artemis.UI.Shared.Services.ProfileEditor;assembly=Artemis.UI.Shared" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.ProfileEditor.ProfileEditorView" - x:DataType="profileEditor:ProfileEditorViewModel" - Name="ProfileEditorView"> + x:DataType="profileEditor:ProfileEditorViewModel"> diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs index ecdc2dfb8..ee2319ea3 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs @@ -1,5 +1,4 @@ using Avalonia; -using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml index 3f3571c93..ce9f301d8 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml @@ -29,7 +29,7 @@ - + diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml index b1f10bdab..bdec0d278 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml @@ -157,166 +157,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs b/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs index 7d6977eb8..8e4d4d108 100644 --- a/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs +++ b/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs @@ -1,6 +1,5 @@ using Avalonia; using Avalonia.Controls; -using Avalonia.Controls.Generators; using Avalonia.Input; using Avalonia.VisualTree; using Avalonia.Xaml.Interactions.DragAndDrop; diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs index 0b134ddc5..fc6a5f097 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs @@ -2,7 +2,6 @@ using System; using System.Reactive.Disposables; using Artemis.UI.Shared; using Avalonia; -using Avalonia.Controls; using Avalonia.Markup.Xaml; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml index d20036165..e4e9a7c40 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml @@ -9,15 +9,12 @@ x:Class="Artemis.UI.Screens.Sidebar.SidebarView" x:DataType="sidebar:SidebarViewModel"> - + - + Artemis 2 diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs index a4f4e9c04..1e6d7b00f 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs @@ -3,9 +3,7 @@ using System.Reactive.Disposables; using Artemis.UI.Screens.StartupWizard.Steps; using Artemis.UI.Shared; using Avalonia; -using Avalonia.Controls; using Avalonia.Markup.Xaml; -using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Navigation; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs index 99d0eb719..05bbc060c 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardViewModel.cs @@ -3,15 +3,12 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reactive; using System.Reactive.Disposables; -using System.Reflection; using System.Threading.Tasks; using Artemis.Core; using Artemis.Core.DeviceProviders; using Artemis.Core.Services; using Artemis.UI.DryIoc.Factories; using Artemis.UI.Screens.Plugins; -using Artemis.UI.Services.Interfaces; -using Artemis.UI.Services.Updating; using Artemis.UI.Shared; using Artemis.UI.Shared.Providers; using Artemis.UI.Shared.Services; diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml index f9184e406..6422e2508 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml @@ -30,7 +30,7 @@ - - { InitializeComponent(); - ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; - UpdateZoomBorderBackground(); - - ZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - ZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - ZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - - this.WhenActivated(d => - { - ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested; - ViewModel.PickerPositionSubject.Subscribe(ShowPickerAt).DisposeWith(d); - if (ViewModel.IsPreview) - { - BoundsProperty.Changed.Subscribe(BoundsPropertyChanged).DisposeWith(d); - ViewModel.NodeViewModels.ToObservableChangeSet().Subscribe(_ => AutoFitIfPreview()).DisposeWith(d); - } - - Dispatcher.UIThread.InvokeAsync(() => AutoFit(true), DispatcherPriority.ContextIdle); - Disposable.Create(() => ViewModel.AutoFitRequested -= ViewModelOnAutoFitRequested).DisposeWith(d); - }); + // NodeScriptZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + // UpdateZoomBorderBackground(); + // + // NodeScriptZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + // NodeScriptZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + // NodeScriptZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + // + // this.WhenActivated(d => + // { + // ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested; + // ViewModel.PickerPositionSubject.Subscribe(ShowPickerAt).DisposeWith(d); + // if (ViewModel.IsPreview) + // { + // BoundsProperty.Changed.Subscribe(BoundsPropertyChanged).DisposeWith(d); + // ViewModel.NodeViewModels.ToObservableChangeSet().Subscribe(_ => AutoFitIfPreview()).DisposeWith(d); + // } + // + // Dispatcher.UIThread.InvokeAsync(() => AutoFit(true), DispatcherPriority.ContextIdle); + // Disposable.Create(() => ViewModel.AutoFitRequested -= ViewModelOnAutoFitRequested).DisposeWith(d); + // }); } protected override Size MeasureOverride(Size availableSize) @@ -56,7 +54,7 @@ public partial class NodeScriptView : ReactiveUserControl private void ZoomOnPointerWheelChanged(object? sender, PointerWheelEventArgs e) { // If scroll events aren't handled here the ZoomBorder does some random panning when at the zoom limit - if (e.Delta.Y > 0 && ZoomBorder.ZoomX >= 1) + if (e.Delta.Y > 0 && NodeScriptZoomBorder.ZoomX >= 1) e.Handled = true; } @@ -71,7 +69,7 @@ public partial class NodeScriptView : ReactiveUserControl if (ViewModel == null) return; ViewModel.NodePickerViewModel.Position = point; - ZoomBorder?.ContextFlyout?.ShowAt(ZoomBorder); + NodeScriptZoomBorder?.ContextFlyout?.ShowAt(NodeScriptZoomBorder); } private void AutoFitIfPreview() @@ -111,8 +109,8 @@ public partial class NodeScriptView : ReactiveUserControl double scale = Math.Min(1, Math.Min(Bounds.Width / scriptRect.Width, Bounds.Height / scriptRect.Height)); // Pan and zoom to make the script fit - ZoomBorder.Zoom(scale, 0, 0, skipTransitions); - ZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); + NodeScriptZoomBorder.Zoom(scale, 0, 0, skipTransitions); + NodeScriptZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); } private void ViewModelOnAutoFitRequested(object? sender, EventArgs e) @@ -122,14 +120,14 @@ public partial class NodeScriptView : ReactiveUserControl private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property.Name == nameof(ZoomBorder.Background)) + if (e.Property.Name == nameof(NodeScriptZoomBorder.Background)) UpdateZoomBorderBackground(); } private void UpdateZoomBorderBackground() { - if (ZoomBorder.Background is VisualBrush visualBrush) - visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); + if (NodeScriptZoomBorder.Background is VisualBrush visualBrush) + visualBrush.DestinationRect = new RelativeRect(NodeScriptZoomBorder.OffsetX * -1, NodeScriptZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } private void InitializeComponent() @@ -140,7 +138,7 @@ public partial class NodeScriptView : ReactiveUserControl private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e) { if (ViewModel != null) - ViewModel.PanMatrix = ZoomBorder.Matrix; + ViewModel.PanMatrix = NodeScriptZoomBorder.Matrix; UpdateZoomBorderBackground(); } diff --git a/src/Artemis.UI/Services/Updating/UpdateService.cs b/src/Artemis.UI/Services/Updating/UpdateService.cs index fee0b93b0..15e66985e 100644 --- a/src/Artemis.UI/Services/Updating/UpdateService.cs +++ b/src/Artemis.UI/Services/Updating/UpdateService.cs @@ -5,7 +5,6 @@ using System.Threading; using System.Threading.Tasks; using Artemis.Core; using Artemis.Core.Services; -using Artemis.Storage.Entities.General; using Artemis.Storage.Repositories; using Artemis.UI.Exceptions; using Artemis.UI.Shared.Services.MainWindow; @@ -110,6 +109,9 @@ public class UpdateService : IUpdateService private async void HandleAutoUpdateEvent(object? sender, EventArgs e) { + if (Constants.CurrentVersion == "local") + return; + // The event can trigger from multiple sources with a timer acting as a fallback, only actual perform an action once per max 59 minutes if (DateTime.UtcNow - _lastAutoUpdateCheck < TimeSpan.FromMinutes(59)) return; @@ -204,6 +206,9 @@ public class UpdateService : IUpdateService /// public bool Initialize() { + if (Constants.CurrentVersion == "local") + return false; + string? channelArgument = Constants.StartupArguments.FirstOrDefault(a => a.StartsWith("--channel=")); if (channelArgument != null) Channel = channelArgument.Split("=")[1]; diff --git a/src/Artemis.UI/Styles/Artemis.axaml b/src/Artemis.UI/Styles/Artemis.axaml index d92851a90..c8febf069 100644 --- a/src/Artemis.UI/Styles/Artemis.axaml +++ b/src/Artemis.UI/Styles/Artemis.axaml @@ -1,10 +1,11 @@  + xmlns:styling="clr-namespace:FluentAvalonia.Styling;assembly=FluentAvalonia" + xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"> + + - - \ No newline at end of file diff --git a/src/Artemis.UI/Styles/Markdown.axaml b/src/Artemis.UI/Styles/Markdown.axaml deleted file mode 100644 index 34acbe75f..000000000 --- a/src/Artemis.UI/Styles/Markdown.axaml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## Core - * Cleaned up ProfileService render condition - * Core - Added fading in and out of profiles - * Core - Apply opacity layer only when fading - * Core - Fixed when condition stops being true mid-fade - * Core - Removed FadingStatus enum - - # General - - Meta - Fixed warnings - - Meta - Update RGB.NET - - # Plugins - - Plugins - Ignore version when loading shared assemblies - - # UI - - Sidebar - Improved category reordering code - - - - - - \ No newline at end of file diff --git a/src/Artemis.UI/ViewLocator.cs b/src/Artemis.UI/ViewLocator.cs index 45ceec2d2..d95012653 100644 --- a/src/Artemis.UI/ViewLocator.cs +++ b/src/Artemis.UI/ViewLocator.cs @@ -11,7 +11,7 @@ namespace Artemis.UI; public class ViewLocator : IDataTemplate { - public IControl Build(object data) + public Control Build(object data) { Type dataType = data.GetType(); string name = dataType.FullName!.Split('`')[0].Replace("ViewModel", "View"); diff --git a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj index fedc59d0a..56819af53 100644 --- a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj +++ b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 enable enable x64 diff --git a/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs index 183d660fd..b83bc475e 100644 --- a/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Color.Screens; -public class ColorGradientNodeCustomView : ReactiveUserControl +public partial class ColorGradientNodeCustomView : ReactiveUserControl { public ColorGradientNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Color/Screens/RampSKColorNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Color/Screens/RampSKColorNodeCustomView.axaml.cs index b0133dcc3..1727e477c 100644 --- a/src/Artemis.VisualScripting/Nodes/Color/Screens/RampSKColorNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Color/Screens/RampSKColorNodeCustomView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Color.Screens; -public class RampSKColorNodeCustomView : ReactiveUserControl +public partial class RampSKColorNodeCustomView : ReactiveUserControl { public RampSKColorNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventCycleNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventCycleNodeCustomView.axaml.cs index 3df2bafcc..c6ff737f2 100644 --- a/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventCycleNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventCycleNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.DataModel.Screens; -public class DataModelEventCycleNodeCustomView : ReactiveUserControl +public partial class DataModelEventCycleNodeCustomView : ReactiveUserControl { public DataModelEventCycleNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventNodeCustomView.axaml.cs index fc75675af..d0490def8 100644 --- a/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelEventNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.DataModel.Screens; -public class DataModelEventNodeCustomView : ReactiveUserControl +public partial class DataModelEventNodeCustomView : ReactiveUserControl { public DataModelEventNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelNodeCustomView.axaml.cs index 9be092730..5447d7056 100644 --- a/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/DataModel/Screens/DataModelNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.DataModel.Screens; -public class DataModelNodeCustomView : ReactiveUserControl +public partial class DataModelNodeCustomView : ReactiveUserControl { public DataModelNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml.cs index 5f4996c3a..7573160d2 100644 --- a/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.External.Screens; -public class LayerPropertyNodeCustomView : ReactiveUserControl +public partial class LayerPropertyNodeCustomView : ReactiveUserControl { public LayerPropertyNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomViewModel.cs index c9cb56289..bca028ff6 100644 --- a/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomViewModel.cs @@ -1,10 +1,10 @@ using System.Collections.ObjectModel; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.VisualScripting; using Artemis.VisualScripting.Nodes.External.Commands; -using Avalonia.Controls.Mixins; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomView.axaml.cs index 90bf774e0..db71d47c1 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomView.axaml.cs @@ -1,6 +1,4 @@ using Artemis.UI.Shared; -using Avalonia; -using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomViewModel.cs index ccb1d7342..abf8bcbb8 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyEnableDisableNodeCustomViewModel.cs @@ -1,9 +1,9 @@ +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Artemis.UI.Shared.VisualScripting; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.VisualScripting.Nodes.Input.Screens; diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomView.axaml.cs index fb8f76f7d..3d3672e6e 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomView.axaml.cs @@ -1,6 +1,4 @@ using Artemis.UI.Shared; -using Avalonia; -using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomViewModel.cs index 631a4644a..a161de70b 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyPressNodeCustomViewModel.cs @@ -1,9 +1,9 @@ +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Artemis.UI.Shared.VisualScripting; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.VisualScripting.Nodes.Input.Screens; diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomView.axaml.cs index 46aed80ce..6fc0f45e5 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomView.axaml.cs @@ -1,6 +1,4 @@ using Artemis.UI.Shared; -using Avalonia; -using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomViewModel.cs index 57ea098d6..c7dc683ea 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/HotkeyToggleNodeCustomViewModel.cs @@ -1,9 +1,9 @@ +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Artemis.UI.Shared.VisualScripting; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.VisualScripting.Nodes.Input.Screens; diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomViewModel.cs index fce2c13a3..2cc2660e1 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomViewModel.cs @@ -1,10 +1,10 @@ using System.Collections.ObjectModel; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Artemis.UI.Shared.VisualScripting; -using Avalonia.Controls.Mixins; using ReactiveUI; using static Artemis.VisualScripting.Nodes.Input.PressedKeyPositionNodeEntity; diff --git a/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomView.axaml.cs index a7fbe2304..675b4c226 100644 --- a/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Mathematics.Screens; -public class MathExpressionNodeCustomView : ReactiveUserControl +public partial class MathExpressionNodeCustomView : ReactiveUserControl { public MathExpressionNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomViewModel.cs index 46c5c337b..4cd475a8d 100644 --- a/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Mathematics/Screens/MathExpressionNodeCustomViewModel.cs @@ -1,10 +1,10 @@ -using System.Reactive.Linq; +using System.Reactive.Disposables; +using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Artemis.UI.Shared.VisualScripting; -using Avalonia.Controls.Mixins; using ReactiveUI; using ReactiveUI.Validation.Extensions; diff --git a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml index 0b19e7bd5..b97440803 100644 --- a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml @@ -7,7 +7,6 @@ diff --git a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml.cs index 0252616f0..373042a5a 100644 --- a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Operators.Screens; -public class EnumEqualsNodeCustomView : ReactiveUserControl +public partial class EnumEqualsNodeCustomView : ReactiveUserControl { public EnumEqualsNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs index dfff67695..7fee56fa6 100644 --- a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs @@ -1,11 +1,11 @@ using System.Collections.ObjectModel; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Artemis.UI.Shared.VisualScripting; -using Avalonia.Controls.Mixins; using Avalonia.Threading; using DynamicData; using Humanizer; diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml.cs index 9a448c403..fda8da8f9 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Static.Screens; -public class DisplayValueNodeCustomView : ReactiveUserControl +public partial class DisplayValueNodeCustomView : ReactiveUserControl { public DisplayValueNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticNumericValueNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticNumericValueNodeCustomView.axaml.cs index 913c0f22b..d6479a2ee 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticNumericValueNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticNumericValueNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Static.Screens; -public class StaticNumericValueNodeCustomView : ReactiveUserControl +public partial class StaticNumericValueNodeCustomView : ReactiveUserControl { public StaticNumericValueNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticSKColorValueNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticSKColorValueNodeCustomView.axaml.cs index 285069694..13c598ed5 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticSKColorValueNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticSKColorValueNodeCustomView.axaml.cs @@ -4,7 +4,7 @@ using FluentAvalonia.UI.Controls; namespace Artemis.VisualScripting.Nodes.Static.Screens; -public class StaticSKColorValueNodeCustomView : ReactiveUserControl +public partial class StaticSKColorValueNodeCustomView : ReactiveUserControl { public StaticSKColorValueNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticStringValueNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticStringValueNodeCustomView.axaml.cs index 427382854..c973f92eb 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticStringValueNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/StaticStringValueNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Static.Screens; -public class StaticStringValueNodeCustomView : ReactiveUserControl +public partial class StaticStringValueNodeCustomView : ReactiveUserControl { public StaticStringValueNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml.cs index 9af92d995..7ecbb69cc 100644 --- a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.VisualScripting.Nodes.Transition.Screens; -public class EasingFunctionNodeCustomView : ReactiveUserControl +public partial class EasingFunctionNodeCustomView : ReactiveUserControl { public EasingFunctionNodeCustomView() { diff --git a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionView.axaml.cs index 3ff2acb0a..95fb590a0 100644 --- a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.VisualScripting.Nodes.Transition.Screens; -public class EasingFunctionView : UserControl +public partial class EasingFunctionView : UserControl { public EasingFunctionView() { diff --git a/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj b/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj index f087e1de1..1f56c0bf2 100644 --- a/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj +++ b/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 enable enable From 4518691907ea3bbad2494b2a77095a9c22a5041d Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 31 Mar 2023 21:17:14 +0200 Subject: [PATCH 04/18] Fixed lots of runtime errors --- .../Artemis.Core.csproj.DotSettings | 3 +- .../DryIoc/ContainerExtensions.cs | 10 +-- src/Artemis.Core/Events/UpdateEventArgs.cs | 2 +- .../Extensions/ProcessExtensions.cs | 6 +- .../Entities/General/ReleaseEntity.cs | 2 +- .../Entities/Profile/LedEntity.cs | 10 +-- .../Migrations/M0021GradientNodes.cs | 26 ++++---- .../Migrations/M0022TransitionNodes.cs | 2 +- .../Repositories/QueuedActionRepository.cs | 2 +- .../Artemis.UI.Shared.csproj.DotSettings | 3 +- .../Controls/ArtemisIcon.axaml.cs | 5 -- .../Controls/DraggableNumberBox.axaml.cs | 5 -- .../Controls/EnumComboBox.axaml.cs | 5 -- .../Controls/HotkeyBox.axaml.cs | 5 -- .../ProfileConfigurationIcon.axaml.cs | 5 -- .../DefaultDataModelDisplayView.axaml.cs | 5 -- .../SKColorDataModelDisplayView.axaml.cs | 4 -- .../Window/ExceptionDialogView.axaml.cs | 4 -- src/Artemis.UI.Shared/Styles/TextBox.axaml | 64 ++++++++++--------- src/Artemis.UI/Artemis.UI.csproj.DotSettings | 3 +- .../BoolPropertyInputView.axaml.cs | 4 -- .../BrushPropertyInputView.axaml.cs | 4 -- .../ColorGradientPropertyInputView.axaml.cs | 4 -- .../EnumPropertyInputView.axaml.cs | 4 -- .../FloatPropertyInputView.axaml.cs | 4 -- .../FloatRangePropertyInputView.axaml.cs | 4 -- .../IntPropertyInputView.axaml.cs | 4 -- .../IntRangePropertyInputView.axaml.cs | 4 -- .../SKColorPropertyInputView.axaml.cs | 4 -- .../SKPointPropertyInputView.axaml.cs | 4 -- .../SKSizePropertyInputView.axaml.cs | 4 -- .../StringPropertyInputView.axaml.cs | 4 -- src/Artemis.UI/MainWindow.axaml.cs | 4 -- .../Screens/Debugger/DebugView.axaml.cs | 4 -- .../DataModel/DataModelDebugView.axaml.cs | 4 -- .../Debugger/Tabs/Logs/LogsDebugView.axaml.cs | 4 -- .../PerformanceDebugPluginView.axaml.cs | 4 -- .../PerformanceDebugProfilerView.axaml.cs | 4 -- .../Performance/PerformanceDebugView.axaml.cs | 4 -- .../Tabs/Render/RenderDebugView.axaml.cs | 4 -- .../Tabs/Settings/DebugSettingsView.axaml.cs | 4 -- .../Device/DeviceDetectInputView.axaml.cs | 4 -- .../Device/DevicePropertiesView.axaml.cs | 4 -- .../Device/DeviceSettingsView.axaml.cs | 4 -- .../Device/Tabs/DeviceInfoTabView.axaml.cs | 4 -- .../Device/Tabs/DeviceLedsTabView.axaml.cs | 4 -- .../DeviceLogicalLayoutDialogView.axaml.cs | 4 -- .../DevicePhysicalLayoutDialogView.axaml.cs | 4 -- .../Tabs/DevicePropertiesTabView.axaml.cs | 4 -- .../Device/Tabs/InputMappingsTabView.axaml.cs | 4 -- src/Artemis.UI/Screens/Home/HomeView.axaml.cs | 4 -- ...ginPrerequisitesInstallDialogView.axaml.cs | 4 -- ...nPrerequisitesUninstallDialogView.axaml.cs | 4 -- .../Plugins/PluginFeatureView.axaml.cs | 4 -- .../Plugins/PluginPlatformView.axaml.cs | 4 -- .../PluginPrerequisiteActionView.axaml.cs | 4 -- .../Plugins/PluginPrerequisiteView.axaml.cs | 4 -- .../Plugins/PluginSettingsView.axaml.cs | 4 -- .../Plugins/PluginSettingsWindowView.axaml.cs | 4 -- .../Screens/Plugins/PluginView.axaml.cs | 4 -- .../AlwaysOnConditionView.axaml.cs | 4 -- .../EventConditionView.axaml.cs | 4 -- .../PlayOnceConditionView.axaml.cs | 4 -- .../StaticConditionView.axaml.cs | 4 -- .../DisplayConditionScriptView.axaml.cs | 4 -- .../Panels/MenuBar/MenuBarView.axaml.cs | 4 -- .../Panels/Playback/PlaybackView.axaml.cs | 4 -- .../CategoryAdaptionHintView.axaml.cs | 4 -- .../DeviceAdaptionHintView.axaml.cs | 4 -- .../KeyboardSectionAdaptionHintView.axaml.cs | 4 -- .../Dialogs/LayerHintsDialogView.axaml.cs | 4 -- .../ProfileTree/FolderTreeItemView.axaml.cs | 4 -- .../ProfileTree/LayerTreeItemView.axaml.cs | 4 -- .../ProfileTree/ProfileTreeView.axaml.cs | 4 -- .../DataBinding/DataBindingView.axaml.cs | 4 -- .../Properties/Dialogs/AddEffectView.axaml.cs | 4 -- .../Dialogs/TimelineSegmentEditView.axaml.cs | 4 -- .../Panels/Properties/PropertiesView.axaml.cs | 4 -- .../Keyframes/TimelineEasingView.axaml.cs | 4 -- .../Keyframes/TimelineKeyframeView.axaml.cs | 4 -- .../Timeline/Segments/EndSegmentView.axaml.cs | 4 -- .../Segments/MainSegmentView.axaml.cs | 4 -- .../Segments/StartSegmentView.axaml.cs | 4 -- .../Timeline/TimelineGroupView.axaml.cs | 4 -- .../Timeline/TimelinePropertyView.axaml.cs | 4 -- .../Properties/Timeline/TimelineView.axaml.cs | 4 -- .../LayerEffectRenameView.axaml.cs | 4 -- .../Dialogs/LayerBrushPresetView.axaml.cs | 4 -- .../Properties/Tree/TreeGroupView.axaml.cs | 4 -- .../Properties/Tree/TreePropertyView.axaml.cs | 4 -- .../Panels/StatusBar/StatusBarView.axaml.cs | 4 -- .../Tools/SelectionAddToolView.axaml.cs | 4 -- .../Tools/SelectionRemoveToolView.axaml.cs | 4 -- .../Tools/TransformToolView.axaml.cs | 4 -- .../VisualEditor/VisualEditorView.axaml.cs | 4 -- .../LayerShapeVisualizerView.axaml.cs | 4 -- .../Visualizers/LayerVisualizerView.axaml.cs | 4 -- .../ProfileEditorTitleBarView.axaml.cs | 4 -- .../ProfileEditor/ProfileEditorView.axaml.cs | 4 -- .../Screens/Root/DefaultTitleBarView.axaml.cs | 4 -- src/Artemis.UI/Screens/Root/RootView.axaml.cs | 4 -- .../Screens/Root/SplashView.axaml.cs | 4 -- .../ScriptConfigurationCreateView.axaml.cs | 4 -- .../ScriptConfigurationEditView.axaml.cs | 4 -- .../Scripting/ScriptsDialogView.axaml.cs | 4 -- .../Screens/Settings/SettingsView.axaml.cs | 4 -- .../Settings/Tabs/AboutTabView.axaml.cs | 4 -- .../Settings/Tabs/DevicesTabView.axaml.cs | 4 -- .../Settings/Tabs/GeneralTabView.axaml.cs | 4 -- .../Settings/Tabs/PluginsTabView.axaml | 2 +- .../Settings/Tabs/PluginsTabView.axaml.cs | 4 -- .../Settings/Tabs/ReleasesTabView.axaml.cs | 4 -- .../Settings/Updating/ReleaseView.axaml.cs | 4 -- .../SidebarCategoryEditView.axaml.cs | 4 -- .../ModuleActivationRequirementView.axaml.cs | 4 -- .../ModuleActivationRequirementsView.axaml.cs | 4 -- .../ProfileConfigurationEditView.axaml.cs | 4 -- .../Sidebar/SidebarCategoryView.axaml.cs | 4 -- .../SidebarProfileConfigurationView.axaml.cs | 4 -- .../Sidebar/SidebarScreenView.axaml.cs | 4 -- .../Screens/Sidebar/SidebarView.axaml.cs | 4 -- .../StartupWizard/StartupWizardView.axaml.cs | 4 -- .../StartupWizard/Steps/DevicesStep.axaml.cs | 4 -- .../StartupWizard/Steps/FinishStep.axaml.cs | 4 -- .../StartupWizard/Steps/LayoutStep.axaml.cs | 4 -- .../StartupWizard/Steps/SettingsStep.axaml.cs | 4 -- .../StartupWizard/Steps/WelcomeStep.axaml.cs | 4 -- .../SurfaceEditor/ListDeviceView.axaml.cs | 4 -- .../SurfaceEditor/SurfaceDeviceView.axaml.cs | 4 -- .../SurfaceEditor/SurfaceEditorView.axaml.cs | 4 -- .../VisualScripting/CableView.axaml.cs | 4 -- .../VisualScripting/DragCableView.axaml.cs | 4 -- .../VisualScripting/NodePickerView.axaml.cs | 4 -- .../VisualScripting/NodeScriptView.axaml.cs | 44 ++++++------- .../NodeScriptWindowView.axaml.cs | 4 -- .../Screens/VisualScripting/NodeView.axaml.cs | 4 -- .../Pins/InputPinCollectionView.axaml.cs | 4 -- .../Pins/InputPinView.axaml.cs | 4 -- .../Pins/OutputPinCollectionView.axaml.cs | 4 -- .../Pins/OutputPinView.axaml.cs | 4 -- .../Screens/Workshop/WorkshopView.axaml.cs | 4 -- .../ColorGradientNodeCustomView.axaml.cs | 4 -- .../RampSKColorNodeCustomView.axaml.cs | 4 -- ...DataModelEventCycleNodeCustomView.axaml.cs | 4 -- .../DataModelEventNodeCustomView.axaml.cs | 4 -- .../Screens/DataModelNodeCustomView.axaml.cs | 4 -- .../LayerPropertyNodeCustomView.axaml.cs | 4 -- ...HotkeyEnableDisableNodeCustomView.axaml.cs | 4 -- .../HotkeyPressNodeCustomView.axaml.cs | 4 -- .../HotkeyToggleNodeCustomView.axaml.cs | 4 -- .../PressedKeyPositionNodeCustomView.axaml.cs | 4 -- .../ListOperatorNodeCustomView.axaml.cs | 4 -- ...stOperatorPredicateNodeCustomView.axaml.cs | 4 -- .../MathExpressionNodeCustomView.axaml.cs | 4 -- .../Screens/EnumEqualsNodeCustomView.axaml.cs | 4 -- .../DisplayValueNodeCustomView.axaml.cs | 4 -- .../StaticBooleanValueNodeCustomView.axaml.cs | 4 -- .../StaticNumericValueNodeCustomView.axaml.cs | 4 -- .../StaticSKColorValueNodeCustomView.axaml.cs | 4 -- .../StaticStringValueNodeCustomView.axaml.cs | 4 -- .../EasingFunctionNodeCustomView.axaml.cs | 4 -- .../Screens/EasingFunctionView.axaml.cs | 4 -- .../Queries/GetReleases.graphql | 2 +- 163 files changed, 91 insertions(+), 688 deletions(-) diff --git a/src/Artemis.Core/Artemis.Core.csproj.DotSettings b/src/Artemis.Core/Artemis.Core.csproj.DotSettings index 6641be310..fe32d7dc1 100644 --- a/src/Artemis.Core/Artemis.Core.csproj.DotSettings +++ b/src/Artemis.Core/Artemis.Core.csproj.DotSettings @@ -1,4 +1,5 @@ - + True True True diff --git a/src/Artemis.Core/DryIoc/ContainerExtensions.cs b/src/Artemis.Core/DryIoc/ContainerExtensions.cs index 927f606a9..b9b768c78 100644 --- a/src/Artemis.Core/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.Core/DryIoc/ContainerExtensions.cs @@ -11,12 +11,12 @@ using DryIoc; namespace Artemis.Core.DryIoc; /// -/// Provides an extension method to register services onto a DryIoc . +/// Provides an extension method to register services onto a DryIoc . /// public static class ContainerExtensions { /// - /// Registers core services into the container. + /// Registers core services into the container. /// /// The builder building the current container public static void RegisterCore(this IContainer container) @@ -37,13 +37,13 @@ public static class ContainerExtensions container.RegisterMany(storageAssembly, type => type.IsAssignableTo(), Reuse.Singleton, nonPublicServiceTypes: true); container.Register(Reuse.Singleton); - container.Register(made: Made.Of(_ => ServiceInfo.Of(), f => f.CreatePluginSettings(Arg.Index(0)), r => r.Parent.ImplementationType)); + container.Register(Made.Of(_ => ServiceInfo.Of(), f => f.CreatePluginSettings(Arg.Index(0)), r => r.Parent.ImplementationType)); container.Register(Reuse.Singleton); - container.Register(made: Made.Of(_ => ServiceInfo.Of(), f => f.CreateLogger(Arg.Index(0)), r => r.Parent.ImplementationType)); + container.Register(Made.Of(_ => ServiceInfo.Of(), f => f.CreateLogger(Arg.Index(0)), r => r.Parent.ImplementationType)); } /// - /// Registers plugin services into the container, this is typically a child container. + /// Registers plugin services into the container, this is typically a child container. /// /// The builder building the current container /// The plugin to register diff --git a/src/Artemis.Core/Events/UpdateEventArgs.cs b/src/Artemis.Core/Events/UpdateEventArgs.cs index 977e4fe91..3d8d04de5 100644 --- a/src/Artemis.Core/Events/UpdateEventArgs.cs +++ b/src/Artemis.Core/Events/UpdateEventArgs.cs @@ -13,7 +13,7 @@ public class UpdateEventArgs : EventArgs } /// - /// Gets a boolean indicating whether to silently update or not. + /// Gets a boolean indicating whether to silently update or not. /// public bool Silent { get; } } \ No newline at end of file diff --git a/src/Artemis.Core/Extensions/ProcessExtensions.cs b/src/Artemis.Core/Extensions/ProcessExtensions.cs index 27475a988..8d6e724ad 100644 --- a/src/Artemis.Core/Extensions/ProcessExtensions.cs +++ b/src/Artemis.Core/Extensions/ProcessExtensions.cs @@ -21,17 +21,17 @@ public static class ProcessExtensions { int capacity = 2000; StringBuilder builder = new(capacity); - IntPtr ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id); + nint ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id); if (!QueryFullProcessImageName(ptr, 0, builder, ref capacity)) return string.Empty; return builder.ToString(); } [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - private static extern bool QueryFullProcessImageName([In] IntPtr hProcess, [In] int dwFlags, [Out] StringBuilder lpExeName, ref int lpdwSize); + private static extern bool QueryFullProcessImageName([In] nint hProcess, [In] int dwFlags, [Out] StringBuilder lpExeName, ref int lpdwSize); [DllImport("kernel32.dll")] - private static extern IntPtr OpenProcess(ProcessAccessFlags processAccess, bool bInheritHandle, int processId); + private static extern nint OpenProcess(ProcessAccessFlags processAccess, bool bInheritHandle, int processId); [Flags] private enum ProcessAccessFlags : uint diff --git a/src/Artemis.Storage/Entities/General/ReleaseEntity.cs b/src/Artemis.Storage/Entities/General/ReleaseEntity.cs index 7c517ff79..b3f39fb64 100644 --- a/src/Artemis.Storage/Entities/General/ReleaseEntity.cs +++ b/src/Artemis.Storage/Entities/General/ReleaseEntity.cs @@ -5,7 +5,7 @@ namespace Artemis.Storage.Entities.General; public class ReleaseEntity { public Guid Id { get; set; } - + public string Version { get; set; } public DateTimeOffset? InstalledAt { get; set; } } \ No newline at end of file diff --git a/src/Artemis.Storage/Entities/Profile/LedEntity.cs b/src/Artemis.Storage/Entities/Profile/LedEntity.cs index 1b479ef69..be4536471 100644 --- a/src/Artemis.Storage/Entities/Profile/LedEntity.cs +++ b/src/Artemis.Storage/Entities/Profile/LedEntity.cs @@ -5,6 +5,11 @@ namespace Artemis.Storage.Entities.Profile; public class LedEntity { + public string LedName { get; set; } + public string DeviceIdentifier { get; set; } + + public int? PhysicalLayout { get; set; } + #region LedEntityEqualityComparer private sealed class LedEntityEqualityComparer : IEqualityComparer @@ -31,9 +36,4 @@ public class LedEntity public static IEqualityComparer LedEntityComparer { get; } = new LedEntityEqualityComparer(); #endregion - - public string LedName { get; set; } - public string DeviceIdentifier { get; set; } - - public int? PhysicalLayout { get; set; } } \ No newline at end of file diff --git a/src/Artemis.Storage/Migrations/M0021GradientNodes.cs b/src/Artemis.Storage/Migrations/M0021GradientNodes.cs index c89801fab..dba1e8956 100644 --- a/src/Artemis.Storage/Migrations/M0021GradientNodes.cs +++ b/src/Artemis.Storage/Migrations/M0021GradientNodes.cs @@ -51,7 +51,7 @@ public class M0021GradientNodes : IStorageMigration TargetType = "ColorGradient", TargetNode = gradientNode.Id, TargetPinCollectionId = -1, - TargetPinId = 0, + TargetPinId = 0 }); // Move the exit node to the right @@ -59,6 +59,18 @@ public class M0021GradientNodes : IStorageMigration exitNode.Y += 30; } + private void MigrateDataBinding(PropertyGroupEntity propertyGroup) + { + foreach (PropertyGroupEntity propertyGroupPropertyGroup in propertyGroup.PropertyGroups) + MigrateDataBinding(propertyGroupPropertyGroup); + + foreach (PropertyEntity property in propertyGroup.Properties) + { + if (property.Value.StartsWith("[{\"Color\":\"") && property.DataBinding?.NodeScript != null && property.DataBinding.IsEnabled) + MigrateDataBinding(property); + } + } + public int UserVersion => 21; public void Apply(LiteRepository repository) @@ -73,16 +85,4 @@ public class M0021GradientNodes : IStorageMigration repository.Update(profileEntity); } } - - private void MigrateDataBinding(PropertyGroupEntity propertyGroup) - { - foreach (PropertyGroupEntity propertyGroupPropertyGroup in propertyGroup.PropertyGroups) - MigrateDataBinding(propertyGroupPropertyGroup); - - foreach (PropertyEntity property in propertyGroup.Properties) - { - if (property.Value.StartsWith("[{\"Color\":\"") && property.DataBinding?.NodeScript != null && property.DataBinding.IsEnabled) - MigrateDataBinding(property); - } - } } \ No newline at end of file diff --git a/src/Artemis.Storage/Migrations/M0022TransitionNodes.cs b/src/Artemis.Storage/Migrations/M0022TransitionNodes.cs index 5341371da..3258a6d10 100644 --- a/src/Artemis.Storage/Migrations/M0022TransitionNodes.cs +++ b/src/Artemis.Storage/Migrations/M0022TransitionNodes.cs @@ -22,7 +22,7 @@ public class M0022TransitionNodes : IStorageMigration else if (node.Type == "ColorGradientEasingNode") node.Type = "ColorGradientTransitionNode"; else if (node.Type == "SKColorEasingNode") - node.Type = "SKColorTransitionNode"; + node.Type = "SKColorTransitionNode"; else if (node.Type == "EasingTypeNode") node.Type = "EasingFunctionNode"; } diff --git a/src/Artemis.Storage/Repositories/QueuedActionRepository.cs b/src/Artemis.Storage/Repositories/QueuedActionRepository.cs index f5c83cd0e..cf2bc862d 100644 --- a/src/Artemis.Storage/Repositories/QueuedActionRepository.cs +++ b/src/Artemis.Storage/Repositories/QueuedActionRepository.cs @@ -46,7 +46,7 @@ public class QueuedActionRepository : IQueuedActionRepository { return _repository.Query().Where(q => q.Type == type).Count() > 0; } - + /// public void ClearByType(string type) { diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj.DotSettings b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj.DotSettings index 22557dc59..4dc50ad43 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj.DotSettings +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj.DotSettings @@ -1,4 +1,5 @@ - + True True True diff --git a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs index 04aa74a0d..3a0f2eab1 100644 --- a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs @@ -93,11 +93,6 @@ public partial class ArtemisIcon : UserControl disposable.Dispose(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - #region Properties /// diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs index d2737744f..397a50d33 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs @@ -179,11 +179,6 @@ public partial class DraggableNumberBox : UserControl FocusManager.Instance?.Focus(Parent as IInputElement); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - private void OnPointerPressed(object? sender, PointerPressedEventArgs e) { PointerPoint point = e.GetCurrentPoint(this); diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs index 3048f239b..93c669e24 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs @@ -47,11 +47,6 @@ public partial class EnumComboBox : UserControl } } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - private void OnSelectionChanged(object? sender, SelectionChangedEventArgs e) { if (_enumComboBox == null || _enumComboBox.SelectedIndex == -1) diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs index e9e2ce0b3..45480fcc3 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs @@ -68,11 +68,6 @@ public partial class HotkeyBox : UserControl _displayTextBox.CaretIndex = _displayTextBox.Text?.Length ?? 0; } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - private void Button_OnClick(object? sender, RoutedEventArgs e) { Hotkey = null; diff --git a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs index 5313522d9..4dd0711ba 100644 --- a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs @@ -79,11 +79,6 @@ public partial class ProfileConfigurationIcon : UserControl, IDisposable }; } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - private void OnDetachedFromLogicalTree(object? sender, LogicalTreeAttachmentEventArgs e) { if (ConfigurationIcon != null) diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs index 685f6eade..2980cf877 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml.cs @@ -15,9 +15,4 @@ public partial class DefaultDataModelDisplayView : UserControl { InitializeComponent(); } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs index 4951fcc44..57a8c867a 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml.cs @@ -17,8 +17,4 @@ public partial class SKColorDataModelDisplayView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs index 8b6fe08d7..9aca2bcf9 100644 --- a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs +++ b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml.cs @@ -14,8 +14,4 @@ internal partial class ExceptionDialogView : ReactiveWindow - - + + - - - + + + + VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" + IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}" + AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"> + VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> + Text="{TemplateBinding Text, Mode=TwoWay}" + CaretIndex="{TemplateBinding CaretIndex}" + SelectionStart="{TemplateBinding SelectionStart}" + SelectionEnd="{TemplateBinding SelectionEnd}" + TextAlignment="{TemplateBinding TextAlignment}" + TextWrapping="{TemplateBinding TextWrapping}" + LineHeight="{TemplateBinding LineHeight}" + PasswordChar="{TemplateBinding PasswordChar}" + RevealPassword="{TemplateBinding RevealPassword}" + SelectionBrush="{TemplateBinding SelectionBrush}" + SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}" + CaretBrush="{TemplateBinding CaretBrush}" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> diff --git a/src/Artemis.UI/Artemis.UI.csproj.DotSettings b/src/Artemis.UI/Artemis.UI.csproj.DotSettings index 9b01cf388..e73de0af9 100644 --- a/src/Artemis.UI/Artemis.UI.csproj.DotSettings +++ b/src/Artemis.UI/Artemis.UI.csproj.DotSettings @@ -1,4 +1,5 @@ - + True True True diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs index bc6e253bb..66e0f8f66 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.axaml.cs @@ -10,8 +10,4 @@ public partial class BoolPropertyInputView : ReactiveUserControl ViewModel?.Unfocused(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs index b201fca80..6b7f58b7f 100644 --- a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs @@ -29,10 +29,6 @@ public partial class DebugView : ReactiveAppWindow }); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void DeviceVisualizer_OnLedClicked(object? sender, LedClickedEventArgs e) { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs index 11ae2e1e1..dd39a5f8d 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs @@ -10,8 +10,4 @@ public partial class DataModelDebugView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } protected override void OnInitialized() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs index 230f1b7bb..27f98c36e 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs @@ -10,8 +10,4 @@ public partial class PerformanceDebugPluginView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs index 2f0e76a86..56c8ec8de 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs @@ -10,8 +10,4 @@ public partial class PerformanceDebugProfilerView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs index 9f5da4e78..0c91c2bbb 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs @@ -10,8 +10,4 @@ public partial class PerformanceDebugView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs index e9eddd054..f0ba0577a 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs @@ -10,8 +10,4 @@ public partial class DebugSettingsView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs index 4b8efec20..5186027b4 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs @@ -10,8 +10,4 @@ public partial class PluginPrerequisitesInstallDialogView : ReactiveUserControl< InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs index 83ede62ab..6ea72f1da 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs @@ -10,8 +10,4 @@ public partial class PluginPrerequisitesUninstallDialogView : ReactiveUserContro InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs index 5f032736e..7f21c9ce0 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs @@ -10,8 +10,4 @@ public partial class PluginFeatureView : ReactiveUserControl EnabledToggle.Click += EnabledToggleOnClick; } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void EnabledToggleOnClick(object? sender, RoutedEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs index d9875515d..20c9a7452 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs @@ -10,8 +10,4 @@ public partial class AlwaysOnConditionView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs index c4a74eed0..2240a63ea 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs @@ -10,8 +10,4 @@ public partial class EventConditionView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void MenuBase_OnMenuClosed(object? sender, RoutedEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs index 0c3cec9a2..06a684191 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs @@ -10,8 +10,4 @@ public partial class PlaybackView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs index bb65355de..68e0563e8 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs @@ -10,8 +10,4 @@ public partial class CategoryAdaptionHintView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs index 68ab025ba..bc64fa3e6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs @@ -10,8 +10,4 @@ public partial class DeviceAdaptionHintView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs index e7db0abdd..df0eb98f7 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs @@ -10,8 +10,4 @@ public partial class KeyboardSectionAdaptionHintView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs index a406a063c..c7703fe65 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs @@ -14,8 +14,4 @@ public partial class LayerHintsDialogView : ReactiveAppWindow _dragAdorner.RenderTransform = new TranslateTransform(_dragStartPosition.X - _elementDragOffset.X, position.Y - _elementDragOffset.Y); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void ProfileTreeView_OnSelectionChanged(object? sender, SelectionChangedEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs index 2888b4271..f0d5a3e71 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs @@ -10,8 +10,4 @@ public partial class DataBindingView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs index 40782dd0d..89a8aab4c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs @@ -13,10 +13,6 @@ public partial class AddEffectView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs index 72e19028c..aa499ec9d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs @@ -10,8 +10,4 @@ public partial class TimelineSegmentEditView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void ApplyTransition(bool enable) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs index 3f44be6ea..5aa75d59c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs @@ -10,8 +10,4 @@ public partial class TimelineEasingView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs index 307b8bc43..cebade11d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs @@ -30,10 +30,6 @@ public partial class TimelineKeyframeView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void KeyframeDragAnchor_OnPointerPressed(object? sender, PointerPressedEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs index db6cb5928..4923e2def 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs @@ -13,10 +13,6 @@ public partial class MainSegmentView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void KeyframeDragAnchor_OnPointerPressed(object? sender, PointerPressedEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs index 2f567292c..231a80b51 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs @@ -13,10 +13,6 @@ public partial class StartSegmentView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void SelectionRectangle_OnSelectionFinished(object? sender, SelectionRectangleEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs index 8b8cb3d54..19972807c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs @@ -27,8 +27,4 @@ public partial class LayerEffectRenameView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs index ce31aec8d..0a42de288 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs @@ -23,10 +23,6 @@ public partial class TreePropertyView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs index 77d850ec2..c7399853d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs @@ -13,10 +13,6 @@ public partial class SelectionAddToolView : ReactiveUserControl ViewModel.WhenAnyValue(vm => vm.Selected).Subscribe(_ => UpdateStrokeThickness()).DisposeWith(d)); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } #region Overrides of TemplatedControl diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs index 6882addb0..71567cf66 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerView.axaml.cs @@ -17,10 +17,6 @@ public partial class LayerVisualizerView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Root/SplashView.axaml.cs b/src/Artemis.UI/Screens/Root/SplashView.axaml.cs index 954265d1d..cc54a133c 100644 --- a/src/Artemis.UI/Screens/Root/SplashView.axaml.cs +++ b/src/Artemis.UI/Screens/Root/SplashView.axaml.cs @@ -25,8 +25,4 @@ public partial class SplashView : ReactiveWindow }); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs index 56dc931c5..801279422 100644 --- a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs @@ -10,8 +10,4 @@ public partial class ScriptConfigurationCreateView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs index 27f8c0075..0450a4417 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs @@ -10,8 +10,4 @@ public partial class AboutTabView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs index a5031d9f6..cc8949831 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs @@ -10,8 +10,4 @@ public partial class DevicesTabView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs index 4b1c2b693..d94e90eae 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs @@ -10,8 +10,4 @@ public partial class GeneralTabView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml index 5e150f25e..06a0deb5b 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml @@ -14,7 +14,7 @@ - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs index b5428a68a..555c1c1c2 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs @@ -10,8 +10,4 @@ public partial class PluginsTabView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs index 7d0304e75..b1a6bbeaa 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs @@ -10,8 +10,4 @@ public partial class ReleasesTabView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs index d4670e37b..64c2af738 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs @@ -11,10 +11,6 @@ public partial class ReleaseView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { diff --git a/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs index d29132e7e..a9447050f 100644 --- a/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs @@ -13,8 +13,4 @@ public partial class SidebarCategoryEditView : ReactiveUserControl this.ClearAllDataValidationErrors()); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs index 6e404be76..17a674bb7 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs @@ -10,8 +10,4 @@ public partial class ModuleActivationRequirementView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs index 1e6d7b00f..094e16d39 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs @@ -21,10 +21,6 @@ public partial class StartupWizardView : ReactiveAppWindow ViewModel.WhenAnyValue(vm => vm.CurrentStep).Subscribe(ApplyCurrentStep).DisposeWith(d)); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void ApplyCurrentStep(int step) { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs index d385e9452..2e8e356fc 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs @@ -10,8 +10,4 @@ public partial class DevicesStep : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs index aed3014f1..536f71cd1 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs @@ -10,8 +10,4 @@ public partial class FinishStep : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs index dae2f4bec..cf318b584 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs @@ -10,8 +10,4 @@ public partial class LayoutStep : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs index 343b11526..cb34b052e 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs @@ -10,8 +10,4 @@ public partial class SettingsStep : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs index 8a2ed216c..3fb6b20af 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs @@ -10,8 +10,4 @@ public partial class WelcomeStep : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs index 878e3ad91..ffc3421bf 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs @@ -10,8 +10,4 @@ public partial class ListDeviceView : UserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs index ec1653427..886c6818a 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs @@ -16,10 +16,6 @@ public partial class SurfaceDeviceView : ReactiveUserControl }); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void Update(bool from) { diff --git a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs index e88dca567..8ba56ea89 100644 --- a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs @@ -26,10 +26,6 @@ public partial class DragCableView : ReactiveUserControl }); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void Update() { diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs index fcaf66d43..ce2413a3c 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs @@ -24,10 +24,6 @@ public partial class NodePickerView : ReactiveUserControl }); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs index 4aa41de65..47fa01493 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs @@ -23,26 +23,26 @@ public partial class NodeScriptView : ReactiveUserControl { InitializeComponent(); - // NodeScriptZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; - // UpdateZoomBorderBackground(); - // - // NodeScriptZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - // NodeScriptZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - // NodeScriptZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - // - // this.WhenActivated(d => - // { - // ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested; - // ViewModel.PickerPositionSubject.Subscribe(ShowPickerAt).DisposeWith(d); - // if (ViewModel.IsPreview) - // { - // BoundsProperty.Changed.Subscribe(BoundsPropertyChanged).DisposeWith(d); - // ViewModel.NodeViewModels.ToObservableChangeSet().Subscribe(_ => AutoFitIfPreview()).DisposeWith(d); - // } - // - // Dispatcher.UIThread.InvokeAsync(() => AutoFit(true), DispatcherPriority.ContextIdle); - // Disposable.Create(() => ViewModel.AutoFitRequested -= ViewModelOnAutoFitRequested).DisposeWith(d); - // }); + NodeScriptZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + UpdateZoomBorderBackground(); + + NodeScriptZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + NodeScriptZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + NodeScriptZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + + this.WhenActivated(d => + { + ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested; + ViewModel.PickerPositionSubject.Subscribe(ShowPickerAt).DisposeWith(d); + if (ViewModel.IsPreview) + { + BoundsProperty.Changed.Subscribe(BoundsPropertyChanged).DisposeWith(d); + ViewModel.NodeViewModels.ToObservableChangeSet().Subscribe(_ => AutoFitIfPreview()).DisposeWith(d); + } + + Dispatcher.UIThread.InvokeAsync(() => AutoFit(true), DispatcherPriority.ContextIdle); + Disposable.Create(() => ViewModel.AutoFitRequested -= ViewModelOnAutoFitRequested).DisposeWith(d); + }); } protected override Size MeasureOverride(Size availableSize) @@ -130,10 +130,6 @@ public partial class NodeScriptView : ReactiveUserControl visualBrush.DestinationRect = new RelativeRect(NodeScriptZoomBorder.OffsetX * -1, NodeScriptZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e) { diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs index a5ad7196d..c58c4eade 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs @@ -14,8 +14,4 @@ public partial class NodeScriptWindowView : ReactiveAppWindow #endregion - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs index f7f3359c2..f23901ca1 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs @@ -10,8 +10,4 @@ public partial class InputPinCollectionView : ReactiveUserControl("PinPoint")); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void PinContainer_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs index bb9a4a73d..765a43cfe 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs @@ -10,8 +10,4 @@ public partial class OutputPinCollectionView : ReactiveUserControl("PinPoint")); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } private void PinContainer_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { diff --git a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs index 7f8fac500..c875bd294 100644 --- a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs +++ b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs @@ -10,8 +10,4 @@ public partial class WorkshopView : ReactiveUserControl InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } } \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs b/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs index b83bc475e..ec578cde5 100644 --- a/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs +++ b/src/Artemis.VisualScripting/Nodes/Color/Screens/ColorGradientNodeCustomView.axaml.cs @@ -11,10 +11,6 @@ public partial class ColorGradientNodeCustomView : ReactiveUserControl Date: Fri, 31 Mar 2023 23:23:18 +0200 Subject: [PATCH 05/18] Fixed Windows input provider, Vulkan and logging --- .../DryIoc/ContainerExtensions.cs | 2 +- .../Providers/Input/WindowsInputProvider.cs | 47 +++++++++----- .../SkiaSharp/Vulkan/Win32VkContext.cs | 12 ++-- src/Artemis.UI/Artemis.UI.csproj | 1 - .../Screens/Debugger/DebugView.axaml | 1 - .../Debugger/Tabs/Logs/LogsDebugView.axaml | 18 +----- .../Debugger/Tabs/Logs/LogsDebugView.axaml.cs | 63 +++++++++++-------- .../Debugger/Tabs/Logs/LogsDebugViewModel.cs | 62 +++++++++--------- 8 files changed, 110 insertions(+), 96 deletions(-) diff --git a/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs index de6fb01df..337e21744 100644 --- a/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Windows/DryIoc/ContainerExtensions.cs @@ -20,7 +20,7 @@ public static class UIContainerExtensions public static void RegisterProviders(this IContainer container) { container.Register(Reuse.Singleton); - // container.Register(Reuse.Singleton); + container.Register(Reuse.Singleton); container.Register(); container.Register(serviceKey: WindowsInputProvider.Id); container.Register(); diff --git a/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs b/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs index cd3004b69..b34201da2 100644 --- a/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs +++ b/src/Artemis.UI.Windows/Providers/Input/WindowsInputProvider.cs @@ -5,7 +5,7 @@ using System.Timers; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Windows.Utilities; -using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Controls.Platform; using Avalonia.Platform; using Linearstar.Windows.RawInput; using Linearstar.Windows.RawInput.Native; @@ -15,35 +15,43 @@ namespace Artemis.UI.Windows.Providers.Input; public class WindowsInputProvider : InputProvider { + private const int GWL_WNDPROC = -4; private const int WM_INPUT = 0x00FF; + private readonly IWindowImpl _window; + private readonly nint _hWndProcHook; + private readonly WndProc? _fnWndProcHook; private readonly IInputService _inputService; private readonly ILogger _logger; private readonly Timer _taskManagerTimer; + private int _lastProcessId; + delegate nint WndProc(nint hWnd, uint msg, nint wParam, nint lParam); + + private nint CustomWndProc(nint hWnd, uint msg, nint wParam, nint lParam) + { + OnWndProcCalled(hWnd, msg, wParam, lParam); + return CallWindowProc(_hWndProcHook, hWnd, msg, wParam, lParam); + } public WindowsInputProvider(ILogger logger, IInputService inputService) { _logger = logger; _inputService = inputService; - + _taskManagerTimer = new Timer(500); _taskManagerTimer.Elapsed += TaskManagerTimerOnElapsed; _taskManagerTimer.Start(); - // if (Avalonia.Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - // { - // IWindowImpl window = desktop.MainWindow!.PlatformImpl!; - // - // // https://github.com/sanjay900/guitar-configurator/blob/master/Notify/WindowsDeviceNotifierAvalonia.cs - // // _hWndProcHook = GetWindowLongPtr(window.Handle.Handle, GwlWndproc); - // // _fnWndProcHook = CustomWndProc; - // // var newLong = Marshal.GetFunctionPointerForDelegate(_fnWndProcHook); - // // SetWindowLongPtr(window.Handle.Handle, GwlWndproc, newLong); - // - // RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, window.Handle.Handle); - // RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, window.Handle.Handle); - // } + _window = PlatformManager.CreateWindow(); + + _hWndProcHook = GetWindowLongPtr(_window.Handle.Handle, GWL_WNDPROC); + _fnWndProcHook = CustomWndProc; + nint newLong = Marshal.GetFunctionPointerForDelegate(_fnWndProcHook); + SetWindowLongPtr(_window.Handle.Handle, GWL_WNDPROC, newLong); + + RawInputDevice.RegisterDevice(HidUsageAndPage.Keyboard, RawInputDeviceFlags.InputSink, _window.Handle.Handle); + RawInputDevice.RegisterDevice(HidUsageAndPage.Mouse, RawInputDeviceFlags.InputSink, _window.Handle.Handle); } public static Guid Id { get; } = new("6737b204-ffb1-4cd9-8776-9fb851db303a"); @@ -256,6 +264,15 @@ public class WindowsInputProvider : InputProvider #region Native + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + static extern IntPtr CallWindowProc(nint lpPrevWndFunc, IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr", CharSet = CharSet.Unicode)] + private static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex); + + [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", CharSet = CharSet.Unicode)] + private static extern IntPtr SetWindowLongPtr(nint hWnd, int nIndex, IntPtr dwNewLong); + [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool GetCursorPos(ref Win32Point pt); diff --git a/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs b/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs index 01a2f92d2..7ebb48a16 100644 --- a/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs +++ b/src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs @@ -1,7 +1,7 @@ using System; using System.Linq; -using Avalonia.Controls; -using Avalonia.Win32; +using Avalonia.Controls.Platform; +using Avalonia.Platform; using SharpVk; using SharpVk.Khronos; @@ -11,10 +11,10 @@ internal sealed class Win32VkContext : VkContext { public Win32VkContext() { - Window = new Window(); + Window = PlatformManager.CreateWindow(); Instance = Instance.Create(null, new[] {"VK_KHR_surface", "VK_KHR_win32_surface"}); PhysicalDevice = Instance.EnumeratePhysicalDevices().First(); - Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.PlatformImpl!.Handle.Handle); + Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.Handle.Handle); (GraphicsFamily, PresentFamily) = FindQueueFamilies(); @@ -44,12 +44,12 @@ internal sealed class Win32VkContext : VkContext }; } - public Window Window { get; } + public IWindowImpl Window { get; } public override void Dispose() { base.Dispose(); - Window.Close(); + Window.Dispose(); } private IntPtr Proc(string name, IntPtr instanceHandle, IntPtr deviceHandle) diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index cffb4d57c..f1fc2ee93 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -16,7 +16,6 @@ - diff --git a/src/Artemis.UI/Screens/Debugger/DebugView.axaml b/src/Artemis.UI/Screens/Debugger/DebugView.axaml index 2bc369cab..26097641e 100644 --- a/src/Artemis.UI/Screens/Debugger/DebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/DebugView.axaml @@ -16,7 +16,6 @@ Height="800"> - diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml index bffe6621c..5a5c6d457 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml @@ -8,19 +8,7 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.Debugger.Logs.LogsDebugView" x:DataType="logs:LogsDebugViewModel"> - - - - - - + + + \ No newline at end of file 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 d6cf4bda3..219215877 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml.cs @@ -1,7 +1,10 @@ using System; +using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using Avalonia.Threading; +using ReactiveUI; +using Serilog; namespace Artemis.UI.Screens.Debugger.Logs; @@ -19,36 +22,42 @@ public partial class LogsDebugView : ReactiveUserControl protected override void OnInitialized() { base.OnInitialized(); - Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); + Dispatcher.UIThread.Post(() => LogsScrollViewer.ScrollToEnd(), DispatcherPriority.ApplicationIdle); } - private void OnTextChanged(object? sender, EventArgs e) + // private void OnTextChanged(object? sender, EventArgs e) + // { + // if (LogTextEditor.ExtentHeight == 0) + // return; + // + // int linesAdded = LogTextEditor.LineCount - _lineCount; + // double lineHeight = LogTextEditor.ExtentHeight / LogTextEditor.LineCount; + // double outOfScreenTextHeight = LogTextEditor.ExtentHeight - LogTextEditor.VerticalOffset - LogTextEditor.ViewportHeight; + // double outOfScreenLines = outOfScreenTextHeight / lineHeight; + // + // //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 GRACE_DISTANCE = 1d; + // + // //if we were at the bottom of the log and + // //if the last log event was 5 lines long + // //we will be 5 lines out sync. + // //if this is the case, scroll down. + // + // //if we are more than that out of sync, + // //the user scrolled up and we should not + // //mess with anything. + // if (_lineCount == 0 || linesAdded + GRACE_DISTANCE > outOfScreenLines) + // { + // Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); + // _lineCount = LogTextEditor.LineCount; + // } + // } + private void Control_OnSizeChanged(object? sender, SizeChangedEventArgs e) { - if (LogTextEditor.ExtentHeight == 0) + if (!(LogsScrollViewer.Extent.Height - LogsScrollViewer.Offset.Y - LogsScrollViewer.Bounds.Bottom <= 60)) return; - - int linesAdded = LogTextEditor.LineCount - _lineCount; - double lineHeight = LogTextEditor.ExtentHeight / LogTextEditor.LineCount; - double outOfScreenTextHeight = LogTextEditor.ExtentHeight - LogTextEditor.VerticalOffset - LogTextEditor.ViewportHeight; - double outOfScreenLines = outOfScreenTextHeight / lineHeight; - - //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 GRACE_DISTANCE = 1d; - - //if we were at the bottom of the log and - //if the last log event was 5 lines long - //we will be 5 lines out sync. - //if this is the case, scroll down. - - //if we are more than that out of sync, - //the user scrolled up and we should not - //mess with anything. - if (_lineCount == 0 || linesAdded + GRACE_DISTANCE > outOfScreenLines) - { - Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); - _lineCount = LogTextEditor.LineCount; - } + Dispatcher.UIThread.Post(() => LogsScrollViewer.ScrollToEnd(), DispatcherPriority.Normal); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugViewModel.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugViewModel.cs index c1860b01a..4df1be54e 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugViewModel.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugViewModel.cs @@ -1,12 +1,15 @@ -using Artemis.Core; +using System; +using System.Collections.ObjectModel; +using Artemis.Core; using Artemis.UI.Shared; using Avalonia.Threading; -using AvaloniaEdit.Document; using ReactiveUI; using Serilog.Events; using Serilog.Formatting.Display; using System.IO; using System.Reactive.Disposables; +using Avalonia.Controls.Documents; +using Avalonia.Media; namespace Artemis.UI.Screens.Debugger.Logs; @@ -14,38 +17,32 @@ public class LogsDebugViewModel : ActivatableViewModelBase { private readonly MessageTemplateTextFormatter _formatter; - public TextDocument Document { get; } + public InlineCollection Lines { get; } = new InlineCollection(); private const int MAX_ENTRIES = 1000; - + public LogsDebugViewModel() { DisplayName = "Logs"; - Document = new TextDocument(); + _formatter = new MessageTemplateTextFormatter( "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff}] [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}" ); - foreach(LogEvent logEvent in LogStore.Events) + foreach (LogEvent logEvent in LogStore.Events) AddLogEvent(logEvent); - + this.WhenActivated(disp => - { + { LogStore.EventAdded += OnLogEventAdded; - Disposable.Create(() => - { - LogStore.EventAdded -= OnLogEventAdded; - }).DisposeWith(disp); + Disposable.Create(() => { LogStore.EventAdded -= OnLogEventAdded; }).DisposeWith(disp); }); } private void OnLogEventAdded(object? sender, LogEventEventArgs e) { - Dispatcher.UIThread.Post(() => - { - AddLogEvent(e.LogEvent); - }); + Dispatcher.UIThread.Post(() => { AddLogEvent(e.LogEvent); }); } private void AddLogEvent(LogEvent? logEvent) @@ -56,22 +53,27 @@ public class LogsDebugViewModel : ActivatableViewModelBase using StringWriter writer = new(); _formatter.Format(logEvent, writer); string line = writer.ToString(); - Document.Insert(Document.TextLength, '\n' + line.TrimEnd('\r', '\n')); - while (Document.LineCount > MAX_ENTRIES) - RemoveOldestLine(); + + + Lines.Add(new Run(line.TrimEnd('\r', '\n') + '\n') + { + Foreground = logEvent.Level switch + { + LogEventLevel.Verbose => new SolidColorBrush(Colors.White), + LogEventLevel.Debug => new SolidColorBrush(Color.FromRgb(216, 216, 216)), + LogEventLevel.Information => new SolidColorBrush(Color.FromRgb(93, 201, 255)), + LogEventLevel.Warning => new SolidColorBrush(Color.FromRgb(255, 177, 53)), + LogEventLevel.Error => new SolidColorBrush(Color.FromRgb(255, 63, 63)), + LogEventLevel.Fatal => new SolidColorBrush(Colors.Red), + _ => throw new ArgumentOutOfRangeException() + } + }); + LimitLines(); } - private void RemoveOldestLine() + private void LimitLines() { - int firstNewLine = Document.IndexOf('\n', 0, Document.TextLength); - if (firstNewLine == -1) - { - //this should never happen. - //just in case let's return - //instead of throwing - return; - } - - Document.Remove(0, firstNewLine + 1); + if (Lines.Count > MAX_ENTRIES) + Lines.RemoveRange(0, Lines.Count - MAX_ENTRIES); } } \ No newline at end of file From 82b41425aa253cee75033efbdc832e7bde8410da Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 2 Apr 2023 10:40:54 +0200 Subject: [PATCH 06/18] Fixed custom controls not responding to changes, fixed title bar interaciton --- .github/workflows/master.yml | 2 +- .../Controls/ArtemisIcon.axaml.cs | 19 ++++++------ .../Controls/DeviceVisualizer.cs | 26 +++++++++------- .../Controls/DraggableNumberBox.axaml | 2 +- .../Controls/DraggableNumberBox.axaml.cs | 31 ++++++++++--------- .../Controls/EnumComboBox.axaml.cs | 17 ++++++---- .../Controls/GradientPicker/GradientPicker.cs | 14 ++++++--- .../GradientPicker/GradientPickerButton.cs | 18 ++++++++--- .../Controls/HotkeyBox.axaml.cs | 27 ++++++++-------- .../Controls/SelectionRectangle.cs | 14 ++++++--- src/Artemis.UI.Shared/Styles/Border.axaml | 9 +----- .../SKColorPropertyInputView.axaml | 8 +++-- src/Artemis.UI/MainWindow.axaml | 15 +++++++-- src/Artemis.UI/MainWindow.axaml.cs | 22 ++++--------- .../VisualEditor/VisualEditorView.axaml | 6 +--- .../ProfileEditorTitleBarView.axaml | 19 +++++++----- .../Screens/Root/DefaultTitleBarView.axaml | 3 +- .../Screens/Sidebar/SidebarView.axaml | 4 +-- .../Screens/Workshop/WorkshopView.axaml | 3 +- src/Artemis.UI/Styles/Artemis.axaml | 2 +- 20 files changed, 141 insertions(+), 120 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index f7378dab7..36d37e0d3 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -58,7 +58,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: '6.0.x' + dotnet-version: '7.0.x' - name: Publish Artemis run: dotnet publish --configuration Release -p:Version=${{ needs.version.outputs.version-number }} --runtime ${{ matrix.rid }} --output build/${{ matrix.rid }} --self-contained Artemis/src/Artemis.UI.${{ matrix.csproj }}/Artemis.UI.${{ matrix.csproj }}.csproj - name: Publish Plugins diff --git a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs index 3a0f2eab1..e403d0c93 100644 --- a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs @@ -28,6 +28,7 @@ public partial class ArtemisIcon : UserControl InitializeComponent(); DetachedFromLogicalTree += OnDetachedFromLogicalTree; LayoutUpdated += OnLayoutUpdated; + PropertyChanged += OnPropertyChanged; } private void Update() @@ -86,6 +87,12 @@ public partial class ArtemisIcon : UserControl contentControl.Height = Bounds.Height; } } + + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == IconProperty || e.Property == FillProperty) + Update(); + } private void OnDetachedFromLogicalTree(object? sender, LogicalTreeAttachmentEventArgs e) { @@ -109,11 +116,7 @@ public partial class ArtemisIcon : UserControl public object? Icon { get => GetValue(IconProperty); - set - { - SetValue(IconProperty, value); - Update(); - } + set => SetValue(IconProperty, value); } /// @@ -129,11 +132,7 @@ public partial class ArtemisIcon : UserControl public bool Fill { get => GetValue(FillProperty); - set - { - SetValue(FillProperty, value); - Update(); - } + set => SetValue(FillProperty, value); } #endregion diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index b995da975..eeea0fab8 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -38,12 +38,14 @@ public class DeviceVisualizer : Control _deviceVisualizerLeds = new List(); PointerReleased += OnPointerReleased; + PropertyChanged += OnPropertyChanged; } + /// public override void Render(DrawingContext drawingContext) { - if (Device == null) + if (Device == null || _deviceBounds.Width == 0 || _deviceBounds.Height == 0) return; // Determine the scale required to fit the desired size of the control @@ -54,11 +56,11 @@ public class DeviceVisualizer : Control { // Scale the visualization in the desired bounding box if (Bounds.Width > 0 && Bounds.Height > 0) - boundsPush = drawingContext.PushPreTransform(Matrix.CreateScale(scale, scale)); + boundsPush = drawingContext.PushTransform(Matrix.CreateScale(scale, scale)); // Apply device rotation - using DrawingContext.PushedState translationPush = drawingContext.PushPreTransform(Matrix.CreateTranslation(0 - _deviceBounds.Left, 0 - _deviceBounds.Top)); - using DrawingContext.PushedState rotationPush = drawingContext.PushPreTransform(Matrix.CreateRotation(Matrix.ToRadians(Device.Rotation))); + using DrawingContext.PushedState translationPush = drawingContext.PushTransform(Matrix.CreateTranslation(0 - _deviceBounds.Left, 0 - _deviceBounds.Top)); + using DrawingContext.PushedState rotationPush = drawingContext.PushTransform(Matrix.CreateRotation(Matrix.ToRadians(Device.Rotation))); // Render device and LED images if (_deviceImage != null) @@ -75,7 +77,7 @@ public class DeviceVisualizer : Control lock (_deviceVisualizerLeds) { // Apply device scale - using DrawingContext.PushedState scalePush = drawingContext.PushPreTransform(Matrix.CreateScale(Device.Scale, Device.Scale)); + using DrawingContext.PushedState scalePush = drawingContext.PushTransform(Matrix.CreateScale(Device.Scale, Device.Scale)); foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds) deviceVisualizerLed.RenderGeometry(drawingContext, false); } @@ -152,6 +154,12 @@ public class DeviceVisualizer : Control OnClicked(e); } + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == DeviceProperty) + SetupForDevice(); + } + private void DevicePropertyChanged(object? sender, PropertyChangedEventArgs e) { Dispatcher.UIThread.Post(SetupForDevice, DispatcherPriority.Background); @@ -169,18 +177,14 @@ public class DeviceVisualizer : Control /// public static readonly StyledProperty DeviceProperty = AvaloniaProperty.Register(nameof(Device)); - + /// /// Gets or sets the to display /// public ArtemisDevice? Device { get => GetValue(DeviceProperty); - set - { - SetValue(DeviceProperty, value); - SetupForDevice(); - } + set => SetValue(DeviceProperty, value); } /// diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml index d480b0c51..3edd26150 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml @@ -23,7 +23,7 @@ - GetValue(ValueProperty); - set - { - SetValue(ValueProperty, value); - SetNumberBoxValue(value); - } + set => SetValue(ValueProperty, value); } /// @@ -165,11 +162,11 @@ public partial class DraggableNumberBox : UserControl private void SetNumberBoxValue(double value) { - if (!(Math.Abs(NumberBox.Value - Value) > 0.00001)) + if (!(Math.Abs(InnerNumberBox.Value - Value) > 0.00001)) return; _updating = true; - NumberBox.Value = Value; + InnerNumberBox.Value = Value; _updating = false; } @@ -182,7 +179,7 @@ public partial class DraggableNumberBox : UserControl private void OnPointerPressed(object? sender, PointerPressedEventArgs e) { PointerPoint point = e.GetCurrentPoint(this); - _inputTextBox = NumberBox.FindDescendantOfType(); + _inputTextBox = InnerNumberBox.FindDescendantOfType(); _moved = false; _startX = point.Position.X; _lastX = point.Position.X; @@ -246,6 +243,12 @@ public partial class DraggableNumberBox : UserControl e.Handled = true; } + + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == ValueProperty) + SetNumberBoxValue(Value); + } private void NumberBox_OnValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args) { @@ -254,17 +257,17 @@ public partial class DraggableNumberBox : UserControl if (args.NewValue < Minimum) { - NumberBox.Value = Minimum; + InnerNumberBox.Value = Minimum; return; } if (args.NewValue > Maximum) { - NumberBox.Value = Maximum; + InnerNumberBox.Value = Maximum; return; } - if (Math.Abs(Value - NumberBox.Value) > 0.00001) - Value = NumberBox.Value; + if (Math.Abs(Value - InnerNumberBox.Value) > 0.00001) + Value = InnerNumberBox.Value; } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs index 93c669e24..ff2869519 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs @@ -30,21 +30,26 @@ public partial class EnumComboBox : UserControl /// public EnumComboBox() { + PropertyChanged += OnPropertyChanged; InitializeComponent(); } + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == ValueProperty) + { + UpdateValues(); + UpdateSelection(); + } + } + /// /// Gets or sets the currently selected value /// public object? Value { get => GetValue(ValueProperty); - set - { - SetValue(ValueProperty, value); - UpdateValues(); - UpdateSelection(); - } + set => SetValue(ValueProperty, value); } private void OnSelectionChanged(object? sender, SelectionChangedEventArgs e) diff --git a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs index 7edb8e13b..11215c7f0 100644 --- a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs +++ b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPicker.cs @@ -94,6 +94,8 @@ public class GradientPicker : TemplatedControl SelectedColorStop = EditingColorGradient.ElementAtOrDefault(index); }); + + PropertyChanged += OnPropertyChanged; } /// @@ -102,11 +104,7 @@ public class GradientPicker : TemplatedControl public ColorGradient ColorGradient { get => GetValue(ColorGradientProperty); - set - { - SetValue(ColorGradientProperty, value); - ApplyToField(); - } + set => SetValue(ColorGradientProperty, value); } /// @@ -342,4 +340,10 @@ public class GradientPicker : TemplatedControl EditingColorGradient.Randomize(6); SelectedColorStop = EditingColorGradient.First(); } + + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == ColorGradientProperty) + ApplyToField(); + } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs index 4938f59ec..407f7ed11 100644 --- a/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs +++ b/src/Artemis.UI.Shared/Controls/GradientPicker/GradientPickerButton.cs @@ -47,17 +47,19 @@ public class GradientPickerButton : TemplatedControl private Button? _button; private ColorGradient? _lastColorGradient; + /// + public GradientPickerButton() + { + PropertyChanged += OnPropertyChanged; + } + /// /// Gets or sets the color gradient. /// public ColorGradient? ColorGradient { get => GetValue(ColorGradientProperty); - set - { - SetValue(ColorGradientProperty, value); - Subscribe(); - } + set => SetValue(ColorGradientProperty, value); } /// @@ -175,6 +177,12 @@ public class GradientPickerButton : TemplatedControl LinearGradientBrush.GradientStops = collection; } + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == ColorGradientProperty) + Subscribe(); + } + #region Overrides of Visual /// diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs index 45480fcc3..d87e02d70 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs @@ -19,21 +19,24 @@ namespace Artemis.UI.Shared; /// public partial class HotkeyBox : UserControl { - private readonly TextBox _displayTextBox; - /// /// Creates a new instance of the class /// public HotkeyBox() { InitializeComponent(); - - _displayTextBox = this.Find("DisplayTextBox"); - _displayTextBox.KeyDown += DisplayTextBoxOnKeyDown; - _displayTextBox.KeyUp += DisplayTextBoxOnKeyUp; + PropertyChanged += OnPropertyChanged; + DisplayTextBox.KeyDown += DisplayTextBoxOnKeyDown; + DisplayTextBox.KeyUp += DisplayTextBoxOnKeyUp; UpdateDisplayTextBox(); } + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == HotkeyProperty) + UpdateDisplayTextBox(); + } + private void DisplayTextBoxOnKeyDown(object? sender, KeyEventArgs e) { if (e.Key >= Key.LeftShift && e.Key <= Key.RightAlt) @@ -44,7 +47,7 @@ public partial class HotkeyBox : UserControl Hotkey.Modifiers = (KeyboardModifierKey?) e.KeyModifiers; UpdateDisplayTextBox(); HotkeyChanged?.Invoke(this, EventArgs.Empty); - + e.Handled = true; } @@ -64,8 +67,8 @@ public partial class HotkeyBox : UserControl if (Hotkey?.Key != null) display = string.IsNullOrEmpty(display) ? Hotkey.Key.ToString() : $"{display}+{Hotkey.Key}"; - _displayTextBox.Text = display; - _displayTextBox.CaretIndex = _displayTextBox.Text?.Length ?? 0; + DisplayTextBox.Text = display; + DisplayTextBox.CaretIndex = DisplayTextBox.Text?.Length ?? 0; } private void Button_OnClick(object? sender, RoutedEventArgs e) @@ -101,11 +104,7 @@ public partial class HotkeyBox : UserControl public Hotkey? Hotkey { get => GetValue(HotkeyProperty); - set - { - SetValue(HotkeyProperty, value); - UpdateDisplayTextBox(); - } + set => SetValue(HotkeyProperty, value); } /// diff --git a/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs b/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs index 5da12bd99..8e997d532 100644 --- a/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs +++ b/src/Artemis.UI.Shared/Controls/SelectionRectangle.cs @@ -69,6 +69,14 @@ public class SelectionRectangle : Control { AffectsRender(BackgroundProperty, BorderBrushProperty, BorderThicknessProperty); IsHitTestVisible = false; + + PropertyChanged += OnPropertyChanged; + } + + private void OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + if (e.Property == InputElementProperty) + SubscribeToInputElement(); } /// @@ -113,11 +121,7 @@ public class SelectionRectangle : Control public InputElement? InputElement { get => GetValue(InputElementProperty); - set - { - SetValue(InputElementProperty, value); - SubscribeToInputElement(); - } + set => SetValue(InputElementProperty, value); } /// diff --git a/src/Artemis.UI.Shared/Styles/Border.axaml b/src/Artemis.UI.Shared/Styles/Border.axaml index e82655006..9bb22454e 100644 --- a/src/Artemis.UI.Shared/Styles/Border.axaml +++ b/src/Artemis.UI.Shared/Styles/Border.axaml @@ -27,14 +27,7 @@ - - - - + + + + - @@ -20,8 +29,8 @@ - - + + diff --git a/src/Artemis.UI/MainWindow.axaml.cs b/src/Artemis.UI/MainWindow.axaml.cs index 2d41c3a43..38c92d921 100644 --- a/src/Artemis.UI/MainWindow.axaml.cs +++ b/src/Artemis.UI/MainWindow.axaml.cs @@ -14,8 +14,6 @@ namespace Artemis.UI; public partial class MainWindow : ReactiveAppWindow { - private readonly Panel _rootPanel; - private readonly ContentControl _sidebarContentControl; private bool _activated; public MainWindow() @@ -24,12 +22,10 @@ public partial class MainWindow : ReactiveAppWindow Activated += OnActivated; Deactivated += OnDeactivated; - // ApplyWindowSize(); InitializeComponent(); - - _rootPanel = this.Get("RootPanel"); - _sidebarContentControl = this.Get("SidebarContentControl"); - _rootPanel.LayoutUpdated += OnLayoutUpdated; + ApplyWindowSize(); + + RootPanel.LayoutUpdated += OnLayoutUpdated; #if DEBUG this.AttachDevTools(); @@ -56,22 +52,16 @@ public partial class MainWindow : ReactiveAppWindow RootViewModel.WindowSizeSetting.Value ??= new WindowSize(); RootViewModel.WindowSizeSetting.Value.ApplyFromWindow(this); } - - // TODO: Replace with a media query once https://github.com/AvaloniaUI/Avalonia/pull/7938 is implemented + private void OnLayoutUpdated(object? sender, EventArgs e) { - _sidebarContentControl.Width = _rootPanel.Bounds.Width >= 1800 ? 300 : 240; + SidebarContentControl.Width = RootPanel.Bounds.Width >= 1800 ? 300 : 240; } private void OnOpened(object? sender, EventArgs e) { Opened -= OnOpened; - // ICoreApplicationView coreAppTitleBar = this; - // if (coreAppTitleBar.TitleBar != null) - // { - // coreAppTitleBar.TitleBar.ExtendViewIntoTitleBar = true; - // SetTitleBar(this.Get("DragHandle")); - // } + TitleBar.ExtendsContentIntoTitleBar = true; } private void OnActivated(object? sender, EventArgs e) diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml index 7b79b8273..b8e1c5756 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml @@ -84,11 +84,7 @@ - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml index a4add314f..3a69989c8 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml @@ -3,15 +3,18 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" + xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" + xmlns:profileEditor="clr-namespace:Artemis.UI.Screens.ProfileEditor" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="Artemis.UI.Screens.ProfileEditor.ProfileEditorTitleBarView"> - - - - - - - diff --git a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml index 1bfa0720c..057fca3d0 100644 --- a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml +++ b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml @@ -3,9 +3,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" + xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.Root.DefaultTitleBarView"> - \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml index e4e9a7c40..e79099445 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml @@ -25,7 +25,7 @@ Margin="10 2" Items="{CompiledBinding SidebarScreens}" SelectedItem="{CompiledBinding SelectedSidebarScreen}" /> - + @@ -39,7 +39,7 @@ - + - + @@ -44,6 +44,7 @@ + diff --git a/src/Artemis.UI/Styles/Artemis.axaml b/src/Artemis.UI/Styles/Artemis.axaml index c8febf069..242bef032 100644 --- a/src/Artemis.UI/Styles/Artemis.axaml +++ b/src/Artemis.UI/Styles/Artemis.axaml @@ -3,7 +3,7 @@ xmlns:styling="clr-namespace:FluentAvalonia.Styling;assembly=FluentAvalonia" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"> - + From 5a5a6819b1ad9f424bb2b40d2700425f78b31f32 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 2 Apr 2023 20:21:01 +0200 Subject: [PATCH 07/18] Visual scripting fixes --- .../Screens/VisualScripting/CableView.axaml | 18 ++----- .../VisualScripting/CableView.axaml.cs | 47 +++++++++++-------- .../VisualScripting/DragCableView.axaml.cs | 28 ++++++++--- .../VisualScripting/NodeCategoryViewModel.cs | 17 +++++++ .../VisualScripting/NodeMenuItemViewModel.cs | 28 +++++++++++ .../VisualScripting/NodePickerView.axaml | 23 +++++---- .../VisualScripting/NodePickerViewModel.cs | 5 +- .../VisualScripting/NodeScriptView.axaml.cs | 3 +- .../NodeScriptWindowView.axaml | 16 ++----- .../NodeScriptWindowViewModel.cs | 19 ++++---- .../Screens/VisualScripting/Pins/PinView.cs | 43 ++++++++++++++--- 11 files changed, 167 insertions(+), 80 deletions(-) create mode 100644 src/Artemis.UI/Screens/VisualScripting/NodeCategoryViewModel.cs create mode 100644 src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs diff --git a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml index 30a6a4af5..da068c21e 100644 --- a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml @@ -8,6 +8,7 @@ xmlns:shared="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" xmlns:collections="clr-namespace:System.Collections;assembly=System.Runtime" + xmlns:system="clr-namespace:System;assembly=System.Runtime" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.VisualScripting.CableView" x:DataType="visualScripting:CableViewModel" @@ -18,23 +19,12 @@ - + - - - - - - - - - - - - + diff --git a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml.cs index 7a8c82227..e6465474e 100644 --- a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml.cs @@ -24,39 +24,48 @@ public partial class CableView : ReactiveUserControl { ValueBorder.GetObservable(BoundsProperty).Subscribe(rect => ValueBorder.RenderTransform = new TranslateTransform(rect.Width / 2 * -1, rect.Height / 2 * -1)).DisposeWith(d); - ViewModel.WhenAnyValue(vm => vm.FromPoint).Subscribe(_ => Update(true)).DisposeWith(d); - ViewModel.WhenAnyValue(vm => vm.ToPoint).Subscribe(_ => Update(false)).DisposeWith(d); - Update(true); + ViewModel.WhenAnyValue(vm => vm.FromPoint).Subscribe(_ => Update()).DisposeWith(d); + ViewModel.WhenAnyValue(vm => vm.ToPoint).Subscribe(_ => Update()).DisposeWith(d); + Update(); }); } - - private void Update(bool from) + private void Update() { - // Workaround for https://github.com/AvaloniaUI/Avalonia/issues/4748 - CablePath.Margin = new Thickness(CablePath.Margin.Left + 1, CablePath.Margin.Top + 1, 0, 0); - if (CablePath.Margin.Left > 2) - CablePath.Margin = new Thickness(0, 0, 0, 0); + if (ViewModel == null) + return; - PathFigure pathFigure = ((PathGeometry) CablePath.Data).Figures.First(); - BezierSegment segment = (BezierSegment) pathFigure.Segments!.First(); - pathFigure.StartPoint = ViewModel!.FromPoint; - segment.Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y); - segment.Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y); - segment.Point3 = new Point(ViewModel.ToPoint.X, ViewModel.ToPoint.Y); + PathGeometry geometry = new() + { + Figures = new PathFigures() + }; + PathFigure pathFigure = new() + { + StartPoint = ViewModel.FromPoint, + IsClosed = false, + Segments = new PathSegments + { + new BezierSegment + { + Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y), + Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y), + Point3 = new Point(ViewModel.ToPoint.X, ViewModel.ToPoint.Y) + } + } + }; + geometry.Figures.Add(pathFigure); + CablePath.Data = geometry; Canvas.SetLeft(ValueBorder, ViewModel.FromPoint.X + (ViewModel.ToPoint.X - ViewModel.FromPoint.X) / 2); Canvas.SetTop(ValueBorder, ViewModel.FromPoint.Y + (ViewModel.ToPoint.Y - ViewModel.FromPoint.Y) / 2); - - CablePath.InvalidateVisual(); } - private void OnPointerEnter(object? sender, PointerEventArgs e) + private void OnPointerEntered(object? sender, PointerEventArgs e) { ViewModel?.UpdateDisplayValue(true); } - private void OnPointerLeave(object? sender, PointerEventArgs e) + private void OnPointerExited(object? sender, PointerEventArgs e) { ViewModel?.UpdateDisplayValue(false); } diff --git a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs index 8ba56ea89..885ba1996 100644 --- a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs @@ -29,14 +29,28 @@ public partial class DragCableView : ReactiveUserControl private void Update() { - PathFigure? pathFigure = ((PathGeometry) CablePath.Data).Figures?.FirstOrDefault(); - if (pathFigure?.Segments == null) + if (ViewModel == null) return; - BezierSegment segment = (BezierSegment) pathFigure.Segments.First(); - pathFigure.StartPoint = ViewModel!.FromPoint; - segment.Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y); - segment.Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y); - segment.Point3 = new Point(ViewModel.ToPoint.X, ViewModel.ToPoint.Y); + PathGeometry geometry = new() + { + Figures = new PathFigures() + }; + PathFigure pathFigure = new() + { + StartPoint = ViewModel.FromPoint, + IsClosed = false, + Segments = new PathSegments + { + new BezierSegment + { + Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y), + Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y), + Point3 = new Point(ViewModel.ToPoint.X, ViewModel.ToPoint.Y) + } + } + }; + geometry.Figures.Add(pathFigure); + CablePath.Data = geometry; } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeCategoryViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeCategoryViewModel.cs new file mode 100644 index 000000000..acc9e641b --- /dev/null +++ b/src/Artemis.UI/Screens/VisualScripting/NodeCategoryViewModel.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using Artemis.Core; + +namespace Artemis.UI.Screens.VisualScripting; + +public class NodeCategoryViewModel +{ + public NodeCategoryViewModel(DynamicData.List.IGrouping category) + { + Category = category.Key; + Nodes = category.Items.ToList(); + } + + public string Category { get; set; } + public List Nodes { get; set; } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs new file mode 100644 index 000000000..8ca0c9a41 --- /dev/null +++ b/src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive; +using Artemis.Core; +using ReactiveUI; + +namespace Artemis.UI.Screens.VisualScripting; + +public class NodeMenuItemViewModel +{ + public NodeMenuItemViewModel(ReactiveCommand createNode, DynamicData.List.IGrouping category) + { + Header = category.Key; + Items = category.Items.Select(d => new NodeMenuItemViewModel(createNode, d)).ToList(); + } + + public NodeMenuItemViewModel(ReactiveCommand createNode, NodeData nodeData) + { + Header = nodeData.Name; + Items = new List(); + CreateNode = ReactiveCommand.Create(() => { createNode.Execute(nodeData).Subscribe(); }); + } + + public string Header { get; } + public List Items { get; } + public ReactiveCommand? CreateNode { get; } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml index 73065876d..c708afe0b 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml @@ -3,7 +3,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:visualScripting="clr-namespace:Artemis.UI.Screens.VisualScripting" - xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" mc:Ignorable="d" d:DesignWidth="650" d:DesignHeight="450" @@ -17,15 +16,16 @@ @@ -46,16 +46,21 @@ - + - - + + + + + + + diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs index eb1f5d014..9612e2fb7 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs @@ -42,7 +42,8 @@ public class NodePickerViewModel : ActivatableViewModelBase .ThenByAscending(d => d.Category) .ThenByAscending(d => d.Name)) .GroupWithImmutableState(n => n.Category) - .Bind(out ReadOnlyObservableCollection> categories) + .Transform(c => new NodeCategoryViewModel(c)) + .Bind(out ReadOnlyObservableCollection categories) .Subscribe(); Categories = categories; @@ -62,7 +63,7 @@ public class NodePickerViewModel : ActivatableViewModelBase }); } - public ReadOnlyObservableCollection> Categories { get; } + public ReadOnlyObservableCollection Categories { get; } public bool IsVisible { diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs index 47fa01493..1225ea76f 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs @@ -68,8 +68,9 @@ public partial class NodeScriptView : ReactiveUserControl { if (ViewModel == null) return; - ViewModel.NodePickerViewModel.Position = point; + NodeScriptZoomBorder?.ContextFlyout?.ShowAt(NodeScriptZoomBorder); + ViewModel.NodePickerViewModel.Position = point; } private void AutoFitIfPreview() diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml index b55439e50..1d2de9c4a 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml @@ -7,6 +7,7 @@ xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" + xmlns:system="clr-namespace:System;assembly=System.Runtime" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.VisualScripting.NodeScriptWindowView" x:DataType="visualScripting:NodeScriptWindowViewModel" @@ -28,22 +29,11 @@ - - - - - - - - - - - diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs index 7412f8d84..37348d46d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs @@ -48,19 +48,20 @@ public class NodeScriptWindowViewModel : NodeScriptWindowViewModelBase _profileService = profileService; _windowService = windowService; - SourceList nodeSourceList = new(); - nodeSourceList.AddRange(nodeService.AvailableNodes); - nodeSourceList.Connect() - .GroupWithImmutableState(n => n.Category) - .Bind(out ReadOnlyObservableCollection> categories) - .Subscribe(); - Categories = categories; - CreateNode = ReactiveCommand.Create(ExecuteCreateNode); AutoArrange = ReactiveCommand.CreateFromTask(ExecuteAutoArrange); Export = ReactiveCommand.CreateFromTask(ExecuteExport); Import = ReactiveCommand.CreateFromTask(ExecuteImport); + SourceList nodeSourceList = new(); + nodeSourceList.AddRange(nodeService.AvailableNodes); + nodeSourceList.Connect() + .GroupWithImmutableState(n => n.Category) + .Transform(c => new NodeMenuItemViewModel(CreateNode, c)) + .Bind(out ReadOnlyObservableCollection categories) + .Subscribe(); + Categories = categories; + this.WhenActivated(d => { DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update); @@ -83,7 +84,7 @@ public class NodeScriptWindowViewModel : NodeScriptWindowViewModelBase public NodeEditorHistory History { get; } public ReactiveCommand, Unit> ToggleBooleanSetting { get; set; } public ReactiveCommand OpenUri { get; set; } - public ReadOnlyObservableCollection> Categories { get; } + public ReadOnlyObservableCollection Categories { get; } public ReactiveCommand CreateNode { get; } public ReactiveCommand AutoArrange { get; } public ReactiveCommand Export { get; } diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/PinView.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/PinView.cs index 3ee05c759..2663efc64 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/PinView.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/PinView.cs @@ -1,8 +1,9 @@ -using Avalonia; +using System; +using Avalonia; using Avalonia.Controls; using Avalonia.Input; -using Avalonia.Media; using Avalonia.ReactiveUI; +using Avalonia.Rendering; using Avalonia.VisualTree; namespace Artemis.UI.Screens.VisualScripting.Pins; @@ -12,12 +13,20 @@ public class PinView : ReactiveUserControl private Canvas? _container; private bool _dragging; private Border? _pinPoint; + private PinViewRenderLoopTaks _renderLoopTask; protected void InitializePin(Border pinPoint) { _pinPoint = pinPoint; _pinPoint.PointerMoved += PinPointOnPointerMoved; _pinPoint.PointerReleased += PinPointOnPointerReleased; + _pinPoint.PropertyChanged += PinPointOnPropertyChanged; + _renderLoopTask = new PinViewRenderLoopTaks(this); + } + + private void PinPointOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) + { + Console.WriteLine(e); } private void PinPointOnPointerMoved(object? sender, PointerEventArgs e) @@ -67,16 +76,17 @@ public class PinView : ReactiveUserControl { base.OnAttachedToVisualTree(e); _container = this.FindAncestorOfType(); + AvaloniaLocator.Current.GetRequiredService().Add(_renderLoopTask); } /// - public override void Render(DrawingContext context) + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) { - base.Render(context); - UpdatePosition(); + base.OnDetachedFromVisualTree(e); + AvaloniaLocator.Current.GetRequiredService().Remove(_renderLoopTask); } - private void UpdatePosition() + public void UpdatePosition() { if (_container == null || _pinPoint == null || ViewModel == null) return; @@ -87,4 +97,25 @@ public class PinView : ReactiveUserControl } #endregion +} + +public class PinViewRenderLoopTaks : IRenderLoopTask +{ + private readonly PinView _pinView; + + public PinViewRenderLoopTaks(PinView pinView) + { + _pinView = pinView; + } + + public void Update(TimeSpan time) + { + _pinView.UpdatePosition(); + } + + public void Render() + { + } + + public bool NeedsUpdate => true; } \ No newline at end of file From 0116bac346ef923f13830bb0869d7c8c41f51b5d Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 3 Apr 2023 22:17:39 +0200 Subject: [PATCH 08/18] Fix node picker not opening at cursor --- .../VisualScripting/NodeScriptView.axaml.cs | 3 ++- .../Converters/JsonConverter.cs | 26 +++++++++++++++++++ .../Screens/DisplayValueNodeCustomView.axaml | 11 ++++---- 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 src/Artemis.VisualScripting/Converters/JsonConverter.cs diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs index 1225ea76f..eed8b7c31 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs @@ -6,6 +6,7 @@ using Artemis.UI.Shared.Events; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.PanAndZoom; +using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; @@ -69,7 +70,7 @@ public partial class NodeScriptView : ReactiveUserControl if (ViewModel == null) return; - NodeScriptZoomBorder?.ContextFlyout?.ShowAt(NodeScriptZoomBorder); + ((PopupFlyoutBase?) NodeScriptZoomBorder?.ContextFlyout)?.ShowAt(NodeScriptZoomBorder, true); ViewModel.NodePickerViewModel.Position = point; } diff --git a/src/Artemis.VisualScripting/Converters/JsonConverter.cs b/src/Artemis.VisualScripting/Converters/JsonConverter.cs new file mode 100644 index 000000000..f0b9b7820 --- /dev/null +++ b/src/Artemis.VisualScripting/Converters/JsonConverter.cs @@ -0,0 +1,26 @@ +using System.Globalization; +using Artemis.Core; +using Avalonia.Data.Converters; +using Newtonsoft.Json; + +namespace Artemis.VisualScripting.Converters; + +/// +/// Converts input into . +/// +public class JsonConverter : IValueConverter +{ + /// + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + return JsonConvert.SerializeObject(value, Formatting.Indented); + } + + /// + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value == null) + return null; + return JsonConvert.DeserializeObject(value.ToString(), targetType); + } +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml index 100dd461b..ba18c0cf0 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml @@ -7,12 +7,15 @@ xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" xmlns:converters1="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared" xmlns:collections="clr-namespace:System.Collections;assembly=System.Runtime" + xmlns:system="clr-namespace:System;assembly=System.Runtime" + xmlns:converters="clr-namespace:Artemis.VisualScripting.Converters" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.VisualScripting.Nodes.Static.Screens.DisplayValueNodeCustomView" x:DataType="screens:DisplayValueNodeCustomViewModel"> + @@ -44,11 +47,9 @@ - - - - - + + + From 73933ee32440456b4861f2f235939d1f90bd7509 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 4 Apr 2023 22:36:39 +0200 Subject: [PATCH 09/18] Fixed color picker button --- .../Styles/ColorPickerButton.axaml | 33 ++++++++++--------- .../SKColorPropertyInputView.axaml | 3 +- .../Settings/Updating/ReleaseView.axaml | 4 +-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml b/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml index 19fdc882e..4a37a64f9 100644 --- a/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml +++ b/src/Artemis.UI.Shared/Styles/ColorPickerButton.axaml @@ -2,14 +2,17 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"> - - + + + Padding="2 2 30 2" + > + Color="Red" + ShowAcceptDismissButtons="False" + /> @@ -25,23 +28,21 @@ - - - - - + CornerRadius="{TemplateBinding CornerRadius}"/> + + + diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml b/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml index f0ac5b7ba..622178c7b 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml @@ -14,7 +14,7 @@ - + @@ -22,6 +22,7 @@ diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml index bdec0d278..1a576793c 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml @@ -156,9 +156,7 @@ Release notes - - - + From 88558efcb1591daa28e225a6e9f837a83df29934 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 7 Apr 2023 16:18:07 +0200 Subject: [PATCH 10/18] Fix auto connecting nodes --- .../Controls/DeviceVisualizer.cs | 25 ++++++++++++------- .../Settings/Updating/ReleaseView.axaml | 16 +++++++++++- .../VisualScripting/NodePickerViewModel.cs | 9 +++++-- .../Screens/DisplayValueNodeCustomView.axaml | 8 +++--- 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index eeea0fab8..b93053583 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -45,7 +45,7 @@ public class DeviceVisualizer : Control /// public override void Render(DrawingContext drawingContext) { - if (Device == null || _deviceBounds.Width == 0 || _deviceBounds.Height == 0) + if (Device == null || _deviceBounds.Width == 0 || _deviceBounds.Height == 0 || _loading) return; // Determine the scale required to fit the desired size of the control @@ -208,6 +208,8 @@ public class DeviceVisualizer : Control public static readonly StyledProperty?> HighlightedLedsProperty = AvaloniaProperty.Register?>(nameof(HighlightedLeds)); + private bool _loading; + /// /// Gets or sets a list of LEDs to highlight /// @@ -273,6 +275,7 @@ public class DeviceVisualizer : Control return; _deviceBounds = MeasureDevice(); + _loading = true; Device.RgbDevice.PropertyChanged += DevicePropertyChanged; Device.DeviceUpdated += DeviceUpdated; @@ -288,15 +291,15 @@ public class DeviceVisualizer : Control ArtemisDevice? device = Device; Dispatcher.UIThread.Post(() => { - if (device.Layout?.Image == null || !File.Exists(device.Layout.Image.LocalPath)) - { - _deviceImage?.Dispose(); - _deviceImage = null; - return; - } - try { + if (device.Layout?.Image == null || !File.Exists(device.Layout.Image.LocalPath)) + { + _deviceImage?.Dispose(); + _deviceImage = null; + return; + } + // Create a bitmap that'll be used to render the device and LED images just once // Render 4 times the actual size of the device to make sure things look sharp when zoomed in RenderTargetBitmap renderTargetBitmap = new(new PixelSize((int) device.RgbDevice.ActualSize.Width * 2, (int) device.RgbDevice.ActualSize.Height * 2)); @@ -314,12 +317,16 @@ public class DeviceVisualizer : Control _deviceImage?.Dispose(); _deviceImage = renderTargetBitmap; - Dispatcher.UIThread.Post(InvalidateMeasure); + InvalidateMeasure(); } catch (Exception) { // ignored } + finally + { + _loading = false; + } }); } diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml index 1a576793c..d8506a89d 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml @@ -156,7 +156,21 @@ Release notes - + + + + + + + diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs index 9612e2fb7..816ad4343 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerViewModel.cs @@ -50,7 +50,6 @@ public class NodePickerViewModel : ActivatableViewModelBase this.WhenActivated(d => { SearchText = null; - TargetPin = null; nodeSourceList.Edit(list => { @@ -59,7 +58,11 @@ public class NodePickerViewModel : ActivatableViewModelBase }); IsVisible = true; - Disposable.Create(() => IsVisible = false).DisposeWith(d); + Disposable.Create(() => + { + IsVisible = false; + TargetPin = null; + }).DisposeWith(d); }); } @@ -102,6 +105,7 @@ public class NodePickerViewModel : ActivatableViewModelBase node.Y = Math.Round(Position.Y / 10d, 0, MidpointRounding.AwayFromZero) * 10d; if (TargetPin != null) + { using (_nodeEditorService.CreateCommandScope(_nodeScript, "Create node for pin")) { _nodeEditorService.ExecuteCommand(_nodeScript, new AddNode(_nodeScript, node)); @@ -114,6 +118,7 @@ public class NodePickerViewModel : ActivatableViewModelBase if (source != null) _nodeEditorService.ExecuteCommand(_nodeScript, new ConnectPins(source, TargetPin)); } + } else _nodeEditorService.ExecuteCommand(_nodeScript, new AddNode(_nodeScript, node)); } diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml index ba18c0cf0..de10ffaa4 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml @@ -44,12 +44,10 @@ - - - - - + + + From 1ffacb22ae1e9ba46bea8bea79111d0551505b46 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 7 Apr 2023 21:25:33 +0200 Subject: [PATCH 11/18] Remove unused window style --- src/Artemis.UI.Shared/Styles/Artemis.axaml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Artemis.UI.Shared/Styles/Artemis.axaml b/src/Artemis.UI.Shared/Styles/Artemis.axaml index 7b838cdbf..9907a4b20 100644 --- a/src/Artemis.UI.Shared/Styles/Artemis.axaml +++ b/src/Artemis.UI.Shared/Styles/Artemis.axaml @@ -32,15 +32,4 @@ - - - - - - - - - - - \ No newline at end of file From 2fcc6d786241c4eb5d2c658da047cd1b50646eee Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 8 Apr 2023 13:13:58 +0200 Subject: [PATCH 12/18] Plugins - Added constructors to PluginException to provide a help document --- .../Exceptions/ArtemisPluginException.cs | 28 +++++++++++++++++-- .../Interfaces/IPluginManagementService.cs | 7 +++++ .../Services/PluginManagementService.cs | 14 +++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/Artemis.Core/Exceptions/ArtemisPluginException.cs b/src/Artemis.Core/Exceptions/ArtemisPluginException.cs index 8e49b0e19..53f9fd30f 100644 --- a/src/Artemis.Core/Exceptions/ArtemisPluginException.cs +++ b/src/Artemis.Core/Exceptions/ArtemisPluginException.cs @@ -10,7 +10,7 @@ public class ArtemisPluginException : Exception /// /// Creates a new instance of the class /// - public ArtemisPluginException(Plugin plugin) + internal ArtemisPluginException(Plugin plugin) { Plugin = plugin; } @@ -18,7 +18,7 @@ public class ArtemisPluginException : Exception /// /// Creates a new instance of the class /// - public ArtemisPluginException(Plugin plugin, string message) : base(message) + internal ArtemisPluginException(Plugin plugin, string message) : base(message) { Plugin = plugin; } @@ -26,7 +26,7 @@ public class ArtemisPluginException : Exception /// /// Creates a new instance of the class /// - public ArtemisPluginException(Plugin plugin, string message, Exception inner) : base(message, inner) + internal ArtemisPluginException(Plugin plugin, string message, Exception inner) : base(message, inner) { Plugin = plugin; } @@ -44,9 +44,31 @@ public class ArtemisPluginException : Exception public ArtemisPluginException(string message, Exception inner) : base(message, inner) { } + + /// + /// Creates a new instance of the class + /// + public ArtemisPluginException(string message, string helpDocument) : base(message) + { + HelpDocument = helpDocument; + } + + /// + /// Creates a new instance of the class + /// + public ArtemisPluginException(string message, Exception inner, string helpDocument) : base(message, inner) + { + HelpDocument = helpDocument; + } /// /// Gets the plugin the error is related to /// public Plugin? Plugin { get; } + + /// + /// Gets or sets the help document related to this exception. + /// + public string? HelpDocument { get; } + } \ No newline at end of file diff --git a/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs b/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs index 209158529..8e0faf564 100644 --- a/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs +++ b/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs @@ -127,6 +127,13 @@ public interface IPluginManagementService : IArtemisService, IDisposable /// If the current call stack contains a plugin, the plugin. Otherwise null Plugin? GetCallingPlugin(); + /// + /// Returns the plugin that threw the provided exception. + /// + /// + /// If the exception was thrown by a plugin, the plugin. Otherwise null + Plugin? GetPluginFromException(Exception exception); + /// /// Gets the plugin that defined the specified device /// diff --git a/src/Artemis.Core/Services/PluginManagementService.cs b/src/Artemis.Core/Services/PluginManagementService.cs index 06b9b6368..c03aec7bb 100644 --- a/src/Artemis.Core/Services/PluginManagementService.cs +++ b/src/Artemis.Core/Services/PluginManagementService.cs @@ -192,7 +192,19 @@ internal class PluginManagementService : IPluginManagementService public Plugin? GetCallingPlugin() { - StackTrace stackTrace = new(); // get call stack + return GetPluginFromStackTrace(new StackTrace()); + } + + public Plugin? GetPluginFromException(Exception exception) + { + if (exception is ArtemisPluginException pluginException && pluginException.Plugin != null) + return pluginException.Plugin; + + return GetPluginFromStackTrace(new StackTrace(exception)); + } + + private Plugin? GetPluginFromStackTrace(StackTrace stackTrace) + { StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) foreach (StackFrame stackFrame in stackFrames) From 0107bfdd24b31f9202eed605574e83de9746239a Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 8 Apr 2023 18:56:42 +0200 Subject: [PATCH 13/18] UI - Fix hotkeybox keys being mangled up --- .../Controls/HotkeyBox.axaml.cs | 44 ++++++++++++------- .../DryIoc/ContainerExtensions.cs | 2 + src/Artemis.UI.Shared/Utilities.cs | 8 ++++ .../Services/Updating/UpdateService.cs | 7 ++- 4 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 src/Artemis.UI.Shared/Utilities.cs diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs index 0c50e69e4..9bfbe96b4 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs @@ -8,6 +8,8 @@ using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; +using Avalonia.Threading; +using DryIoc; using FluentAvalonia.Core; using Humanizer; using Material.Icons; @@ -19,6 +21,7 @@ namespace Artemis.UI.Shared; /// public class HotkeyBox : UserControl { + private readonly IInputService _inputService; private readonly TextBox _displayTextBox; /// @@ -26,39 +29,50 @@ public class HotkeyBox : UserControl /// public HotkeyBox() { - InitializeComponent(); + _inputService = UI.Locator.Resolve(); + InitializeComponent(); _displayTextBox = this.Find("DisplayTextBox"); - _displayTextBox.KeyDown += DisplayTextBoxOnKeyDown; - _displayTextBox.KeyUp += DisplayTextBoxOnKeyUp; UpdateDisplayTextBox(); } + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + _inputService.KeyboardKeyDown += InputServiceOnKeyboardKeyDown; + _inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp; + } + + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) + { + _inputService.KeyboardKeyDown -= InputServiceOnKeyboardKeyDown; + _inputService.KeyboardKeyUp -= InputServiceOnKeyboardKeyUp; + } + private static void HotkeyChanging(IAvaloniaObject sender, bool before) { ((HotkeyBox) sender).UpdateDisplayTextBox(); } - private void DisplayTextBoxOnKeyDown(object? sender, KeyEventArgs e) + private void InputServiceOnKeyboardKeyDown(object? sender, ArtemisKeyboardKeyEventArgs e) { - if (e.Key >= Key.LeftShift && e.Key <= Key.RightAlt) + if (e.Key >= KeyboardKey.LeftShift && e.Key <= KeyboardKey.RightAlt) return; Hotkey ??= new Hotkey(); - Hotkey.Key = (KeyboardKey?) e.Key; - Hotkey.Modifiers = (KeyboardModifierKey?) e.KeyModifiers; - UpdateDisplayTextBox(); - HotkeyChanged?.Invoke(this, EventArgs.Empty); + Hotkey.Key = e.Key; + Hotkey.Modifiers = e.Modifiers; - e.Handled = true; + Dispatcher.UIThread.Post(() => + { + UpdateDisplayTextBox(); + HotkeyChanged?.Invoke(this, EventArgs.Empty); + }); } - private void DisplayTextBoxOnKeyUp(object? sender, KeyEventArgs e) + private void InputServiceOnKeyboardKeyUp(object? sender, ArtemisKeyboardKeyEventArgs e) { - if (e.KeyModifiers == KeyModifiers.None) - FocusManager.Instance?.Focus(null); - - e.Handled = true; + if (e.Modifiers == KeyboardModifierKey.None) + Dispatcher.UIThread.Post(() => FocusManager.Instance?.Focus(null)); } private void UpdateDisplayTextBox() diff --git a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs index 4c4711b02..1c86ecf84 100644 --- a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs @@ -17,5 +17,7 @@ public static class ContainerExtensions { Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly(); container.RegisterMany(new[] { artemisShared }, type => type.IsAssignableTo(), Reuse.Singleton); + + UI.Locator = container; } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Utilities.cs b/src/Artemis.UI.Shared/Utilities.cs new file mode 100644 index 000000000..35abef7db --- /dev/null +++ b/src/Artemis.UI.Shared/Utilities.cs @@ -0,0 +1,8 @@ +using DryIoc; + +namespace Artemis.UI.Shared; + +internal static class UI +{ + public static IContainer Locator { get; set; } = null!; +} \ No newline at end of file diff --git a/src/Artemis.UI/Services/Updating/UpdateService.cs b/src/Artemis.UI/Services/Updating/UpdateService.cs index fee0b93b0..15e66985e 100644 --- a/src/Artemis.UI/Services/Updating/UpdateService.cs +++ b/src/Artemis.UI/Services/Updating/UpdateService.cs @@ -5,7 +5,6 @@ using System.Threading; using System.Threading.Tasks; using Artemis.Core; using Artemis.Core.Services; -using Artemis.Storage.Entities.General; using Artemis.Storage.Repositories; using Artemis.UI.Exceptions; using Artemis.UI.Shared.Services.MainWindow; @@ -110,6 +109,9 @@ public class UpdateService : IUpdateService private async void HandleAutoUpdateEvent(object? sender, EventArgs e) { + if (Constants.CurrentVersion == "local") + return; + // The event can trigger from multiple sources with a timer acting as a fallback, only actual perform an action once per max 59 minutes if (DateTime.UtcNow - _lastAutoUpdateCheck < TimeSpan.FromMinutes(59)) return; @@ -204,6 +206,9 @@ public class UpdateService : IUpdateService /// public bool Initialize() { + if (Constants.CurrentVersion == "local") + return false; + string? channelArgument = Constants.StartupArguments.FirstOrDefault(a => a.StartsWith("--channel=")); if (channelArgument != null) Channel = channelArgument.Split("=")[1]; From 1f0ec791cfe397b6ddbbcb7fa1dc4ca2f4ab8ef0 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Mon, 10 Apr 2023 10:36:24 +0100 Subject: [PATCH 14/18] Ui - Fixed every hotkey in the same tree receiving input --- src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs index 9bfbe96b4..dfa5bd38c 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs @@ -36,16 +36,20 @@ public class HotkeyBox : UserControl UpdateDisplayTextBox(); } - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + protected override void OnGotFocus(GotFocusEventArgs e) { _inputService.KeyboardKeyDown += InputServiceOnKeyboardKeyDown; _inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp; + + base.OnGotFocus(e); } - protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) + protected override void OnLostFocus(RoutedEventArgs e) { _inputService.KeyboardKeyDown -= InputServiceOnKeyboardKeyDown; _inputService.KeyboardKeyUp -= InputServiceOnKeyboardKeyUp; + + base.OnLostFocus(e); } private static void HotkeyChanging(IAvaloniaObject sender, bool before) From a173f3cc61253bbc32a048ec9fd871d27c120f13 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 10 Apr 2023 12:45:16 +0200 Subject: [PATCH 15/18] Fixed separators and replaced obsolete filepicker calls --- .../Builders/FileDialogFilterBuilder.cs | 22 ++++++++----- .../Builders/OpenFileDialogBuilder.cs | 30 ++++++++---------- .../Builders/OpenFolderDialogBuilder.cs | 17 +++++----- .../Builders/SaveFileDialogBuilder.cs | 31 ++++++++----------- src/Artemis.UI.Shared/Styles/Border.axaml | 4 +-- .../Device/Tabs/DeviceInfoTabView.axaml | 14 ++++----- .../Screens/Settings/Tabs/AboutTabView.axaml | 6 ++-- .../Settings/Tabs/GeneralTabView.axaml | 24 +++++++------- .../Settings/Updating/ReleaseView.axaml | 4 +-- .../ModuleActivationRequirementView.axaml | 2 +- .../ModuleActivationRequirementsView.axaml | 4 +-- .../StartupWizard/Steps/SettingsStep.axaml | 6 ++-- 12 files changed, 83 insertions(+), 81 deletions(-) diff --git a/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs index a53d6dec5..e3c946804 100644 --- a/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/FileDialogFilterBuilder.cs @@ -1,4 +1,7 @@ -using Avalonia.Controls; +using System.Collections.Generic; +using System.Linq; +using Avalonia.Controls; +using Avalonia.Platform.Storage; namespace Artemis.UI.Shared.Services.Builders; @@ -7,11 +10,12 @@ namespace Artemis.UI.Shared.Services.Builders; /// public class FileDialogFilterBuilder { - private readonly FileDialogFilter _filter; + private string _name; + private readonly List _extensions = new(); internal FileDialogFilterBuilder() { - _filter = new FileDialogFilter(); + _name = "Unknown"; } /// @@ -19,7 +23,7 @@ public class FileDialogFilterBuilder /// public FileDialogFilterBuilder WithName(string name) { - _filter.Name = name; + _name = name; return this; } @@ -28,12 +32,16 @@ public class FileDialogFilterBuilder /// public FileDialogFilterBuilder WithExtension(string extension) { - _filter.Extensions.Add(extension); + if (!_extensions.Contains(extension)) + _extensions.Add(extension); return this; } - internal FileDialogFilter Build() + internal FilePickerFileType Build() { - return _filter; + return new FilePickerFileType(_name) + { + Patterns = _extensions.Select(e => "*." + e).ToList() + }; } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs index af53d1e72..e3785eea9 100644 --- a/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/OpenFileDialogBuilder.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Avalonia.Controls; +using Avalonia.Platform.Storage; namespace Artemis.UI.Shared.Services.Builders; @@ -10,8 +12,9 @@ namespace Artemis.UI.Shared.Services.Builders; /// public class OpenFileDialogBuilder { - private readonly OpenFileDialog _openFileDialog; private readonly Window _parent; + private readonly FilePickerOpenOptions _options; + private List? _fileTypeFilters; /// /// Creates a new instance of the class. @@ -20,7 +23,7 @@ public class OpenFileDialogBuilder internal OpenFileDialogBuilder(Window parent) { _parent = parent; - _openFileDialog = new OpenFileDialog(); + _options = new FilePickerOpenOptions(); } /// @@ -28,7 +31,7 @@ public class OpenFileDialogBuilder /// public OpenFileDialogBuilder WithAllowMultiple() { - _openFileDialog.AllowMultiple = true; + _options.AllowMultiple = true; return this; } @@ -37,7 +40,7 @@ public class OpenFileDialogBuilder /// public OpenFileDialogBuilder WithTitle(string? title) { - _openFileDialog.Title = title; + _options.Title = title; return this; } @@ -46,16 +49,7 @@ public class OpenFileDialogBuilder /// public OpenFileDialogBuilder WithDirectory(string? directory) { - _openFileDialog.Directory = directory; - return this; - } - - /// - /// Set the initial file name of the dialog - /// - public OpenFileDialogBuilder WithInitialFileName(string? initialFileName) - { - _openFileDialog.InitialFileName = initialFileName; + _options.SuggestedStartLocation = directory != null ? _parent.StorageProvider.TryGetFolderFromPathAsync(directory).GetAwaiter().GetResult() : null; return this; } @@ -67,8 +61,9 @@ public class OpenFileDialogBuilder FileDialogFilterBuilder builder = new(); configure(builder); - _openFileDialog.Filters ??= new List(); - _openFileDialog.Filters.Add(builder.Build()); + _fileTypeFilters ??= new List(); + _fileTypeFilters.Add(builder.Build()); + _options.FileTypeFilter = _fileTypeFilters; return this; } @@ -82,6 +77,7 @@ public class OpenFileDialogBuilder /// public async Task ShowAsync() { - return await _openFileDialog.ShowAsync(_parent); + IReadOnlyList files = await _parent.StorageProvider.OpenFilePickerAsync(_options); + return files.Select(f => f.Path.AbsolutePath).ToArray(); } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Services/Builders/OpenFolderDialogBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/OpenFolderDialogBuilder.cs index 47846d170..25305b25c 100644 --- a/src/Artemis.UI.Shared/Services/Builders/OpenFolderDialogBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/OpenFolderDialogBuilder.cs @@ -1,5 +1,8 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Avalonia.Controls; +using Avalonia.Platform.Storage; namespace Artemis.UI.Shared.Services.Builders; @@ -8,8 +11,8 @@ namespace Artemis.UI.Shared.Services.Builders; /// public class OpenFolderDialogBuilder { - private readonly OpenFolderDialog _openFolderDialog; private readonly Window _parent; + private readonly FolderPickerOpenOptions _options; /// /// Creates a new instance of the class. @@ -18,16 +21,15 @@ public class OpenFolderDialogBuilder internal OpenFolderDialogBuilder(Window parent) { _parent = parent; - _openFolderDialog = new OpenFolderDialog(); + _options = new FolderPickerOpenOptions {AllowMultiple = false}; } - /// /// Set the title of the dialog /// public OpenFolderDialogBuilder WithTitle(string? title) { - _openFolderDialog.Title = title; + _options.Title = title; return this; } @@ -36,7 +38,7 @@ public class OpenFolderDialogBuilder /// public OpenFolderDialogBuilder WithDirectory(string? directory) { - _openFolderDialog.Directory = directory; + _options.SuggestedStartLocation = directory != null ? _parent.StorageProvider.TryGetFolderFromPathAsync(directory).GetAwaiter().GetResult() : null; return this; } @@ -49,6 +51,7 @@ public class OpenFolderDialogBuilder /// public async Task ShowAsync() { - return await _openFolderDialog.ShowAsync(_parent); + IReadOnlyList folder = await _parent.StorageProvider.OpenFolderPickerAsync(_options); + return folder.FirstOrDefault()?.Path.AbsolutePath; } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs index 7662f7228..a4bc95f18 100644 --- a/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/SaveFileDialogBuilder.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Avalonia.Controls; +using Avalonia.Platform.Storage; namespace Artemis.UI.Shared.Services.Builders; @@ -11,8 +12,9 @@ namespace Artemis.UI.Shared.Services.Builders; public class SaveFileDialogBuilder { private readonly Window _parent; - private readonly SaveFileDialog _saveFileDialog; - + private readonly FilePickerSaveOptions _options; + private List? _fileTypeFilters; + /// /// Creates a new instance of the class. /// @@ -20,7 +22,7 @@ public class SaveFileDialogBuilder internal SaveFileDialogBuilder(Window parent) { _parent = parent; - _saveFileDialog = new SaveFileDialog(); + _options = new FilePickerSaveOptions(); } /// @@ -28,7 +30,7 @@ public class SaveFileDialogBuilder /// public SaveFileDialogBuilder WithTitle(string? title) { - _saveFileDialog.Title = title; + _options.Title = title; return this; } @@ -37,7 +39,7 @@ public class SaveFileDialogBuilder /// public SaveFileDialogBuilder WithDirectory(string? directory) { - _saveFileDialog.Directory = directory; + _options.SuggestedStartLocation = directory != null ? _parent.StorageProvider.TryGetFolderFromPathAsync(directory).GetAwaiter().GetResult() : null; return this; } @@ -46,16 +48,7 @@ public class SaveFileDialogBuilder /// public SaveFileDialogBuilder WithInitialFileName(string? initialFileName) { - _saveFileDialog.InitialFileName = initialFileName; - return this; - } - - /// - /// Set the default extension of the dialog - /// - public SaveFileDialogBuilder WithDefaultExtension(string? defaultExtension) - { - _saveFileDialog.DefaultExtension = defaultExtension; + _options.SuggestedFileName = initialFileName; return this; } @@ -67,8 +60,9 @@ public class SaveFileDialogBuilder FileDialogFilterBuilder builder = new(); configure(builder); - _saveFileDialog.Filters ??= new List(); - _saveFileDialog.Filters.Add(builder.Build()); + _fileTypeFilters ??= new List(); + _fileTypeFilters.Add(builder.Build()); + _options.FileTypeChoices = _fileTypeFilters; return this; } @@ -82,6 +76,7 @@ public class SaveFileDialogBuilder /// public async Task ShowAsync() { - return await _saveFileDialog.ShowAsync(_parent); + IStorageFile? path = await _parent.StorageProvider.SaveFilePickerAsync(_options); + return path?.Path.AbsolutePath; } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Styles/Border.axaml b/src/Artemis.UI.Shared/Styles/Border.axaml index 9bb22454e..afcd9dee8 100644 --- a/src/Artemis.UI.Shared/Styles/Border.axaml +++ b/src/Artemis.UI.Shared/Styles/Border.axaml @@ -8,7 +8,7 @@ I'm in a panel yo! - + I'm in a panel yo! @@ -44,7 +44,7 @@ -