using System.Windows;
using TSManagementApp.Properties;

namespace TSManagementApp.Utils
{
    class Messages
    {
        public static void MsgWarning(string text)
        {
            if (Application.Current.MainWindow == null)
                MessageBox.Show(text, Resources.Messages_Warning, MessageBoxButton.OK, MessageBoxImage.Warning);
            else
                MessageBox.Show(Application.Current.MainWindow, text, Resources.Messages_Warning, MessageBoxButton.OK, MessageBoxImage.Warning);
        }

        public static void MsgError(string text)
        {
            if (Application.Current.MainWindow == null)
                MessageBox.Show(text, Resources.Messages_Error, MessageBoxButton.OK, MessageBoxImage.Error);
            else
                MessageBox.Show(Application.Current.MainWindow, text, Resources.Messages_Error, MessageBoxButton.OK, MessageBoxImage.Error);
        }

        public static bool MsgYesNo(string title ,string text)
        {
            if (Application.Current.MainWindow == null)
                return MessageBox.Show(text, Resources.Messages_Question, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;
            return MessageBox.Show(Application.Current.MainWindow, text, title, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;
        }

        public static void MsgInfo(string text)
        {
             MessageBox.Show(text, Resources.Messages_Info, MessageBoxButton.OK, MessageBoxImage.Information);
        }

        public static bool MsgOkCancel(string text)
        {
            if (Application.Current.MainWindow == null)
                return MessageBox.Show(text, Resources.Messages_Info, MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.OK;
            return MessageBox.Show(Application.Current.MainWindow, text, Resources.Messages_Info, MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.OK;
        }
    }
}
