Implemented layer LED assignment

Added a centralised ProfileEditorSurface for communication between VMs
Prefixed Surface, Device and Led with Artemis to differentiate them better
This commit is contained in:
Robert committed 2019-11-29 17:37:22 +01:00
1 parent c7a5532c34
commit 16decaae42
50 files changed
+556 -662

No files matched your search

@@ -0,0 +1,22 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.Abstract;
namespace Artemis.UI.Services.Interfaces
{
public interface IProfileEditorService : IArtemisUIService
{
Profile SelectedProfile { get; }
ProfileElement SelectedProfileElement { get; }
void ChangeSelectedProfile(Profile profile);
void UpdateSelectedProfile();
void ChangeSelectedProfileElement(ProfileElement profileElement);
void UpdateSelectedProfileElement();
event EventHandler SelectedProfileChanged;
event EventHandler SelectedProfileUpdated;
event EventHandler SelectedProfileElementChanged;
event EventHandler SelectedProfileElementUpdated;
}
}
@@ -0,0 +1,70 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.Abstract;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.UI.Services.Interfaces;
namespace Artemis.UI.Services
{
public class ProfileEditorService : IProfileEditorService
{
private readonly IProfileService _profileService;
public ProfileEditorService(IProfileService profileService)
{
_profileService = profileService;
}
public Profile SelectedProfile { get; private set; }
public ProfileElement SelectedProfileElement { get; private set; }
public void ChangeSelectedProfile(Profile profile)
{
SelectedProfile = profile;
OnSelectedProfileChanged();
}
public void UpdateSelectedProfile()
{
_profileService.UpdateProfile(SelectedProfile, false);
OnSelectedProfileElementUpdated();
}
public void ChangeSelectedProfileElement(ProfileElement profileElement)
{
SelectedProfileElement = profileElement;
OnSelectedProfileElementChanged();
}
public void UpdateSelectedProfileElement()
{
_profileService.UpdateProfile(SelectedProfile, true);
OnSelectedProfileElementUpdated();
}
public event EventHandler SelectedProfileChanged;
public event EventHandler SelectedProfileUpdated;
public event EventHandler SelectedProfileElementChanged;
public event EventHandler SelectedProfileElementUpdated;
protected virtual void OnSelectedProfileElementUpdated()
{
SelectedProfileElementUpdated?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnSelectedProfileElementChanged()
{
SelectedProfileElementChanged?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnSelectedProfileUpdated()
{
SelectedProfileUpdated?.Invoke(this, EventArgs.Empty);
}
protected virtual void OnSelectedProfileChanged()
{
SelectedProfileChanged?.Invoke(this, EventArgs.Empty);
}
}
}