public ProfileExportViewModel(ProfileDescriptor profileDescriptor, IProfileService profileService, ISnackbarMessageQueue mainMessageQueue) { ProfileDescriptor = profileDescriptor; _profileService = profileService; _mainMessageQueue = mainMessageQueue; }
public ProfileExportViewModel(ProfileDescriptor profileDescriptor, IProfileService profileService, IMessageService messageService) { ProfileDescriptor = profileDescriptor; _profileService = profileService; _messageService = messageService; }
public async Task ActivateLastProfileAnimated(ProfileModule profileModule) { ProfileDescriptor activeProfile = GetLastActiveProfile(profileModule); if (activeProfile != null) { await ActivateProfileAnimated(activeProfile); } }
public void ActivateLastProfile(ProfileModule profileModule) { ProfileDescriptor activeProfile = GetLastActiveProfile(profileModule); if (activeProfile != null) { ActivateProfile(activeProfile); } }
public string ExportProfile(ProfileDescriptor profileDescriptor) { ProfileEntity profileEntity = _profileRepository.Get(profileDescriptor.Id); if (profileEntity == null) { throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}"); } return(JsonConvert.SerializeObject(profileEntity, ExportSettings)); }
public async Task <Profile> ActivateProfileAnimated(ProfileDescriptor profileDescriptor) { if (profileDescriptor.ProfileModule.ActiveProfile?.EntityId == profileDescriptor.Id) { return(profileDescriptor.ProfileModule.ActiveProfile); } ProfileEntity profileEntity = _profileRepository.Get(profileDescriptor.Id); if (profileEntity == null) { throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}"); } Profile profile = new Profile(profileDescriptor.ProfileModule, profileEntity); InstantiateProfile(profile); void ActivatingProfileSurfaceUpdate(object sender, SurfaceConfigurationEventArgs e) { profile.PopulateLeds(e.Surface); } void ActivatingProfilePluginToggle(object sender, PluginEventArgs e) { InstantiateProfile(profile); } // This could happen during activation so subscribe to it _pluginService.PluginEnabled += ActivatingProfilePluginToggle; _pluginService.PluginDisabled += ActivatingProfilePluginToggle; _surfaceService.SurfaceConfigurationUpdated += ActivatingProfileSurfaceUpdate; await profileDescriptor.ProfileModule.ChangeActiveProfileAnimated(profile, _surfaceService.ActiveSurface); SaveActiveProfile(profileDescriptor.ProfileModule); _pluginService.PluginEnabled -= ActivatingProfilePluginToggle; _pluginService.PluginDisabled -= ActivatingProfilePluginToggle; _surfaceService.SurfaceConfigurationUpdated -= ActivatingProfileSurfaceUpdate; return(profile); }
public Profile ActivateProfile(ProfileDescriptor profileDescriptor) { if (profileDescriptor.ProfileModule.ActiveProfile?.EntityId == profileDescriptor.Id) { return(profileDescriptor.ProfileModule.ActiveProfile); } ProfileEntity profileEntity = _profileRepository.Get(profileDescriptor.Id); if (profileEntity == null) { throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}"); } Profile profile = new Profile(profileDescriptor.ProfileModule, profileEntity); InstantiateProfile(profile); profileDescriptor.ProfileModule.ChangeActiveProfile(profile, _surfaceService.ActiveSurface); SaveActiveProfile(profileDescriptor.ProfileModule); return(profile); }
public void DeleteProfile(ProfileDescriptor profileDescriptor) { ProfileEntity profileEntity = _profileRepository.Get(profileDescriptor.Id); _profileRepository.Remove(profileEntity); }