public void ShowMessage(string message)
        {
            MessageTimer.Stop();
            HideMessageTimer.Stop();
            MessageBorder.Visibility = Visibility.Visible;
            message.Trim();
            MessageLB.Content = message;
            new Thread(() =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    DoubleAnimation errorAnimation = new DoubleAnimation();
                    errorAnimation.From            = 0;
                    errorAnimation.To = 1;
                    errorAnimation.AccelerationRatio = 0.5;
                    errorAnimation.Duration          = TimeSpan.FromMilliseconds(300);
                    MessageBorder.BeginAnimation(OpacityProperty, errorAnimation);
                });
            }).Start();

            MessageBorder.Background  = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageInformationBackground));
            MessageBorder.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageInformationForeground));
            MessageIconLB.Content     = MessageInformationIcon;
            MessageTimer.Interval     = TimeSpan.FromMilliseconds((500 * App.NumberOfWordsIn(message)) + 2000);
            MessageTimer.Tick        += ((sender, e) =>
            {
                new Thread(() =>
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        DoubleAnimation errorAnimation = new DoubleAnimation();
                        errorAnimation.To = 0;
                        errorAnimation.AccelerationRatio = 0.5;
                        errorAnimation.Duration = TimeSpan.FromMilliseconds(300);
                        MessageBorder.BeginAnimation(OpacityProperty, errorAnimation);
                        HideMessageTimer.Interval = TimeSpan.FromMilliseconds(300);
                        HideMessageTimer.Tick += ((sender1, e1) =>
                        {
                            MessageBorder.Visibility = Visibility.Collapsed;
                        });
                        HideMessageTimer.Start();
                    });
                }).Start();
            });
            MessageTimer.Start();
        }
        public void ShowMessage(MessageType type)
        {
            MessageTimer.Stop();
            HideMessageTimer.Stop();

            MessageBorder.Visibility = Visibility.Visible;
            t1 = new Task(() =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    DoubleAnimation errorAnimation = new DoubleAnimation();
                    errorAnimation.From            = 0;
                    errorAnimation.To = 1;
                    errorAnimation.AccelerationRatio = 0.5;
                    errorAnimation.Duration          = TimeSpan.FromMilliseconds(300);
                    MessageBorder.BeginAnimation(OpacityProperty, errorAnimation);
                });
            });
            t1.Start();
            if (type == MessageType.Error)
            {
                MessageBorder.Background  = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageErrorBackground));
                MessageBorder.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageErrorForeground));
                MessageIconLB.Content     = MessageErrorIcon;
                MessageLB.Content         = "Something went wrong";
            }
            else if (type == MessageType.Warning)
            {
                MessageBorder.Background  = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageWarningBackground));
                MessageBorder.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageWarningForeground));
                MessageIconLB.Content     = MessageWarningIcon;
                MessageLB.Content         = "Something may went wrong";
            }
            else if (type == MessageType.Information)
            {
                MessageBorder.Background  = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageInformationBackground));
                MessageBorder.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageInformationForeground));
                MessageIconLB.Content     = MessageInformationIcon;
                MessageLB.Content         = "Contact support if you need some help";
            }
            else if (type == MessageType.Success)
            {
                MessageBorder.Background  = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageSuccessBackground));
                MessageBorder.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(MessageSuccessForeground));
                MessageIconLB.Content     = MessageSuccessIcon;
                MessageLB.Content         = "Process completed successfully";
            }
            MessageTimer.Interval = TimeSpan.FromMilliseconds((500 * App.NumberOfWordsIn(MessageLB.Content.ToString())) + 2000);
            MessageTimer.Tick    += (async(sender, e) =>
            {
                t2 = new Task(() =>
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        DoubleAnimation errorAnimation = new DoubleAnimation();
                        errorAnimation.To = 0;
                        errorAnimation.AccelerationRatio = 0.5;
                        errorAnimation.Duration = TimeSpan.FromMilliseconds(300);
                        MessageBorder.BeginAnimation(OpacityProperty, errorAnimation);
                        HideMessageTimer.Interval = TimeSpan.FromMilliseconds(300);
                        HideMessageTimer.Tick += ((sender1, e1) =>
                        {
                            MessageBorder.Visibility = Visibility.Collapsed;
                        });
                        HideMessageTimer.Start();
                    });
                });
                t2.Start();
                await Task.WhenAll(t1, t2);
            });
            MessageTimer.Start();
        }