Example #1
0
        //Close other running launchers
        async Task CloseLaunchers(bool SilentClose)
        {
            try
            {
                List <DataBindString> Answers = new List <DataBindString>();
                DataBindString        Answer1 = new DataBindString();
                Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppClose.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer1.Name        = "Close launchers";
                Answers.Add(Answer1);

                DataBindString messageResult = null;
                if (!SilentClose)
                {
                    messageResult = await Popup_Show_MessageBox("Do you want to close other running launchers?", "You can edit the launchers that are closing in the profile manager.", "This includes launchers like Steam, EA Desktop, Ubisoft, GoG, Battle.net, Bethesda and Epic.", Answers);
                }

                if (SilentClose || (messageResult != null && messageResult == Answer1))
                {
                    await Notification_Send_Status("AppClose", "Closing other launchers");

                    //Close all known other launchers
                    foreach (ProfileShared closeLauncher in vCtrlCloseLaunchers)
                    {
                        try
                        {
                            CloseProcessesByNameOrTitle(closeLauncher.String1, false);
                        }
                        catch { }
                    }
                }
            }
            catch { }
        }
Example #2
0
        //Close the remote streamers
        async Task CloseStreamers()
        {
            try
            {
                //Ask if the user really wants to disconnect remote streams
                List <DataBindString> Answers = new List <DataBindString>();
                DataBindString        Answer1 = new DataBindString();
                Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Stream.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer1.Name        = "Disconnect streams";
                Answers.Add(Answer1);

                DataBindString messageResult = await Popup_Show_MessageBox("Do you want to disconnect remote streams?", "", "This includes streams from GeForce Experience, Parsec and Steam In-Home Streaming.", Answers);

                if (messageResult != null && messageResult == Answer1)
                {
                    await Notification_Send_Status("Stream", "Disconnecting remote streams");

                    //Disconnect Steam Streaming
                    CloseProcessesByNameOrTitle("steam", false);

                    //Disconnect GeForce Experience
                    CloseProcessesByNameOrTitle("nvstreamer", false);

                    //Disconnect Parsec Streaming
                    await KeyPressComboAuto(KeysVirtual.Control, KeysVirtual.F3);

                    //Disconnect Remote Desktop
                    //LaunchProcess(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\tsdiscon.exe", "", "", "");
                }
            }
            catch { }
        }
Example #3
0
        //Show the quick launch prompt
        async Task QuickLaunchPrompt()
        {
            try
            {
                //Get the current quick launch application
                DataBindApp quickLaunchApp = CombineAppLists(false, false, false).Where(x => x.QuickLaunch).FirstOrDefault();

                //Prompt user to quick launch application
                List <DataBindString> Answers = new List <DataBindString>();

                DataBindString AnswerLaunch = new DataBindString();
                AnswerLaunch.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppLaunch.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                AnswerLaunch.Name        = "Launch application";
                Answers.Add(AnswerLaunch);

                DataBindString messageResult = await Popup_Show_MessageBox("Quick launch", "* You can change the quick launch application in the CtrlUI settings.", "Do you want to launch " + quickLaunchApp.Name + "?", Answers);

                if (messageResult != null)
                {
                    if (messageResult == AnswerLaunch)
                    {
                        await LaunchQuickLaunchApp();
                    }
                }
            }
            catch
            {
                await Notification_Send_Status("AppLaunch", "Please set a quick launch app");

                Debug.WriteLine("Please set a quick launch app");
            }
        }
Example #4
0
        //Add files and folders from recycle bin
        void ListLoadAllRecycleBinFiles(List <DataBindString> targetList)
        {
            try
            {
                Shell  shell       = new Shell();
                Folder folderShell = shell.NameSpace(10);

                //Load file and folder images
                BitmapImage listImageFolder = FileToBitmapImage(new string[] { "Assets/Default/Icons/Folder.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                BitmapImage listImageFile   = FileToBitmapImage(new string[] { "Assets/Default/Icons/File.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);

                //Add recycle bin items to the list
                foreach (FolderItem folderItem in folderShell.Items())
                {
                    DataBindString answerRecycleItem = new DataBindString();
                    if (folderItem.IsFolder)
                    {
                        answerRecycleItem.ImageBitmap = listImageFolder;
                    }
                    else
                    {
                        answerRecycleItem.ImageBitmap = listImageFile;
                    }
                    answerRecycleItem.Name  = folderItem.Name;
                    answerRecycleItem.Data1 = folderItem;
                    answerRecycleItem.Data2 = folderShell;
                    targetList.Add(answerRecycleItem);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Recyclebin list error: " + ex.Message);
            }
        }
Example #5
0
        async void Button_AddAppLogo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Check if there is an application name set
                if (string.IsNullOrWhiteSpace(tb_AddAppName.Text) || tb_AddAppName.Text == "Select application executable file first")
                {
                    List <DataBindString> Answers = new List <DataBindString>();
                    DataBindString        Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = "Ok";
                    Answers.Add(Answer1);

                    await Popup_Show_MessageBox("Please enter an application name first", "", "", Answers);

                    return;
                }

                vFilePickerFilterIn = new List <string> {
                    "jpg", "png"
                };
                vFilePickerFilterOut       = new List <string>();
                vFilePickerTitle           = "Application Image";
                vFilePickerDescription     = "Please select a new application image:";
                vFilePickerShowNoFile      = false;
                vFilePickerShowRoms        = false;
                vFilePickerShowFiles       = true;
                vFilePickerShowDirectories = true;
                grid_Popup_FilePicker_stackpanel_Description.Visibility = Visibility.Collapsed;
                await Popup_Show_FilePicker("PC", -1, false, null);

                while (vFilePickerResult == null && !vFilePickerCancelled && !vFilePickerCompleted)
                {
                    await Task.Delay(500);
                }
                if (vFilePickerCancelled)
                {
                    return;
                }

                //Load the new application image
                BitmapImage applicationImage = FileToBitmapImage(new string[] { vFilePickerResult.PathFile }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, 120, 0);

                //Update the new application image
                img_AddAppLogo.Source = applicationImage;
                if (vEditAppDataBind != null)
                {
                    vEditAppDataBind.ImageBitmap = applicationImage;
                }

                //Copy the new application image
                File_Copy(vFilePickerResult.PathFile, "Assets/User/Apps/" + tb_AddAppName.Text + ".png", true);
            }
            catch { }
        }
Example #6
0
        //Sort the application lists by name
        async Task SortAppListsByName(bool silentSort)
        {
            try
            {
                if (!silentSort)
                {
                    await Notification_Send_Status("Sorting", "Sorting by name");
                }
                vSortType = SortingType.Name;

                SortFunction <DataBindApp> sortFuncName = new SortFunction <DataBindApp>();
                sortFuncName.function = x => x.Name;

                List <SortFunction <DataBindApp> > orderListGames = new List <SortFunction <DataBindApp> >();
                orderListGames.Add(sortFuncName);
                SortObservableCollection(lb_Games, List_Games, orderListGames, null);

                List <SortFunction <DataBindApp> > orderListApps = new List <SortFunction <DataBindApp> >();
                orderListApps.Add(sortFuncName);
                SortObservableCollection(lb_Apps, List_Apps, orderListApps, null);

                List <SortFunction <DataBindApp> > orderListEmulators = new List <SortFunction <DataBindApp> >();
                orderListEmulators.Add(sortFuncName);
                SortObservableCollection(lb_Emulators, List_Emulators, orderListEmulators, null);

                List <SortFunction <DataBindApp> > orderListLaunchers = new List <SortFunction <DataBindApp> >();
                orderListLaunchers.Add(sortFuncName);
                SortObservableCollection(lb_Launchers, List_Launchers, orderListLaunchers, null);

                List <SortFunction <DataBindApp> > orderListShortcuts = new List <SortFunction <DataBindApp> >();
                orderListShortcuts.Add(sortFuncName);
                SortObservableCollection(lb_Shortcuts, List_Shortcuts, orderListShortcuts, null);

                List <SortFunction <DataBindApp> > orderListProcesses = new List <SortFunction <DataBindApp> >();
                orderListProcesses.Add(sortFuncName);
                SortObservableCollection(lb_Processes, List_Processes, orderListProcesses, null);

                DataBindString menuSortItem = List_MainMenu.Where(x => x.Data1.ToString() == "menuButtonSorting").FirstOrDefault();
                if (menuSortItem != null)
                {
                    menuSortItem.Name = "Sort applications by number or date";
                }

                ToolTip newTooltip = new ToolTip()
                {
                    Content = "Sort by number or date"
                };
                button_MenuSorting.ToolTip = newTooltip;
            }
            catch { }
        }
Example #7
0
        //Show failed launch messagebox
        async Task LaunchProcessFailed()
        {
            try
            {
                List <DataBindString> Answers = new List <DataBindString>();
                DataBindString        Answer1 = new DataBindString();
                Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer1.Name        = "Ok";
                Answers.Add(Answer1);

                await Popup_Show_MessageBox("Failed to launch the application", "", "Perhaps the application has moved to a new location or has closed.", Answers);
            }
            catch { }
        }
Example #8
0
        async Task SwitchAudioDevice()
        {
            try
            {
                Debug.WriteLine("Listing all the active audio playback devices.");

                //Get the current active audio device
                AudioDeviceSummary deviceCurrent = GetDefaultDevice();

                //Get all the available audio devices
                List <AudioDeviceSummary> devicesList = ListAudioDevices();

                //Add all devices to answers list
                List <DataBindString> Answers = new List <DataBindString>();

                foreach (AudioDeviceSummary audioDevice in devicesList)
                {
                    DataBindString Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/VolumeUp.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = audioDevice.Name;
                    Answers.Add(Answer1);
                }

                //Show the messagebox prompt
                DataBindString messageResult = await Popup_Show_MessageBox("Switch audio playback device", "", "Please select the audio playback device you want to start listening from, your current audio device is: " + deviceCurrent.Name, Answers);

                if (messageResult != null)
                {
                    //Change the default device
                    AudioDeviceSummary changeDevice = devicesList.Where(x => x.Name.ToLower() == messageResult.Name.ToLower()).FirstOrDefault();
                    if (changeDevice != null)
                    {
                        if (SetDefaultDevice(changeDevice.Identifier))
                        {
                            await Notification_Send_Status("VolumeUp", "Switched audio device");
                        }
                        else
                        {
                            await Notification_Send_Status("VolumeUp", "Switching audio failed");
                        }
                    }
                }
            }
            catch
            {
                Debug.WriteLine("Failed to load the audio devices");
                await Notification_Send_Status("VolumeUp", "No audio available");
            }
        }
Example #9
0
        async Task RightClickLauncher(ListBox listboxSender, int listboxSelectedIndex, DataBindApp dataBindApp)
        {
            try
            {
                List <DataBindString> Answers = new List <DataBindString>();

                DataBindString AnswerDownload = new DataBindString();
                AnswerDownload.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Download.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                AnswerDownload.Name        = "Download game information";
                Answers.Add(AnswerDownload);

                DataBindString AnswerHide = new DataBindString();
                AnswerHide.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Hide.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                AnswerHide.Name        = "Hide the launcher application";
                Answers.Add(AnswerHide);

                //Get launcher application information
                string launcherInfoString = dataBindApp.PathExe;
                if (!string.IsNullOrWhiteSpace(dataBindApp.Argument))
                {
                    launcherInfoString += " (" + dataBindApp.Argument + ")";
                }

                DataBindString messageResult = await Popup_Show_MessageBox("What would you like to do with " + dataBindApp.Name + "?", launcherInfoString, "", Answers);

                if (messageResult != null)
                {
                    if (messageResult == AnswerDownload)
                    {
                        DownloadInfoGame informationDownloaded = await DownloadInfoGame(dataBindApp.Name, 100, true);

                        if (informationDownloaded != null)
                        {
                            if (informationDownloaded.ImageBitmap != null)
                            {
                                dataBindApp.ImageBitmap = informationDownloaded.ImageBitmap;
                            }
                        }
                    }
                    else if (messageResult == AnswerHide)
                    {
                        await HideLauncherApp(listboxSender, listboxSelectedIndex, dataBindApp);
                    }
                }
            }
            catch { }
        }
Example #10
0
 //Insert update to main menu
 void MainMenuInsertUpdate()
 {
     try
     {
         if (!List_MainMenu.Any(x => x.Data1.ToString() == "menuButtonUpdateRestart"))
         {
             DataBindString menuButtonUpdateRestart = new DataBindString
             {
                 ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Refresh.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                 Name        = "Update and restart CtrlUI",
                 Data1       = "menuButtonUpdateRestart"
             };
             List_MainMenu.Insert(0, menuButtonUpdateRestart);
         }
     }
     catch { }
 }
Example #11
0
        //Application update check failed message
        async Task AppUpdateFailed(bool silentCheck)
        {
            try
            {
                if (!silentCheck)
                {
                    List <DataBindString> Answers = new List <DataBindString>();
                    DataBindString        Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = "Ok";
                    Answers.Add(Answer1);

                    await Popup_Show_MessageBox("Failed to check for application update", "", "Please check your internet connection and try again.", Answers);
                }
            }
            catch { }
        }
Example #12
0
        async Task FilePicker_FileRemove_Checked()
        {
            try
            {
                //Confirm file remove prompt
                List <DataBindString> messageAnswers = new List <DataBindString>();
                DataBindString        answerRecycle  = new DataBindString();
                answerRecycle.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                answerRecycle.Name        = "Move files or folders to recycle bin*";
                messageAnswers.Add(answerRecycle);

                DataBindString answerPerma = new DataBindString();
                answerPerma.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/RemoveCross.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                answerPerma.Name        = "Remove files or folders permanently";
                messageAnswers.Add(answerPerma);

                bool           useRecycleBin = true;
                string         deleteString  = "Do you want to remove the selected files or folders?";
                DataBindString messageResult = await Popup_Show_MessageBox("Remove files or folders", "* Files and folders on a network drive get permanently deleted.", deleteString, messageAnswers);

                if (messageResult == null)
                {
                    Debug.WriteLine("Cancelled files or folders removal.");
                    return;
                }
                else if (messageResult == answerPerma)
                {
                    useRecycleBin = false;
                }

                await Notification_Send_Status("Remove", "Removing files or folders");

                //Remove the files or folders
                foreach (DataBindFile dataBindFile in List_FilePicker.Where(x => x.Checked == Visibility.Visible).ToList())
                {
                    Debug.WriteLine("Removing files or folders: " + dataBindFile.Name + " path: " + dataBindFile.PathFile);
                    await FilePicker_FileRemove_Remove(dataBindFile, useRecycleBin);
                }

                //Update the clipboard status text
                Clipboard_UpdateStatusText();
            }
            catch { }
        }
Example #13
0
        //Change the interface sound pack
        async void Button_Settings_InterfaceSoundPackName(object sender, RoutedEventArgs e)
        {
            try
            {
                //Add sound packs to string list
                List <DataBindString>       Answers              = new List <DataBindString>();
                DirectoryInfo               directoryInfoUser    = new DirectoryInfo("Assets/User/Sounds");
                DirectoryInfo[]             soundPacksUser       = directoryInfoUser.GetDirectories("*", SearchOption.TopDirectoryOnly);
                DirectoryInfo               directoryInfoDefault = new DirectoryInfo("Assets/Default/Sounds");
                DirectoryInfo[]             soundPacksDefault    = directoryInfoDefault.GetDirectories("*", SearchOption.TopDirectoryOnly);
                IEnumerable <DirectoryInfo> soundPacks           = soundPacksUser.Concat(soundPacksDefault);

                BitmapImage imagePacks = FileToBitmapImage(new string[] { "Assets/Default/Icons/VolumeUp.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);

                foreach (DirectoryInfo soundPack in soundPacks)
                {
                    try
                    {
                        DataBindString AnswerCustom = new DataBindString();
                        AnswerCustom.ImageBitmap = imagePacks;
                        AnswerCustom.Name        = soundPack.Name;
                        Answers.Add(AnswerCustom);
                    }
                    catch { }
                }

                //Show the messagebox
                DataBindString messageResult = await Popup_Show_MessageBox("Interface Sounds", "", "Please select a sound pack to use:", Answers);

                if (messageResult != null)
                {
                    //Show changed message
                    await Notification_Send_Status("VolumeUp", "Sound pack changed");

                    //Update the setting
                    Setting_Save(vConfigurationCtrlUI, "InterfaceSoundPackName", messageResult.Name);

                    //Notify applications setting changed
                    await NotifyDirectXInputSettingChanged("InterfaceSoundPackName");
                }
            }
            catch { }
        }
Example #14
0
        //Open Windows Game controller settings
        async void Button_Settings_CheckControllers_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                List <DataBindString> Answers = new List <DataBindString>();
                DataBindString        Answer1 = new DataBindString();
                Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Controller.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer1.Name        = "Manage controllers";
                Answers.Add(Answer1);

                DataBindString messageResult = await Popup_Show_MessageBox("This will open a window you can't controller", "", "You can always return back to CtrlUI using the 'Guide' button on your controller or you can use the on screen keyboard mouse function.", Answers);

                if (messageResult != null && messageResult == Answer1)
                {
                    Process.Start("joy.cpl");
                }
            }
            catch { }
        }
Example #15
0
        //Change the quick launch app
        async void Button_Settings_AppQuickLaunch(object sender, RoutedEventArgs e)
        {
            try
            {
                //Add all apps to the string list
                List <DataBindString> Answers = new List <DataBindString>();
                foreach (DataBindApp dataBindApp in CombineAppLists(false, false, false))
                {
                    DataBindString stringApp = new DataBindString()
                    {
                        Name = dataBindApp.Name, ImageBitmap = dataBindApp.ImageBitmap
                    };
                    Answers.Add(stringApp);
                }

                //Show the messagebox
                DataBindString messageResult = await Popup_Show_MessageBox("Quick Launch Application", "", "Please select a new quick launch application:", Answers);

                if (messageResult != null)
                {
                    btn_Settings_AppQuickLaunch_TextBlock.Text = "Change quick launch app: " + messageResult.Name;

                    //Set previous quick launch application to false
                    foreach (DataBindApp dataBindApp in CombineAppLists(false, false, false).Where(x => x.QuickLaunch))
                    {
                        dataBindApp.QuickLaunch = false;
                    }

                    //Set new quick launch application to true
                    foreach (DataBindApp dataBindApp in CombineAppLists(false, false, false).Where(x => x.Name.ToLower() == messageResult.Name.ToLower()))
                    {
                        dataBindApp.QuickLaunch = true;
                    }

                    //Show changed message
                    await Notification_Send_Status("AppLaunch", "Quick launch app changed");

                    //Save changes to Json file
                    JsonSaveApplications();
                }
            }
            catch { }
        }
Example #16
0
        //Change the interface clock stlye
        async void Button_Settings_InterfaceClockStyleName(object sender, RoutedEventArgs e)
        {
            try
            {
                //Add clock styles to string list
                List <DataBindString> Answers = new List <DataBindString>();

                DirectoryInfo               directoryInfoUser    = new DirectoryInfo("Assets/User/Clocks");
                DirectoryInfo[]             clockStylesUser      = directoryInfoUser.GetDirectories("*", SearchOption.TopDirectoryOnly);
                DirectoryInfo               directoryInfoDefault = new DirectoryInfo("Assets/Default/Clocks");
                DirectoryInfo[]             clockStylesDefault   = directoryInfoDefault.GetDirectories("*", SearchOption.TopDirectoryOnly);
                IEnumerable <DirectoryInfo> clockStyles          = clockStylesUser.Concat(clockStylesDefault);

                foreach (DirectoryInfo clockStyle in clockStyles)
                {
                    BitmapImage    imageClocks  = FileToBitmapImage(new string[] { clockStyle.FullName + "/Preview.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    DataBindString AnswerCustom = new DataBindString();
                    AnswerCustom.ImageBitmap = imageClocks;
                    AnswerCustom.Name        = clockStyle.Name;
                    Answers.Add(AnswerCustom);
                }

                //Show the messagebox
                DataBindString messageResult = await Popup_Show_MessageBox("Interface Clocks", "", "Please select a clock style to use:", Answers);

                if (messageResult != null)
                {
                    //Show changed message
                    await Notification_Send_Status("Clock", "Clock style changed");

                    //Update the setting
                    Setting_Save(vConfigurationCtrlUI, "InterfaceClockStyleName", messageResult.Name);

                    //Update the clock style
                    UpdateClockStyle();

                    //Notify applications setting changed
                    await NotifyDirectXInputSettingChanged("InterfaceClockStyleName");
                }
            }
            catch { }
        }
Example #17
0
        //Show the recyclebin manager popup
        async Task ShowRecycleBinManager()
        {
            try
            {
                List <DataBindString> Answers = new List <DataBindString>();

                //Add empty the recycle bin
                DataBindString answerEmpty = new DataBindString();
                answerEmpty.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                answerEmpty.Name        = "Empty the Windows recycle bin";
                Answers.Add(answerEmpty);

                //Add files and folders from recycle bin
                ListLoadAllRecycleBinFiles(Answers);

                //Check if there are any items
                if (Answers.Count <= 1)
                {
                    await Notification_Send_Status("Remove", "No files in recycle bin");

                    Debug.WriteLine("Recycle bin does not have any files or folders.");
                    return;
                }

                //Show recycle bin prompt
                DataBindString messageResult = await Popup_Show_MessageBox("Recycle bin", "", "Please select a file or folder to interact with:", Answers);

                if (messageResult != null)
                {
                    if (messageResult == answerEmpty)
                    {
                        await RecycleBin_Empty();
                    }
                    else if (messageResult.Data1 != null)
                    {
                        await RecycleBin_RestoreDelete((FolderItem)messageResult.Data1, (Folder)messageResult.Data2);
                    }
                }
            }
            catch { }
        }
Example #18
0
        //Show application minimize popup
        async Task ApplicationPopupMinimize(string headerString)
        {
            try
            {
                List <DataBindString> Answers        = new List <DataBindString>();
                DataBindString        AnswerMinimize = new DataBindString();
                AnswerMinimize.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppMinimize.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                AnswerMinimize.Name        = "Minimize CtrlUI";
                Answers.Add(AnswerMinimize);

                DataBindString messageResult = await Popup_Show_MessageBox(headerString, "", "Would you like to minimize CtrlUI?", Answers);

                if (messageResult != null)
                {
                    if (messageResult == AnswerMinimize)
                    {
                        //Minimize the CtrlUI window
                        await AppMinimize(false);
                    }
                }
            }
            catch { }
        }
Example #19
0
        //Remove shortcut file prompt
        async Task RemoveShortcutFilePrompt(DataBindApp dataBindApp)
        {
            try
            {
                List <DataBindString> Answers = new List <DataBindString>();

                DataBindString AnswerRemove = new DataBindString();
                AnswerRemove.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                AnswerRemove.Name        = "Move shortcut file to recycle bin";
                Answers.Add(AnswerRemove);

                DataBindString messageResult = await Popup_Show_MessageBox("Shortcut target path no longer exists", string.Empty, "Would you like to remove the shortcut file?", Answers);

                if (messageResult != null)
                {
                    if (messageResult == AnswerRemove)
                    {
                        await RemoveShortcutFile(lb_Shortcuts, lb_Shortcuts.SelectedIndex, dataBindApp, true);
                    }
                }
            }
            catch { }
        }
Example #20
0
        //Empty the Windows Recycle Bin
        async Task RecycleBin_Empty()
        {
            try
            {
                List <DataBindString> messageAnswers = new List <DataBindString>();
                DataBindString        answerEmpty    = new DataBindString();
                answerEmpty.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                answerEmpty.Name        = "Empty the recycle bin";
                messageAnswers.Add(answerEmpty);

                DataBindString messageResult = await Popup_Show_MessageBox("Empty the recycle bin?", "", "This will permanently remove all the files and folders from your recycle bin.", messageAnswers);

                if (messageResult != null && messageResult == answerEmpty)
                {
                    await Notification_Send_Status("Remove", "Emptying recycle bin");

                    Debug.WriteLine("Emptying the Windows recycle bin.");

                    //Play recycle bin empty sound
                    PlayInterfaceSound(vConfigurationCtrlUI, "RecycleBinEmpty", false);

                    //Prepare the recycle bin task
                    void TaskAction()
                    {
                        try
                        {
                            SHEmptyRecycleBin(IntPtr.Zero, null, RecycleBin_FLAGS.SHRB_NOCONFIRMATION | RecycleBin_FLAGS.SHRB_NOSOUND);
                        }
                        catch { }
                    }

                    //Empty the windows recycle bin
                    await AVActions.TaskStart(TaskAction);
                }
            }
            catch { }
        }
Example #21
0
        //Restore or delete item from reycle bin
        async Task RecycleBin_RestoreDelete(FolderItem folderItem, Folder folder)
        {
            try
            {
                List <DataBindString> Answers       = new List <DataBindString>();
                DataBindString        answerRestore = new DataBindString();
                answerRestore.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Restart.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                if (folderItem.IsFolder)
                {
                    answerRestore.Name = "Restore the folder to disk";
                }
                else
                {
                    answerRestore.Name = "Restore the file to disk";
                }
                Answers.Add(answerRestore);

                DataBindString answerDelete = new DataBindString();
                answerDelete.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                if (folderItem.IsFolder)
                {
                    answerDelete.Name = "Permanently delete folder";
                }
                else
                {
                    answerDelete.Name = "Permanently delete file";
                }
                Answers.Add(answerDelete);

                DataBindString messageResult = await Popup_Show_MessageBox("Restore or delete", "", "Do you want to restore or permanantly delete " + folderItem.Name + "?", Answers);

                if (messageResult != null)
                {
                    if (messageResult == answerRestore)
                    {
                        //Get the original file path
                        string originalFullPath = Path.Combine(folder.GetDetailsOf(folderItem, 1), folder.GetDetailsOf(folderItem, 0));

                        //Restore the selected item
                        SHFILEOPSTRUCT shFileOpstruct = new SHFILEOPSTRUCT();
                        shFileOpstruct.wFunc = FILEOP_FUNC.FO_MOVE;
                        shFileOpstruct.pFrom = folderItem.Path + "\0\0";
                        shFileOpstruct.pTo   = originalFullPath + "\0\0";
                        int shFileResult = SHFileOperation(ref shFileOpstruct);

                        //Check file operation status
                        if (shFileResult == 0 && !shFileOpstruct.fAnyOperationsAborted)
                        {
                            await Notification_Send_Status("Restart", "File or folder restored");
                        }
                    }
                    else if (messageResult == answerDelete)
                    {
                        //Delete the selected item
                        SHFILEOPSTRUCT shFileOpstruct = new SHFILEOPSTRUCT();
                        shFileOpstruct.wFunc  = FILEOP_FUNC.FO_DELETE;
                        shFileOpstruct.pFrom  = folderItem.Path + "\0\0";
                        shFileOpstruct.fFlags = FILEOP_FLAGS.FOF_NOCONFIRMATION;
                        int shFileResult = SHFileOperation(ref shFileOpstruct);

                        //Check file operation status
                        if (shFileResult == 0 && !shFileOpstruct.fAnyOperationsAborted)
                        {
                            await Notification_Send_Status("Remove", "File or folder permanently deleted");
                        }
                    }
                }
            }
            catch { }
        }
Example #22
0
        //Add main menu items
        void MainMenuAddItems()
        {
            try
            {
                DataBindString menuButtonWindowsStart = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Windows.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Show the Windows start menu",
                    Data1       = "menuButtonWindowsStart"
                };
                List_MainMenu.Add(menuButtonWindowsStart);

                DataBindString menuButtonSorting = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Sorting.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Sort applications by name",
                    Data1       = "menuButtonSorting"
                };
                List_MainMenu.Add(menuButtonSorting);

                DataBindString menuButtonFullScreen = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/FullScreen.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Switch between screen modes",
                    Data1       = "menuButtonFullScreen"
                };
                List_MainMenu.Add(menuButtonFullScreen);

                DataBindString menuButtonMonitor = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Monitor.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Change display monitor settings",
                    Data1       = "menuButtonMonitor"
                };
                List_MainMenu.Add(menuButtonMonitor);

                DataBindString menuButtonAudioDevice = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/VolumeUp.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Switch audio playback device",
                    Data1       = "menuButtonAudioDevice"
                };
                List_MainMenu.Add(menuButtonAudioDevice);

                DataBindString menuButtonFps = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Fps.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Show or hide the fps overlayer",
                    Data1       = "menuButtonFps"
                };
                List_MainMenu.Add(menuButtonFps);

                DataBindString menuButtonRunExe = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppRunExe.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Launch an executable file from disk",
                    Data1       = "menuButtonRunExe"
                };
                List_MainMenu.Add(menuButtonRunExe);

                DataBindString menuButtonRunStore = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppRunStore.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Launch Windows store application",
                    Data1       = "menuButtonRunStore"
                };
                List_MainMenu.Add(menuButtonRunStore);

                DataBindString menuButtonAddExe = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppAddExe.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Add an executable file to the list",
                    Data1       = "menuButtonAddExe"
                };
                List_MainMenu.Add(menuButtonAddExe);

                DataBindString menuButtonAddStore = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppAddStore.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Add Windows store application to the list",
                    Data1       = "menuButtonAddStore"
                };
                List_MainMenu.Add(menuButtonAddStore);

                DataBindString menuButtonDisconnect = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Stream.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Disconnect active remote streams",
                    Data1       = "menuButtonDisconnect"
                };
                List_MainMenu.Add(menuButtonDisconnect);

                DataBindString menuButtonCloseLaunchers = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppClose.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Close other running app launchers",
                    Data1       = "menuButtonCloseLaunchers"
                };
                List_MainMenu.Add(menuButtonCloseLaunchers);

                DataBindString menuButtonShutdown = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Shutdown.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Close CtrlUI or shutdown the PC",
                    Data1       = "menuButtonShutdown"
                };
                List_MainMenu.Add(menuButtonShutdown);

                DataBindString menuButtonShowFileManager = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Folder.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Show file browser and manager",
                    Data1       = "menuButtonShowFileManager"
                };
                List_MainMenu.Add(menuButtonShowFileManager);

                DataBindString menuButtonRecycleBin = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Remove.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Manage Windows recycle bin",
                    Data1       = "menuButtonRecycleBin"
                };
                List_MainMenu.Add(menuButtonRecycleBin);

                DataBindString menuButtonProfileManager = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Profile.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Open the profile manager",
                    Data1       = "menuButtonProfileManager"
                };
                List_MainMenu.Add(menuButtonProfileManager);

                DataBindString menuButtonSettings = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Settings.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Open application settings",
                    Data1       = "menuButtonSettings"
                };
                List_MainMenu.Add(menuButtonSettings);

                DataBindString menuButtonHelp = new DataBindString
                {
                    ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Help.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0),
                    Name        = "Show application help",
                    Data1       = "menuButtonHelp"
                };
                List_MainMenu.Add(menuButtonHelp);

                //Bind the list to main menu
                listbox_MainMenu.ItemsSource = List_MainMenu;
            }
            catch { }
        }
Example #23
0
        //Add or edit application to list apps and Json file
        async void Button_Manage_SaveEditApp_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Check the selected application category
                AppCategory selectedAddCategory = (AppCategory)lb_Manage_AddAppCategory.SelectedIndex;

                //Check if there is an application name set
                if (string.IsNullOrWhiteSpace(tb_AddAppName.Text) || tb_AddAppName.Text == "Select application executable file first")
                {
                    List <DataBindString> Answers = new List <DataBindString>();
                    DataBindString        Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = "Ok";
                    Answers.Add(Answer1);

                    await Popup_Show_MessageBox("Please enter an application name first", "", "", Answers);

                    return;
                }

                //Check if there is an application exe set
                if (string.IsNullOrWhiteSpace(tb_AddAppExePath.Text))
                {
                    List <DataBindString> Answers = new List <DataBindString>();
                    DataBindString        Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = "Ok";
                    Answers.Add(Answer1);

                    await Popup_Show_MessageBox("Please select an application executable file first", "", "", Answers);

                    return;
                }

                //Prevent CtrlUI from been added to the list
                if (tb_AddAppExePath.Text.Contains("CtrlUI.exe") || tb_AddAppExePath.Text.Contains("CtrlUI-Launcher.exe"))
                {
                    List <DataBindString> Answers = new List <DataBindString>();
                    DataBindString        Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = "Ok";
                    Answers.Add(Answer1);

                    await Popup_Show_MessageBox("Sorry, you can't add CtrlUI as an application", "", "", Answers);

                    return;
                }

                //Check if the application paths exist for Win32 apps
                if (vEditAppDataBind == null || (vEditAppDataBind != null && vEditAppDataBind.Type == ProcessType.Win32))
                {
                    //Validate the launch target
                    if (!File.Exists(tb_AddAppExePath.Text))
                    {
                        List <DataBindString> Answers = new List <DataBindString>();
                        DataBindString        Answer1 = new DataBindString();
                        Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        Answer1.Name        = "Ok";
                        Answers.Add(Answer1);

                        await Popup_Show_MessageBox("Application executable not found, please select another one", "", "", Answers);

                        return;
                    }

                    //Validate the launch path
                    if (!string.IsNullOrWhiteSpace(tb_AddAppPathLaunch.Text) && !Directory.Exists(tb_AddAppPathLaunch.Text))
                    {
                        List <DataBindString> Answers = new List <DataBindString>();
                        DataBindString        Answer1 = new DataBindString();
                        Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        Answer1.Name        = "Ok";
                        Answers.Add(Answer1);

                        await Popup_Show_MessageBox("Launch folder not found, please select another one", "", "", Answers);

                        return;
                    }

                    //Check if application is emulator and validate the rom path
                    if (selectedAddCategory == AppCategory.Emulator && !(bool)checkbox_AddLaunchSkipRom.IsChecked)
                    {
                        if (string.IsNullOrWhiteSpace(tb_AddAppPathRoms.Text))
                        {
                            List <DataBindString> Answers = new List <DataBindString>();
                            DataBindString        Answer1 = new DataBindString();
                            Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                            Answer1.Name        = "Ok";
                            Answers.Add(Answer1);

                            await Popup_Show_MessageBox("Please select an emulator rom folder first", "", "", Answers);

                            return;
                        }
                        if (!Directory.Exists(tb_AddAppPathRoms.Text))
                        {
                            List <DataBindString> Answers = new List <DataBindString>();
                            DataBindString        Answer1 = new DataBindString();
                            Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                            Answer1.Name        = "Ok";
                            Answers.Add(Answer1);

                            await Popup_Show_MessageBox("Rom folder not found, please select another one", "", "", Answers);

                            return;
                        }
                    }

                    //Check if application needs to be edited or added
                    string BtnTextContent = (sender as Button).Content.ToString();
                    if (BtnTextContent == "Add the application as filled in above")
                    {
                        //Check if new application already exists
                        if (CombineAppLists(false, false, false).Any(x => x.Name.ToLower() == tb_AddAppName.Text.ToLower() || x.PathExe.ToLower() == tb_AddAppExePath.Text.ToLower()))
                        {
                            List <DataBindString> Answers = new List <DataBindString>();
                            DataBindString        Answer1 = new DataBindString();
                            Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                            Answer1.Name        = "Ok";
                            Answers.Add(Answer1);

                            await Popup_Show_MessageBox("This application already exists", "", "", Answers);

                            return;
                        }

                        await Notification_Send_Status("Plus", "Added " + tb_AddAppName.Text);

                        Debug.WriteLine("Adding Win32 app: " + tb_AddAppName.Text + " to the list.");
                        DataBindApp dataBindApp = new DataBindApp()
                        {
                            Type = ProcessType.Win32, Category = selectedAddCategory, Name = tb_AddAppName.Text, PathExe = tb_AddAppExePath.Text, PathLaunch = tb_AddAppPathLaunch.Text, PathRoms = tb_AddAppPathRoms.Text, Argument = tb_AddAppArgument.Text, NameExe = tb_AddAppNameExe.Text, LaunchFilePicker = (bool)checkbox_AddLaunchFilePicker.IsChecked, LaunchSkipRom = (bool)checkbox_AddLaunchSkipRom.IsChecked, LaunchKeyboard = (bool)checkbox_AddLaunchKeyboard.IsChecked
                        };
                        await AddAppToList(dataBindApp, true, true);

                        //Close the open popup
                        await Popup_Close_Top();

                        //Focus on the application list
                        if (selectedAddCategory == AppCategory.Game)
                        {
                            await ListboxFocusIndex(lb_Games, false, true, -1, vProcessCurrent.MainWindowHandle);
                        }
                        else if (selectedAddCategory == AppCategory.App)
                        {
                            await ListboxFocusIndex(lb_Apps, false, true, -1, vProcessCurrent.MainWindowHandle);
                        }
                        else if (selectedAddCategory == AppCategory.Emulator)
                        {
                            await ListboxFocusIndex(lb_Emulators, false, true, -1, vProcessCurrent.MainWindowHandle);
                        }
                    }
                    else
                    {
                        //Check if application name already exists
                        if (vEditAppDataBind.Name.ToLower() == tb_AddAppName.Text.ToLower())
                        {
                            Debug.WriteLine("Application name has not changed or just caps.");
                        }
                        else if (CombineAppLists(false, false, false).Any(x => x.Name.ToLower() == tb_AddAppName.Text.ToLower()))
                        {
                            List <DataBindString> Answers = new List <DataBindString>();
                            DataBindString        Answer1 = new DataBindString();
                            Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                            Answer1.Name        = "Ok";
                            Answers.Add(Answer1);

                            await Popup_Show_MessageBox("This application name already exists, please use another one", "", "", Answers);

                            return;
                        }

                        //Check if application executable already exists
                        if (vEditAppDataBind.PathExe == tb_AddAppExePath.Text)
                        {
                            Debug.WriteLine("Application executable has not changed.");
                        }
                        else if (CombineAppLists(false, false, false).Any(x => x.PathExe.ToLower() == tb_AddAppExePath.Text.ToLower()))
                        {
                            List <DataBindString> Answers = new List <DataBindString>();
                            DataBindString        Answer1 = new DataBindString();
                            Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                            Answer1.Name        = "Ok";
                            Answers.Add(Answer1);

                            await Popup_Show_MessageBox("This application executable already exists, please select another one", "", "", Answers);

                            return;
                        }

                        //Rename application logo based on name and reload it
                        string imageFileNameOld = "Assets/User/Apps/" + vEditAppDataBind.Name + ".png";
                        if (vEditAppDataBind.Name != tb_AddAppName.Text && File.Exists(imageFileNameOld))
                        {
                            Debug.WriteLine("App name changed and application logo file exists.");
                            string imageFileNameNew = "Assets/User/Apps/" + tb_AddAppName.Text + ".png";
                            File_Move(imageFileNameOld, imageFileNameNew, true);
                        }

                        //Edit application in the list
                        vEditAppDataBind.Category         = selectedAddCategory;
                        vEditAppDataBind.Name             = tb_AddAppName.Text;
                        vEditAppDataBind.PathExe          = tb_AddAppExePath.Text;
                        vEditAppDataBind.PathLaunch       = tb_AddAppPathLaunch.Text;
                        vEditAppDataBind.PathRoms         = tb_AddAppPathRoms.Text;
                        vEditAppDataBind.Argument         = tb_AddAppArgument.Text;
                        vEditAppDataBind.NameExe          = tb_AddAppNameExe.Text;
                        vEditAppDataBind.LaunchFilePicker = (bool)checkbox_AddLaunchFilePicker.IsChecked;
                        vEditAppDataBind.LaunchSkipRom    = (bool)checkbox_AddLaunchSkipRom.IsChecked;
                        vEditAppDataBind.LaunchKeyboard   = (bool)checkbox_AddLaunchKeyboard.IsChecked;
                        vEditAppDataBind.ImageBitmap      = FileToBitmapImage(new string[] { vEditAppDataBind.Name, vEditAppDataBind.PathExe, vEditAppDataBind.PathImage }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, 90, 0);

                        //Reset the application status
                        vEditAppDataBind.StatusAvailable       = Visibility.Collapsed;
                        vEditAppDataBind.StatusRunning         = Visibility.Collapsed;
                        vEditAppDataBind.StatusSuspended       = Visibility.Collapsed;
                        vEditAppDataBind.RunningProcessCount   = string.Empty;
                        vEditAppDataBind.RunningTimeLastUpdate = 0;
                        vEditAppDataBind.ProcessMulti.Clear();

                        await Notification_Send_Status("Edit", "Edited " + vEditAppDataBind.Name);

                        Debug.WriteLine("Editing application: " + vEditAppDataBind.Name + " in the list.");

                        //Save changes to Json file
                        JsonSaveApplications();

                        //Close the open popup
                        await Popup_Close_Top();

                        await Task.Delay(500);

                        //Focus on the application list
                        if (vEditAppCategoryPrevious != vEditAppDataBind.Category)
                        {
                            Debug.WriteLine("App category changed to: " + vEditAppDataBind.Category);

                            //Remove app from previous category
                            if (vEditAppCategoryPrevious == AppCategory.Game)
                            {
                                await ListBoxRemoveItem(lb_Games, List_Games, vEditAppDataBind, false);
                            }
                            else if (vEditAppCategoryPrevious == AppCategory.App)
                            {
                                await ListBoxRemoveItem(lb_Apps, List_Apps, vEditAppDataBind, false);
                            }
                            else if (vEditAppCategoryPrevious == AppCategory.Emulator)
                            {
                                await ListBoxRemoveItem(lb_Emulators, List_Emulators, vEditAppDataBind, false);
                            }

                            //Add application to new category
                            if (vEditAppDataBind.Category == AppCategory.Game)
                            {
                                await ListBoxAddItem(lb_Games, List_Games, vEditAppDataBind, false, false);
                            }
                            else if (vEditAppDataBind.Category == AppCategory.App)
                            {
                                await ListBoxAddItem(lb_Apps, List_Apps, vEditAppDataBind, false, false);
                            }
                            else if (vEditAppDataBind.Category == AppCategory.Emulator)
                            {
                                await ListBoxAddItem(lb_Emulators, List_Emulators, vEditAppDataBind, false, false);
                            }

                            //Focus on the edited item listbox
                            if (vSearchOpen)
                            {
                                await ListboxFocusIndex(lb_Search, false, false, -1, vProcessCurrent.MainWindowHandle);
                            }
                            else
                            {
                                if (vEditAppDataBind.Category == AppCategory.Game)
                                {
                                    await ListboxFocusIndex(lb_Games, false, true, -1, vProcessCurrent.MainWindowHandle);
                                }
                                else if (vEditAppDataBind.Category == AppCategory.App)
                                {
                                    await ListboxFocusIndex(lb_Apps, false, true, -1, vProcessCurrent.MainWindowHandle);
                                }
                                else if (vEditAppDataBind.Category == AppCategory.Emulator)
                                {
                                    await ListboxFocusIndex(lb_Emulators, false, true, -1, vProcessCurrent.MainWindowHandle);
                                }
                            }
                        }
                        else
                        {
                            //Focus on the item listbox
                            if (vSearchOpen)
                            {
                                await ListboxFocusIndex(lb_Search, false, false, -1, vProcessCurrent.MainWindowHandle);
                            }
                            else
                            {
                                if (vEditAppDataBind.Category == AppCategory.Game)
                                {
                                    await ListboxFocusIndex(lb_Games, false, false, -1, vProcessCurrent.MainWindowHandle);
                                }
                                else if (vEditAppDataBind.Category == AppCategory.App)
                                {
                                    await ListboxFocusIndex(lb_Apps, false, false, -1, vProcessCurrent.MainWindowHandle);
                                }
                                else if (vEditAppDataBind.Category == AppCategory.Emulator)
                                {
                                    await ListboxFocusIndex(lb_Emulators, false, false, -1, vProcessCurrent.MainWindowHandle);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("App edit failed: " + ex.Message);
            }
        }
Example #24
0
 //Handle main menu single tap
 async Task Listbox_Menu_SingleTap()
 {
     try
     {
         if (listbox_MainMenu.SelectedIndex >= 0)
         {
             DataBindString selectedItem       = (DataBindString)listbox_MainMenu.SelectedItem;
             string         selectedItemString = selectedItem.Data1.ToString();
             if (selectedItemString == "menuButtonUpdateRestart")
             {
                 await AppUpdateRestart();
             }
             else if (selectedItemString == "menuButtonFullScreen")
             {
                 await AppSwitchScreenMode(false, false);
             }
             else if (selectedItemString == "menuButtonMonitor")
             {
                 await Popup_Show(grid_Popup_Monitor, btn_Monitor_Switch_Primary);
             }
             else if (selectedItemString == "menuButtonWindowsStart")
             {
                 await ShowWindowStartMenu();
             }
             else if (selectedItemString == "menuButtonSorting")
             {
                 await SortAppListsSwitch(false);
             }
             else if (selectedItemString == "menuButtonAudioDevice")
             {
                 await SwitchAudioDevice();
             }
             else if (selectedItemString == "menuButtonRunExe")
             {
                 await RunExecutableFile();
             }
             else if (selectedItemString == "menuButtonRunStore")
             {
                 await RunStoreApplication();
             }
             else if (selectedItemString == "menuButtonAddExe")
             {
                 await Popup_Show_AddExe();
             }
             else if (selectedItemString == "menuButtonAddStore")
             {
                 await Popup_Show_AddStore();
             }
             else if (selectedItemString == "menuButtonFps")
             {
                 await LaunchCloseFpsOverlayer();
             }
             else if (selectedItemString == "menuButtonSettings")
             {
                 await ShowLoadSettingsPopup();
             }
             else if (selectedItemString == "menuButtonHelp")
             {
                 await Popup_Show(grid_Popup_Help, btn_Help_Focus);
             }
             else if (selectedItemString == "menuButtonCloseLaunchers")
             {
                 await CloseLaunchers(false);
             }
             else if (selectedItemString == "menuButtonDisconnect")
             {
                 await CloseStreamers();
             }
             else if (selectedItemString == "menuButtonShutdown")
             {
                 await Application_Exit_Prompt();
             }
             else if (selectedItemString == "menuButtonShowFileManager")
             {
                 await ShowFileManager();
             }
             else if (selectedItemString == "menuButtonProfileManager")
             {
                 await Popup_Show_ProfileManager();
             }
             else if (selectedItemString == "menuButtonRecycleBin")
             {
                 await ShowRecycleBinManager();
             }
         }
     }
     catch { }
 }
Example #25
0
        //Change the edit profile category
        private async Task ChangeProfileCategory()
        {
            try
            {
                //Add profile categories
                List <DataBindString> Answers = new List <DataBindString>();

                BitmapImage imageProfile = FileToBitmapImage(new string[] { "Assets/Default/Icons/Profile.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);

                DataBindString stringCtrlLocationsShortcut = new DataBindString()
                {
                    Name = "Shortcut locations", Data1 = "CtrlLocationsShortcut", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlLocationsShortcut);

                DataBindString stringCtrlLocationsFile = new DataBindString()
                {
                    Name = "File browser locations", Data1 = "CtrlLocationsFile", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlLocationsFile);

                DataBindString stringCtrlIgnoreProcessName = new DataBindString()
                {
                    Name = "Ignored process names", Data1 = "CtrlIgnoreProcessName", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlIgnoreProcessName);

                DataBindString stringCtrlIgnoreLauncherName = new DataBindString()
                {
                    Name = "Ignored launcher names", Data1 = "CtrlIgnoreLauncherName", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlIgnoreLauncherName);

                DataBindString stringCtrlIgnoreShortcutName = new DataBindString()
                {
                    Name = "Ignored shortcuts names", Data1 = "CtrlIgnoreShortcutName", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlIgnoreShortcutName);

                DataBindString stringCtrlIgnoreShortcutUri = new DataBindString()
                {
                    Name = "Ignored shortcut uri's", Data1 = "CtrlIgnoreShortcutUri", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlIgnoreShortcutUri);

                DataBindString stringCtrlKeyboardExtensionName = new DataBindString()
                {
                    Name = "Keyboard open extension names", Data1 = "CtrlKeyboardExtensionName", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlKeyboardExtensionName);

                DataBindString stringCtrlKeyboardProcessName = new DataBindString()
                {
                    Name = "Keyboard open process names", Data1 = "CtrlKeyboardProcessName", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlKeyboardProcessName);

                DataBindString stringCtrlHDRProcessName = new DataBindString()
                {
                    Name = "Enable HDR process names", Data1 = @"User\CtrlHDRProcessName", ImageBitmap = imageProfile
                };
                Answers.Add(stringCtrlHDRProcessName);

                //Show the messagebox
                DataBindString messageResult = await Popup_Show_MessageBox("Profile Category", "", "Please select the profile to manage:", Answers);

                if (messageResult != null)
                {
                    //Set the selected profile category
                    vProfileManagerName = messageResult.Data1.ToString();

                    //Load profile in manager
                    await ProfileManager_LoadProfile();
                }
            }
            catch { }
        }
Example #26
0
        //Change the interface font style
        async void Button_Settings_InterfaceFontStyleName(object sender, RoutedEventArgs e)
        {
            try
            {
                //Add font styles to string list
                List <DataBindString> Answers    = new List <DataBindString>();
                BitmapImage           imageFonts = FileToBitmapImage(new string[] { "Assets/Default/Icons/Font.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);

                //Add default fonts
                DataBindString AnswerSegoe = new DataBindString();
                AnswerSegoe.ImageBitmap = imageFonts;
                AnswerSegoe.Name        = "Segoe UI";
                Answers.Add(AnswerSegoe);

                DataBindString AnswerVerdana = new DataBindString();
                AnswerVerdana.ImageBitmap = imageFonts;
                AnswerVerdana.Name        = "Verdana";
                Answers.Add(AnswerVerdana);

                DataBindString AnswerConsolas = new DataBindString();
                AnswerConsolas.ImageBitmap = imageFonts;
                AnswerConsolas.Name        = "Consolas";
                Answers.Add(AnswerConsolas);

                DataBindString AnswerArial = new DataBindString();
                AnswerArial.ImageBitmap = imageFonts;
                AnswerArial.Name        = "Arial";
                Answers.Add(AnswerArial);

                //Add custom fonts
                DirectoryInfo          directoryInfoUser    = new DirectoryInfo("Assets/User/Fonts");
                FileInfo[]             fontFilesUser        = directoryInfoUser.GetFiles("*.ttf", SearchOption.TopDirectoryOnly);
                DirectoryInfo          directoryInfoDefault = new DirectoryInfo("Assets/Default/Fonts");
                FileInfo[]             fontFilesDefault     = directoryInfoDefault.GetFiles("*.ttf", SearchOption.TopDirectoryOnly);
                IEnumerable <FileInfo> fontFiles            = fontFilesUser.Concat(fontFilesDefault);

                foreach (FileInfo fontFile in fontFiles)
                {
                    DataBindString AnswerCustom = new DataBindString();
                    AnswerCustom.ImageBitmap = imageFonts;
                    AnswerCustom.Name        = Path.GetFileNameWithoutExtension(fontFile.Name);
                    Answers.Add(AnswerCustom);
                }

                //Show the messagebox
                DataBindString messageResult = await Popup_Show_MessageBox("Interface Fonts", "", "Please select a font style to use:", Answers);

                if (messageResult != null)
                {
                    //Show changed message
                    await Notification_Send_Status("Font", "Font style changed");

                    //Update the setting
                    Setting_Save(vConfigurationCtrlUI, "InterfaceFontStyleName", messageResult.Name);

                    //Adjust the application font family
                    UpdateAppFontStyle();
                }
            }
            catch { }
        }
Example #27
0
        //Application close prompt
        async Task Application_Exit_Prompt()
        {
            try
            {
                //Force focus on CtrlUI
                if (!vAppActivated)
                {
                    await PrepareFocusProcessWindow("CtrlUI", vProcessCurrent.Id, vProcessCurrent.MainWindowHandle, 0, false, true, true, false);
                }

                //Show the closing messagebox
                List <DataBindString> Answers = new List <DataBindString>();
                DataBindString        Answer1 = new DataBindString();
                Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppClose.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer1.Name        = "Close CtrlUI";
                Answers.Add(Answer1);

                DataBindString Answer4 = new DataBindString();
                Answer4.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppRestart.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer4.Name        = "Restart CtrlUI";
                Answers.Add(Answer4);

                DataBindString Answer3 = new DataBindString();
                Answer3.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Shutdown.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer3.Name        = "Shutdown my PC";
                Answers.Add(Answer3);

                DataBindString Answer2 = new DataBindString();
                Answer2.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Restart.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer2.Name        = "Restart my PC";
                Answers.Add(Answer2);

                DataBindString messageResult = await Popup_Show_MessageBox("Would you like to close CtrlUI or shutdown your PC?", "If you have DirectXInput running and a controller connected you can launch CtrlUI by pressing on the 'Guide' button.", "", Answers);

                if (messageResult != null)
                {
                    if (messageResult == Answer1)
                    {
                        await Notification_Send_Status("AppClose", "Closing CtrlUI");
                        await Application_Exit();
                    }
                    else if (messageResult == Answer4)
                    {
                        await Notification_Send_Status("AppRestart", "Restarting CtrlUI");
                        await Application_Restart();
                    }
                    else if (messageResult == Answer2)
                    {
                        await Notification_Send_Status("Restart", "Restarting your PC");

                        //Close all other launchers
                        await CloseLaunchers(true);

                        //Restart the PC
                        await ProcessLauncherWin32Async(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\shutdown.exe", "", "/r /t 0", false, true);

                        //Close CtrlUI
                        await Application_Exit();
                    }
                    else if (messageResult == Answer3)
                    {
                        await Notification_Send_Status("Shutdown", "Shutting down your PC");

                        //Close all other launchers
                        await CloseLaunchers(true);

                        //Shutdown the PC
                        await ProcessLauncherWin32Async(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\shutdown.exe", "", "/s /t 0", false, true);

                        //Close CtrlUI
                        await Application_Exit();
                    }
                }
            }
            catch { }
        }
Example #28
0
        //Download console information
        public async Task <DownloadInfoConsole> DownloadInfoConsole(string nameConsole, int imageWidth)
        {
            try
            {
                //Filter the name
                string nameConsoleSave = FilterNameRom(nameConsole, true, false, false, 0);

                //Show the text input popup
                string nameConsoleDownload = await Popup_ShowHide_TextInput("Console search", nameConsoleSave, "Search information for the console", true);

                if (string.IsNullOrWhiteSpace(nameConsoleDownload))
                {
                    Debug.WriteLine("No search term entered.");
                    return(null);
                }
                nameConsoleDownload = FilterNameRom(nameConsoleDownload, false, true, false, 0);

                //Search for consoles
                IEnumerable <ApiIGDBPlatforms> iGDBPlatforms = vApiIGDBPlatforms.Where(x => FilterNameRom(x.name, false, true, false, 0).Contains(nameConsoleDownload) || (x.alternative_name != null && FilterNameRom(x.alternative_name, false, true, false, 0).Contains(nameConsoleDownload)));
                if (iGDBPlatforms == null || !iGDBPlatforms.Any())
                {
                    Debug.WriteLine("No consoles found");
                    await Notification_Send_Status("Close", "No consoles found");

                    return(null);
                }

                //Ask user which console to download
                List <DataBindString> Answers     = new List <DataBindString>();
                BitmapImage           imageAnswer = FileToBitmapImage(new string[] { "Assets/Default/Icons/Emulator.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                foreach (ApiIGDBPlatforms infoPlatforms in iGDBPlatforms)
                {
                    DataBindString answerDownload = new DataBindString();
                    answerDownload.ImageBitmap = imageAnswer;
                    answerDownload.Name        = infoPlatforms.name;
                    answerDownload.NameSub     = infoPlatforms.alternative_name;
                    answerDownload.Data1       = infoPlatforms;
                    Answers.Add(answerDownload);
                }

                //Get selected result
                DataBindString messageResult = await Popup_Show_MessageBox("Select a found console (" + Answers.Count() + ")", "* Information will be saved in the \"Assets\\User\\Games\\Downloaded\" folder as:\n" + nameConsoleSave, "Download image and description for the console:", Answers);

                if (messageResult == null)
                {
                    Debug.WriteLine("No console selected");
                    return(null);
                }

                //Create downloaded directory
                AVFiles.Directory_Create("Assets/User/Games/Downloaded", false);

                //Convert result back to json
                ApiIGDBPlatforms selectedConsole = (ApiIGDBPlatforms)messageResult.Data1;

                await Notification_Send_Status("Download", "Downloading information");

                Debug.WriteLine("Downloading information for: " + nameConsole);

                //Get the platform versions id
                string firstPlatformId = selectedConsole.versions.FirstOrDefault().ToString();
                ApiIGDBPlatformVersions[] iGDBPlatformVersions = await ApiIGDBDownloadPlatformVersions(firstPlatformId);

                if (iGDBPlatformVersions == null || !iGDBPlatformVersions.Any())
                {
                    Debug.WriteLine("No information found");
                    await Notification_Send_Status("Close", "No information found");

                    return(null);
                }

                ApiIGDBPlatformVersions targetPlatformVersions = iGDBPlatformVersions.FirstOrDefault();

                await Notification_Send_Status("Download", "Downloading image");

                Debug.WriteLine("Downloading image for: " + nameConsole);

                //Get the image url
                BitmapImage downloadedBitmapImage = null;
                string      downloadImageId       = targetPlatformVersions.platform_logo.ToString();
                if (downloadImageId != "0")
                {
                    ApiIGDBImage[] iGDBImages = await ApiIGDB_DownloadImage(downloadImageId, "platform_logos");

                    if (iGDBImages == null || !iGDBImages.Any())
                    {
                        Debug.WriteLine("No images found");
                        await Notification_Send_Status("Close", "No images found");

                        return(null);
                    }

                    //Download and save image
                    ApiIGDBImage infoImages = iGDBImages.FirstOrDefault();
                    Uri          imageUri   = new Uri("https://images.igdb.com/igdb/image/upload/t_720p/" + infoImages.image_id + ".png");
                    byte[]       imageBytes = await AVDownloader.DownloadByteAsync(5000, "CtrlUI", null, imageUri);

                    if (imageBytes != null && imageBytes.Length > 256)
                    {
                        try
                        {
                            //Convert bytes to a BitmapImage
                            downloadedBitmapImage = BytesToBitmapImage(imageBytes, imageWidth);

                            //Save bytes to image file
                            File.WriteAllBytes("Assets/User/Games/Downloaded/" + nameConsoleSave + ".png", imageBytes);
                            Debug.WriteLine("Saved image: " + imageBytes.Length + "bytes/" + imageUri);
                        }
                        catch { }
                    }
                }

                //Json settings
                JsonSerializerSettings jsonSettings = new JsonSerializerSettings();
                jsonSettings.NullValueHandling = NullValueHandling.Ignore;

                //Json serialize
                string serializedObject = JsonConvert.SerializeObject(targetPlatformVersions, jsonSettings);

                //Save json information
                File.WriteAllText("Assets/User/Games/Downloaded/" + nameConsoleSave + ".json", serializedObject);

                await Notification_Send_Status("Download", "Downloaded information");

                Debug.WriteLine("Downloaded and saved information for: " + nameConsole);

                //Return the information
                DownloadInfoConsole downloadInfo = new DownloadInfoConsole();
                downloadInfo.ImageBitmap = downloadedBitmapImage;
                downloadInfo.Details     = targetPlatformVersions;
                return(downloadInfo);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed downloading console information: " + ex.Message);
                await Notification_Send_Status("Close", "Failed downloading");

                return(null);
            }
        }
Example #29
0
        //Create remote desktop geforce experience shortcut
        async void Button_Settings_AddRemoteDesktop_Click(object sender, RoutedEventArgs args)
        {
            try
            {
                //Set application shortcut paths
                string TargetFilePath                 = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\System32\mstsc.exe";
                string TargetName                     = "Remote Desktop";
                string TargetFileShortcut             = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/NVIDIA Corporation/Shield Apps/" + TargetName + ".url";
                string TargetFileBoxArtFile           = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/NVIDIA Corporation/Shield Apps/StreamingAssets/Default/" + TargetName + "/box-art.png";
                string TargetFileBoxArtDirectory      = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/NVIDIA Corporation/Shield Apps/StreamingAssets/Default/" + TargetName;
                string TargetDirectoryStreamingAssets = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/NVIDIA Corporation/Shield Apps/StreamingAssets";

                //Check if the Streaming Assets folder exists
                Directory_Create(TargetDirectoryStreamingAssets, false);
                Directory_Create(TargetFileBoxArtDirectory, false);

                //Check if the shortcut already exists
                if (!File.Exists(TargetFileShortcut))
                {
                    Debug.WriteLine("Adding application to GeForce Experience");

                    using (StreamWriter StreamWriter = new StreamWriter(TargetFileShortcut))
                    {
                        StreamWriter.WriteLine("[InternetShortcut]");
                        StreamWriter.WriteLine("URL=" + TargetFilePath);
                        StreamWriter.WriteLine("IconFile=" + TargetFilePath);
                        StreamWriter.WriteLine("IconIndex=0");
                        StreamWriter.Flush();
                    }

                    //Copy art box to the Streaming Assets directory
                    File_Copy("Assets/BoxArt-RemoteDesktop.png", TargetFileBoxArtFile, true);

                    btn_Settings_AddRemoteDesktop_TextBlock.Text = "Remove Remote Desktop from GeForce Experience";

                    List <DataBindString> Answers = new List <DataBindString>();
                    DataBindString        Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = "Ok";
                    Answers.Add(Answer1);

                    await Popup_Show_MessageBox("Remote Desktop has been added to GeForce Experience", "", "You can now remotely launch Remote Desktop from your devices.", Answers);
                }
                else
                {
                    Debug.WriteLine("Removing application from GeForce Experience");

                    File_Delete(TargetFileShortcut);
                    Directory_Delete(TargetFileBoxArtDirectory);

                    btn_Settings_AddRemoteDesktop_TextBlock.Text = "Add Remote Desktop to GeForce Experience";

                    List <DataBindString> Answers = new List <DataBindString>();
                    DataBindString        Answer1 = new DataBindString();
                    Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    Answer1.Name        = "Ok";
                    Answers.Add(Answer1);

                    await Popup_Show_MessageBox("Remote Desktop has been removed from GeForce Experience", "", "", Answers);
                }
            }
            catch (Exception ex)
            {
                List <DataBindString> Answers = new List <DataBindString>();
                DataBindString        Answer1 = new DataBindString();
                Answer1.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/Check.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                Answer1.Name        = "Ok";
                Answers.Add(Answer1);

                Debug.WriteLine("Failed add GeForce Experience: " + ex.Message);
                await Popup_Show_MessageBox("Failed to add Remote Desktop to GeForce Experience", "", "Please make sure that GeForce experience is installed.", Answers);
            }
        }
Example #30
0
        async Task ShowProcessWindow(DataBindApp dataBindApp, ProcessMulti processMulti)
        {
            try
            {
                Debug.WriteLine("Showing the application: " + dataBindApp.Name);

                //Check if application has multiple windows
                IntPtr processWindowHandle = await CheckProcessWindowsAuto(dataBindApp, processMulti);

                //Check if application window has been found
                if (processWindowHandle == new IntPtr(-50))
                {
                    await LaunchProcessDatabindAuto(dataBindApp);
                }
                else if (processWindowHandle == new IntPtr(-75))
                {
                    await RestartProcessAuto(processMulti, dataBindApp, true);
                }
                else if (processWindowHandle == new IntPtr(-80))
                {
                    await RestartProcessAuto(processMulti, dataBindApp, false);
                }
                else if (processWindowHandle == new IntPtr(-100))
                {
                    await CloseSingleProcessAuto(processMulti, dataBindApp, true, false);
                }
                else if (processWindowHandle == new IntPtr(-200))
                {
                    Debug.WriteLine("Cancelled window selection.");
                }
                else if (processWindowHandle != IntPtr.Zero)
                {
                    //Minimize the CtrlUI window
                    if (Convert.ToBoolean(Setting_Load(vConfigurationCtrlUI, "MinimizeAppOnShow")))
                    {
                        await AppMinimize(true);
                    }

                    //Check keyboard controller launch
                    string fileNameNoExtension = Path.GetFileNameWithoutExtension(dataBindApp.NameExe);
                    bool   keyboardProcess     = vCtrlKeyboardProcessName.Any(x => x.String1.ToLower() == fileNameNoExtension.ToLower() || x.String1.ToLower() == dataBindApp.PathExe.ToLower());
                    bool   keyboardLaunch      = (keyboardProcess || dataBindApp.LaunchKeyboard) && vControllerAnyConnected();

                    //Force focus on the app
                    await PrepareFocusProcessWindow(dataBindApp.Name, processMulti.Identifier, processWindowHandle, 0, false, false, false, keyboardLaunch);
                }
                else
                {
                    Debug.WriteLine("Show application has no window.");

                    //Focus or Close when process is already running
                    List <DataBindString> Answers      = new List <DataBindString>();
                    DataBindString        AnswerLaunch = new DataBindString();
                    AnswerLaunch.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppLaunch.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    AnswerLaunch.Name        = "Launch new instance";
                    Answers.Add(AnswerLaunch);

                    DataBindString AnswerRestartCurrent = new DataBindString();
                    if (!string.IsNullOrWhiteSpace(processMulti.Argument))
                    {
                        AnswerRestartCurrent.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppRestart.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                        AnswerRestartCurrent.Name        = "Restart application";
                        AnswerRestartCurrent.NameSub     = "(Current argument)";
                        Answers.Add(AnswerRestartCurrent);
                    }

                    DataBindString AnswerRestartWithout = new DataBindString();
                    AnswerRestartWithout.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppRestart.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    AnswerRestartWithout.Name        = "Restart application";
                    if (!string.IsNullOrWhiteSpace(dataBindApp.Argument) || dataBindApp.Category == AppCategory.Shortcut || dataBindApp.Category == AppCategory.Emulator || dataBindApp.LaunchFilePicker)
                    {
                        AnswerRestartWithout.NameSub = "(Default argument)";
                    }
                    else
                    {
                        AnswerRestartWithout.NameSub = "(Without argument)";
                    }
                    Answers.Add(AnswerRestartWithout);

                    DataBindString AnswerClose = new DataBindString();
                    AnswerClose.ImageBitmap = FileToBitmapImage(new string[] { "Assets/Default/Icons/AppClose.png" }, vImageSourceFolders, vImageBackupSource, IntPtr.Zero, -1, 0);
                    AnswerClose.Name        = "Close application";
                    Answers.Add(AnswerClose);

                    //Show the messagebox
                    DataBindString messageResult = await Popup_Show_MessageBox("Application has no window", "", "", Answers);

                    if (messageResult != null)
                    {
                        if (messageResult == AnswerClose)
                        {
                            await CloseSingleProcessAuto(processMulti, dataBindApp, true, false);
                        }
                        else if (messageResult == AnswerRestartCurrent)
                        {
                            await RestartProcessAuto(processMulti, dataBindApp, true);
                        }
                        else if (messageResult == AnswerRestartWithout)
                        {
                            await RestartProcessAuto(processMulti, dataBindApp, false);
                        }
                        else if (messageResult == AnswerLaunch)
                        {
                            await LaunchProcessDatabindAuto(dataBindApp);
                        }
                    }
                }
            }
            catch { }
        }