/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; using System.ComponentModel.Composition; namespace dnSpy.Contracts.Settings.Dialog { /// /// Creates an empty app settings page that only contains children settings pages. /// If it has zero children, it won't be shown in the dialog box. Use /// to export an instance. /// public interface IAppSettingsPageContainer { } /// Metadata public interface IAppSettingsPageContainerMetadata { /// See string? ParentGuid { get; } /// See string Guid { get; } /// See double Order { get; } /// See string Title { get; } /// See string? Icon { get; } } /// /// Exports a instance /// [MetadataAttribute, AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public sealed class ExportAppSettingsPageContainerAttribute : ExportAttribute, IAppSettingsPageContainerMetadata { /// /// Constructor /// /// Title shown in the UI /// Unique of this app settings instance /// Order of this instance relative to other instances with the same parent, eg. /// of the parent or null if the root element is the parent, eg. /// Icon shown in the UI or null public ExportAppSettingsPageContainerAttribute(string title, string guid, double order = double.MaxValue, string? parentGuid = null, string? icon = null) : base(typeof(IAppSettingsPageContainer)) { ParentGuid = parentGuid; Guid = guid ?? throw new ArgumentNullException(nameof(guid)); Order = order; Title = title ?? throw new ArgumentNullException(nameof(title)); Icon = icon; } /// /// Parent or if the root element is the parent /// public string? ParentGuid { get; } /// /// Gets the /// public string Guid { get; } /// /// Gets the order, eg. /// public double Order { get; } /// /// Gets the title shown in the UI /// public string Title { get; } /// /// Gets the icon shown in the UI or null /// public string? Icon { get; } } }