|
@@ -19,6 +19,7 @@ using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using System.Windows.Navigation;
|
|
|
using System.Windows.Shapes;
|
|
|
+using System.Windows.Threading;
|
|
|
|
|
|
namespace OOO_WriteAndClear.MVP.Views
|
|
|
{
|
|
@@ -32,6 +33,9 @@ namespace OOO_WriteAndClear.MVP.Views
|
|
|
InitializeComponent();
|
|
|
|
|
|
_presenter = new AuthorizationUserControlPresenter(this);
|
|
|
+ _dispatcherTimer = new DispatcherTimer();
|
|
|
+ _dispatcherTimer.Tick += EnableButton;
|
|
|
+ _dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -48,6 +52,8 @@ namespace OOO_WriteAndClear.MVP.Views
|
|
|
MessageBoxImage.Error);
|
|
|
Dispatcher.BeginInvoke(new Action(() =>
|
|
|
{
|
|
|
+ if (_capchaCode is not null)
|
|
|
+ DisableButtonAndStartTimer();
|
|
|
UpdateCapcha();
|
|
|
CapchaStackPanel.Visibility = Visibility.Visible;
|
|
|
})).Wait();
|
|
@@ -76,6 +82,8 @@ namespace OOO_WriteAndClear.MVP.Views
|
|
|
|
|
|
private string? _capchaCode = null;
|
|
|
|
|
|
+ private readonly DispatcherTimer _dispatcherTimer;
|
|
|
+
|
|
|
|
|
|
#region Обработчики событий разметки
|
|
|
|
|
@@ -90,6 +98,7 @@ namespace OOO_WriteAndClear.MVP.Views
|
|
|
{
|
|
|
MessageBox.Show("Капча введена не верно!", "Капча", MessageBoxButton.OK);
|
|
|
UpdateCapcha();
|
|
|
+ DisableButtonAndStartTimer();
|
|
|
return;
|
|
|
}
|
|
|
string login = Login;
|
|
@@ -134,5 +143,16 @@ namespace OOO_WriteAndClear.MVP.Views
|
|
|
}
|
|
|
CapchaImage.Source = bitmapimage;
|
|
|
}
|
|
|
+
|
|
|
+ private void DisableButtonAndStartTimer()
|
|
|
+ {
|
|
|
+ AuthButton.IsEnabled = false;
|
|
|
+ _dispatcherTimer.Start();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void EnableButton(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ AuthButton.IsEnabled = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|