using System; using System.Threading.Tasks; using Artemis.UI.Shared.Services.Builders; using Avalonia.Controls; namespace Artemis.UI.Shared.Services; /// /// A service that can be used to show windows and dialogs. /// public interface IWindowService : IArtemisSharedUIService { /// /// Creates a view model instance of type and shows its corresponding View as a /// window /// /// The type of view model to create /// The created view model Window ShowWindow(out TViewModel viewModel, params object[] parameters); /// /// Given a ViewModel, show its corresponding View as a window /// /// ViewModel to show the View for Window ShowWindow(object viewModel); /// /// Shows a dialog displaying the given exception /// /// The title of the dialog /// The exception to display void ShowExceptionDialog(string title, Exception exception); /// /// Creates a view model instance of type and shows its corresponding View as a /// dialog /// /// The type of view model to create /// The created view model Task ShowDialogAsync(params object[] parameters); /// /// Given a ViewModel, show its corresponding View as a dialog /// /// ViewModel to show the View for Task ShowDialogAsync(object viewModel); /// /// Given an existing ViewModel, show its corresponding View as a Dialog /// /// The return type /// ViewModel to show the View for /// A task containing the return value of type Task ShowDialogAsync(DialogViewModelBase viewModel); /// /// Creates a view model instance of type and shows its corresponding View as a /// Dialog /// /// The view model type /// The return type /// A task containing the return value of type Task ShowDialogAsync(params object[] parameters) where TViewModel : DialogViewModelBase; /// /// Shows a content dialog asking the user to confirm an action /// /// The title of the dialog /// The message of the dialog /// The text of the confirm button /// The text of the cancel button, if the cancel button will not be shown /// /// A task containing the result of the dialog, if confirmed; otherwise /// /// Task ShowConfirmContentDialog(string title, string message, string confirm = "Confirm", string? cancel = "Cancel"); /// /// Creates an open folder dialog, use the fluent API to configure it /// /// The builder that can be used to configure the dialog OpenFolderDialogBuilder CreateOpenFolderDialog(); /// /// Creates an open file dialog, use the fluent API to configure it /// /// The builder that can be used to configure the dialog OpenFileDialogBuilder CreateOpenFileDialog(); /// /// Creates a save file dialog, use the fluent API to configure it /// /// The builder that can be used to configure the dialog SaveFileDialogBuilder CreateSaveFileDialog(); /// /// Creates a content dialog, use the fluent API to configure it /// /// The builder that can be used to configure the dialog ContentDialogBuilder CreateContentDialog(); /// /// Gets the current window of the application /// /// The current window of the application Window? GetCurrentWindow(); }