示例#1
0
 private void MenuItem_Unchecked(object sender, RoutedEventArgs e) // infinity listener
 {
     try
     {
         m3md2.StaticVariables.Diagnostics.ProgramInfo += $"{DateTime.Now.ToLongTimeString()}(MainWindow / MenuItem_inflistener_Unchecked event) Останавливаю прослушку...\r\n";
         StopListen();
         ConfigurationRequest.WriteValueByKey("InfnityListen", "False");
         m3md2.StaticVariables.Diagnostics.ProgramInfo += $"{DateTime.Now.ToLongTimeString()}(MainWindow / MenuItem_inflistener_Unchecked event) Конфигурация сохранена и обновлена\r\n";
     }
     catch (Exception ex)
     {
         ExceptionHandler.RegisterNew(ex);
     }
 }
示例#2
0
 private async void Load()
 {
     try
     {
         AuthButton.IsEnabled            = false;
         ResponseTextBox.KeyDown        -= Field_KeyDown;
         sResponseTextBox.KeyDown       -= Field_KeyDown;
         ApiRequest.BaseAddress          = ServerText;
         AuthButton.Content              = "Подключение...";
         UpdateCenterRequest.BaseAddress = ConfigurationRequest.GetValueByKey("MineWebUri");
         m3md2.StaticVariables.Diagnostics.ProgramInfo += $"{DateTime.Now.ToLongTimeString()}(Authorization) Запускаю проверку пароля\r\n";
         AuthButton.Content = "Проверка...";
         if (await ApiRequest.CreateProductAsync <Auth, bool>(new Auth()
         {
             password = Encryption.Encrypt(ResponseText)
         }, $"admin"))
         {
             ConfigurationRequest.WriteValueByKey("MainUri", ServerText);
             AuthButton.Content = "Загрузка сборок...";
             if (await CheckDll())
             {
                 AuthButton.Content = "Загрузка...";
                 m3md2.StaticVariables.Diagnostics.ProgramInfo += $"{DateTime.Now.ToLongTimeString()}(Authorization) Пароль правильный, запускаю основное окно\r\n";
                 MainWindow mainWindow = new MainWindow();
                 mainWindow.Show();
                 System.Windows.Application.Current.MainWindow.Close();
             }
         }
         else
         {
             m3md2.StaticVariables.Diagnostics.ProgramInfo += $"{DateTime.Now.ToLongTimeString()}(Authorization) Пароль неправильный, возвращаю окно в исходное положение\r\n";
             MessageBox.Show("Неправильный пароль");
         }
     }
     catch (Exception ex)
     {
         ExceptionHandler.RegisterNew(ex);
     }
     finally
     {
         AuthButton.Content        = "ОК";
         AuthButton.IsEnabled      = true;
         ResponseTextBox.KeyDown  += Field_KeyDown;
         sResponseTextBox.KeyDown += Field_KeyDown;
     }
 }