diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 08d434c60..c1269c310 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,7 +11,7 @@ resources: variables: BuildConfiguration: 'Release' BuildPlatform: 'Any CPU' - PublishFramework: 'net8.0' + PublishFramework: 'net9.0' PublishProject: 'DockMvvmSample' PublishRuntime: '' Workloads: 'wasm-tools wasm-experimental' diff --git a/build/build/_build.csproj b/build/build/_build.csproj index 5e6ba1f18..bc8d4488d 100644 --- a/build/build/_build.csproj +++ b/build/build/_build.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 false False CS0649;CS0169 @@ -12,6 +12,7 @@ + diff --git a/samples/DockMvvmSample/DockMvvmSample.csproj b/samples/DockMvvmSample/DockMvvmSample.csproj index e6f94008a..3f135354b 100644 --- a/samples/DockMvvmSample/DockMvvmSample.csproj +++ b/samples/DockMvvmSample/DockMvvmSample.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 WinExe False False diff --git a/samples/DockXamlSample/DockXamlSample.csproj b/samples/DockXamlSample/DockXamlSample.csproj index 42c85feac..6ce04777f 100644 --- a/samples/DockXamlSample/DockXamlSample.csproj +++ b/samples/DockXamlSample/DockXamlSample.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 WinExe False False diff --git a/samples/Notepad/Notepad.csproj b/samples/Notepad/Notepad.csproj index 51cf89797..56f2a60d5 100644 --- a/samples/Notepad/Notepad.csproj +++ b/samples/Notepad/Notepad.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 WinExe False False diff --git a/src/Avalonia.Controls.Recycling/ControlRecycling.cs b/src/Avalonia.Controls.Recycling/ControlRecycling.cs index fd328200b..360389cad 100644 --- a/src/Avalonia.Controls.Recycling/ControlRecycling.cs +++ b/src/Avalonia.Controls.Recycling/ControlRecycling.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using Avalonia.Controls.Recycling.Model; using Avalonia.Controls.Templates; @@ -64,14 +63,13 @@ public void Add(object data, object control) /// public object? Build(object? data, object? existing, object? parent) { - if (data is null) + var key = data; + if (key is null) { return null; } - var key = data; - - if (TryToUseIdAsKey && data is IControlRecyclingIdProvider idProvider) + if (TryToUseIdAsKey && key is IControlRecyclingIdProvider idProvider) { if (!string.IsNullOrWhiteSpace(idProvider.GetControlRecyclingId())) { @@ -84,15 +82,15 @@ public void Add(object data, object control) return control; } - var dataTemplate = (parent as Control)?.FindDataTemplate(data); + var dataTemplate = (parent as Control)?.FindDataTemplate(key); - control = dataTemplate?.Build(data); + control = dataTemplate?.Build(key); if (control is null) { return null; } - Add(key, control); + Add(key!, control); return control; } diff --git a/src/Dock.Model.ReactiveUI/Controls/DockDock.cs b/src/Dock.Model.ReactiveUI/Controls/DockDock.cs index 20790e557..c7790d32b 100644 --- a/src/Dock.Model.ReactiveUI/Controls/DockDock.cs +++ b/src/Dock.Model.ReactiveUI/Controls/DockDock.cs @@ -1,7 +1,6 @@ using System.Runtime.Serialization; using Dock.Model.Controls; using Dock.Model.ReactiveUI.Core; -using ReactiveUI; namespace Dock.Model.ReactiveUI.Controls; @@ -9,15 +8,18 @@ namespace Dock.Model.ReactiveUI.Controls; /// Docking panel dock. /// [DataContract(IsReference = true)] -public class DockDock : DockBase, IDockDock -{ - private bool _lastChildFill = true; +public partial class DockDock : DockBase, IDockDock +{ + /// + /// Initializes new instance of the class. + /// + public DockDock() + { + _lastChildFill = true; + } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool LastChildFill - { - get => _lastChildFill; - set => this.RaiseAndSetIfChanged(ref _lastChildFill, value); - } -} \ No newline at end of file + [Reactive] + public partial bool LastChildFill { get; set; } +} diff --git a/src/Dock.Model.ReactiveUI/Controls/Document.cs b/src/Dock.Model.ReactiveUI/Controls/Document.cs index a0a82cf3a..8305a2f1f 100644 --- a/src/Dock.Model.ReactiveUI/Controls/Document.cs +++ b/src/Dock.Model.ReactiveUI/Controls/Document.cs @@ -8,6 +8,6 @@ namespace Dock.Model.ReactiveUI.Controls; /// Document. /// [DataContract(IsReference = true)] -public class Document : DockableBase, IDocument +public partial class Document : DockableBase, IDocument { -} \ No newline at end of file +} diff --git a/src/Dock.Model.ReactiveUI/Controls/DocumentDock.cs b/src/Dock.Model.ReactiveUI/Controls/DocumentDock.cs index 0335fedb6..21cfa8a74 100644 --- a/src/Dock.Model.ReactiveUI/Controls/DocumentDock.cs +++ b/src/Dock.Model.ReactiveUI/Controls/DocumentDock.cs @@ -2,7 +2,6 @@ using System.Windows.Input; using Dock.Model.Controls; using Dock.Model.ReactiveUI.Core; -using ReactiveUI; namespace Dock.Model.ReactiveUI.Controls; @@ -10,17 +9,12 @@ namespace Dock.Model.ReactiveUI.Controls; /// Document dock. /// [DataContract(IsReference = true)] -public class DocumentDock : DockBase, IDocumentDock +public partial class DocumentDock : DockBase, IDocumentDock { - private bool _canCreateDocument; - /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool CanCreateDocument - { - get => _canCreateDocument; - set => this.RaiseAndSetIfChanged(ref _canCreateDocument, value); - } + [Reactive] + public partial bool CanCreateDocument { get; set; } /// [IgnoreDataMember] diff --git a/src/Dock.Model.ReactiveUI/Controls/ProportionalDock.cs b/src/Dock.Model.ReactiveUI/Controls/ProportionalDock.cs index 201b26533..c58f79d6b 100644 --- a/src/Dock.Model.ReactiveUI/Controls/ProportionalDock.cs +++ b/src/Dock.Model.ReactiveUI/Controls/ProportionalDock.cs @@ -2,7 +2,6 @@ using Dock.Model.Controls; using Dock.Model.Core; using Dock.Model.ReactiveUI.Core; -using ReactiveUI; namespace Dock.Model.ReactiveUI.Controls; @@ -10,15 +9,10 @@ namespace Dock.Model.ReactiveUI.Controls; /// Proportional dock. /// [DataContract(IsReference = true)] -public class ProportionalDock : DockBase, IProportionalDock +public partial class ProportionalDock : DockBase, IProportionalDock { - private Orientation _orientation; - /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public Orientation Orientation - { - get => _orientation; - set => this.RaiseAndSetIfChanged(ref _orientation, value); - } -} \ No newline at end of file + [Reactive] + public partial Orientation Orientation { get; set; } +} diff --git a/src/Dock.Model.ReactiveUI/Controls/ProportionalDockSplitter.cs b/src/Dock.Model.ReactiveUI/Controls/ProportionalDockSplitter.cs index 3d3bc47f9..8f13f9593 100644 --- a/src/Dock.Model.ReactiveUI/Controls/ProportionalDockSplitter.cs +++ b/src/Dock.Model.ReactiveUI/Controls/ProportionalDockSplitter.cs @@ -8,6 +8,6 @@ namespace Dock.Model.ReactiveUI.Controls; /// Proportional dock splitter. /// [DataContract(IsReference = true)] -public class ProportionalDockSplitter : DockableBase, IProportionalDockSplitter +public partial class ProportionalDockSplitter : DockableBase, IProportionalDockSplitter { -} \ No newline at end of file +} diff --git a/src/Dock.Model.ReactiveUI/Controls/RootDock.cs b/src/Dock.Model.ReactiveUI/Controls/RootDock.cs index add74922e..146f512ca 100644 --- a/src/Dock.Model.ReactiveUI/Controls/RootDock.cs +++ b/src/Dock.Model.ReactiveUI/Controls/RootDock.cs @@ -12,98 +12,62 @@ namespace Dock.Model.ReactiveUI.Controls; /// Root dock. /// [DataContract(IsReference = true)] -public class RootDock : DockBase, IRootDock +public partial class RootDock : DockBase, IRootDock { - private bool _isFocusableRoot = true; - private IList? _hiddenDockables; - private IList? _leftPinnedDockables; - private IList? _rightPinnedDockables; - private IList? _topPinnedDockables; - private IList? _bottomPinnedDockables; - private IToolDock? _pinnedDock; - private IDockWindow? _window; - private IList? _windows; - /// /// Initializes new instance of the class. /// public RootDock() { + _isFocusableRoot = true; ShowWindows = ReactiveCommand.Create(() => _navigateAdapter.ShowWindows()); ExitWindows = ReactiveCommand.Create(() => _navigateAdapter.ExitWindows()); } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool IsFocusableRoot - { - get => _isFocusableRoot; - set => this.RaiseAndSetIfChanged(ref _isFocusableRoot, value); - } + [Reactive] + public partial bool IsFocusableRoot { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IList? HiddenDockables - { - get => _hiddenDockables; - set => this.RaiseAndSetIfChanged(ref _hiddenDockables, value); - } + [Reactive] + public partial IList? HiddenDockables { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IList? LeftPinnedDockables - { - get => _leftPinnedDockables; - set => this.RaiseAndSetIfChanged(ref _leftPinnedDockables, value); - } + [Reactive] + public partial IList? LeftPinnedDockables { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IList? RightPinnedDockables - { - get => _rightPinnedDockables; - set => this.RaiseAndSetIfChanged(ref _rightPinnedDockables, value); - } + [Reactive] + public partial IList? RightPinnedDockables { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IList? TopPinnedDockables - { - get => _topPinnedDockables; - set => this.RaiseAndSetIfChanged(ref _topPinnedDockables, value); - } + [Reactive] + public partial IList? TopPinnedDockables { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IList? BottomPinnedDockables - { - get => _bottomPinnedDockables; - set => this.RaiseAndSetIfChanged(ref _bottomPinnedDockables, value); - } + [Reactive] + public partial IList? BottomPinnedDockables { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IToolDock? PinnedDock - { - get => _pinnedDock; - set => this.RaiseAndSetIfChanged(ref _pinnedDock, value); - } + [Reactive] + public partial IToolDock? PinnedDock { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IDockWindow? Window - { - get => _window; - set => this.RaiseAndSetIfChanged(ref _window, value); - } + [Reactive] + public partial IDockWindow? Window { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IList? Windows - { - get => _windows; - set => this.RaiseAndSetIfChanged(ref _windows, value); - } + [Reactive] + public partial IList? Windows { get; set; } /// [IgnoreDataMember] diff --git a/src/Dock.Model.ReactiveUI/Controls/Tool.cs b/src/Dock.Model.ReactiveUI/Controls/Tool.cs index c279ff2dc..3ac23e492 100644 --- a/src/Dock.Model.ReactiveUI/Controls/Tool.cs +++ b/src/Dock.Model.ReactiveUI/Controls/Tool.cs @@ -8,6 +8,6 @@ namespace Dock.Model.ReactiveUI.Controls; /// Tool. /// [DataContract(IsReference = true)] -public class Tool : DockableBase, ITool, IDocument +public partial class Tool : DockableBase, ITool, IDocument { -} \ No newline at end of file +} diff --git a/src/Dock.Model.ReactiveUI/Controls/ToolDock.cs b/src/Dock.Model.ReactiveUI/Controls/ToolDock.cs index eec63e192..60439564a 100644 --- a/src/Dock.Model.ReactiveUI/Controls/ToolDock.cs +++ b/src/Dock.Model.ReactiveUI/Controls/ToolDock.cs @@ -2,7 +2,6 @@ using Dock.Model.Controls; using Dock.Model.Core; using Dock.Model.ReactiveUI.Core; -using ReactiveUI; namespace Dock.Model.ReactiveUI.Controls; @@ -10,42 +9,35 @@ namespace Dock.Model.ReactiveUI.Controls; /// Tool dock. /// [DataContract(IsReference = true)] -public class ToolDock : DockBase, IToolDock +public partial class ToolDock : DockBase, IToolDock { - private Alignment _alignment = Alignment.Unset; - private bool _isExpanded; - private bool _autoHide = true; - private GripMode _gripMode = GripMode.Visible; - - /// - [DataMember(IsRequired = false, EmitDefaultValue = true)] - public Alignment Alignment + /// + /// Initializes new instance of the class. + /// + public ToolDock() { - get => _alignment; - set => this.RaiseAndSetIfChanged(ref _alignment, value); + _alignment = Alignment.Unset; + _autoHide = true; + _gripMode = GripMode.Visible; } + + /// + [DataMember(IsRequired = false, EmitDefaultValue = true)] + [Reactive] + public partial Alignment Alignment { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool IsExpanded - { - get => _isExpanded; - set => this.RaiseAndSetIfChanged(ref _isExpanded, value); - } + [Reactive] + public partial bool IsExpanded { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool AutoHide - { - get => _autoHide; - set => this.RaiseAndSetIfChanged(ref _autoHide, value); - } + [Reactive] + public partial bool AutoHide { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public GripMode GripMode - { - get => _gripMode; - set => this.RaiseAndSetIfChanged(ref _gripMode, value); - } -} \ No newline at end of file + [Reactive] + public partial GripMode GripMode { get; set; } +} diff --git a/src/Dock.Model.ReactiveUI/Core/DockBase.cs b/src/Dock.Model.ReactiveUI/Core/DockBase.cs index 92be7c260..7d22cba62 100644 --- a/src/Dock.Model.ReactiveUI/Core/DockBase.cs +++ b/src/Dock.Model.ReactiveUI/Core/DockBase.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Reactive; using System.Runtime.Serialization; using System.Windows.Input; using Dock.Model.Adapters; @@ -11,16 +12,9 @@ namespace Dock.Model.ReactiveUI.Core; /// Dock base class. /// [DataContract(IsReference = true)] -public abstract class DockBase : DockableBase, IDock +public abstract partial class DockBase : DockableBase, IDock { internal readonly INavigateAdapter _navigateAdapter; - private IList? _visibleDockables; - private IDockable? _activeDockable; - private IDockable? _defaultDockable; - private IDockable? _focusedDockable; - private DockMode _dock = DockMode.Center; - private bool _isActive; - private int _openedDockablesCount; /// /// Initializes new instance of the class. @@ -28,77 +22,61 @@ public abstract class DockBase : DockableBase, IDock protected DockBase() { _navigateAdapter = new NavigateAdapter(this); + _dock = DockMode.Center; GoBack = ReactiveCommand.Create(() => _navigateAdapter.GoBack()); GoForward = ReactiveCommand.Create(() => _navigateAdapter.GoForward()); Navigate = ReactiveCommand.Create(root => _navigateAdapter.Navigate(root, true)); Close = ReactiveCommand.Create(() => _navigateAdapter.Close()); + + this.WhenAnyActiveDockable() + .Subscribe(new AnonymousObserver(x => + { + Factory?.InitActiveDockable(x, this); + this.RaisePropertyChanged(nameof(CanGoBack)); + this.RaisePropertyChanged(nameof(CanGoForward)); + })); + + this.WhenAnyFocusedDockable() + .Subscribe(new AnonymousObserver(x => + { + Factory?.OnFocusedDockableChanged(x); + })); } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IList? VisibleDockables - { - get => _visibleDockables; - set => this.RaiseAndSetIfChanged(ref _visibleDockables, value); - } + [Reactive] + public partial IList? VisibleDockables { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IDockable? ActiveDockable - { - get => _activeDockable; - set - { - this.RaiseAndSetIfChanged(ref _activeDockable, value); - Factory?.InitActiveDockable(value, this); - this.RaisePropertyChanged(nameof(CanGoBack)); - this.RaisePropertyChanged(nameof(CanGoForward)); - } - } + [Reactive] + public partial IDockable? ActiveDockable { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IDockable? DefaultDockable - { - get => _defaultDockable; - set => this.RaiseAndSetIfChanged(ref _defaultDockable, value); - } + [Reactive] + public partial IDockable? DefaultDockable { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IDockable? FocusedDockable - { - get => _focusedDockable; - set - { - this.RaiseAndSetIfChanged(ref _focusedDockable, value); - Factory?.OnFocusedDockableChanged(value); - } - } + [Reactive] + public partial IDockable? FocusedDockable { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public DockMode Dock - { - get => _dock; - set => this.RaiseAndSetIfChanged(ref _dock, value); - } + [Reactive] + public partial DockMode Dock { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool IsActive - { - get => _isActive; - set => this.RaiseAndSetIfChanged(ref _isActive, value); - } + [Reactive] + public partial bool IsActive { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public int OpenedDockablesCount - { - get => _openedDockablesCount; - set => this.RaiseAndSetIfChanged(ref _openedDockablesCount, value); - } + [Reactive] + public partial int OpenedDockablesCount { get; set; } /// [IgnoreDataMember] diff --git a/src/Dock.Model.ReactiveUI/Core/DockWindow.cs b/src/Dock.Model.ReactiveUI/Core/DockWindow.cs index b32c0e7fc..f8c4e230a 100644 --- a/src/Dock.Model.ReactiveUI/Core/DockWindow.cs +++ b/src/Dock.Model.ReactiveUI/Core/DockWindow.cs @@ -10,20 +10,9 @@ namespace Dock.Model.ReactiveUI.Core; /// Dock window. /// [DataContract(IsReference = true)] -public class DockWindow : ReactiveObject, IDockWindow +public partial class DockWindow : ReactiveObject, IDockWindow { private readonly IHostAdapter _hostAdapter; - private string _id; - private double _x; - private double _y; - private double _width; - private double _height; - private bool _topmost; - private string _title; - private IDockable? _owner; - private IFactory? _factory; - private IRootDock? _layout; - private IHostWindow? _host; /// /// Initializes new instance of the class. @@ -37,91 +26,58 @@ public DockWindow() /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public string Id - { - get => _id; - set => this.RaiseAndSetIfChanged(ref _id, value); - } + [Reactive] + public partial string Id { get; set; } /// [DataMember(IsRequired = true, EmitDefaultValue = true)] - public double X - { - get => _x; - set => this.RaiseAndSetIfChanged(ref _x, value); - } + [Reactive] + public partial double X { get; set; } /// [DataMember(IsRequired = true, EmitDefaultValue = true)] - public double Y - { - get => _y; - set => this.RaiseAndSetIfChanged(ref _y, value); - } + [Reactive] + public partial double Y { get; set; } /// [DataMember(IsRequired = true, EmitDefaultValue = true)] - public double Width - { - get => _width; - set => this.RaiseAndSetIfChanged(ref _width, value); - } + [Reactive] + public partial double Width { get; set; } /// [DataMember(IsRequired = true, EmitDefaultValue = true)] - public double Height - { - get => _height; - set => this.RaiseAndSetIfChanged(ref _height, value); - } + [Reactive] + public partial double Height { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool Topmost - { - get => _topmost; - set => this.RaiseAndSetIfChanged(ref _topmost, value); - } + [Reactive] + public partial bool Topmost { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public string Title - { - get => _title; - set => this.RaiseAndSetIfChanged(ref _title, value); - } + [Reactive] + public partial string Title { get; set; } /// [IgnoreDataMember] - public IDockable? Owner - { - get => _owner; - set => this.RaiseAndSetIfChanged(ref _owner, value); - } + [Reactive] + public partial IDockable? Owner { get; set; } /// [IgnoreDataMember] - public IFactory? Factory - { - get => _factory; - set => this.RaiseAndSetIfChanged(ref _factory, value); - } + [Reactive] + public partial IFactory? Factory { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public IRootDock? Layout - { - get => _layout; - set => this.RaiseAndSetIfChanged(ref _layout, value); - } + [Reactive] + public partial IRootDock? Layout { get; set; } /// [IgnoreDataMember] - public IHostWindow? Host - { - get => _host; - set => this.RaiseAndSetIfChanged(ref _host, value); - } + [Reactive] + public partial IHostWindow? Host { get; set; } /// public virtual bool OnClose() @@ -162,4 +118,4 @@ public void Exit() { _hostAdapter.Exit(); } -} \ No newline at end of file +} diff --git a/src/Dock.Model.ReactiveUI/Core/DockableBase.cs b/src/Dock.Model.ReactiveUI/Core/DockableBase.cs index ec138b344..5e4d174da 100644 --- a/src/Dock.Model.ReactiveUI/Core/DockableBase.cs +++ b/src/Dock.Model.ReactiveUI/Core/DockableBase.cs @@ -9,125 +9,84 @@ namespace Dock.Model.ReactiveUI.Core; /// Dockable base class. /// [DataContract(IsReference = true)] -public abstract class DockableBase : ReactiveObject, IDockable +public abstract partial class DockableBase : ReactiveObject, IDockable { private readonly TrackingAdapter _trackingAdapter; - private string _id = string.Empty; - private string _title = string.Empty; - private object? _context; - private IDockable? _owner; - private IDockable? _originalOwner; - private IFactory? _factory; - private bool _isEmpty; - private bool _isCollapsable = true; - private double _proportion = double.NaN; - private bool _canClose = true; - private bool _canPin = true; - private bool _canFloat = true; /// /// Initializes new instance of the class. /// protected DockableBase() { + _id = string.Empty; + _title = string.Empty; + _isCollapsable = true; + _proportion = double.NaN; + _canClose = true; + _canPin = true; + _canFloat = true; _trackingAdapter = new TrackingAdapter(); } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public string Id - { - get => _id; - set => this.RaiseAndSetIfChanged(ref _id, value); - } + [Reactive] + public partial string Id { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public string Title - { - get => _title; - set => this.RaiseAndSetIfChanged(ref _title, value); - } + [Reactive] + public partial string Title { get; set; } /// [IgnoreDataMember] - public object? Context - { - get => _context; - set => this.RaiseAndSetIfChanged(ref _context, value); - } + [Reactive] + public partial object? Context { get; set; } /// [IgnoreDataMember] - public IDockable? Owner - { - get => _owner; - set => this.RaiseAndSetIfChanged(ref _owner, value); - } + [Reactive] + public partial IDockable? Owner { get; set; } /// [IgnoreDataMember] - public IDockable? OriginalOwner - { - get => _originalOwner; - set => this.RaiseAndSetIfChanged(ref _originalOwner, value); - } + [Reactive] + public partial IDockable? OriginalOwner { get; set; } /// [IgnoreDataMember] - public IFactory? Factory - { - get => _factory; - set => this.RaiseAndSetIfChanged(ref _factory, value); - } + [Reactive] + public partial IFactory? Factory { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool IsEmpty - { - get => _isEmpty; - set => this.RaiseAndSetIfChanged(ref _isEmpty, value); - } + [Reactive] + public partial bool IsEmpty { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool IsCollapsable - { - get => _isCollapsable; - set => this.RaiseAndSetIfChanged(ref _isCollapsable, value); - } + [Reactive] + public partial bool IsCollapsable { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public double Proportion - { - get => _proportion; - set => this.RaiseAndSetIfChanged(ref _proportion, value); - } + [Reactive] + public partial double Proportion { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool CanClose - { - get => _canClose; - set => this.RaiseAndSetIfChanged(ref _canClose, value); - } + [Reactive] + public partial bool CanClose { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool CanPin - { - get => _canPin; - set => this.RaiseAndSetIfChanged(ref _canPin, value); - } + [Reactive] + public partial bool CanPin { get; set; } /// [DataMember(IsRequired = false, EmitDefaultValue = true)] - public bool CanFloat - { - get => _canFloat; - set => this.RaiseAndSetIfChanged(ref _canFloat, value); - } + [Reactive] + public partial bool CanFloat { get; set; } /// public string? GetControlRecyclingId() => _id; diff --git a/src/Dock.Model.ReactiveUI/Dock.Model.ReactiveUI.csproj b/src/Dock.Model.ReactiveUI/Dock.Model.ReactiveUI.csproj index cac032f20..f476889a1 100644 --- a/src/Dock.Model.ReactiveUI/Dock.Model.ReactiveUI.csproj +++ b/src/Dock.Model.ReactiveUI/Dock.Model.ReactiveUI.csproj @@ -7,6 +7,12 @@ enable + + true + true + $(BaseIntermediateOutputPath)\GeneratedFiles + + Dock.Model.ReactiveUI @@ -21,4 +27,11 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/src/Dock.Model/FactoryBase.Dockable.cs b/src/Dock.Model/FactoryBase.Dockable.cs index b5a9330ba..2cc4acb90 100644 --- a/src/Dock.Model/FactoryBase.Dockable.cs +++ b/src/Dock.Model/FactoryBase.Dockable.cs @@ -353,10 +353,10 @@ public void PreviewPinnedDockable(IDockable dockable) Debug.Assert(rootDock.PinnedDock != null); - RemoveAllVisibleDockables(rootDock.PinnedDock); + RemoveAllVisibleDockables(rootDock.PinnedDock!); dockable.OriginalOwner = dockable.Owner; - AddVisibleDockable(rootDock.PinnedDock, dockable); + AddVisibleDockable(rootDock.PinnedDock!, dockable); } /// @@ -527,7 +527,7 @@ public virtual void PinDockable(IDockable dockable) else { Debug.Assert(dockable.OriginalOwner is IDock); - var originalOwner = (IDock)dockable.OriginalOwner; + var originalOwner = (IDock)dockable.OriginalOwner!; HidePreviewingDockables(rootDock); AddVisibleDockable(originalOwner, dockable); } diff --git a/tests/Dock.Avalonia.UnitTests/Dock.Avalonia.UnitTests.csproj b/tests/Dock.Avalonia.UnitTests/Dock.Avalonia.UnitTests.csproj index 422532f07..95131d803 100644 --- a/tests/Dock.Avalonia.UnitTests/Dock.Avalonia.UnitTests.csproj +++ b/tests/Dock.Avalonia.UnitTests/Dock.Avalonia.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 Library False True diff --git a/tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj b/tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj index 9798b8744..05e6fcde2 100644 --- a/tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj +++ b/tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 Library False True diff --git a/tests/Dock.Model.Mvvm.UnitTests/Dock.Model.Mvvm.UnitTests.csproj b/tests/Dock.Model.Mvvm.UnitTests/Dock.Model.Mvvm.UnitTests.csproj index 43a49db6c..bcc68ba0b 100644 --- a/tests/Dock.Model.Mvvm.UnitTests/Dock.Model.Mvvm.UnitTests.csproj +++ b/tests/Dock.Model.Mvvm.UnitTests/Dock.Model.Mvvm.UnitTests.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 Library False True diff --git a/tests/Dock.Model.ReactiveUI.UnitTests/Dock.Model.ReactiveUI.UnitTests.csproj b/tests/Dock.Model.ReactiveUI.UnitTests/Dock.Model.ReactiveUI.UnitTests.csproj index f411eb177..9e3920d6d 100644 --- a/tests/Dock.Model.ReactiveUI.UnitTests/Dock.Model.ReactiveUI.UnitTests.csproj +++ b/tests/Dock.Model.ReactiveUI.UnitTests/Dock.Model.ReactiveUI.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 Library False True diff --git a/tests/Dock.Model.UnitTests/Dock.Model.UnitTests.csproj b/tests/Dock.Model.UnitTests/Dock.Model.UnitTests.csproj index d78a9cb34..6dde3e9c1 100644 --- a/tests/Dock.Model.UnitTests/Dock.Model.UnitTests.csproj +++ b/tests/Dock.Model.UnitTests/Dock.Model.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 Library False True