Storage - Added migration to clear the DB

Profile - Don't store empty visual scripts
Profile tree - Improved drag & drop
This commit is contained in:
Robert committed 2022-08-04 23:01:27 +02:00
1 parent 73a80ef476
commit e9566ca689
22 files changed
+73 -515

No files matched your search

@@ -81,5 +81,6 @@ public class EventConditionViewModel : ActivatableViewModelBase
private async Task ExecuteOpenEditor()
{
await _windowService.ShowDialogAsync<NodeScriptWindowViewModel, bool>(("nodeScript", _eventCondition.Script));
await _profileEditorService.SaveProfileAsync();
}
}
@@ -52,5 +52,6 @@ public class StaticConditionViewModel : ActivatableViewModelBase
private async Task ExecuteOpenEditor()
{
await _windowService.ShowDialogAsync<NodeScriptWindowViewModel, bool>(("nodeScript", _staticCondition.Script));
await _profileEditorService.SaveProfileAsync();
}
}
@@ -63,7 +63,8 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
TreeDropType dropType = TreeDropType.Before;
if (!targetNode.SupportsChildren)
{
if (position.Y > targetVisual.Bounds.Top + targetVisual.Bounds.Height / 2)
position = e.GetPosition(targetVisual);
if (position.Y > targetVisual.Bounds.Height / 2)
dropType = TreeDropType.After;
}
else
@@ -71,10 +72,11 @@ public class ProfileTreeViewDropHandler : DropHandlerBase
IVisual? header = targetVisual.GetVisualDescendants().FirstOrDefault(d => d is Border b && b.Name == "PART_LayoutRoot");
if (header != null)
{
position = e.GetPosition(header);
double segments = header.Bounds.Height / 3.0;
if (position.Y > targetVisual.Bounds.Top + segments * 2)
if (position.Y > segments * 2)
dropType = TreeDropType.After;
else if (position.Y > targetVisual.Bounds.Top + segments)
else if (position.Y > segments)
dropType = TreeDropType.Into;
}
}
@@ -10,6 +10,7 @@ using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.VisualScripting;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Services;
using Artemis.UI.Shared.Services.NodeEditor;
using Artemis.UI.Shared.Services.ProfileEditor;
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
using Avalonia.Threading;
@@ -72,7 +73,10 @@ public class DataBindingViewModel : ActivatableViewModelBase
public async Task OpenEditor()
{
if (LayerProperty != null && LayerProperty.BaseDataBinding.IsEnabled)
{
await _windowService.ShowDialogAsync<NodeScriptWindowViewModel, bool>(("nodeScript", LayerProperty.BaseDataBinding.Script));
await _profileEditorService.SaveProfileAsync();
}
}
private void Update(object? sender, EventArgs e)