mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
UI - Removed Fody, begone arrogant devs!
This commit is contained in:
parent
8e01d1f63e
commit
2c2b0ca3e1
@ -89,6 +89,9 @@ namespace Artemis.Core.Services.Storage
|
|||||||
|
|
||||||
public void ActivateProfile(ProfileModule module, Profile profile)
|
public void ActivateProfile(ProfileModule module, Profile profile)
|
||||||
{
|
{
|
||||||
|
if (module.ActiveProfile == profile)
|
||||||
|
return;
|
||||||
|
|
||||||
module.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
|
module.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,10 +128,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
||||||
<PackageReference Include="FluentValidation" Version="8.6.2" />
|
<PackageReference Include="FluentValidation" Version="8.6.2" />
|
||||||
<PackageReference Include="Fody" Version="6.2.0">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="gong-wpf-dragdrop" Version="2.2.0" />
|
<PackageReference Include="gong-wpf-dragdrop" Version="2.2.0" />
|
||||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.11" />
|
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.11" />
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
|
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
|
||||||
@ -141,7 +137,6 @@
|
|||||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
|
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
|
||||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||||
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
|
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
|
||||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
|
|
||||||
<PackageReference Include="Serilog" Version="2.9.0" />
|
<PackageReference Include="Serilog" Version="2.9.0" />
|
||||||
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.3" />
|
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.3" />
|
||||||
<PackageReference Include="Stylet" Version="1.3.2" />
|
<PackageReference Include="Stylet" Version="1.3.2" />
|
||||||
|
|||||||
@ -9,6 +9,10 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
{
|
{
|
||||||
public class DataModelListViewModel : DataModelVisualizationViewModel
|
public class DataModelListViewModel : DataModelVisualizationViewModel
|
||||||
{
|
{
|
||||||
|
private BindableCollection<DataModelVisualizationViewModel> _children;
|
||||||
|
private IList _list;
|
||||||
|
private string _count;
|
||||||
|
|
||||||
public DataModelListViewModel(PropertyInfo propertyInfo, DataModelPropertyAttribute propertyDescription, DataModelVisualizationViewModel parent)
|
public DataModelListViewModel(PropertyInfo propertyInfo, DataModelPropertyAttribute propertyDescription, DataModelVisualizationViewModel parent)
|
||||||
{
|
{
|
||||||
PropertyInfo = propertyInfo;
|
PropertyInfo = propertyInfo;
|
||||||
@ -17,9 +21,23 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
Children = new BindableCollection<DataModelVisualizationViewModel>();
|
Children = new BindableCollection<DataModelVisualizationViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BindableCollection<DataModelVisualizationViewModel> Children { get; set; }
|
public BindableCollection<DataModelVisualizationViewModel> Children
|
||||||
public IList List { get; set; }
|
{
|
||||||
public string Count { get; set; }
|
get => _children;
|
||||||
|
set => SetAndNotify(ref _children, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList List
|
||||||
|
{
|
||||||
|
get => _list;
|
||||||
|
set => SetAndNotify(ref _list, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Count
|
||||||
|
{
|
||||||
|
get => _count;
|
||||||
|
set => SetAndNotify(ref _count, value);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,6 +7,8 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
{
|
{
|
||||||
public class DataModelViewModel : DataModelVisualizationViewModel
|
public class DataModelViewModel : DataModelVisualizationViewModel
|
||||||
{
|
{
|
||||||
|
private BindableCollection<DataModelVisualizationViewModel> _children;
|
||||||
|
|
||||||
public DataModelViewModel()
|
public DataModelViewModel()
|
||||||
{
|
{
|
||||||
Children = new BindableCollection<DataModelVisualizationViewModel>();
|
Children = new BindableCollection<DataModelVisualizationViewModel>();
|
||||||
@ -23,7 +25,11 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
PopulateProperties();
|
PopulateProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BindableCollection<DataModelVisualizationViewModel> Children { get; set; }
|
public BindableCollection<DataModelVisualizationViewModel> Children
|
||||||
|
{
|
||||||
|
get => _children;
|
||||||
|
set => SetAndNotify(ref _children, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void PopulateProperties()
|
public void PopulateProperties()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,15 +10,55 @@ namespace Artemis.UI.DataModelVisualization
|
|||||||
{
|
{
|
||||||
public abstract class DataModelVisualizationViewModel : PropertyChangedBase
|
public abstract class DataModelVisualizationViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
public DataModelPropertyAttribute PropertyDescription { get; protected set; }
|
private DataModelPropertyAttribute _propertyDescription;
|
||||||
public PropertyInfo PropertyInfo { get; protected set; }
|
private PropertyInfo _propertyInfo;
|
||||||
public Type PropertyType { get; set; }
|
private Type _propertyType;
|
||||||
|
private DataModelVisualizationViewModel _parent;
|
||||||
|
private object _model;
|
||||||
|
private bool _isListProperty;
|
||||||
|
private string _listDescription;
|
||||||
|
|
||||||
public DataModelVisualizationViewModel Parent { get; protected set; }
|
public DataModelPropertyAttribute PropertyDescription
|
||||||
public object Model { get; set; }
|
{
|
||||||
|
get => _propertyDescription;
|
||||||
|
protected set => SetAndNotify(ref _propertyDescription, value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsListProperty { get; set; }
|
public PropertyInfo PropertyInfo
|
||||||
public string ListDescription { get; set; }
|
{
|
||||||
|
get => _propertyInfo;
|
||||||
|
protected set => SetAndNotify(ref _propertyInfo, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type PropertyType
|
||||||
|
{
|
||||||
|
get => _propertyType;
|
||||||
|
set => SetAndNotify(ref _propertyType, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataModelVisualizationViewModel Parent
|
||||||
|
{
|
||||||
|
get => _parent;
|
||||||
|
protected set => SetAndNotify(ref _parent, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Model
|
||||||
|
{
|
||||||
|
get => _model;
|
||||||
|
set => SetAndNotify(ref _model, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsListProperty
|
||||||
|
{
|
||||||
|
get => _isListProperty;
|
||||||
|
set => SetAndNotify(ref _isListProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ListDescription
|
||||||
|
{
|
||||||
|
get => _listDescription;
|
||||||
|
set => SetAndNotify(ref _listDescription, value);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void Update();
|
public abstract void Update();
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
|
|||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem;
|
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
|
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools;
|
||||||
using Artemis.UI.Screens.Settings.Debug;
|
using Artemis.UI.Screens.Settings.Debug;
|
||||||
using Artemis.UI.Screens.Settings.Tabs.Devices;
|
using Artemis.UI.Screens.Settings.Tabs.Devices;
|
||||||
using Artemis.UI.Screens.Settings.Tabs.Plugins;
|
using Artemis.UI.Screens.Settings.Tabs.Plugins;
|
||||||
@ -63,6 +64,14 @@ namespace Artemis.UI.Ninject.Factories
|
|||||||
ProfileLayerViewModel Create(Layer layer);
|
ProfileLayerViewModel Create(Layer layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IVisualizationToolVmFactory : IVmFactory
|
||||||
|
{
|
||||||
|
ViewpointMoveToolViewModel ViewpointMoveToolViewModel(ProfileViewModel profileViewModel);
|
||||||
|
EditToolViewModel EditToolViewModel(ProfileViewModel profileViewModel);
|
||||||
|
SelectionToolViewModel SelectionToolViewModel(ProfileViewModel profileViewModel);
|
||||||
|
SelectionRemoveToolViewModel SelectionRemoveToolViewModel(ProfileViewModel profileViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
public interface ILayerPropertyVmFactory : IVmFactory
|
public interface ILayerPropertyVmFactory : IVmFactory
|
||||||
{
|
{
|
||||||
LayerPropertyGroupViewModel LayerPropertyGroupViewModel(LayerPropertyGroup layerPropertyGroup, PropertyGroupDescriptionAttribute propertyGroupDescription);
|
LayerPropertyGroupViewModel LayerPropertyGroupViewModel(LayerPropertyGroup layerPropertyGroup, PropertyGroupDescriptionAttribute propertyGroupDescription);
|
||||||
|
|||||||
@ -15,6 +15,7 @@ namespace Artemis.UI.PropertyInput
|
|||||||
{
|
{
|
||||||
private readonly ILayerService _layerService;
|
private readonly ILayerService _layerService;
|
||||||
private readonly IPluginService _pluginService;
|
private readonly IPluginService _pluginService;
|
||||||
|
private List<LayerBrushDescriptor> _descriptors;
|
||||||
|
|
||||||
public BrushPropertyInputViewModel(LayerProperty<LayerBrushReference> layerProperty, IProfileEditorService profileEditorService,
|
public BrushPropertyInputViewModel(LayerProperty<LayerBrushReference> layerProperty, IProfileEditorService profileEditorService,
|
||||||
ILayerService layerService, IPluginService pluginService) : base(layerProperty, profileEditorService)
|
ILayerService layerService, IPluginService pluginService) : base(layerProperty, profileEditorService)
|
||||||
@ -27,7 +28,11 @@ namespace Artemis.UI.PropertyInput
|
|||||||
UpdateEnumValues();
|
UpdateEnumValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LayerBrushDescriptor> Descriptors { get; set; }
|
public List<LayerBrushDescriptor> Descriptors
|
||||||
|
{
|
||||||
|
get => _descriptors;
|
||||||
|
set => SetAndNotify(ref _descriptors, value);
|
||||||
|
}
|
||||||
|
|
||||||
public LayerBrushDescriptor SelectedDescriptor
|
public LayerBrushDescriptor SelectedDescriptor
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,14 +18,12 @@ namespace Artemis.UI.PropertyInput
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Since SKSize is immutable we need to create properties that replace the SKSize entirely
|
// Since SKSize is immutable we need to create properties that replace the SKSize entirely
|
||||||
// [DependsOn(nameof(InputValue))]
|
|
||||||
public float Width
|
public float Width
|
||||||
{
|
{
|
||||||
get => InputValue.Width;
|
get => InputValue.Width;
|
||||||
set => InputValue = new SKSize(value, Height);
|
set => InputValue = new SKSize(value, Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// [DependsOn(nameof(InputValue))]
|
|
||||||
public float Height
|
public float Height
|
||||||
{
|
{
|
||||||
get => InputValue.Height;
|
get => InputValue.Height;
|
||||||
|
|||||||
@ -7,11 +7,17 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
|||||||
{
|
{
|
||||||
public class ProfileCreateViewModel : DialogViewModelBase
|
public class ProfileCreateViewModel : DialogViewModelBase
|
||||||
{
|
{
|
||||||
|
private string _profileName;
|
||||||
|
|
||||||
public ProfileCreateViewModel(IModelValidator<ProfileCreateViewModel> validator) : base(validator)
|
public ProfileCreateViewModel(IModelValidator<ProfileCreateViewModel> validator) : base(validator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ProfileName { get; set; }
|
public string ProfileName
|
||||||
|
{
|
||||||
|
get => _profileName;
|
||||||
|
set => SetAndNotify(ref _profileName, value);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Accept()
|
public async Task Accept()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,6 +7,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
|||||||
{
|
{
|
||||||
public class RenameViewModel : DialogViewModelBase
|
public class RenameViewModel : DialogViewModelBase
|
||||||
{
|
{
|
||||||
|
private string _elementName;
|
||||||
|
|
||||||
public RenameViewModel(IModelValidator<RenameViewModel> validator, string subject, string currentName) : base(validator)
|
public RenameViewModel(IModelValidator<RenameViewModel> validator, string subject, string currentName) : base(validator)
|
||||||
{
|
{
|
||||||
Subject = subject;
|
Subject = subject;
|
||||||
@ -14,7 +16,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string Subject { get; }
|
public string Subject { get; }
|
||||||
public string ElementName { get; set; }
|
|
||||||
|
public string ElementName
|
||||||
|
{
|
||||||
|
get => _elementName;
|
||||||
|
set => SetAndNotify(ref _elementName, value);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Accept()
|
public async Task Accept()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,15 +7,28 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract
|
|||||||
{
|
{
|
||||||
public abstract class LayerPropertyBaseViewModel : PropertyChangedBase, IDisposable
|
public abstract class LayerPropertyBaseViewModel : PropertyChangedBase, IDisposable
|
||||||
{
|
{
|
||||||
|
private bool _isExpanded;
|
||||||
|
private List<LayerPropertyBaseViewModel> _children;
|
||||||
|
|
||||||
protected LayerPropertyBaseViewModel()
|
protected LayerPropertyBaseViewModel()
|
||||||
{
|
{
|
||||||
Children = new List<LayerPropertyBaseViewModel>();
|
Children = new List<LayerPropertyBaseViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool IsExpanded { get; set; }
|
|
||||||
public abstract bool IsVisible { get; }
|
public abstract bool IsVisible { get; }
|
||||||
|
|
||||||
public List<LayerPropertyBaseViewModel> Children { get; set; }
|
public virtual bool IsExpanded
|
||||||
|
{
|
||||||
|
get => _isExpanded;
|
||||||
|
set => SetAndNotify(ref _isExpanded, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LayerPropertyBaseViewModel> Children
|
||||||
|
{
|
||||||
|
get => _children;
|
||||||
|
set => SetAndNotify(ref _children, value);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void Dispose();
|
public abstract void Dispose();
|
||||||
|
|
||||||
public abstract List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly);
|
public abstract List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly);
|
||||||
|
|||||||
@ -13,8 +13,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerEffects
|
|||||||
public class EffectsViewModel : PropertyChangedBase
|
public class EffectsViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
private readonly ILayerService _layerService;
|
private readonly ILayerService _layerService;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
|
||||||
private readonly IPluginService _pluginService;
|
private readonly IPluginService _pluginService;
|
||||||
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
private BindableCollection<LayerEffectDescriptor> _layerEffectDescriptors;
|
||||||
|
private LayerEffectDescriptor _selectedLayerEffectDescriptor;
|
||||||
|
|
||||||
public EffectsViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IPluginService pluginService, ILayerService layerService, IProfileEditorService profileEditorService)
|
public EffectsViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IPluginService pluginService, ILayerService layerService, IProfileEditorService profileEditorService)
|
||||||
{
|
{
|
||||||
@ -27,11 +29,19 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerEffects
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
|
public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
|
||||||
|
|
||||||
public BindableCollection<LayerEffectDescriptor> LayerEffectDescriptors { get; set; }
|
|
||||||
public bool HasLayerEffectDescriptors => LayerEffectDescriptors.Any();
|
public bool HasLayerEffectDescriptors => LayerEffectDescriptors.Any();
|
||||||
|
|
||||||
public LayerEffectDescriptor SelectedLayerEffectDescriptor { get; set; }
|
public BindableCollection<LayerEffectDescriptor> LayerEffectDescriptors
|
||||||
|
{
|
||||||
|
get => _layerEffectDescriptors;
|
||||||
|
set => SetAndNotify(ref _layerEffectDescriptors, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerEffectDescriptor SelectedLayerEffectDescriptor
|
||||||
|
{
|
||||||
|
get => _selectedLayerEffectDescriptor;
|
||||||
|
set => SetAndNotify(ref _selectedLayerEffectDescriptor, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void PopulateDescriptors()
|
public void PopulateDescriptors()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
{
|
{
|
||||||
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
||||||
private LayerPropertyGroupViewModel _brushPropertyGroup;
|
private LayerPropertyGroupViewModel _brushPropertyGroup;
|
||||||
|
private bool _repeatAfterLastKeyframe;
|
||||||
|
private int _propertyTreeIndex;
|
||||||
|
private PropertiesProfileElement _selectedPropertiesElement;
|
||||||
|
private BindableCollection<LayerPropertyGroupViewModel> _layerPropertyGroups;
|
||||||
|
private TreeViewModel _treeViewModel;
|
||||||
|
private EffectsViewModel _effectsViewModel;
|
||||||
|
private TimelineViewModel _timelineViewModel;
|
||||||
|
private bool _playing;
|
||||||
|
|
||||||
public LayerPropertiesViewModel(IProfileEditorService profileEditorService, ICoreService coreService, ISettingsService settingsService,
|
public LayerPropertiesViewModel(IProfileEditorService profileEditorService, ICoreService coreService, ISettingsService settingsService,
|
||||||
ILayerPropertyVmFactory layerPropertyVmFactory)
|
ILayerPropertyVmFactory layerPropertyVmFactory)
|
||||||
@ -46,8 +54,18 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
public ICoreService CoreService { get; }
|
public ICoreService CoreService { get; }
|
||||||
public ISettingsService SettingsService { get; }
|
public ISettingsService SettingsService { get; }
|
||||||
|
|
||||||
public bool Playing { get; set; }
|
public bool Playing
|
||||||
public bool RepeatAfterLastKeyframe { get; set; }
|
{
|
||||||
|
get => _playing;
|
||||||
|
set => SetAndNotify(ref _playing, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool RepeatAfterLastKeyframe
|
||||||
|
{
|
||||||
|
get => _repeatAfterLastKeyframe;
|
||||||
|
set => SetAndNotify(ref _repeatAfterLastKeyframe, value);
|
||||||
|
}
|
||||||
|
|
||||||
public string FormattedCurrentTime => $"{Math.Floor(ProfileEditorService.CurrentTime.TotalSeconds):00}.{ProfileEditorService.CurrentTime.Milliseconds:000}";
|
public string FormattedCurrentTime => $"{Math.Floor(ProfileEditorService.CurrentTime.TotalSeconds):00}.{ProfileEditorService.CurrentTime.Milliseconds:000}";
|
||||||
|
|
||||||
public Thickness TimeCaretPosition
|
public Thickness TimeCaretPosition
|
||||||
@ -56,17 +74,55 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
set => ProfileEditorService.CurrentTime = TimeSpan.FromSeconds(value.Left / ProfileEditorService.PixelsPerSecond);
|
set => ProfileEditorService.CurrentTime = TimeSpan.FromSeconds(value.Left / ProfileEditorService.PixelsPerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int PropertyTreeIndex { get; set; }
|
public int PropertyTreeIndex
|
||||||
|
{
|
||||||
|
get => _propertyTreeIndex;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!SetAndNotify(ref _propertyTreeIndex, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(PropertyTreeVisible));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool PropertyTreeVisible => PropertyTreeIndex == 0;
|
public bool PropertyTreeVisible => PropertyTreeIndex == 0;
|
||||||
|
|
||||||
public PropertiesProfileElement SelectedPropertiesElement { get; set; }
|
public PropertiesProfileElement SelectedPropertiesElement
|
||||||
|
{
|
||||||
|
get => _selectedPropertiesElement;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!SetAndNotify(ref _selectedPropertiesElement, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(SelectedLayer));
|
||||||
|
NotifyOfPropertyChange(nameof(SelectedFolder));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Layer SelectedLayer => SelectedPropertiesElement as Layer;
|
public Layer SelectedLayer => SelectedPropertiesElement as Layer;
|
||||||
public Folder SelectedFolder => SelectedPropertiesElement as Folder;
|
public Folder SelectedFolder => SelectedPropertiesElement as Folder;
|
||||||
|
|
||||||
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; set; }
|
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups
|
||||||
public TreeViewModel TreeViewModel { get; set; }
|
{
|
||||||
public EffectsViewModel EffectsViewModel { get; set; }
|
get => _layerPropertyGroups;
|
||||||
public TimelineViewModel TimelineViewModel { get; set; }
|
set => SetAndNotify(ref _layerPropertyGroups, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeViewModel TreeViewModel
|
||||||
|
{
|
||||||
|
get => _treeViewModel;
|
||||||
|
set => SetAndNotify(ref _treeViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EffectsViewModel EffectsViewModel
|
||||||
|
{
|
||||||
|
get => _effectsViewModel;
|
||||||
|
set => SetAndNotify(ref _effectsViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimelineViewModel TimelineViewModel
|
||||||
|
{
|
||||||
|
get => _timelineViewModel;
|
||||||
|
set => SetAndNotify(ref _timelineViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnInitialActivate()
|
protected override void OnInitialActivate()
|
||||||
{
|
{
|
||||||
@ -116,8 +172,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
|
|
||||||
private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e)
|
private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => FormattedCurrentTime);
|
NotifyOfPropertyChange(nameof(FormattedCurrentTime));
|
||||||
NotifyOfPropertyChange(() => TimeCaretPosition);
|
NotifyOfPropertyChange(nameof(TimeCaretPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProfileEditorServiceOnPixelsPerSecondChanged(object sender, EventArgs e)
|
private void ProfileEditorServiceOnPixelsPerSecondChanged(object sender, EventArgs e)
|
||||||
|
|||||||
@ -26,6 +26,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
||||||
|
private ViewModelType _groupType;
|
||||||
|
private TreePropertyGroupViewModel _treePropertyGroupViewModel;
|
||||||
|
private TimelinePropertyGroupViewModel _timelinePropertyGroupViewModel;
|
||||||
|
|
||||||
public LayerPropertyGroupViewModel(LayerPropertyGroup layerPropertyGroup, PropertyGroupDescriptionAttribute propertyGroupDescription,
|
public LayerPropertyGroupViewModel(LayerPropertyGroup layerPropertyGroup, PropertyGroupDescriptionAttribute propertyGroupDescription,
|
||||||
IProfileEditorService profileEditorService, ILayerPropertyVmFactory layerPropertyVmFactory)
|
IProfileEditorService profileEditorService, ILayerPropertyVmFactory layerPropertyVmFactory)
|
||||||
@ -44,22 +47,34 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
DetermineType();
|
DetermineType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool IsVisible => !LayerPropertyGroup.IsHidden;
|
||||||
|
public IProfileEditorService ProfileEditorService { get; }
|
||||||
|
public LayerPropertyGroup LayerPropertyGroup { get; }
|
||||||
|
public PropertyGroupDescriptionAttribute PropertyGroupDescription { get; }
|
||||||
|
|
||||||
public override bool IsExpanded
|
public override bool IsExpanded
|
||||||
{
|
{
|
||||||
get => LayerPropertyGroup.ProfileElement.IsPropertyGroupExpanded(LayerPropertyGroup);
|
get => LayerPropertyGroup.ProfileElement.IsPropertyGroupExpanded(LayerPropertyGroup);
|
||||||
set => LayerPropertyGroup.ProfileElement.SetPropertyGroupExpanded(LayerPropertyGroup, value);
|
set => LayerPropertyGroup.ProfileElement.SetPropertyGroupExpanded(LayerPropertyGroup, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsVisible => !LayerPropertyGroup.IsHidden;
|
public ViewModelType GroupType
|
||||||
public ViewModelType GroupType { get; set; }
|
{
|
||||||
|
get => _groupType;
|
||||||
|
set => SetAndNotify(ref _groupType, value);
|
||||||
|
}
|
||||||
|
|
||||||
public IProfileEditorService ProfileEditorService { get; }
|
public TreePropertyGroupViewModel TreePropertyGroupViewModel
|
||||||
|
{
|
||||||
|
get => _treePropertyGroupViewModel;
|
||||||
|
set => SetAndNotify(ref _treePropertyGroupViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
public LayerPropertyGroup LayerPropertyGroup { get; }
|
public TimelinePropertyGroupViewModel TimelinePropertyGroupViewModel
|
||||||
public PropertyGroupDescriptionAttribute PropertyGroupDescription { get; }
|
{
|
||||||
|
get => _timelinePropertyGroupViewModel;
|
||||||
public TreePropertyGroupViewModel TreePropertyGroupViewModel { get; set; }
|
set => SetAndNotify(ref _timelinePropertyGroupViewModel, value);
|
||||||
public TimelinePropertyGroupViewModel TimelinePropertyGroupViewModel { get; set; }
|
}
|
||||||
|
|
||||||
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly)
|
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,6 +17,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
{
|
{
|
||||||
public class LayerPropertyViewModel<T> : LayerPropertyViewModel
|
public class LayerPropertyViewModel<T> : LayerPropertyViewModel
|
||||||
{
|
{
|
||||||
|
private TreePropertyViewModel<T> _treePropertyViewModel;
|
||||||
|
private TimelinePropertyViewModel<T> _timelinePropertyViewModel;
|
||||||
|
|
||||||
public LayerPropertyViewModel(IProfileEditorService profileEditorService, LayerProperty<T> layerProperty) : base(profileEditorService, layerProperty)
|
public LayerPropertyViewModel(IProfileEditorService profileEditorService, LayerProperty<T> layerProperty) : base(profileEditorService, layerProperty)
|
||||||
{
|
{
|
||||||
LayerProperty = layerProperty;
|
LayerProperty = layerProperty;
|
||||||
@ -44,8 +47,17 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
|
|
||||||
public LayerProperty<T> LayerProperty { get; }
|
public LayerProperty<T> LayerProperty { get; }
|
||||||
|
|
||||||
public TreePropertyViewModel<T> TreePropertyViewModel { get; set; }
|
public TreePropertyViewModel<T> TreePropertyViewModel
|
||||||
public TimelinePropertyViewModel<T> TimelinePropertyViewModel { get; set; }
|
{
|
||||||
|
get => _treePropertyViewModel;
|
||||||
|
set => SetAndNotify(ref _treePropertyViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimelinePropertyViewModel<T> TimelinePropertyViewModel
|
||||||
|
{
|
||||||
|
get => _timelinePropertyViewModel;
|
||||||
|
set => SetAndNotify(ref _timelinePropertyViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly)
|
public override List<BaseLayerPropertyKeyframe> GetKeyframes(bool expandedOnly)
|
||||||
{
|
{
|
||||||
@ -102,6 +114,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
|
|
||||||
public abstract class LayerPropertyViewModel : LayerPropertyBaseViewModel
|
public abstract class LayerPropertyViewModel : LayerPropertyBaseViewModel
|
||||||
{
|
{
|
||||||
|
private TreePropertyViewModel _treePropertyBaseViewModel;
|
||||||
|
private TimelinePropertyViewModel _timelinePropertyBaseViewModel;
|
||||||
|
|
||||||
protected LayerPropertyViewModel(IProfileEditorService profileEditorService, BaseLayerProperty baseLayerProperty)
|
protected LayerPropertyViewModel(IProfileEditorService profileEditorService, BaseLayerProperty baseLayerProperty)
|
||||||
{
|
{
|
||||||
ProfileEditorService = profileEditorService;
|
ProfileEditorService = profileEditorService;
|
||||||
@ -111,7 +126,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
public IProfileEditorService ProfileEditorService { get; }
|
public IProfileEditorService ProfileEditorService { get; }
|
||||||
public BaseLayerProperty BaseLayerProperty { get; }
|
public BaseLayerProperty BaseLayerProperty { get; }
|
||||||
|
|
||||||
public TreePropertyViewModel TreePropertyBaseViewModel { get; set; }
|
public TreePropertyViewModel TreePropertyBaseViewModel
|
||||||
public TimelinePropertyViewModel TimelinePropertyBaseViewModel { get; set; }
|
{
|
||||||
|
get => _treePropertyBaseViewModel;
|
||||||
|
set => SetAndNotify(ref _treePropertyBaseViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimelinePropertyViewModel TimelinePropertyBaseViewModel
|
||||||
|
{
|
||||||
|
get => _timelinePropertyBaseViewModel;
|
||||||
|
set => SetAndNotify(ref _timelinePropertyBaseViewModel, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,12 +18,18 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
EasingFunction = easingFunction;
|
EasingFunction = easingFunction;
|
||||||
Description = easingFunction.Humanize();
|
Description = easingFunction.Humanize();
|
||||||
|
|
||||||
CreateEasingPoints();
|
EasingPoints = new PointCollection();
|
||||||
|
for (var i = 1; i <= 10; i++)
|
||||||
|
{
|
||||||
|
var x = i;
|
||||||
|
var y = Easings.Interpolate(i / 10.0, EasingFunction) * 10;
|
||||||
|
EasingPoints.Add(new Point(x, y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Easings.Functions EasingFunction { get; }
|
public Easings.Functions EasingFunction { get; }
|
||||||
public PointCollection EasingPoints { get; set; }
|
public PointCollection EasingPoints { get; }
|
||||||
public string Description { get; set; }
|
public string Description { get; }
|
||||||
|
|
||||||
public bool IsEasingModeSelected
|
public bool IsEasingModeSelected
|
||||||
{
|
{
|
||||||
@ -35,16 +41,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
_keyframeViewModel.SelectEasingMode(this);
|
_keyframeViewModel.SelectEasingMode(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateEasingPoints()
|
|
||||||
{
|
|
||||||
EasingPoints = new PointCollection();
|
|
||||||
for (var i = 1; i <= 10; i++)
|
|
||||||
{
|
|
||||||
var x = i;
|
|
||||||
var y = Easings.Interpolate(i / 10.0, EasingFunction) * 10;
|
|
||||||
EasingPoints.Add(new Point(x, y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
using Artemis.Core.Models.Profile.LayerProperties;
|
||||||
using Artemis.Core.Utilities;
|
using Artemis.Core.Utilities;
|
||||||
using Artemis.UI.Shared.Services.Interfaces;
|
using Artemis.UI.Shared.Services.Interfaces;
|
||||||
@ -47,7 +46,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
public abstract class TimelineKeyframeViewModel : PropertyChangedBase
|
public abstract class TimelineKeyframeViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
private BindableCollection<TimelineEasingViewModel> _easingViewModels;
|
||||||
|
private bool _isSelected;
|
||||||
private int _pixelsPerSecond;
|
private int _pixelsPerSecond;
|
||||||
|
private string _timestamp;
|
||||||
|
private double _x;
|
||||||
|
|
||||||
protected TimelineKeyframeViewModel(IProfileEditorService profileEditorService, BaseLayerPropertyKeyframe baseLayerPropertyKeyframe)
|
protected TimelineKeyframeViewModel(IProfileEditorService profileEditorService, BaseLayerPropertyKeyframe baseLayerPropertyKeyframe)
|
||||||
{
|
{
|
||||||
@ -57,13 +60,30 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BaseLayerPropertyKeyframe BaseLayerPropertyKeyframe { get; }
|
public BaseLayerPropertyKeyframe BaseLayerPropertyKeyframe { get; }
|
||||||
public BindableCollection<TimelineEasingViewModel> EasingViewModels { get; set; }
|
|
||||||
|
|
||||||
public bool IsSelected { get; set; }
|
public BindableCollection<TimelineEasingViewModel> EasingViewModels
|
||||||
public double X { get; set; }
|
{
|
||||||
public string Timestamp { get; set; }
|
get => _easingViewModels;
|
||||||
|
set => SetAndNotify(ref _easingViewModels, value);
|
||||||
|
}
|
||||||
|
|
||||||
public UIElement ParentView { get; set; }
|
public bool IsSelected
|
||||||
|
{
|
||||||
|
get => _isSelected;
|
||||||
|
set => SetAndNotify(ref _isSelected, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double X
|
||||||
|
{
|
||||||
|
get => _x;
|
||||||
|
set => SetAndNotify(ref _x, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Timestamp
|
||||||
|
{
|
||||||
|
get => _timestamp;
|
||||||
|
set => SetAndNotify(ref _timestamp, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(int pixelsPerSecond)
|
public void Update(int pixelsPerSecond)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,6 +8,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
{
|
{
|
||||||
public class TimelinePropertyGroupViewModel : PropertyChangedBase
|
public class TimelinePropertyGroupViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
|
private BindableCollection<double> _timelineKeyframeViewModels;
|
||||||
|
|
||||||
public TimelinePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
|
public TimelinePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
|
||||||
{
|
{
|
||||||
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
|
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
|
||||||
@ -19,7 +21,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
|
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
|
||||||
public BindableCollection<double> TimelineKeyframeViewModels { get; set; }
|
|
||||||
|
public BindableCollection<double> TimelineKeyframeViewModels
|
||||||
|
{
|
||||||
|
get => _timelineKeyframeViewModels;
|
||||||
|
set => SetAndNotify(ref _timelineKeyframeViewModels, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateKeyframes()
|
public void UpdateKeyframes()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -65,6 +65,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
|
|
||||||
public abstract class TimelinePropertyViewModel : PropertyChangedBase, IDisposable
|
public abstract class TimelinePropertyViewModel : PropertyChangedBase, IDisposable
|
||||||
{
|
{
|
||||||
|
private BindableCollection<TimelineKeyframeViewModel> _timelineKeyframeViewModels;
|
||||||
|
|
||||||
protected TimelinePropertyViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
|
protected TimelinePropertyViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
|
||||||
{
|
{
|
||||||
LayerPropertyBaseViewModel = layerPropertyBaseViewModel;
|
LayerPropertyBaseViewModel = layerPropertyBaseViewModel;
|
||||||
@ -72,7 +74,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertyBaseViewModel LayerPropertyBaseViewModel { get; }
|
public LayerPropertyBaseViewModel LayerPropertyBaseViewModel { get; }
|
||||||
public BindableCollection<TimelineKeyframeViewModel> TimelineKeyframeViewModels { get; set; }
|
|
||||||
|
public BindableCollection<TimelineKeyframeViewModel> TimelineKeyframeViewModels
|
||||||
|
{
|
||||||
|
get => _timelineKeyframeViewModels;
|
||||||
|
set => SetAndNotify(ref _timelineKeyframeViewModels, value);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void Dispose();
|
public abstract void Dispose();
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
|
||||||
using Artemis.UI.Shared.Services.Interfaces;
|
using Artemis.UI.Shared.Services.Interfaces;
|
||||||
using Artemis.UI.Shared.Utilities;
|
using Artemis.UI.Shared.Utilities;
|
||||||
@ -18,6 +17,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
{
|
{
|
||||||
private readonly LayerPropertiesViewModel _layerPropertiesViewModel;
|
private readonly LayerPropertiesViewModel _layerPropertiesViewModel;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
private RectangleGeometry _selectionRectangle;
|
||||||
|
private double _width;
|
||||||
|
|
||||||
public TimelineViewModel(LayerPropertiesViewModel layerPropertiesViewModel, BindableCollection<LayerPropertyGroupViewModel> layerPropertyGroups,
|
public TimelineViewModel(LayerPropertiesViewModel layerPropertiesViewModel, BindableCollection<LayerPropertyGroupViewModel> layerPropertyGroups,
|
||||||
IProfileEditorService profileEditorService)
|
IProfileEditorService profileEditorService)
|
||||||
@ -32,8 +33,17 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
|
|
||||||
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; }
|
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; }
|
||||||
|
|
||||||
public double Width { get; set; }
|
public double Width
|
||||||
public RectangleGeometry SelectionRectangle { get; set; }
|
{
|
||||||
|
get => _width;
|
||||||
|
set => SetAndNotify(ref _width, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RectangleGeometry SelectionRectangle
|
||||||
|
{
|
||||||
|
get => _selectionRectangle;
|
||||||
|
set => SetAndNotify(ref _selectionRectangle, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateKeyframes()
|
public void UpdateKeyframes()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,9 +9,11 @@ using Stylet;
|
|||||||
|
|
||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
||||||
{
|
{
|
||||||
|
|
||||||
public class TreePropertyViewModel<T> : TreePropertyViewModel
|
public class TreePropertyViewModel<T> : TreePropertyViewModel
|
||||||
{
|
{
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
private PropertyInputViewModel<T> _propertyInputViewModel;
|
||||||
|
|
||||||
public TreePropertyViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel, PropertyInputViewModel<T> propertyInputViewModel,
|
public TreePropertyViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel, PropertyInputViewModel<T> propertyInputViewModel,
|
||||||
IProfileEditorService profileEditorService) : base(layerPropertyBaseViewModel)
|
IProfileEditorService profileEditorService) : base(layerPropertyBaseViewModel)
|
||||||
@ -22,7 +24,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertyViewModel<T> LayerPropertyViewModel { get; }
|
public LayerPropertyViewModel<T> LayerPropertyViewModel { get; }
|
||||||
public PropertyInputViewModel<T> PropertyInputViewModel { get; set; }
|
|
||||||
|
public PropertyInputViewModel<T> PropertyInputViewModel
|
||||||
|
{
|
||||||
|
get => _propertyInputViewModel;
|
||||||
|
set => SetAndNotify(ref _propertyInputViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool KeyframesEnabled
|
public bool KeyframesEnabled
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,6 +23,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
|||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
private readonly IProfileService _profileService;
|
private readonly IProfileService _profileService;
|
||||||
private readonly ISettingsService _settingsService;
|
private readonly ISettingsService _settingsService;
|
||||||
|
private BindableCollection<Profile> _profiles;
|
||||||
|
private PluginSetting<GridLength> _sidePanelsWidth;
|
||||||
|
private PluginSetting<GridLength> _displayConditionsHeight;
|
||||||
|
private PluginSetting<GridLength> _bottomPanelsHeight;
|
||||||
|
private PluginSetting<GridLength> _elementPropertiesWidth;
|
||||||
|
|
||||||
public ProfileEditorViewModel(ProfileModule module,
|
public ProfileEditorViewModel(ProfileModule module,
|
||||||
ICollection<ProfileEditorPanelViewModel> viewModels,
|
ICollection<ProfileEditorPanelViewModel> viewModels,
|
||||||
@ -54,12 +59,36 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
|||||||
public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
|
public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
|
||||||
public ProfileTreeViewModel ProfileTreeViewModel { get; }
|
public ProfileTreeViewModel ProfileTreeViewModel { get; }
|
||||||
public ProfileViewModel ProfileViewModel { get; }
|
public ProfileViewModel ProfileViewModel { get; }
|
||||||
public BindableCollection<Profile> Profiles { get; set; }
|
|
||||||
|
|
||||||
public PluginSetting<GridLength> SidePanelsWidth { get; set; }
|
public BindableCollection<Profile> Profiles
|
||||||
public PluginSetting<GridLength> DisplayConditionsHeight { get; set; }
|
{
|
||||||
public PluginSetting<GridLength> BottomPanelsHeight { get; set; }
|
get => _profiles;
|
||||||
public PluginSetting<GridLength> ElementPropertiesWidth { get; set; }
|
set => SetAndNotify(ref _profiles, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<GridLength> SidePanelsWidth
|
||||||
|
{
|
||||||
|
get => _sidePanelsWidth;
|
||||||
|
set => SetAndNotify(ref _sidePanelsWidth, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<GridLength> DisplayConditionsHeight
|
||||||
|
{
|
||||||
|
get => _displayConditionsHeight;
|
||||||
|
set => SetAndNotify(ref _displayConditionsHeight, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<GridLength> BottomPanelsHeight
|
||||||
|
{
|
||||||
|
get => _bottomPanelsHeight;
|
||||||
|
set => SetAndNotify(ref _bottomPanelsHeight, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<GridLength> ElementPropertiesWidth
|
||||||
|
{
|
||||||
|
get => _elementPropertiesWidth;
|
||||||
|
set => SetAndNotify(ref _elementPropertiesWidth, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Profile SelectedProfile
|
public Profile SelectedProfile
|
||||||
{
|
{
|
||||||
@ -165,6 +194,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
|||||||
|
|
||||||
if (_profileEditorService.SelectedProfile != profile)
|
if (_profileEditorService.SelectedProfile != profile)
|
||||||
_profileEditorService.ChangeSelectedProfile(profile);
|
_profileEditorService.ChangeSelectedProfile(profile);
|
||||||
|
|
||||||
|
NotifyOfPropertyChange(nameof(SelectedProfile));
|
||||||
|
NotifyOfPropertyChange(nameof(CanDeleteActiveProfile));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ModuleOnActiveProfileChanged(object sender, EventArgs e)
|
private void ModuleOnActiveProfileChanged(object sender, EventArgs e)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree
|
|||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
private TreeItemViewModel _selectedTreeItem;
|
private TreeItemViewModel _selectedTreeItem;
|
||||||
private bool _updatingTree;
|
private bool _updatingTree;
|
||||||
|
private FolderViewModel _rootFolder;
|
||||||
|
|
||||||
public ProfileTreeViewModel(IProfileEditorService profileEditorService, IFolderVmFactory folderVmFactory)
|
public ProfileTreeViewModel(IProfileEditorService profileEditorService, IFolderVmFactory folderVmFactory)
|
||||||
{
|
{
|
||||||
@ -26,7 +27,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree
|
|||||||
_profileEditorService.ProfileElementSelected += OnProfileElementSelected;
|
_profileEditorService.ProfileElementSelected += OnProfileElementSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FolderViewModel RootFolder { get; set; }
|
public FolderViewModel RootFolder
|
||||||
|
{
|
||||||
|
get => _rootFolder;
|
||||||
|
set => SetAndNotify(ref _rootFolder, value);
|
||||||
|
}
|
||||||
|
|
||||||
public TreeItemViewModel SelectedTreeItem
|
public TreeItemViewModel SelectedTreeItem
|
||||||
{
|
{
|
||||||
@ -34,7 +39,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_updatingTree) return;
|
if (_updatingTree) return;
|
||||||
_selectedTreeItem = value;
|
SetAndNotify(ref _selectedTreeItem, value);
|
||||||
_profileEditorService.ChangeSelectedProfileElement(value?.ProfileElement);
|
_profileEditorService.ChangeSelectedProfileElement(value?.ProfileElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
@ -20,6 +19,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
|
|||||||
private readonly ILayerService _layerService;
|
private readonly ILayerService _layerService;
|
||||||
private readonly ILayerVmFactory _layerVmFactory;
|
private readonly ILayerVmFactory _layerVmFactory;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
private BindableCollection<TreeItemViewModel> _children;
|
||||||
|
private TreeItemViewModel _parent;
|
||||||
|
private ProfileElement _profileElement;
|
||||||
|
|
||||||
protected TreeItemViewModel(TreeItemViewModel parent,
|
protected TreeItemViewModel(TreeItemViewModel parent,
|
||||||
ProfileElement profileElement,
|
ProfileElement profileElement,
|
||||||
@ -42,11 +44,31 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
|
|||||||
UpdateProfileElements();
|
UpdateProfileElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeItemViewModel Parent { get; set; }
|
public TreeItemViewModel Parent
|
||||||
public ProfileElement ProfileElement { get; set; }
|
{
|
||||||
|
get => _parent;
|
||||||
|
set => SetAndNotify(ref _parent, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileElement ProfileElement
|
||||||
|
{
|
||||||
|
get => _profileElement;
|
||||||
|
set => SetAndNotify(ref _profileElement, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<TreeItemViewModel> Children
|
||||||
|
{
|
||||||
|
get => _children;
|
||||||
|
set => SetAndNotify(ref _children, value);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract bool SupportsChildren { get; }
|
public abstract bool SupportsChildren { get; }
|
||||||
public BindableCollection<TreeItemViewModel> Children { get; set; }
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
public List<TreeItemViewModel> GetAllChildren()
|
public List<TreeItemViewModel> GetAllChildren()
|
||||||
{
|
{
|
||||||
@ -214,11 +236,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,8 +5,20 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
{
|
{
|
||||||
public abstract class CanvasViewModel : PropertyChangedBase, IDisposable
|
public abstract class CanvasViewModel : PropertyChangedBase, IDisposable
|
||||||
{
|
{
|
||||||
public double X { get; set; }
|
private double _x;
|
||||||
public double Y { get; set; }
|
private double _y;
|
||||||
|
|
||||||
|
public double X
|
||||||
|
{
|
||||||
|
get => _x;
|
||||||
|
set => SetAndNotify(ref _x, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Y
|
||||||
|
{
|
||||||
|
get => _y;
|
||||||
|
set => SetAndNotify(ref _y, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,6 +9,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
{
|
{
|
||||||
public class ProfileDeviceViewModel : CanvasViewModel
|
public class ProfileDeviceViewModel : CanvasViewModel
|
||||||
{
|
{
|
||||||
|
private ObservableCollection<ProfileLedViewModel> _leds;
|
||||||
|
private ArtemisDevice _device;
|
||||||
|
private bool _addedLeds;
|
||||||
|
|
||||||
public ProfileDeviceViewModel(ArtemisDevice device)
|
public ProfileDeviceViewModel(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
Device = device;
|
Device = device;
|
||||||
@ -17,9 +21,23 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
Task.Run(AddLedsAsync);
|
Task.Run(AddLedsAsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<ProfileLedViewModel> Leds { get; set; }
|
public ObservableCollection<ProfileLedViewModel> Leds
|
||||||
public ArtemisDevice Device { get; set; }
|
{
|
||||||
public bool AddedLeds { get; private set; }
|
get => _leds;
|
||||||
|
set => SetAndNotify(ref _leds, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtemisDevice Device
|
||||||
|
{
|
||||||
|
get => _device;
|
||||||
|
set => SetAndNotify(ref _device, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddedLeds
|
||||||
|
{
|
||||||
|
get => _addedLeds;
|
||||||
|
private set => SetAndNotify(ref _addedLeds, value);
|
||||||
|
}
|
||||||
|
|
||||||
public new double X
|
public new double X
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,6 +20,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
{
|
{
|
||||||
private readonly ILayerEditorService _layerEditorService;
|
private readonly ILayerEditorService _layerEditorService;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
private Geometry _layerGeometry;
|
||||||
|
private Geometry _opacityGeometry;
|
||||||
|
private Geometry _shapeGeometry;
|
||||||
|
private RenderTargetBitmap _layerGeometryBitmap;
|
||||||
|
private Rect _viewportRectangle;
|
||||||
|
private bool _isSelected;
|
||||||
|
|
||||||
public ProfileLayerViewModel(Layer layer, IProfileEditorService profileEditorService, ILayerEditorService layerEditorService)
|
public ProfileLayerViewModel(Layer layer, IProfileEditorService profileEditorService, ILayerEditorService layerEditorService)
|
||||||
{
|
{
|
||||||
@ -36,13 +42,47 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
|
|
||||||
public Layer Layer { get; }
|
public Layer Layer { get; }
|
||||||
|
|
||||||
public Geometry LayerGeometry { get; set; }
|
public Geometry LayerGeometry
|
||||||
public Geometry OpacityGeometry { get; set; }
|
{
|
||||||
public Geometry ShapeGeometry { get; set; }
|
get => _layerGeometry;
|
||||||
public RenderTargetBitmap LayerGeometryBitmap { get; set; }
|
set => SetAndNotify(ref _layerGeometry, value);
|
||||||
public Rect ViewportRectangle { get; set; }
|
}
|
||||||
|
|
||||||
|
public Geometry OpacityGeometry
|
||||||
|
{
|
||||||
|
get => _opacityGeometry;
|
||||||
|
set => SetAndNotify(ref _opacityGeometry, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Geometry ShapeGeometry
|
||||||
|
{
|
||||||
|
get => _shapeGeometry;
|
||||||
|
set => SetAndNotify(ref _shapeGeometry, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RenderTargetBitmap LayerGeometryBitmap
|
||||||
|
{
|
||||||
|
get => _layerGeometryBitmap;
|
||||||
|
set => SetAndNotify(ref _layerGeometryBitmap, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rect ViewportRectangle
|
||||||
|
{
|
||||||
|
get => _viewportRectangle;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!SetAndNotify(ref _viewportRectangle, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(LayerPosition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Thickness LayerPosition => new Thickness(ViewportRectangle.Left, ViewportRectangle.Top, 0, 0);
|
public Thickness LayerPosition => new Thickness(ViewportRectangle.Left, ViewportRectangle.Top, 0, 0);
|
||||||
public bool IsSelected { get; set; }
|
|
||||||
|
public bool IsSelected
|
||||||
|
{
|
||||||
|
get => _isSelected;
|
||||||
|
set => SetAndNotify(ref _isSelected, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
{
|
{
|
||||||
public class ProfileLedViewModel : PropertyChangedBase
|
public class ProfileLedViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
|
private bool _isSelected;
|
||||||
|
private bool _isDimmed;
|
||||||
|
private Geometry _displayGeometry;
|
||||||
|
private Geometry _strokeGeometry;
|
||||||
|
private Color _displayColor;
|
||||||
|
|
||||||
public ProfileLedViewModel(ArtemisLed led)
|
public ProfileLedViewModel(ArtemisLed led)
|
||||||
{
|
{
|
||||||
Led = led;
|
Led = led;
|
||||||
@ -26,17 +32,40 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
|
|
||||||
public ArtemisLed Led { get; }
|
public ArtemisLed Led { get; }
|
||||||
|
|
||||||
public bool IsSelected { get; set; }
|
|
||||||
public bool IsDimmed { get; set; }
|
|
||||||
|
|
||||||
public double X { get; }
|
public double X { get; }
|
||||||
public double Y { get; }
|
public double Y { get; }
|
||||||
public double Width { get; }
|
public double Width { get; }
|
||||||
public double Height { get; }
|
public double Height { get; }
|
||||||
|
|
||||||
public Geometry DisplayGeometry { get; private set; }
|
public bool IsSelected
|
||||||
public Geometry StrokeGeometry { get; private set; }
|
{
|
||||||
public Color DisplayColor { get; private set; }
|
get => _isSelected;
|
||||||
|
set => SetAndNotify(ref _isSelected, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsDimmed
|
||||||
|
{
|
||||||
|
get => _isDimmed;
|
||||||
|
set => SetAndNotify(ref _isDimmed, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Geometry DisplayGeometry
|
||||||
|
{
|
||||||
|
get => _displayGeometry;
|
||||||
|
private set => SetAndNotify(ref _displayGeometry, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Geometry StrokeGeometry
|
||||||
|
{
|
||||||
|
get => _strokeGeometry;
|
||||||
|
private set => SetAndNotify(ref _strokeGeometry, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color DisplayColor
|
||||||
|
{
|
||||||
|
get => _displayColor;
|
||||||
|
private set => SetAndNotify(ref _displayColor, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,14 +8,12 @@ using Artemis.Core.Models.Profile;
|
|||||||
using Artemis.Core.Models.Surface;
|
using Artemis.Core.Models.Surface;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.Core.Services.Interfaces;
|
|
||||||
using Artemis.Core.Services.Storage.Interfaces;
|
using Artemis.Core.Services.Storage.Interfaces;
|
||||||
using Artemis.UI.Events;
|
using Artemis.UI.Events;
|
||||||
using Artemis.UI.Extensions;
|
using Artemis.UI.Extensions;
|
||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools;
|
using Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools;
|
||||||
using Artemis.UI.Screens.Shared;
|
using Artemis.UI.Screens.Shared;
|
||||||
using Artemis.UI.Services.Interfaces;
|
|
||||||
using Artemis.UI.Shared.Services.Interfaces;
|
using Artemis.UI.Shared.Services.Interfaces;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
|
|
||||||
@ -23,30 +21,38 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
{
|
{
|
||||||
public class ProfileViewModel : ProfileEditorPanelViewModel, IHandle<MainWindowFocusChangedEvent>, IHandle<MainWindowKeyEvent>
|
public class ProfileViewModel : ProfileEditorPanelViewModel, IHandle<MainWindowFocusChangedEvent>, IHandle<MainWindowKeyEvent>
|
||||||
{
|
{
|
||||||
private readonly ILayerEditorService _layerEditorService;
|
|
||||||
private readonly ILayerService _layerService;
|
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
private readonly IProfileLayerVmFactory _profileLayerVmFactory;
|
private readonly IProfileLayerVmFactory _profileLayerVmFactory;
|
||||||
private readonly ISettingsService _settingsService;
|
private readonly ISettingsService _settingsService;
|
||||||
private readonly ISurfaceService _surfaceService;
|
private readonly ISurfaceService _surfaceService;
|
||||||
|
private readonly IVisualizationToolVmFactory _visualizationToolVmFactory;
|
||||||
|
|
||||||
private int _activeToolIndex;
|
private int _activeToolIndex;
|
||||||
private VisualizationToolViewModel _activeToolViewModel;
|
private VisualizationToolViewModel _activeToolViewModel;
|
||||||
|
private bool _canApplyToLayer;
|
||||||
|
private bool _canSelectEditTool;
|
||||||
|
private BindableCollection<CanvasViewModel> _canvasViewModels;
|
||||||
|
private BindableCollection<ArtemisDevice> _devices;
|
||||||
|
private BindableCollection<ArtemisLed> _highlightedLeds;
|
||||||
|
private PluginSetting<bool> _highlightSelectedLayer;
|
||||||
|
private bool _isInitializing;
|
||||||
|
private PluginSetting<bool> _onlyShowSelectedShape;
|
||||||
|
private PanZoomViewModel _panZoomViewModel;
|
||||||
private Layer _previousSelectedLayer;
|
private Layer _previousSelectedLayer;
|
||||||
private int _previousTool;
|
private int _previousTool;
|
||||||
|
private BindableCollection<ArtemisLed> _selectedLeds;
|
||||||
|
|
||||||
public ProfileViewModel(IProfileEditorService profileEditorService,
|
public ProfileViewModel(IProfileEditorService profileEditorService,
|
||||||
ILayerEditorService layerEditorService,
|
|
||||||
ILayerService layerService,
|
|
||||||
ISurfaceService surfaceService,
|
ISurfaceService surfaceService,
|
||||||
ISettingsService settingsService,
|
ISettingsService settingsService,
|
||||||
IEventAggregator eventAggregator,
|
IEventAggregator eventAggregator,
|
||||||
|
IVisualizationToolVmFactory visualizationToolVmFactory,
|
||||||
IProfileLayerVmFactory profileLayerVmFactory)
|
IProfileLayerVmFactory profileLayerVmFactory)
|
||||||
{
|
{
|
||||||
_profileEditorService = profileEditorService;
|
_profileEditorService = profileEditorService;
|
||||||
_layerEditorService = layerEditorService;
|
|
||||||
_layerService = layerService;
|
|
||||||
_surfaceService = surfaceService;
|
_surfaceService = surfaceService;
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
|
_visualizationToolVmFactory = visualizationToolVmFactory;
|
||||||
_profileLayerVmFactory = profileLayerVmFactory;
|
_profileLayerVmFactory = profileLayerVmFactory;
|
||||||
|
|
||||||
Execute.OnUIThreadSync(() =>
|
Execute.OnUIThreadSync(() =>
|
||||||
@ -65,19 +71,59 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
eventAggregator.Subscribe(this);
|
eventAggregator.Subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInitializing
|
||||||
|
{
|
||||||
|
get => _isInitializing;
|
||||||
|
private set => SetAndNotify(ref _isInitializing, value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsInitializing { get; private set; }
|
public bool CanSelectEditTool
|
||||||
public bool CanSelectEditTool { get; set; }
|
{
|
||||||
|
get => _canSelectEditTool;
|
||||||
|
set => SetAndNotify(ref _canSelectEditTool, value);
|
||||||
|
}
|
||||||
|
|
||||||
public PanZoomViewModel PanZoomViewModel { get; set; }
|
public PanZoomViewModel PanZoomViewModel
|
||||||
|
{
|
||||||
|
get => _panZoomViewModel;
|
||||||
|
set => SetAndNotify(ref _panZoomViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
public BindableCollection<CanvasViewModel> CanvasViewModels { get; set; }
|
public BindableCollection<CanvasViewModel> CanvasViewModels
|
||||||
public BindableCollection<ArtemisDevice> Devices { get; set; }
|
{
|
||||||
public BindableCollection<ArtemisLed> HighlightedLeds { get; set; }
|
get => _canvasViewModels;
|
||||||
public BindableCollection<ArtemisLed> SelectedLeds { get; set; }
|
set => SetAndNotify(ref _canvasViewModels, value);
|
||||||
|
}
|
||||||
|
|
||||||
public PluginSetting<bool> OnlyShowSelectedShape { get; set; }
|
public BindableCollection<ArtemisDevice> Devices
|
||||||
public PluginSetting<bool> HighlightSelectedLayer { get; set; }
|
{
|
||||||
|
get => _devices;
|
||||||
|
set => SetAndNotify(ref _devices, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<ArtemisLed> HighlightedLeds
|
||||||
|
{
|
||||||
|
get => _highlightedLeds;
|
||||||
|
set => SetAndNotify(ref _highlightedLeds, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<ArtemisLed> SelectedLeds
|
||||||
|
{
|
||||||
|
get => _selectedLeds;
|
||||||
|
set => SetAndNotify(ref _selectedLeds, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<bool> OnlyShowSelectedShape
|
||||||
|
{
|
||||||
|
get => _onlyShowSelectedShape;
|
||||||
|
set => SetAndNotify(ref _onlyShowSelectedShape, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<bool> HighlightSelectedLayer
|
||||||
|
{
|
||||||
|
get => _highlightSelectedLayer;
|
||||||
|
set => SetAndNotify(ref _highlightSelectedLayer, value);
|
||||||
|
}
|
||||||
|
|
||||||
public VisualizationToolViewModel ActiveToolViewModel
|
public VisualizationToolViewModel ActiveToolViewModel
|
||||||
{
|
{
|
||||||
@ -95,7 +141,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the new tool
|
// Set the new tool
|
||||||
_activeToolViewModel = value;
|
SetAndNotify(ref _activeToolViewModel, value);
|
||||||
// Add the new tool to the canvas
|
// Add the new tool to the canvas
|
||||||
if (_activeToolViewModel != null)
|
if (_activeToolViewModel != null)
|
||||||
{
|
{
|
||||||
@ -113,13 +159,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
get => _activeToolIndex;
|
get => _activeToolIndex;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_activeToolIndex != value)
|
if (!SetAndNotify(ref _activeToolIndex, value)) return;
|
||||||
{
|
|
||||||
_activeToolIndex = value;
|
|
||||||
ActivateToolByIndex(value);
|
ActivateToolByIndex(value);
|
||||||
NotifyOfPropertyChange(() => ActiveToolIndex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanApplyToLayer
|
||||||
|
{
|
||||||
|
get => _canApplyToLayer;
|
||||||
|
set => SetAndNotify(ref _canApplyToLayer, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ArtemisLed> GetLedsInRectangle(Rect selectedRect)
|
public List<ArtemisLed> GetLedsInRectangle(Rect selectedRect)
|
||||||
@ -230,16 +278,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ActiveToolViewModel = new ViewpointMoveToolViewModel(this, _profileEditorService);
|
ActiveToolViewModel = _visualizationToolVmFactory.ViewpointMoveToolViewModel(this);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ActiveToolViewModel = new EditToolViewModel(this, _profileEditorService, _layerEditorService);
|
ActiveToolViewModel = _visualizationToolVmFactory.EditToolViewModel(this);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ActiveToolViewModel = new SelectionToolViewModel(this, _profileEditorService, _layerService);
|
ActiveToolViewModel = _visualizationToolVmFactory.SelectionToolViewModel(this);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ActiveToolViewModel = new SelectionRemoveToolViewModel(this, _profileEditorService);
|
ActiveToolViewModel = _visualizationToolVmFactory.SelectionRemoveToolViewModel(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,8 +330,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
|||||||
|
|
||||||
#region Context menu actions
|
#region Context menu actions
|
||||||
|
|
||||||
public bool CanApplyToLayer { get; set; }
|
|
||||||
|
|
||||||
public void CreateLayer()
|
public void CreateLayer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
private SKPoint _dragOffset;
|
private SKPoint _dragOffset;
|
||||||
private SKPoint _dragStart;
|
private SKPoint _dragStart;
|
||||||
private SKPoint _topLeft;
|
private SKPoint _topLeft;
|
||||||
|
private SKPath _shapePath;
|
||||||
|
private SKPoint _shapeAnchor;
|
||||||
|
private RectangleGeometry _shapeGeometry;
|
||||||
|
|
||||||
public EditToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService, ILayerEditorService layerEditorService)
|
public EditToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService, ILayerEditorService layerEditorService)
|
||||||
: base(profileViewModel, profileEditorService)
|
: base(profileViewModel, profileEditorService)
|
||||||
@ -32,9 +35,23 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
profileEditorService.ProfilePreviewUpdated += (sender, args) => Update();
|
profileEditorService.ProfilePreviewUpdated += (sender, args) => Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SKPath ShapePath { get; set; }
|
public SKPath ShapePath
|
||||||
public SKPoint ShapeAnchor { get; set; }
|
{
|
||||||
public RectangleGeometry ShapeGeometry { get; set; }
|
get => _shapePath;
|
||||||
|
set => SetAndNotify(ref _shapePath, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SKPoint ShapeAnchor
|
||||||
|
{
|
||||||
|
get => _shapeAnchor;
|
||||||
|
set => SetAndNotify(ref _shapeAnchor, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RectangleGeometry ShapeGeometry
|
||||||
|
{
|
||||||
|
get => _shapeGeometry;
|
||||||
|
set => SetAndNotify(ref _shapeGeometry, value);
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,6 +10,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
{
|
{
|
||||||
public class SelectionRemoveToolViewModel : VisualizationToolViewModel
|
public class SelectionRemoveToolViewModel : VisualizationToolViewModel
|
||||||
{
|
{
|
||||||
|
private Rect _dragRectangle;
|
||||||
|
|
||||||
public SelectionRemoveToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
|
public SelectionRemoveToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
|
||||||
{
|
{
|
||||||
using (var stream = new MemoryStream(Resources.aero_pen_min))
|
using (var stream = new MemoryStream(Resources.aero_pen_min))
|
||||||
@ -18,7 +20,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rect DragRectangle { get; set; }
|
public Rect DragRectangle
|
||||||
|
{
|
||||||
|
get => _dragRectangle;
|
||||||
|
set => SetAndNotify(ref _dragRectangle, value);
|
||||||
|
}
|
||||||
|
|
||||||
public override void MouseUp(object sender, MouseButtonEventArgs e)
|
public override void MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,6 +12,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
public class SelectionToolViewModel : VisualizationToolViewModel
|
public class SelectionToolViewModel : VisualizationToolViewModel
|
||||||
{
|
{
|
||||||
private readonly ILayerService _layerService;
|
private readonly ILayerService _layerService;
|
||||||
|
private Rect _dragRectangle;
|
||||||
|
|
||||||
public SelectionToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService, ILayerService layerService)
|
public SelectionToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService, ILayerService layerService)
|
||||||
: base(profileViewModel, profileEditorService)
|
: base(profileViewModel, profileEditorService)
|
||||||
@ -23,7 +24,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rect DragRectangle { get; set; }
|
public Rect DragRectangle
|
||||||
|
{
|
||||||
|
get => _dragRectangle;
|
||||||
|
set => SetAndNotify(ref _dragRectangle, value);
|
||||||
|
}
|
||||||
|
|
||||||
public override void MouseUp(object sender, MouseButtonEventArgs e)
|
public override void MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,6 +7,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
{
|
{
|
||||||
public abstract class VisualizationToolViewModel : CanvasViewModel
|
public abstract class VisualizationToolViewModel : CanvasViewModel
|
||||||
{
|
{
|
||||||
|
private Cursor _cursor;
|
||||||
|
private bool _isMouseDown;
|
||||||
|
private Point _mouseDownStartPosition;
|
||||||
|
|
||||||
protected VisualizationToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService)
|
protected VisualizationToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService)
|
||||||
{
|
{
|
||||||
// Not relevant for visualization tools as they overlay the entire canvas
|
// Not relevant for visualization tools as they overlay the entire canvas
|
||||||
@ -20,9 +24,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
|
|||||||
|
|
||||||
public ProfileViewModel ProfileViewModel { get; }
|
public ProfileViewModel ProfileViewModel { get; }
|
||||||
public IProfileEditorService ProfileEditorService { get; }
|
public IProfileEditorService ProfileEditorService { get; }
|
||||||
public Cursor Cursor { get; protected set; }
|
|
||||||
public bool IsMouseDown { get; protected set; }
|
public Cursor Cursor
|
||||||
public Point MouseDownStartPosition { get; protected set; }
|
{
|
||||||
|
get => _cursor;
|
||||||
|
protected set => SetAndNotify(ref _cursor, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsMouseDown
|
||||||
|
{
|
||||||
|
get => _isMouseDown;
|
||||||
|
protected set => SetAndNotify(ref _isMouseDown, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point MouseDownStartPosition
|
||||||
|
{
|
||||||
|
get => _mouseDownStartPosition;
|
||||||
|
protected set => SetAndNotify(ref _mouseDownStartPosition, value);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void MouseDown(object sender, MouseButtonEventArgs e)
|
public virtual void MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -24,11 +24,13 @@ namespace Artemis.UI.Screens
|
|||||||
private readonly ICoreService _coreService;
|
private readonly ICoreService _coreService;
|
||||||
private readonly IDebugService _debugService;
|
private readonly IDebugService _debugService;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IEventAggregator _eventAggregator;
|
||||||
private readonly ISettingsService _settingsService;
|
|
||||||
private readonly ThemeWatcher _themeWatcher;
|
private readonly ThemeWatcher _themeWatcher;
|
||||||
private readonly Timer _titleUpdateTimer;
|
private readonly Timer _titleUpdateTimer;
|
||||||
private readonly PluginSetting<WindowSize> _windowSize;
|
private readonly PluginSetting<WindowSize> _windowSize;
|
||||||
private bool _lostFocus;
|
private bool _lostFocus;
|
||||||
|
private bool _isSidebarVisible;
|
||||||
|
private bool _activeItemReady;
|
||||||
|
private string _windowTitle;
|
||||||
|
|
||||||
public RootViewModel(IEventAggregator eventAggregator, SidebarViewModel sidebarViewModel, ISettingsService settingsService, ICoreService coreService,
|
public RootViewModel(IEventAggregator eventAggregator, SidebarViewModel sidebarViewModel, ISettingsService settingsService, ICoreService coreService,
|
||||||
IDebugService debugService, ISnackbarMessageQueue snackbarMessageQueue)
|
IDebugService debugService, ISnackbarMessageQueue snackbarMessageQueue)
|
||||||
@ -36,7 +38,6 @@ namespace Artemis.UI.Screens
|
|||||||
SidebarViewModel = sidebarViewModel;
|
SidebarViewModel = sidebarViewModel;
|
||||||
MainMessageQueue = snackbarMessageQueue;
|
MainMessageQueue = snackbarMessageQueue;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
_settingsService = settingsService;
|
|
||||||
_coreService = coreService;
|
_coreService = coreService;
|
||||||
_debugService = debugService;
|
_debugService = debugService;
|
||||||
|
|
||||||
@ -55,10 +56,25 @@ namespace Artemis.UI.Screens
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SidebarViewModel SidebarViewModel { get; }
|
public SidebarViewModel SidebarViewModel { get; }
|
||||||
public ISnackbarMessageQueue MainMessageQueue { get; set; }
|
public ISnackbarMessageQueue MainMessageQueue { get; }
|
||||||
public bool IsSidebarVisible { get; set; }
|
|
||||||
public bool ActiveItemReady { get; set; }
|
public bool IsSidebarVisible
|
||||||
public string WindowTitle { get; set; }
|
{
|
||||||
|
get => _isSidebarVisible;
|
||||||
|
set => SetAndNotify(ref _isSidebarVisible, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ActiveItemReady
|
||||||
|
{
|
||||||
|
get => _activeItemReady;
|
||||||
|
set => SetAndNotify(ref _activeItemReady, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string WindowTitle
|
||||||
|
{
|
||||||
|
get => _windowTitle;
|
||||||
|
set => SetAndNotify(ref _windowTitle, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void WindowDeactivated()
|
public void WindowDeactivated()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,6 +14,7 @@ namespace Artemis.UI.Screens.Settings.Debug
|
|||||||
{
|
{
|
||||||
private readonly IDeviceService _deviceService;
|
private readonly IDeviceService _deviceService;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
|
private ArtemisLed _selectedLed;
|
||||||
|
|
||||||
public DeviceDebugViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService)
|
public DeviceDebugViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService)
|
||||||
{
|
{
|
||||||
@ -22,11 +23,18 @@ namespace Artemis.UI.Screens.Settings.Debug
|
|||||||
Device = device;
|
Device = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [DependsOn(nameof(SelectedLed))]
|
|
||||||
public List<ArtemisLed> SelectedLeds => SelectedLed != null ? new List<ArtemisLed> {SelectedLed} : null;
|
public List<ArtemisLed> SelectedLeds => SelectedLed != null ? new List<ArtemisLed> {SelectedLed} : null;
|
||||||
|
|
||||||
public ArtemisDevice Device { get; }
|
public ArtemisDevice Device { get; }
|
||||||
public ArtemisLed SelectedLed { get; set; }
|
|
||||||
|
public ArtemisLed SelectedLed
|
||||||
|
{
|
||||||
|
get => _selectedLed;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!SetAndNotify(ref _selectedLed, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(SelectedLeds));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool CanOpenImageDirectory => Device.RgbDevice.DeviceInfo.Image != null;
|
public bool CanOpenImageDirectory => Device.RgbDevice.DeviceInfo.Image != null;
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,9 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
|||||||
private readonly Timer _updateTimer;
|
private readonly Timer _updateTimer;
|
||||||
private bool _isModuleFilterEnabled;
|
private bool _isModuleFilterEnabled;
|
||||||
private Core.Plugins.Abstract.Module _selectedModule;
|
private Core.Plugins.Abstract.Module _selectedModule;
|
||||||
|
private DataModelViewModel _mainDataModel;
|
||||||
|
private string _propertySearch;
|
||||||
|
private List<Core.Plugins.Abstract.Module> _modules;
|
||||||
|
|
||||||
public DataModelDebugViewModel(IDataModelVisualizationService dataModelVisualizationService, IPluginService pluginService)
|
public DataModelDebugViewModel(IDataModelVisualizationService dataModelVisualizationService, IPluginService pluginService)
|
||||||
{
|
{
|
||||||
@ -27,17 +30,30 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
|||||||
DisplayName = "Data model";
|
DisplayName = "Data model";
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataModelViewModel MainDataModel { get; set; }
|
public DataModelViewModel MainDataModel
|
||||||
|
{
|
||||||
|
get => _mainDataModel;
|
||||||
|
set => SetAndNotify(ref _mainDataModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
public string PropertySearch { get; set; }
|
public string PropertySearch
|
||||||
public List<Core.Plugins.Abstract.Module> Modules { get; set; }
|
{
|
||||||
|
get => _propertySearch;
|
||||||
|
set => SetAndNotify(ref _propertySearch, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Core.Plugins.Abstract.Module> Modules
|
||||||
|
{
|
||||||
|
get => _modules;
|
||||||
|
set => SetAndNotify(ref _modules, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Core.Plugins.Abstract.Module SelectedModule
|
public Core.Plugins.Abstract.Module SelectedModule
|
||||||
{
|
{
|
||||||
get => _selectedModule;
|
get => _selectedModule;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_selectedModule = value;
|
if (!SetAndNotify(ref _selectedModule, value)) return;
|
||||||
GetDataModel();
|
GetDataModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,7 +63,7 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
|||||||
get => _isModuleFilterEnabled;
|
get => _isModuleFilterEnabled;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_isModuleFilterEnabled = value;
|
SetAndNotify(ref _isModuleFilterEnabled, value);
|
||||||
|
|
||||||
if (!IsModuleFilterEnabled)
|
if (!IsModuleFilterEnabled)
|
||||||
SelectedModule = null;
|
SelectedModule = null;
|
||||||
|
|||||||
@ -4,7 +4,6 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using Artemis.Core.Events;
|
using Artemis.Core.Events;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using Artemis.Core.Services.Storage.Interfaces;
|
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using SkiaSharp.Views.WPF;
|
using SkiaSharp.Views.WPF;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
@ -14,20 +13,26 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
|||||||
public class RenderDebugViewModel : Screen
|
public class RenderDebugViewModel : Screen
|
||||||
{
|
{
|
||||||
private readonly ICoreService _coreService;
|
private readonly ICoreService _coreService;
|
||||||
private readonly IRgbService _rgbService;
|
private double _currentFps;
|
||||||
private readonly ISurfaceService _surfaceService;
|
private ImageSource _currentFrame;
|
||||||
|
|
||||||
public RenderDebugViewModel(ICoreService coreService, IRgbService rgbService, ISurfaceService surfaceService)
|
public RenderDebugViewModel(ICoreService coreService)
|
||||||
{
|
{
|
||||||
_coreService = coreService;
|
_coreService = coreService;
|
||||||
_rgbService = rgbService;
|
|
||||||
_surfaceService = surfaceService;
|
|
||||||
|
|
||||||
DisplayName = "Rendering";
|
DisplayName = "Rendering";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageSource CurrentFrame { get; set; }
|
public ImageSource CurrentFrame
|
||||||
public double CurrentFps { get; set; }
|
{
|
||||||
|
get => _currentFrame;
|
||||||
|
set => SetAndNotify(ref _currentFrame, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double CurrentFps
|
||||||
|
{
|
||||||
|
get => _currentFps;
|
||||||
|
set => SetAndNotify(ref _currentFps, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
{
|
{
|
||||||
@ -47,7 +52,7 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
|||||||
{
|
{
|
||||||
Execute.PostToUIThread(() =>
|
Execute.PostToUIThread(() =>
|
||||||
{
|
{
|
||||||
if (e.BitmapBrush?.Bitmap == null)
|
if (e.BitmapBrush?.Bitmap == null || e.BitmapBrush.Bitmap.Pixels.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(CurrentFrame is WriteableBitmap writeableBitmap))
|
if (!(CurrentFrame is WriteableBitmap writeableBitmap))
|
||||||
|
|||||||
@ -29,6 +29,11 @@ namespace Artemis.UI.Screens.Settings
|
|||||||
private readonly ISettingsService _settingsService;
|
private readonly ISettingsService _settingsService;
|
||||||
private readonly IPluginSettingsVmFactory _pluginSettingsVmFactory;
|
private readonly IPluginSettingsVmFactory _pluginSettingsVmFactory;
|
||||||
private readonly ISurfaceService _surfaceService;
|
private readonly ISurfaceService _surfaceService;
|
||||||
|
private List<Tuple<string, int>> _targetFrameRates;
|
||||||
|
private List<Tuple<string, double>> _renderScales;
|
||||||
|
private List<int> _sampleSizes;
|
||||||
|
private BindableCollection<DeviceSettingsViewModel> _deviceSettingsViewModels;
|
||||||
|
private BindableCollection<PluginSettingsViewModel> _plugins;
|
||||||
|
|
||||||
public SettingsViewModel(ISurfaceService surfaceService, IPluginService pluginService, IDialogService dialogService, IDebugService debugService,
|
public SettingsViewModel(ISurfaceService surfaceService, IPluginService pluginService, IDialogService dialogService, IDebugService debugService,
|
||||||
ISettingsService settingsService, IPluginSettingsVmFactory pluginSettingsVmFactory, IDeviceSettingsVmFactory deviceSettingsVmFactory)
|
ISettingsService settingsService, IPluginSettingsVmFactory pluginSettingsVmFactory, IDeviceSettingsVmFactory deviceSettingsVmFactory)
|
||||||
@ -60,15 +65,39 @@ namespace Artemis.UI.Screens.Settings
|
|||||||
SampleSizes = new List<int> {1, 9};
|
SampleSizes = new List<int> {1, 9};
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Tuple<string, int>> TargetFrameRates { get; set; }
|
public List<Tuple<string, int>> TargetFrameRates
|
||||||
public List<Tuple<string, double>> RenderScales { get; set; }
|
{
|
||||||
|
get => _targetFrameRates;
|
||||||
|
set => SetAndNotify(ref _targetFrameRates, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Tuple<string, double>> RenderScales
|
||||||
|
{
|
||||||
|
get => _renderScales;
|
||||||
|
set => SetAndNotify(ref _renderScales, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> SampleSizes
|
||||||
|
{
|
||||||
|
get => _sampleSizes;
|
||||||
|
set => SetAndNotify(ref _sampleSizes, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<DeviceSettingsViewModel> DeviceSettingsViewModels
|
||||||
|
{
|
||||||
|
get => _deviceSettingsViewModels;
|
||||||
|
set => SetAndNotify(ref _deviceSettingsViewModels, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindableCollection<PluginSettingsViewModel> Plugins
|
||||||
|
{
|
||||||
|
get => _plugins;
|
||||||
|
set => SetAndNotify(ref _plugins, value);
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<ValueDescription> LogLevels { get; }
|
public IEnumerable<ValueDescription> LogLevels { get; }
|
||||||
public IEnumerable<ValueDescription> ColorSchemes { get; }
|
public IEnumerable<ValueDescription> ColorSchemes { get; }
|
||||||
|
|
||||||
public List<int> SampleSizes { get; set; }
|
|
||||||
public BindableCollection<DeviceSettingsViewModel> DeviceSettingsViewModels { get; set; }
|
|
||||||
public BindableCollection<PluginSettingsViewModel> Plugins { get; set; }
|
|
||||||
|
|
||||||
public bool StartWithWindows
|
public bool StartWithWindows
|
||||||
{
|
{
|
||||||
get => _settingsService.GetSetting("UI.AutoRun", false).Value;
|
get => _settingsService.GetSetting("UI.AutoRun", false).Value;
|
||||||
|
|||||||
@ -10,12 +10,13 @@ using Stylet;
|
|||||||
|
|
||||||
namespace Artemis.UI.Screens.Settings.Tabs.Devices
|
namespace Artemis.UI.Screens.Settings.Tabs.Devices
|
||||||
{
|
{
|
||||||
public class DeviceSettingsViewModel
|
public class DeviceSettingsViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
private readonly IDeviceService _deviceService;
|
private readonly IDeviceService _deviceService;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IWindowManager _windowManager;
|
private readonly IWindowManager _windowManager;
|
||||||
private readonly IDeviceDebugVmFactory _deviceDebugVmFactory;
|
private readonly IDeviceDebugVmFactory _deviceDebugVmFactory;
|
||||||
|
private bool _isDeviceEnabled;
|
||||||
|
|
||||||
public DeviceSettingsViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService,
|
public DeviceSettingsViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService,
|
||||||
IWindowManager windowManager, IDeviceDebugVmFactory deviceDebugVmFactory)
|
IWindowManager windowManager, IDeviceDebugVmFactory deviceDebugVmFactory)
|
||||||
@ -29,15 +30,22 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
|
|||||||
Type = Device.RgbDevice.DeviceInfo.DeviceType.ToString().Humanize();
|
Type = Device.RgbDevice.DeviceInfo.DeviceType.ToString().Humanize();
|
||||||
Name = Device.RgbDevice.DeviceInfo.Model;
|
Name = Device.RgbDevice.DeviceInfo.Model;
|
||||||
Manufacturer = Device.RgbDevice.DeviceInfo.Manufacturer;
|
Manufacturer = Device.RgbDevice.DeviceInfo.Manufacturer;
|
||||||
|
|
||||||
|
// TODO: Implement this bad boy
|
||||||
IsDeviceEnabled = true;
|
IsDeviceEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtemisDevice Device { get; }
|
public ArtemisDevice Device { get; }
|
||||||
|
|
||||||
public string Type { get; set; }
|
public string Type { get; }
|
||||||
public string Name { get; set; }
|
public string Name { get; }
|
||||||
public string Manufacturer { get; set; }
|
public string Manufacturer { get; }
|
||||||
public bool IsDeviceEnabled { get; set; }
|
|
||||||
|
public bool IsDeviceEnabled
|
||||||
|
{
|
||||||
|
get => _isDeviceEnabled;
|
||||||
|
set => SetAndNotify(ref _isDeviceEnabled, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void IdentifyDevice()
|
public void IdentifyDevice()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,6 +17,9 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
private readonly IPluginService _pluginService;
|
private readonly IPluginService _pluginService;
|
||||||
private readonly ISnackbarMessageQueue _snackbarMessageQueue;
|
private readonly ISnackbarMessageQueue _snackbarMessageQueue;
|
||||||
private readonly IWindowManager _windowManager;
|
private readonly IWindowManager _windowManager;
|
||||||
|
private Plugin _plugin;
|
||||||
|
private PluginInfo _pluginInfo;
|
||||||
|
private bool _enabling;
|
||||||
|
|
||||||
public PluginSettingsViewModel(Plugin plugin, IWindowManager windowManager, IDialogService dialogService, IPluginService pluginService,
|
public PluginSettingsViewModel(Plugin plugin, IWindowManager windowManager, IDialogService dialogService, IPluginService pluginService,
|
||||||
ISnackbarMessageQueue snackbarMessageQueue)
|
ISnackbarMessageQueue snackbarMessageQueue)
|
||||||
@ -30,9 +33,24 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
|||||||
_snackbarMessageQueue = snackbarMessageQueue;
|
_snackbarMessageQueue = snackbarMessageQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin Plugin { get; set; }
|
public Plugin Plugin
|
||||||
public PluginInfo PluginInfo { get; set; }
|
{
|
||||||
public bool Enabling { get; set; }
|
get => _plugin;
|
||||||
|
set => SetAndNotify(ref _plugin, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginInfo PluginInfo
|
||||||
|
{
|
||||||
|
get => _pluginInfo;
|
||||||
|
set => SetAndNotify(ref _pluginInfo, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Enabling
|
||||||
|
{
|
||||||
|
get => _enabling;
|
||||||
|
set => SetAndNotify(ref _enabling, value);
|
||||||
|
}
|
||||||
|
|
||||||
public PackIconKind Icon => GetIconKind();
|
public PackIconKind Icon => GetIconKind();
|
||||||
public string Type => Plugin.GetType().BaseType?.Name ?? Plugin.GetType().Name;
|
public string Type => Plugin.GetType().BaseType?.Name ?? Plugin.GetType().Name;
|
||||||
public bool CanOpenSettings => IsEnabled && Plugin.HasConfigurationViewModel;
|
public bool CanOpenSettings => IsEnabled && Plugin.HasConfigurationViewModel;
|
||||||
|
|||||||
@ -12,8 +12,29 @@ namespace Artemis.UI.Screens.Shared
|
|||||||
{
|
{
|
||||||
public class PanZoomViewModel : PropertyChangedBase
|
public class PanZoomViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
public Point? LastPanPosition { get; set; }
|
private Point? _lastPanPosition;
|
||||||
public double Zoom { get; set; } = 1;
|
private double _zoom = 1;
|
||||||
|
private double _panX;
|
||||||
|
private double _panY;
|
||||||
|
private double _canvasWidth;
|
||||||
|
private double _canvasHeight;
|
||||||
|
private bool _limitToZero;
|
||||||
|
|
||||||
|
public Point? LastPanPosition
|
||||||
|
{
|
||||||
|
get => _lastPanPosition;
|
||||||
|
set => SetAndNotify(ref _lastPanPosition, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Zoom
|
||||||
|
{
|
||||||
|
get => _zoom;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!SetAndNotify(ref _zoom, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(ZoomPercentage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double ZoomPercentage
|
public double ZoomPercentage
|
||||||
{
|
{
|
||||||
@ -21,11 +42,43 @@ namespace Artemis.UI.Screens.Shared
|
|||||||
set => SetZoomFromPercentage(value);
|
set => SetZoomFromPercentage(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double PanX { get; set; }
|
public double PanX
|
||||||
public double PanY { get; set; }
|
{
|
||||||
public double CanvasWidth { get; set; }
|
get => _panX;
|
||||||
public double CanvasHeight { get; set; }
|
set
|
||||||
public bool LimitToZero { get; set; }
|
{
|
||||||
|
if (!SetAndNotify(ref _panX, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(BackgroundViewport));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double PanY
|
||||||
|
{
|
||||||
|
get => _panY;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!SetAndNotify(ref _panY, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(BackgroundViewport));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double CanvasWidth
|
||||||
|
{
|
||||||
|
get => _canvasWidth;
|
||||||
|
set => SetAndNotify(ref _canvasWidth, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double CanvasHeight
|
||||||
|
{
|
||||||
|
get => _canvasHeight;
|
||||||
|
set => SetAndNotify(ref _canvasHeight, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LimitToZero
|
||||||
|
{
|
||||||
|
get => _limitToZero;
|
||||||
|
set => SetAndNotify(ref _limitToZero, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Rect BackgroundViewport => new Rect(PanX, PanY, 20, 20);
|
public Rect BackgroundViewport => new Rect(PanX, PanY, 20, 20);
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,9 @@ namespace Artemis.UI.Screens.Sidebar
|
|||||||
private readonly IKernel _kernel;
|
private readonly IKernel _kernel;
|
||||||
private readonly IModuleVmFactory _moduleVmFactory;
|
private readonly IModuleVmFactory _moduleVmFactory;
|
||||||
private readonly IPluginService _pluginService;
|
private readonly IPluginService _pluginService;
|
||||||
|
private BindableCollection<INavigationItem> _sidebarItems;
|
||||||
|
private Dictionary<INavigationItem, Core.Plugins.Abstract.Module> _sidebarModules;
|
||||||
|
private IScreen _selectedItem;
|
||||||
|
|
||||||
public SidebarViewModel(IKernel kernel, IEventAggregator eventAggregator, IModuleVmFactory moduleVmFactory, IPluginService pluginService)
|
public SidebarViewModel(IKernel kernel, IEventAggregator eventAggregator, IModuleVmFactory moduleVmFactory, IPluginService pluginService)
|
||||||
{
|
{
|
||||||
@ -41,9 +44,23 @@ namespace Artemis.UI.Screens.Sidebar
|
|||||||
eventAggregator.Subscribe(this);
|
eventAggregator.Subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BindableCollection<INavigationItem> SidebarItems { get; set; }
|
public BindableCollection<INavigationItem> SidebarItems
|
||||||
public Dictionary<INavigationItem, Core.Plugins.Abstract.Module> SidebarModules { get; set; }
|
{
|
||||||
public IScreen SelectedItem { get; set; }
|
get => _sidebarItems;
|
||||||
|
set => SetAndNotify(ref _sidebarItems, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<INavigationItem, Core.Plugins.Abstract.Module> SidebarModules
|
||||||
|
{
|
||||||
|
get => _sidebarModules;
|
||||||
|
set => SetAndNotify(ref _sidebarModules, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScreen SelectedItem
|
||||||
|
{
|
||||||
|
get => _selectedItem;
|
||||||
|
set => SetAndNotify(ref _selectedItem, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetupSidebar()
|
public void SetupSidebar()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,7 @@ namespace Artemis.UI.Screens.Splash
|
|||||||
{
|
{
|
||||||
private readonly ICoreService _coreService;
|
private readonly ICoreService _coreService;
|
||||||
private readonly IPluginService _pluginService;
|
private readonly IPluginService _pluginService;
|
||||||
|
private string _status;
|
||||||
|
|
||||||
public SplashViewModel(ICoreService coreService, IPluginService pluginService)
|
public SplashViewModel(ICoreService coreService, IPluginService pluginService)
|
||||||
{
|
{
|
||||||
@ -19,7 +20,11 @@ namespace Artemis.UI.Screens.Splash
|
|||||||
Status = "Initializing Core";
|
Status = "Initializing Core";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Status { get; set; }
|
public string Status
|
||||||
|
{
|
||||||
|
get => _status;
|
||||||
|
set => SetAndNotify(ref _status, value);
|
||||||
|
}
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
// ReSharper disable once UnusedMember.Global - Called from view
|
||||||
public void MouseDown(object sender, MouseButtonEventArgs e)
|
public void MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
|||||||
@ -6,11 +6,17 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
|||||||
{
|
{
|
||||||
public class SurfaceCreateViewModel : DialogViewModelBase
|
public class SurfaceCreateViewModel : DialogViewModelBase
|
||||||
{
|
{
|
||||||
|
private string _surfaceName;
|
||||||
|
|
||||||
public SurfaceCreateViewModel(IModelValidator<SurfaceCreateViewModel> validator) : base(validator)
|
public SurfaceCreateViewModel(IModelValidator<SurfaceCreateViewModel> validator) : base(validator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SurfaceName { get; set; }
|
public string SurfaceName
|
||||||
|
{
|
||||||
|
get => _surfaceName;
|
||||||
|
set => SetAndNotify(ref _surfaceName, value);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Accept()
|
public async Task Accept()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,6 +9,11 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
|||||||
public class SurfaceDeviceConfigViewModel : DialogViewModelBase
|
public class SurfaceDeviceConfigViewModel : DialogViewModelBase
|
||||||
{
|
{
|
||||||
private readonly ICoreService _coreService;
|
private readonly ICoreService _coreService;
|
||||||
|
private string _title;
|
||||||
|
private int _x;
|
||||||
|
private int _y;
|
||||||
|
private double _scale;
|
||||||
|
private int _rotation;
|
||||||
|
|
||||||
public SurfaceDeviceConfigViewModel(SurfaceDeviceViewModel surfaceDeviceViewModel, ICoreService coreService, IModelValidator<SurfaceDeviceConfigViewModel> validator)
|
public SurfaceDeviceConfigViewModel(SurfaceDeviceViewModel surfaceDeviceViewModel, ICoreService coreService, IModelValidator<SurfaceDeviceConfigViewModel> validator)
|
||||||
: base(validator)
|
: base(validator)
|
||||||
@ -24,12 +29,36 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SurfaceDeviceViewModel SurfaceDeviceViewModel { get; }
|
public SurfaceDeviceViewModel SurfaceDeviceViewModel { get; }
|
||||||
public string Title { get; set; }
|
|
||||||
|
|
||||||
public int X { get; set; }
|
public string Title
|
||||||
public int Y { get; set; }
|
{
|
||||||
public double Scale { get; set; }
|
get => _title;
|
||||||
public int Rotation { get; set; }
|
set => SetAndNotify(ref _title, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int X
|
||||||
|
{
|
||||||
|
get => _x;
|
||||||
|
set => SetAndNotify(ref _x, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Y
|
||||||
|
{
|
||||||
|
get => _y;
|
||||||
|
set => SetAndNotify(ref _y, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Scale
|
||||||
|
{
|
||||||
|
get => _scale;
|
||||||
|
set => SetAndNotify(ref _scale, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Rotation
|
||||||
|
{
|
||||||
|
get => _rotation;
|
||||||
|
set => SetAndNotify(ref _rotation, value);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Accept()
|
public async Task Accept()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,13 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
|||||||
private readonly IRgbService _rgbService;
|
private readonly IRgbService _rgbService;
|
||||||
private readonly ISettingsService _settingsService;
|
private readonly ISettingsService _settingsService;
|
||||||
private readonly ISurfaceService _surfaceService;
|
private readonly ISurfaceService _surfaceService;
|
||||||
|
private ArtemisSurface _selectedSurface;
|
||||||
|
private ObservableCollection<SurfaceDeviceViewModel> _devices;
|
||||||
|
private ObservableCollection<ArtemisSurface> _surfaceConfigurations;
|
||||||
|
private RectangleGeometry _selectionRectangle;
|
||||||
|
private PanZoomViewModel _panZoomViewModel;
|
||||||
|
private PluginSetting<GridLength> _surfaceListWidth;
|
||||||
|
private Cursor _cursor;
|
||||||
|
|
||||||
public SurfaceEditorViewModel(IRgbService rgbService, ISurfaceService surfaceService, IDialogService dialogService, ISettingsService settingsService,
|
public SurfaceEditorViewModel(IRgbService rgbService, ISurfaceService surfaceService, IDialogService dialogService, ISettingsService settingsService,
|
||||||
IDeviceService deviceService)
|
IDeviceService deviceService)
|
||||||
@ -46,12 +53,41 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
|||||||
_deviceService = deviceService;
|
_deviceService = deviceService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<SurfaceDeviceViewModel> Devices { get; set; }
|
public ObservableCollection<SurfaceDeviceViewModel> Devices
|
||||||
public ObservableCollection<ArtemisSurface> SurfaceConfigurations { get; set; }
|
{
|
||||||
public RectangleGeometry SelectionRectangle { get; set; }
|
get => _devices;
|
||||||
public PanZoomViewModel PanZoomViewModel { get; set; }
|
set => SetAndNotify(ref _devices, value);
|
||||||
public PluginSetting<GridLength> SurfaceListWidth { get; set; }
|
}
|
||||||
public Cursor Cursor { get; set; }
|
|
||||||
|
public ObservableCollection<ArtemisSurface> SurfaceConfigurations
|
||||||
|
{
|
||||||
|
get => _surfaceConfigurations;
|
||||||
|
set => SetAndNotify(ref _surfaceConfigurations, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RectangleGeometry SelectionRectangle
|
||||||
|
{
|
||||||
|
get => _selectionRectangle;
|
||||||
|
set => SetAndNotify(ref _selectionRectangle, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PanZoomViewModel PanZoomViewModel
|
||||||
|
{
|
||||||
|
get => _panZoomViewModel;
|
||||||
|
set => SetAndNotify(ref _panZoomViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<GridLength> SurfaceListWidth
|
||||||
|
{
|
||||||
|
get => _surfaceListWidth;
|
||||||
|
set => SetAndNotify(ref _surfaceListWidth, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cursor Cursor
|
||||||
|
{
|
||||||
|
get => _cursor;
|
||||||
|
set => SetAndNotify(ref _cursor, value);
|
||||||
|
}
|
||||||
|
|
||||||
public ArtemisSurface SelectedSurface
|
public ArtemisSurface SelectedSurface
|
||||||
{
|
{
|
||||||
@ -61,7 +97,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
|||||||
if (value == null)
|
if (value == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_selectedSurface = value;
|
SetAndNotify(ref _selectedSurface, value);
|
||||||
ApplySelectedSurfaceConfiguration();
|
ApplySelectedSurfaceConfiguration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +296,6 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
|||||||
|
|
||||||
private MouseDragStatus _mouseDragStatus;
|
private MouseDragStatus _mouseDragStatus;
|
||||||
private Point _mouseDragStartPoint;
|
private Point _mouseDragStartPoint;
|
||||||
private ArtemisSurface _selectedSurface;
|
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
// ReSharper disable once UnusedMember.Global - Called from view
|
||||||
public void EditorGridMouseClick(object sender, MouseButtonEventArgs e)
|
public void EditorGridMouseClick(object sender, MouseButtonEventArgs e)
|
||||||
|
|||||||
@ -10,15 +10,36 @@ namespace Artemis.UI.Screens.SurfaceEditor.Visualization
|
|||||||
{
|
{
|
||||||
private double _dragOffsetX;
|
private double _dragOffsetX;
|
||||||
private double _dragOffsetY;
|
private double _dragOffsetY;
|
||||||
|
private ArtemisDevice _device;
|
||||||
|
private SelectionStatus _selectionStatus;
|
||||||
|
private Cursor _cursor;
|
||||||
|
|
||||||
public SurfaceDeviceViewModel(ArtemisDevice device)
|
public SurfaceDeviceViewModel(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
Device = device;
|
Device = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtemisDevice Device { get; set; }
|
public ArtemisDevice Device
|
||||||
public SelectionStatus SelectionStatus { get; set; }
|
{
|
||||||
public Cursor Cursor { get; set; }
|
get => _device;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (SetAndNotify(ref _device, value)) return;
|
||||||
|
NotifyOfPropertyChange(nameof(DeviceRectangle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionStatus SelectionStatus
|
||||||
|
{
|
||||||
|
get => _selectionStatus;
|
||||||
|
set => SetAndNotify(ref _selectionStatus, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cursor Cursor
|
||||||
|
{
|
||||||
|
get => _cursor;
|
||||||
|
set => SetAndNotify(ref _cursor, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Rect DeviceRectangle => Device.RgbDevice == null
|
public Rect DeviceRectangle => Device.RgbDevice == null
|
||||||
? new Rect()
|
? new Rect()
|
||||||
|
|||||||
@ -17,6 +17,7 @@ namespace Artemis.UI.Screens
|
|||||||
private readonly IWindowManager _windowManager;
|
private readonly IWindowManager _windowManager;
|
||||||
private bool _setGradientPickerService;
|
private bool _setGradientPickerService;
|
||||||
private SplashViewModel _splashViewModel;
|
private SplashViewModel _splashViewModel;
|
||||||
|
private bool _canShowRootViewModel;
|
||||||
|
|
||||||
public TrayViewModel(IKernel kernel, IWindowManager windowManager, IEventAggregator eventAggregator, ICoreService coreService, ISettingsService settingsService)
|
public TrayViewModel(IKernel kernel, IWindowManager windowManager, IEventAggregator eventAggregator, ICoreService coreService, ISettingsService settingsService)
|
||||||
{
|
{
|
||||||
@ -34,7 +35,11 @@ namespace Artemis.UI.Screens
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanShowRootViewModel { get; set; }
|
public bool CanShowRootViewModel
|
||||||
|
{
|
||||||
|
get => _canShowRootViewModel;
|
||||||
|
set => SetAndNotify(ref _canShowRootViewModel, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void TrayBringToForeground()
|
public void TrayBringToForeground()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,13 +4,25 @@ namespace Artemis.UI.Screens.Workshop
|
|||||||
{
|
{
|
||||||
public class WorkshopViewModel : MainScreenViewModel
|
public class WorkshopViewModel : MainScreenViewModel
|
||||||
{
|
{
|
||||||
|
private Color _testColor;
|
||||||
|
private bool _testPopupOpen;
|
||||||
|
|
||||||
public WorkshopViewModel()
|
public WorkshopViewModel()
|
||||||
{
|
{
|
||||||
DisplayName = "Workshop";
|
DisplayName = "Workshop";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color TestColor { get; set; }
|
public Color TestColor
|
||||||
public bool TestPopupOpen { get; set; }
|
{
|
||||||
|
get => _testColor;
|
||||||
|
set => SetAndNotify(ref _testColor, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TestPopupOpen
|
||||||
|
{
|
||||||
|
get => _testPopupOpen;
|
||||||
|
set => SetAndNotify(ref _testPopupOpen, value);
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user