mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Editor - Fixed suspending layers
Editor - Disable suspending layers with spacebar Nodes - Fixed changed event source node not using numerics Nodes - Simplify checking wether a pin is numeric
This commit is contained in:
1 parent
eec2419005
commit
5c4175ed9c
16 files changed
+55
-36
No files matched your search
@@ -32,7 +32,7 @@ public class DataModelDebugViewModel : ActivatableViewModelBase, IRoutableViewMo
|
||||
{
|
||||
_dataModelUIService = dataModelUIService;
|
||||
_pluginManagementService = pluginManagementService;
|
||||
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(25), DispatcherPriority.Normal, (_, _) => Update());
|
||||
_updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(25), DispatcherPriority.DataBind, (_, _) => Update());
|
||||
|
||||
HostScreen = hostScreen;
|
||||
Modules = new ObservableCollection<Module>();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
@@ -13,52 +14,36 @@ namespace Artemis.UI.Screens.Plugins;
|
||||
public class PluginSettingsViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private Plugin _plugin;
|
||||
|
||||
private readonly ISettingsVmFactory _settingsVmFactory;
|
||||
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly INotificationService _notificationService;
|
||||
|
||||
private PluginViewModel _pluginViewModel;
|
||||
|
||||
public PluginSettingsViewModel(Plugin plugin, ISettingsVmFactory settingsVmFactory, IPluginManagementService pluginManagementService, INotificationService notificationService)
|
||||
{
|
||||
_plugin = plugin;
|
||||
_settingsVmFactory = settingsVmFactory;
|
||||
_pluginManagementService = pluginManagementService;
|
||||
_notificationService = notificationService;
|
||||
|
||||
Reload = ReactiveCommand.CreateFromTask(ExecuteReload);
|
||||
|
||||
PluginViewModel = settingsVmFactory.PluginViewModel(_plugin, Reload);
|
||||
PluginFeatures = new ObservableCollection<PluginFeatureViewModel>();
|
||||
foreach (PluginFeatureInfo pluginFeatureInfo in _plugin.Features)
|
||||
PluginFeatures.Add(settingsVmFactory.PluginFeatureViewModel(pluginFeatureInfo, false));
|
||||
PluginFeatures = new ObservableCollection<PluginFeatureViewModel>(_plugin.Features.Select(f => settingsVmFactory.PluginFeatureViewModel(f, false)));
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> Reload { get; }
|
||||
|
||||
public PluginViewModel PluginViewModel
|
||||
{
|
||||
get => _pluginViewModel;
|
||||
private set => RaiseAndSetIfChanged(ref _pluginViewModel, value);
|
||||
}
|
||||
public PluginViewModel PluginViewModel { get; }
|
||||
|
||||
public ObservableCollection<PluginFeatureViewModel> PluginFeatures { get; }
|
||||
|
||||
private async Task ExecuteReload()
|
||||
{
|
||||
// Unloading the plugin will remove this viewmodel, this method is it's final act 😭
|
||||
bool wasEnabled = _plugin.IsEnabled;
|
||||
await Task.Run(() => _pluginManagementService.UnloadPlugin(_plugin));
|
||||
|
||||
PluginFeatures.Clear();
|
||||
_plugin = _pluginManagementService.LoadPlugin(_plugin.Directory);
|
||||
|
||||
PluginViewModel = _settingsVmFactory.PluginViewModel(_plugin, Reload);
|
||||
foreach (PluginFeatureInfo pluginFeatureInfo in _plugin.Features)
|
||||
PluginFeatures.Add(_settingsVmFactory.PluginFeatureViewModel(pluginFeatureInfo, false));
|
||||
|
||||
if (wasEnabled)
|
||||
await PluginViewModel.UpdateEnabled(true);
|
||||
await Task.Run(() => _pluginManagementService.EnablePlugin(_plugin, true, true));
|
||||
|
||||
_notificationService.CreateNotification().WithTitle("Reloaded plugin.").Show();
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class DisplayConditionScriptViewModel : ActivatableViewModelBase
|
||||
.DisposeWith(d);
|
||||
});
|
||||
|
||||
_conditionViewModel = this.WhenAnyValue(vm => vm.SelectedConditionTypeViewModel).Select(_ => CreateConditionViewModel()).ToProperty(this, vm => vm.ConditionViewModel);
|
||||
_conditionViewModel = this.WhenAnyValue(vm => vm.SelectedConditionTypeViewModel, vm => vm.ProfileElement).Select(_ => CreateConditionViewModel()).ToProperty(this, vm => vm.ConditionViewModel);
|
||||
}
|
||||
|
||||
public RenderProfileElement? ProfileElement => _profileElement?.Value;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
Classes="icon-button icon-button-small"
|
||||
ToolTip.Tip="Toggle suspended state"
|
||||
IsChecked="{CompiledBinding Folder.Suspended}"
|
||||
Focusable="False"
|
||||
VerticalAlignment="Center"
|
||||
Margin="4 0">
|
||||
<avalonia:MaterialIcon Kind="Pause" />
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
Classes="icon-button icon-button-small"
|
||||
ToolTip.Tip="Toggle suspended state"
|
||||
IsChecked="{CompiledBinding Layer.Suspended}"
|
||||
Focusable="False"
|
||||
VerticalAlignment="Center"
|
||||
Margin="4 0">
|
||||
<avalonia:MaterialIcon Kind="Pause" />
|
||||
|
||||
@@ -31,6 +31,7 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase
|
||||
private ProfileElement? _profileElement;
|
||||
private string? _renameValue;
|
||||
private bool _renaming;
|
||||
private TimeSpan _time;
|
||||
|
||||
protected TreeItemViewModel(TreeItemViewModel? parent,
|
||||
ProfileElement? profileElement,
|
||||
@@ -56,6 +57,7 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
ProfileEditorService.Time.Subscribe(t => _time = t).DisposeWith(d);
|
||||
ProfileEditorService.ProfileElement.Subscribe(element => _currentProfileElement = element).DisposeWith(d);
|
||||
SubscribeToProfileElement(d);
|
||||
CreateTreeItems();
|
||||
@@ -173,6 +175,7 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase
|
||||
Observable.FromEventPattern<ProfileElementEventArgs>(x => ProfileElement.ChildRemoved += x, x => ProfileElement.ChildRemoved -= x)
|
||||
.Subscribe(c => RemoveTreeItemsIfFound(c.Sender, c.EventArgs.ProfileElement))
|
||||
.DisposeWith(d);
|
||||
ProfileElement.WhenAnyValue(e => e.Suspended).Subscribe(_ => ProfileEditorService.ChangeTime(_time)).DisposeWith(d);
|
||||
}
|
||||
|
||||
protected void RemoveTreeItemsIfFound(object? sender, ProfileElement profileElement)
|
||||
|
||||
Reference in new issue
Block a user