mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Core - Fixed an error when enabling a module without a datamodel
Shared UI - XML comments
This commit is contained in:
1 parent
fb3466e102
commit
833a61ecab
38 files changed
+622
-210
No files matched your search
@@ -2,7 +2,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Properties;
|
||||
@@ -14,16 +13,37 @@ namespace Artemis.UI.Shared
|
||||
/// <summary>
|
||||
/// Interaction logic for GradientPicker.xaml
|
||||
/// </summary>
|
||||
public partial class GradientPicker : UserControl, INotifyPropertyChanged
|
||||
public partial class GradientPicker : INotifyPropertyChanged
|
||||
{
|
||||
private static IColorPickerService _colorPickerService;
|
||||
private static IColorPickerService? _colorPickerService;
|
||||
private bool _inCallback;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="GradientPicker" /> class
|
||||
/// </summary>
|
||||
public GradientPicker()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color gradient
|
||||
/// </summary>
|
||||
public ColorGradient ColorGradient
|
||||
{
|
||||
get => (ColorGradient) GetValue(ColorGradientProperty);
|
||||
set => SetValue(ColorGradientProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dialog host in which to show the gradient dialog
|
||||
/// </summary>
|
||||
public string DialogHost
|
||||
{
|
||||
get => (string) GetValue(DialogHostProperty);
|
||||
set => SetValue(DialogHostProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used by the gradient picker to load saved gradients, do not touch or it'll just throw an exception
|
||||
/// </summary>
|
||||
@@ -38,39 +58,35 @@ namespace Artemis.UI.Shared
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected color gradient
|
||||
/// Occurs when the dialog has opened
|
||||
/// </summary>
|
||||
public ColorGradient ColorGradient
|
||||
{
|
||||
get => (ColorGradient) GetValue(ColorGradientProperty);
|
||||
set => SetValue(ColorGradientProperty, value);
|
||||
}
|
||||
public event EventHandler? DialogOpened;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected color gradient
|
||||
/// Occurs when the dialog has closed
|
||||
/// </summary>
|
||||
public string DialogHost
|
||||
{
|
||||
get => (string) GetValue(DialogHostProperty);
|
||||
set => SetValue(DialogHostProperty, value);
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public event EventHandler DialogOpened;
|
||||
public event EventHandler DialogClosed;
|
||||
public event EventHandler? DialogClosed;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="PropertyChanged" /> event
|
||||
/// </summary>
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="DialogOpened" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnDialogOpened()
|
||||
{
|
||||
DialogOpened?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="DialogClosed" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnDialogClosed()
|
||||
{
|
||||
DialogClosed?.Invoke(this, EventArgs.Empty);
|
||||
@@ -89,6 +105,9 @@ namespace Artemis.UI.Shared
|
||||
|
||||
private void UIElement_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (_colorPickerService == null)
|
||||
return;
|
||||
|
||||
Execute.OnUIThread(async () =>
|
||||
{
|
||||
OnDialogOpened();
|
||||
@@ -97,14 +116,26 @@ namespace Artemis.UI.Shared
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
#region Static WPF fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color gradient
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ColorGradientProperty = DependencyProperty.Register(nameof(ColorGradient), typeof(ColorGradient), typeof(GradientPicker),
|
||||
new FrameworkPropertyMetadata(default(ColorGradient), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, ColorGradientPropertyChangedCallback));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the dialog host in which to show the gradient dialog
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DialogHostProperty = DependencyProperty.Register(nameof(DialogHost), typeof(string), typeof(GradientPicker),
|
||||
new FrameworkPropertyMetadata(default(string)));
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the color gradient has changed
|
||||
/// </summary>
|
||||
public static readonly RoutedEvent ColorGradientChangedEvent =
|
||||
EventManager.RegisterRoutedEvent(nameof(ColorGradient), RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler<ColorGradient>), typeof(GradientPicker));
|
||||
|
||||
|
||||
Reference in new issue
Block a user