Beispiel #1
0
        //Check admin priviliges
        async System.Threading.Tasks.Task CheckAdmin()
        {
            try
            {
                if (!vAdministratorPermission)
                {
                    int messageResult = await AVMessageBox.MessageBoxPopup(null, SchTask_Description, "It seems like this is the first time you are using the helper or the application path has changed so you will have to accept the upcoming administrator prompt, after that you will be able to run this helper without the administrator prompt.", "Continue", "Cancel", "", "");

                    if (messageResult == 1)
                    {
                        await ProcessLauncherWin32Async(Assembly.GetEntryAssembly().Location, Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "", true, false);

                        Environment.Exit(0);
                        return;
                    }
                    else
                    {
                        Debug.WriteLine("Admin launcher cancelled.");
                        Environment.Exit(0);
                        return;
                    }
                }
            }
            catch { }
        }
Beispiel #2
0
        //Ignore and disconnect controller
        async void Btn_IgnoreController_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ControllerStatus activeController = vActiveController();
                if (activeController != null)
                {
                    int messageResult = await AVMessageBox.MessageBoxPopup(this, "Do you really want to ignore this controller?", "This will prevent the controller from been converted to XInput.", "Ignore the controller", "Cancel", "", "");

                    if (messageResult == 1)
                    {
                        //Update json profile
                        activeController.Details.Profile.Ignore = true;
                        JsonSaveObject(vDirectControllersProfile, "DirectControllersProfile");

                        //Release controller from hid guardian
                        HidGuardianReleaseController(activeController.Details);

                        //Disconnect the controller
                        await StopControllerAsync(activeController, "ignored");

                        Debug.Write("Ignored active controller.");
                    }
                }
                else
                {
                    NotificationDetails notificationDetails = new NotificationDetails();
                    notificationDetails.Icon = "Controller";
                    notificationDetails.Text = "No controller connected";
                    App.vWindowOverlay.Notification_Show_Status(notificationDetails);
                }
            }
            catch { }
        }
Beispiel #3
0
        //Application close prompt
        public async Task Application_Exit_Prompt()
        {
            try
            {
                int messageResult = await AVMessageBox.MessageBoxPopup(this, "Do you really want to close DirectXInput?", "This will disconnect all your currently connected controllers.", "Close application", "Cancel", "", "");

                if (messageResult == 1)
                {
                    await Application_Exit();
                }
            }
            catch { }
        }
Beispiel #4
0
        //Install the required drivers message popup
        async Task Message_InstallDrivers()
        {
            try
            {
                int messageResult = await AVMessageBox.MessageBoxPopup(this, "Drivers not installed", "Welcome to DirectXInput, it seems like you have not yet installed the required drivers to use this application, please make sure that you have installed the required drivers.\n\nDirectXInput will be closed during the installation of the required drivers.\n\nIf you just installed the drivers and this message shows up restart your PC.", "Install the drivers", "Close application", "", "");

                if (messageResult == 1)
                {
                    if (!CheckRunningProcessByNameOrTitle("DriverInstaller", false))
                    {
                        await ProcessLauncherWin32Async("DriverInstaller.exe", "", "", false, false);
                        await Application_Exit();
                    }
                }
                else
                {
                    await Application_Exit();
                }
            }
            catch { }
        }
Beispiel #5
0
        //Remove the controller from the list
        async void Btn_RemoveController_Click(object sender, RoutedEventArgs args)
        {
            try
            {
                ControllerStatus activeController = vActiveController();
                if (activeController != null)
                {
                    int messageResult = await AVMessageBox.MessageBoxPopup(this, "Do you really want to remove this controller?", "This will reset the active controller to it's defaults and disconnect it.", "Remove controller profile", "Cancel", "", "");

                    if (messageResult == 1)
                    {
                        Debug.WriteLine("Removed the controller: " + activeController.Details.DisplayName);

                        NotificationDetails notificationDetails = new NotificationDetails();
                        notificationDetails.Icon = "Controller";
                        notificationDetails.Text = "Removed controller";
                        App.vWindowOverlay.Notification_Show_Status(notificationDetails);

                        AVActions.ActionDispatcherInvoke(delegate
                        {
                            txt_Controller_Information.Text = "Removed the controller: " + activeController.Details.DisplayName;
                        });

                        vDirectControllersProfile.Remove(activeController.Details.Profile);
                        await StopControllerAsync(activeController, "removed");

                        //Save changes to Json file
                        JsonSaveObject(vDirectControllersProfile, "DirectControllersProfile");
                    }
                }
                else
                {
                    NotificationDetails notificationDetails = new NotificationDetails();
                    notificationDetails.Icon = "Controller";
                    notificationDetails.Text = "No controller connected";
                    App.vWindowOverlay.Notification_Show_Status(notificationDetails);
                }
            }
            catch { }
        }