Пример #1
0
        private void InterceptionMethod_Selected(object sender, RoutedEventArgs e)
        {
            if (!is_initialized)
            {
                return;
            }
            lock (Helpers.locker)
            {
                Options.Instance.key_bindings.interception_method = InterceptionMethod.SelectedIndex == 0 ? KeyBindings.InterceptionMethod.WinApi : KeyBindings.InterceptionMethod.OblitaDriver;
                bool success = input_manager.UpdateInterceptionMethod();

                if (!success)
                {
                    if (Options.Instance.key_bindings.interception_method == KeyBindings.InterceptionMethod.WinApi)
                    {
                        throw new Exception("Failed setting WinAPI interception method.");
                    }

                    Options.Instance.key_bindings.is_driver_installed = false;
                    if (MessageBox.Show(
                            "This interception method will require driver installation and OS reboot.\nContinue?",
                            Helpers.application_name,
                            MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        var driver_installation_window = new DriverInstallationWindow();
                        driver_installation_window.ShowDialog();
                    }
                }

                Options.Instance.SaveToFile(Options.Filepath);

                UpdateKeyBindingControls();
                UpdateTexts();
            }
        }
Пример #2
0
        private void InterceptionMethod_Selected(object sender, RoutedEventArgs e)
        {
            if (!is_initialized)
            {
                return;
            }
            lock (Helpers.locker)
            {
                Options.Instance.key_bindings.interception_method = InterceptionMethod.SelectedIndex == 0 ? KeyBindings.InterceptionMethod.WinApi : KeyBindings.InterceptionMethod.OblitaDriver;
                Options.Instance.SaveToFile();
                bool success = input_manager.UpdateInterceptionMethod();
                if (!success)
                {
                    if (Options.Instance.key_bindings.interception_method == KeyBindings.InterceptionMethod.WinApi)
                    {
                        throw new Exception("Failed setting WinAPI interception method.");
                    }

                    if (!Options.Instance.key_bindings.is_driver_installed)
                    {
                        if (MessageBox.Show(
                                "This interception method will require driver installation and OS reboot.\nContinue?",
                                Helpers.application_name,
                                MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            var driver_installation_window = new DriverInstallationWindow();
                            driver_installation_window.ShowDialog();
                        }
                    }
                    else
                    {
                        MessageBox.Show(
                            "Failed loading interception driver." +
                            "Reinstall EyeTrackingMouse or install the driver from command line:" +
                            " https://github.com/oblitum/Interception. Application will run using WinAPI.",
                            Helpers.application_name, MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                UpdateKeyBindingControls();
                UpdateTexts();
            }
        }