mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +00:00
Profile editor - Added F5 previewing
Core - Performance fixes
This commit is contained in:
1 parent
5b183d3010
commit
8c7bbc3f0f
11 files changed
+180
-82
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
@@ -17,9 +18,11 @@ namespace Artemis.UI.Screens.ProfileEditor;
|
||||
|
||||
public class ProfileEditorViewModel : MainScreenViewModel
|
||||
{
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private ObservableAsPropertyHelper<ProfileEditorHistory?>? _history;
|
||||
private ObservableAsPropertyHelper<ProfileConfiguration?>? _profileConfiguration;
|
||||
private ObservableAsPropertyHelper<bool>? _suspendedEditing;
|
||||
private ReadOnlyObservableCollection<IToolViewModel>? _tools;
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -34,6 +37,7 @@ public class ProfileEditorViewModel : MainScreenViewModel
|
||||
StatusBarViewModel statusBarViewModel)
|
||||
: base(hostScreen, "profile-editor")
|
||||
{
|
||||
_profileEditorService = profileEditorService;
|
||||
_settingsService = settingsService;
|
||||
VisualEditorViewModel = visualEditorViewModel;
|
||||
ProfileTreeViewModel = profileTreeViewModel;
|
||||
@@ -41,11 +45,12 @@ public class ProfileEditorViewModel : MainScreenViewModel
|
||||
DisplayConditionScriptViewModel = displayConditionScriptViewModel;
|
||||
StatusBarViewModel = statusBarViewModel;
|
||||
TitleBarViewModel = profileEditorTitleBarViewModel;
|
||||
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
_profileConfiguration = profileEditorService.ProfileConfiguration.ToProperty(this, vm => vm.ProfileConfiguration).DisposeWith(d);
|
||||
_history = profileEditorService.History.ToProperty(this, vm => vm.History).DisposeWith(d);
|
||||
_suspendedEditing = profileEditorService.SuspendedEditing.ToProperty(this, vm => vm.SuspendedEditing).DisposeWith(d);
|
||||
profileEditorService.Tools.Connect()
|
||||
.Filter(t => t.ShowInToolbar)
|
||||
.Sort(SortExpressionComparer<IToolViewModel>.Ascending(vm => vm.Order))
|
||||
@@ -54,6 +59,9 @@ public class ProfileEditorViewModel : MainScreenViewModel
|
||||
.DisposeWith(d);
|
||||
Tools = tools;
|
||||
});
|
||||
|
||||
ToggleSuspend = ReactiveCommand.Create(ExecuteToggleSuspend);
|
||||
ToggleAutoSuspend = ReactiveCommand.Create(ExecuteToggleAutoSuspend);
|
||||
}
|
||||
|
||||
public VisualEditorViewModel VisualEditorViewModel { get; }
|
||||
@@ -70,12 +78,24 @@ public class ProfileEditorViewModel : MainScreenViewModel
|
||||
|
||||
public ProfileConfiguration? ProfileConfiguration => _profileConfiguration?.Value;
|
||||
public ProfileEditorHistory? History => _history?.Value;
|
||||
public bool SuspendedEditing => _suspendedEditing?.Value ?? false;
|
||||
public PluginSetting<double> TreeWidth => _settingsService.GetSetting("ProfileEditor.TreeWidth", 350.0);
|
||||
public PluginSetting<double> ConditionsHeight => _settingsService.GetSetting("ProfileEditor.ConditionsHeight", 300.0);
|
||||
public PluginSetting<double> PropertiesHeight => _settingsService.GetSetting("ProfileEditor.PropertiesHeight", 300.0);
|
||||
public ReactiveCommand<Unit, Unit> ToggleSuspend { get; }
|
||||
public ReactiveCommand<Unit, Unit> ToggleAutoSuspend { get; }
|
||||
|
||||
public void OpenUrl(string url)
|
||||
{
|
||||
Utilities.OpenUrl(url);
|
||||
}
|
||||
|
||||
private void ExecuteToggleSuspend()
|
||||
{
|
||||
_profileEditorService.ChangeSuspendedEditing(!SuspendedEditing);
|
||||
}
|
||||
|
||||
private void ExecuteToggleAutoSuspend()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user