mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-11 19:12:31 +02:00
6ff9fee77c
- **Windows MSI installer:**
- (Add) UVtools folder to start menu with:
- UVtools
- UVtoolsCmd
- Uninstall UVtools
- (Add) Prompt for add open in UVtools when right-click on supported files
- (Add) Prompt for create desktop shortcut
- (Add) Prompt for launch UVtools after the installation
- (Improvement) Cleanup and simplify the install project
- (Add) PrusaSlicer printer: Peopoly Phenom Forge
- (Upgrade) .NET from 6.0.8 to 6.0.9
- (Fix) Corruption in file after attempt to save to a locked file (#551)
64 lines
2.1 KiB
C#
64 lines
2.1 KiB
C#
/*
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* Version 3, 19 November 2007
|
|
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace UVtools.Core.Objects;
|
|
|
|
/// <summary>
|
|
/// Implementation of <see cref="INotifyPropertyChanged" /> to simplify models.
|
|
/// </summary>
|
|
public abstract class BindableBase : INotifyPropertyChanged
|
|
{
|
|
/// <summary>
|
|
/// Multicast event for property change notifications.
|
|
/// </summary>
|
|
private PropertyChangedEventHandler? _propertyChanged;
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged
|
|
{
|
|
add => _propertyChanged += value;
|
|
remove => _propertyChanged -= value;
|
|
}
|
|
|
|
protected bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
|
{
|
|
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
|
field = value;
|
|
RaisePropertyChanged(propertyName);
|
|
return true;
|
|
}
|
|
|
|
protected void RaiseAndSet<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
|
{
|
|
field = value;
|
|
RaisePropertyChanged(propertyName);
|
|
}
|
|
|
|
|
|
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Notifies listeners that a property value has changed.
|
|
/// </summary>
|
|
/// <param name="propertyName">
|
|
/// Name of the property used to notify listeners. This
|
|
/// value is optional and can be provided automatically when invoked from compilers
|
|
/// that support <see cref="CallerMemberNameAttribute" />.
|
|
/// </param>
|
|
protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null)
|
|
{
|
|
var e = new PropertyChangedEventArgs(propertyName);
|
|
OnPropertyChanged(e);
|
|
_propertyChanged?.Invoke(this, e);
|
|
}
|
|
} |