Exemplo n.º 1
0
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            //SaveSettings
            RS.PenalityShod = Int32.Parse(PenalityShod);
            RS.Penality     = Int32.Parse(Penality);
            int tmp = Int32.Parse(Attempts);

            if (tmp != RS.Attempts)
            {
                MessageBox.Show("Для применения новых настроек необходимо перезапустить программу",
                                "Внимание", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            RS.Attempts = tmp;
            if (RS.Attempts < 1)
            {
                RS.Attempts = 1;
            }
            RS.SavingPath            = SavingPath;
            RS.RaceHeader            = RHeader;
            RS.ResultCalculationType = ResultCalculationType;
            RS.RaceStartTime         = DateTime.Parse(RaceStartTime);
            RS.IsHardwareStart       = isHardwareStart;
            RS.CommunicationPort     = CommunicationPort;
            RS.Save();

            HardwareCommunicator.ReInitialize();

            Close();
        }
Exemplo n.º 2
0
 private void btStart_Click(object sender, RoutedEventArgs e)
 {
     SetState(ThisStates.Countdown);
     //hardware start
     if (RaceSettings.RS.IsHardwareStart)
     {
         HardwareCommunicator.RunCountdown(ProcessHardwareStart);
     }
     else
     {
         DoStart(0);
     }
 }
Exemplo n.º 3
0
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            var r = MessageBox.Show("Вы действительно хотите закрыть программу?", "Выход", MessageBoxButton.OKCancel, MessageBoxImage.Question);

            if (r == MessageBoxResult.Cancel)
            {
                e.Cancel = true;
                return;
            }
            else
            {
                InterceptKeys.UnhookWindowsHookEx1();
                var w = this.Owner;
                if (w != null)
                {
                    (w as MainWindow).Deactivate();
                }
            }

            HardwareCommunicator.Close();
        }