예제 #1
0
 public MainWindow()
 {
     try
     {
         InitializeComponent();
         InfinityListenMenuItem.IsChecked = Convert.ToBoolean(m3md2.StaticVariables.Windows.InfinityListen);
         Grid.Background      = brush;
         ScrollLog.Background = brush1;
         foreach (var label in m3md2.WinHelper.FindVisualChildren <Label>(Grid))
         {
             label.Foreground = brush2;
         }
         foreach (var textBlock in m3md2.WinHelper.FindVisualChildren <TextBlock>(Grid))
         {
             textBlock.Foreground = brush2;
         }
         foreach (var scrollViewer in m3md2.WinHelper.FindVisualChildren <ScrollViewer>(Grid))
         {
             scrollViewer.Foreground = brush2;
         }
         foreach (var textbox in m3md2.WinHelper.FindVisualChildren <TextBox>(Grid))
         {
             textbox.Background = brush3;
             textbox.Foreground = brush2;
         }
         if (Convert.ToBoolean(ConfigurationRequest.GetValueByKey("EnablePerfomanceCounter")))
         {
             StartPerfomanceCounter();
         }
     }
     catch (Exception ex)
     {
         ExceptionHandler.RegisterNew(ex);
     }
 }
예제 #2
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);
     }
 }
예제 #3
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;
     }
 }
예제 #4
0
 private void Start()
 {
     try
     {
         m3md2_startup.StartupManager.Main();
         System.Net.ServicePointManager.Expect100Continue = System.Convert.ToBoolean(ConfigurationRequest.GetValueByKey("Expect100Continue"));
         System.Net.ServicePointManager.SecurityProtocol  = System.Net.SecurityProtocolType.Tls12;
         m3md2.StaticVariables.Diagnostics.ProgramInfo   += $"(StartupManager) Значение Expect100Continue установлено на {System.Net.ServicePointManager.Expect100Continue}\n";
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show(ex.ToString() + "\nОшибки возникшие во время запуска не позволяют продолжать бесперебойную работу программы.\nУстраните эти ошибки прежде чем начать использование программы");
         Environment.Exit(0);
     }
 }
예제 #5
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     ServerText = ConfigurationRequest.GetValueByKey("MainUri");
 }