using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using System.Threading.Tasks;
using System.Windows;

namespace MahappsMetroDialogExampleCS
{
    /// <summary>
    /// Interaktionslogik für MainWindow.xaml
    /// </summary>
    public partial class MainWindow : MetroWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void ShowSimpleDialog(object sender, RoutedEventArgs e)
        {
            var dialogInstance = new SimpleWpfDialog();
            var result = dialogInstance.ShowDialog();
            // result should be true, false, or null
        }

        private async void ShowMessage(object sender, RoutedEventArgs e)
        {
            var result = await this.ShowMessageAsync("My title", "The Message", MessageDialogStyle.Affirmative);
        }

        private async void ShowInput(object sender, RoutedEventArgs e)
        {
            var result = await this.ShowInputAsync("My Title", "Enter something");
        }

        private async void ShowLogin(object sender, RoutedEventArgs e)
        {
            var result = await this.ShowLoginAsync("My Title", "Enter something");
        }

        private async void ShowProgress(object sender, RoutedEventArgs e)
        {
            var progressController = await this.ShowProgressAsync("My Title", "Enter something");
            progressController.SetProgress(0);
            for (var i = 1; i <= 10; i++)
            {
                progressController.SetProgress(i / 10);
                await Task.Delay(1000);
            }
        }

    }
}
