1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Artemis/Artemis/Artemis/Modules/Effects/WindowsProfile/WindowsProfileViewModel.cs
SpoinkyNL b2c09a96b5 Tiny UI fixes
Layers can no longer be dragged/resized off of the canvas
Added Qwertz option to dropdown box
Added default profiles for Pro L
Added default profiles for GTA V
LUA DrawText returns resulting text width
Fixed a null reference in LuaWrapper
Save button now forces a profile save too
Added profile save to debug log
Bumped version number
2016-11-15 23:14:08 +01:00

72 lines
2.6 KiB
C#

using System.ComponentModel;
using Artemis.Managers;
using Artemis.Models;
using Artemis.Modules.Effects.ProfilePreview;
using Artemis.ViewModels.Abstract;
using Artemis.ViewModels.Profiles;
using Ninject;
using Ninject.Parameters;
namespace Artemis.Modules.Effects.WindowsProfile
{
// TODO: This effect is a hybrid between a regular effect and a game, may want to clean this up
public sealed class WindowsProfileViewModel : EffectViewModel
{
public WindowsProfileViewModel(MainManager main, IKernel kernel, ProfilePreviewModel profilePreviewModel,
[Named("WindowsProfileModel")] EffectModel model) : base(main, model)
{
DisplayName = "Windows Profile";
ProfilePreviewModel = profilePreviewModel;
EffectSettings = ((WindowsProfileModel) EffectModel).Settings;
IParameter[] args =
{
new ConstructorArgument("mainManager", main),
new ConstructorArgument("gameModel", (WindowsProfileModel) EffectModel),
new ConstructorArgument("lastProfile", ((WindowsProfileSettings) EffectSettings).LastProfile)
};
ProfileEditor = kernel.Get<ProfileEditorViewModel>(args);
ProfileEditor.PropertyChanged += ProfileUpdater;
EffectModel.Profile = ProfileEditor.SelectedProfile;
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
}
public ProfileEditorViewModel ProfileEditor { get; set; }
public ProfilePreviewModel ProfilePreviewModel { get; set; }
private void ProfileUpdater(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName != "SelectedProfile") && IsActive)
return;
EffectModel.Profile = ProfileEditor.SelectedProfile;
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
if ((e.PropertyName != "SelectedProfile") || !ProfileEditor.ProfileViewModel.Activated ||
(ProfileEditor.ProfileViewModel.SelectedProfile == null))
return;
((WindowsProfileSettings) EffectSettings).LastProfile = ProfileEditor.ProfileViewModel.SelectedProfile.Name;
EffectSettings.Save();
}
public override void SaveSettings()
{
ProfileEditor.SaveSelectedProfile();
base.SaveSettings();
}
protected override void OnActivate()
{
base.OnActivate();
ProfileEditor.Activate();
}
protected override void OnDeactivate(bool close)
{
base.OnDeactivate(close);
ProfileEditor.Deactivate();
}
}
}