示例#1
0
        internal void ChangeActiveProfile(Profile profile, ArtemisSurface surface)
        {
            if (profile != null && profile.Module != this)
            {
                throw new ArtemisCoreException($"Cannot activate a profile of module {profile.Module} on a module of plugin {PluginInfo}.");
            }
            if (!IsActivated)
            {
                throw new ArtemisCoreException("Cannot activate a profile on a deactivated module");
            }

            lock (this)
            {
                if (profile == ActiveProfile)
                {
                    return;
                }

                ActiveProfile?.Dispose();

                ActiveProfile = profile;
                ActiveProfile?.Activate(surface);
            }

            OnActiveProfileChanged();
        }
示例#2
0
        public void ChangeActiveProfile(Profile profile)
        {
            lock (this)
            {
                if (profile == null)
                {
                    throw new ArgumentNullException(nameof(profile));
                }

                ActiveProfile?.Deactivate();

                ActiveProfile = profile;
                ActiveProfile.Activate();
            }
        }
示例#3
0
        internal void ChangeActiveProfile(Profile profile, ArtemisSurface surface)
        {
            if (profile != null && profile.PluginInfo != PluginInfo)
            {
                throw new ArtemisCoreException($"Cannot activate a profile of plugin {profile.PluginInfo} on a module of plugin {PluginInfo}.");
            }
            lock (this)
            {
                if (profile == ActiveProfile)
                {
                    return;
                }

                ActiveProfile?.Deactivate();

                ActiveProfile = profile;
                ActiveProfile?.Activate(surface);
            }

            OnActiveProfileChanged();
        }