ilyalehchylin/educats-xamarin

View on GitHub
source/EduCATS/Helpers/Forms/Dialogs/Interfaces/IDialogs.cs

Summary

Maintainability
A
0 mins
Test Coverage
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Input;

namespace EduCATS.Helpers.Forms.Dialogs
{
    /// <summary>
    /// App dialogs interface.
    /// </summary>
    public interface IDialogs
    {
        /// <summary>
        /// Show message dialog.
        /// </summary>
        /// <param name="title">Dialog title.</param>
        /// <param name="message">Dialog description.</param>
        void ShowMessage(string title, string message);

        /// <summary>
        /// Show message dialog.
        /// </summary>
        /// <param name="title">Dialog title.</param>
        /// <param name="message">Dialog description.</param>
        Task<bool> ShowMessageUpdate(string title, string message, string linkButton, string cancelButton);

        /// <summary>
        /// Show error dialog.
        /// </summary>
        /// <param name="message">Dialog description.</param>
        void ShowError(string message);

        /// <summary>
        /// Show loading dialog.
        /// </summary>
        void ShowLoading();

        /// <summary>
        /// Show loading dialog.
        /// </summary>
        /// <param name="message">Dialog description.</param>
        void ShowLoading(string message);

        /// <summary>
        /// Hide loading dialog.
        /// </summary>
        void HideLoading();

        /// <summary>
        /// Show alert sheet.
        /// </summary>
        /// <param name="title">Dialog title.</param>
        /// <param name="buttons">Dialog buttons (id and name).</param>
        /// <param name="command">Command to execute on button click.</param>
        /// <returns>Chosen button name.</returns>
        void ShowSheet(string title, Dictionary<int, string> buttons, ICommand command);

        /// <summary>
        /// Show confirmation dialog.
        /// </summary>
        /// <param name="title">Dialog title.</param>
        /// <param name="message">Dialog description.</param>
        /// <returns>Dialog result.</returns>
        Task<bool> ShowConfirmationMessage(string title, string message);

        /// <summary>
        /// Show confirmation dialog with buttot OK.
        /// </summary>
        /// <param name="title">Dialog title.</param>
        /// <param name="message">Dialog description.</param>
        Task ShowConfirmation(string title, string message);

        /// <summary>
        /// Show progress dialog.
        /// </summary>
        /// <param name="message">Dialog message.</param>
        /// <param name="cancelText">Cancel button text.</param>
        /// <param name="onCancel">Action on cancel.</param>
        /// <returns>Progress dialog.</returns>
        object ShowProgress(string message, string cancelText, Action onCancel);

        /// <summary>
        /// Update progress dialog with percent.
        /// </summary>
        /// <param name="dialog">
        /// Progress dialog instance
        /// (retrieved from <see cref="ShowProgress(string, string, Action)"/>).
        /// </param>
        /// <param name="percent">Percent to apply.</param>
        void UpdateProgress(object dialog, int percent);

        /// <summary>
        /// Hide progress dialog.
        /// </summary>
        /// <param name="dialog">
        /// Progress dialog instance
        /// (retrieved from <see cref="ShowProgress(string, string, Action)"/>).
        /// </param>
        void HideProgress(object dialog);
    }
}