/* 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; using System.Windows; using dnSpy.Contracts.Images; namespace dnSpy.Contracts.Settings.Dialog { /// /// Content shown in the options dialog box /// public abstract class AppSettingsPage : INotifyPropertyChanged { /// /// Parent or if the root element is the parent /// public virtual Guid ParentGuid => Guid.Empty; /// /// Gets the /// public abstract Guid Guid { get; } /// /// Gets the order, eg. /// public abstract double Order { get; } /// /// Gets the title shown in the UI /// public abstract string Title { get; } /// /// Gets the icon shown in the UI (eg. ) or /// public virtual ImageReference Icon => ImageReference.None; /// /// Gets the UI object. This property is only loaded if the user clicks on the page /// title in the dialog box. /// public abstract object? UIObject { get; } /// /// Called when all settings should be saved /// public abstract void OnApply(); /// /// Called when the dialog box has been closed /// public virtual void OnClosed() { } /// /// Returns the UI object that contains strings. This can be a , /// an object with a or the of an object /// with a . The caller will find all strings in it. /// /// By default, it returns . Return null if /// takes too long to create and override instead. /// /// See also . /// /// public virtual object? GetStringsObject() => UIObject; /// /// Returns an array of strings shown in the UI that can be searched. This method /// isn't needed if returns a non-null value (default /// behavior). /// /// public virtual string[]? GetSearchStrings() => null; /// /// Raised when a property is changed /// public event PropertyChangedEventHandler? PropertyChanged; /// /// Raises /// /// Name of property that changed protected void OnPropertyChanged(string propName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName)); /// /// Constructor /// protected AppSettingsPage() { } } /// /// Content shown in the options dialog box /// public interface IAppSettingsPage2 { /// /// Called when all settings should be saved. is /// never called. /// /// Add anything that needs to be refreshed, eg. re-decompile code void OnApply(IAppRefreshSettings appRefreshSettings); } }