├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── PULL_REQUEST_TEMPLATE │ └── localization_request.md ├── profile │ └── README.md └── workflows │ ├── Badge.yml │ └── SophiApp.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── Download_SophiApp.ps1 ├── LICENSE ├── Misc └── Microsoft.HEVCVideoExtension_2.0.51121.0_x64__8wekyb3d8bbwe.Appx ├── README.md ├── README_it-it.md ├── README_ru-ru.md ├── README_uk-ua.md ├── ReleaseNotesTemplate.md ├── img ├── 0.gif ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── Toasts.png ├── get-it-on-github.svg ├── heart.svg ├── reddit.svg ├── search.gif ├── sophiapp_big.svg └── theme.gif ├── sophiapp_versions.json └── src ├── .vsconfig └── SophiApp ├── .editorconfig ├── App.manifest ├── App.xaml ├── App.xaml.cs ├── Assets ├── AppLogo.svg ├── AppLogoBig.svg ├── Discord.svg ├── Folder.svg ├── GitHub.svg ├── Info.svg ├── LinkedIn.svg ├── LockScreenLogo.scale-200.png ├── SophiApp.ico ├── SplashScreen.scale-200.png ├── Square150x150Logo.scale-200.png ├── Square44x44Logo.scale-200.png ├── Square44x44Logo.targetsize-24_altform-unplated.png ├── StoreLogo.png ├── Telegram.svg ├── Wide310x150Logo.scale-200.png └── Windows.svg ├── Behaviors ├── NavigationViewHeaderBehavior.cs └── NavigationViewHeaderMode.cs ├── Contracts ├── Services │ ├── IAppNotificationService.cs │ ├── IAppxPackagesService.cs │ ├── ICommonDataService.cs │ ├── ICursorsService.cs │ ├── IDefenderService.cs │ ├── IDiskService.cs │ ├── IDisplayService.cs │ ├── IFileService.cs │ ├── IFirewallService.cs │ ├── IGroupPolicyService.cs │ ├── IHttpService.cs │ ├── IInitializeService.cs │ ├── IInstrumentationService.cs │ ├── ILoggerService.cs │ ├── IModelService.cs │ ├── INavigationService.cs │ ├── INavigationViewService.cs │ ├── IOsService.cs │ ├── IPageService.cs │ ├── IPowerShellService.cs │ ├── IProcessService.cs │ ├── IRegistryService.cs │ ├── IRequirementsService.cs │ ├── IScheduledTaskService.cs │ ├── ISettingsService.cs │ ├── IThemesService.cs │ ├── IUpdateService.cs │ ├── IUriService.cs │ └── IXmlService.cs └── ViewModels │ └── INavigationAware.cs ├── ControlTemplates ├── ContentBlock.xaml ├── ContentBlock.xaml.cs ├── ExpandingCheckBox.xaml ├── ExpandingCheckBox.xaml.cs ├── ExpandingRadioGroup.xaml ├── ExpandingRadioGroup.xaml.cs ├── IconHyperlink.xaml ├── IconHyperlink.xaml.cs ├── MadeForWindows.xaml ├── MadeForWindows.xaml.cs ├── SquareCheckBox.xaml ├── SquareCheckBox.xaml.cs ├── TeamMateLink.xaml ├── TeamMateLink.xaml.cs ├── TextCheckBox.xaml ├── TextCheckBox.xaml.cs ├── UwpAppCheckBox.xaml └── UwpAppCheckBox.xaml.cs ├── Converters └── StringToVisibility.cs ├── Customizations ├── Accessors.cs └── Mutators.cs ├── Extensions ├── ConcurrentBagExtensions.cs ├── FrameExtensions.cs ├── IntExtensions.cs ├── JsonExtensions.cs ├── ProcessExtensions.cs ├── RegistryKeyExtensions.cs ├── ResourceExtensions.cs ├── ServiceControllerExtensions.cs ├── StringExtensions.cs └── UserControlExtensions.cs ├── Helpers ├── AppVersionWrapper.cs ├── ContextMenuHelper.cs ├── ElementThemeWrapper.cs ├── EnvironmentHelper.cs ├── FontOptions.cs ├── NavigationHelper.cs ├── OsProperties.cs ├── RequirementsFailure.cs ├── RuntimeHelper.cs ├── TitleBarHelper.cs ├── UICategoryTags.cs ├── UIDataTemplateSelector.cs └── UIModelType.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Models ├── LocalSettingsOptions.cs ├── MsTerminalSettingsDto.cs ├── UICheckBoxModel.cs ├── UIExpandingCheckBoxModel.cs ├── UIExpandingRadioGroupModel.cs ├── UIModel.cs ├── UIModelDto.cs ├── UIRadioGroupItemModel.cs ├── UISquareCheckBoxModel.cs └── UIUwpAppModel.cs ├── Package.appinstaller ├── Package.appxmanifest ├── Properties ├── Resources.Designer.cs ├── Resources.resx └── launchsettings.json ├── Services ├── AppNotificationService.cs ├── AppxPackagesService.cs ├── CommonDataService.cs ├── CursorsService.cs ├── DefenderService.cs ├── DiskService.cs ├── DisplayService.cs ├── FileService.cs ├── FirewallService.cs ├── GroupPolicyService.cs ├── HttpService.cs ├── InitializeService.cs ├── InstrumentationService.cs ├── LoggerService.cs ├── ModelService.cs ├── NavigationService.cs ├── NavigationViewService.cs ├── OsService.cs ├── PageService.cs ├── PowerShellService.cs ├── ProcessService.cs ├── RegistryService.cs ├── RequirementsService.cs ├── ScheduledTaskService.cs ├── SettingsService.cs ├── ThemesService.cs ├── UpdateService.cs ├── UriService.cs └── XmlService.cs ├── SophiApp.csproj ├── SophiApp.sln ├── Strings └── en-us │ └── Resources.resw ├── Styles ├── Border.xaml ├── Button.xaml ├── CheckBox.xaml ├── Expander.xaml ├── FontSizes.xaml ├── Image.xaml ├── ScrollView.xaml ├── TextBlock.xaml ├── Themes.xaml ├── Thickness.xaml └── ToggleButton.xaml ├── UIMarkup └── UIMarkup.json ├── Usings.cs ├── ViewModels ├── ContextMenuViewModel.cs ├── FatalErrorViewModel.cs ├── LogViewModel.cs ├── PersonalizationViewModel.cs ├── PrivacyViewModel.cs ├── ProVersionViewModel.cs ├── RequirementsFailureViewModel.cs ├── SearchViewModel.cs ├── SecurityViewModel.cs ├── SettingsViewModel.cs ├── ShellViewModel.cs ├── StartupViewModel.cs ├── SystemViewModel.cs ├── TaskSchedulerViewModel.cs └── UwpViewModel.cs ├── Views ├── ContextMenuPage.xaml ├── ContextMenuPage.xaml.cs ├── FatalErrorPage.xaml ├── FatalErrorPage.xaml.cs ├── LogPage.xaml ├── LogPage.xaml.cs ├── PersonalizationPage.xaml ├── PersonalizationPage.xaml.cs ├── PrivacyPage.xaml ├── PrivacyPage.xaml.cs ├── ProVersionPage.xaml ├── ProVersionPage.xaml.cs ├── RequirementsFailurePage.xaml ├── RequirementsFailurePage.xaml.cs ├── SearchPage.xaml ├── SearchPage.xaml.cs ├── SecurityPage.xaml ├── SecurityPage.xaml.cs ├── SettingsPage.xaml ├── SettingsPage.xaml.cs ├── ShellPage.xaml ├── ShellPage.xaml.cs ├── StartupPage.xaml ├── StartupPage.xaml.cs ├── SystemPage.xaml ├── SystemPage.xaml.cs ├── TaskSchedulerPage.xaml ├── TaskSchedulerPage.xaml.cs ├── UwpPage.xaml └── UwpPage.xaml.cs └── stylecop.json /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Discord 4 | url: https://discord.gg/sSryhaEv79 5 | about: Sophia Community 6 | 7 | - name: Telegram 8 | url: https://t.me/sophia_chat 9 | about: Sophia Chat 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request ⭐ 2 | description: An idea to make SophiApp better 3 | labels: enhancement 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: Your Idea 8 | description: If you have an idea to improve SophiApp, describe it clearly. 9 | - type: input 10 | id: sophiapp-version 11 | attributes: 12 | label: SophiApp Version 13 | description: Which version of SophiApp are you using? The version number can be found in the Settings 14 | placeholder: e.g. 1.0.0.45 15 | - type: input 16 | attributes: 17 | label: Windows Version 18 | description: Which version of Windows are you using? Press Win + Pause/Break to open the page to copy from. 19 | placeholder: e.g. Windows 11 21H2 22000.527 20 | validations: 21 | required: true 22 | - type: textarea 23 | attributes: 24 | label: Comments 25 | description: Additional information or screenshots. 26 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/localization_request.md: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /.github/profile/README.md: -------------------------------------------------------------------------------- 1 | # 📌 Socials 2 | 3 | 4 | 5 | 6 | # ♥️ SophiApp Contributors 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/workflows/Badge.yml: -------------------------------------------------------------------------------- 1 | name: Badge 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | # Trigger Action for a new release only 8 | # tags: 9 | # - '*.*.*' 10 | 11 | jobs: 12 | update-badges: 13 | name: Update Badges 14 | runs-on: windows-latest 15 | steps: 16 | - name: Checkout Repository 17 | uses: actions/checkout@main 18 | - name: Download cloc 19 | run: | 20 | $Token = "${{ secrets.GITHUB_TOKEN }}" 21 | $Headers = @{ 22 | Accept = "application/json" 23 | Authorization = "Bearer $Token" 24 | } 25 | $Parameters = @{ 26 | Uri = "https://api.github.com/repos/AlDanial/cloc/releases/latest" 27 | Headers = $Headers 28 | UseBasicParsing = $true 29 | Verbose = $true 30 | } 31 | $Tag = (Invoke-RestMethod @Parameters).tag_name.replace("v", "") 32 | 33 | $Parameters = @{ 34 | Uri = "https://github.com/AlDanial/cloc/releases/download/v$Tag/cloc-$Tag.exe" 35 | OutFile = "$PSScriptRoot\cloc.exe" 36 | UseBasicParsing = $true 37 | Verbose = $true 38 | } 39 | Invoke-WebRequest @Parameters 40 | 41 | - name: Get the Numbers 42 | run: | 43 | $JSON = & "$PSScriptRoot\cloc.exe" "src/SophiApp" --exclude-list-file=".clocignore" --json | ConvertFrom-Json 44 | $blank = $JSON.SUM.blank 45 | $comment = $JSON.SUM.comment 46 | $code = $JSON.SUM.code 47 | # "$((($blank + $comment + $code)/1000).ToString("#.#").replace(",", "."))k" 48 | $Summary = ("{0:N1}k" -f (($blank + $comment + $code)/1000)).replace(",", ".") 49 | 50 | Write-Verbose -Message ($blank + $comment + $code) -Verbose 51 | 52 | echo "CODE_LINES=$Summary" >> $env:GITHUB_ENV 53 | 54 | - name: Writing to Gist 55 | uses: schneegans/dynamic-badges-action@master 56 | with: 57 | auth: ${{ secrets.GIST_SophiApp }} 58 | gistID: c9f6b02ff4037050dcaade30c574bac7 59 | filename: SophiApp.json 60 | label: Lines of Code 61 | message: ${{ env.CODE_LINES }} 62 | namedLogo: C Sharp 63 | color: brightgreen 64 | -------------------------------------------------------------------------------- /Download_SophiApp.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Download the latest SophiApp version 4 | 5 | .EXAMPLE Download the latest SophiApp version 6 | irm app.sophi.app | iex 7 | #> 8 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 9 | 10 | if ((Get-Location).Path -eq $env:USERPROFILE) 11 | { 12 | $DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" 13 | } 14 | elseif ((Get-Location).Path -eq "$env:SystemRoot\System32") 15 | { 16 | $DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" 17 | } 18 | else 19 | { 20 | $DownloadsFolder = (Get-Location).Path 21 | } 22 | 23 | $Parameters = @{ 24 | Uri = "https://raw.githubusercontent.com/Sophia-Community/SophiApp/master/sophiapp_versions.json" 25 | UseBasicParsing = $true 26 | } 27 | $LatestRelease = (Invoke-RestMethod @Parameters).SophiApp_release 28 | $Parameters = @{ 29 | Uri = "https://github.com/Sophia-Community/SophiApp/releases/download/$LatestRelease/SophiApp.zip" 30 | OutFile = "$DownloadsFolder\SophiApp.zip" 31 | UseBasicParsing = $true 32 | Verbose = $true 33 | } 34 | Invoke-WebRequest @Parameters 35 | 36 | $Parameters = @{ 37 | Path = "$DownloadsFolder\SophiApp.zip" 38 | DestinationPath = "$DownloadsFolder" 39 | Force = $true 40 | } 41 | Expand-Archive @Parameters 42 | 43 | Remove-Item -Path "$DownloadsFolder\SophiApp.zip" -Force 44 | Start-Sleep -Second 1 45 | Invoke-Item -Path "$DownloadsFolder\SophiApp" 46 | 47 | $SetForegroundWindow = @{ 48 | Namespace = "WinAPI" 49 | Name = "ForegroundWindow" 50 | Language = "CSharp" 51 | MemberDefinition = @" 52 | [DllImport("user32.dll")] 53 | public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); 54 | [DllImport("user32.dll")] 55 | [return: MarshalAs(UnmanagedType.Bool)] 56 | public static extern bool SetForegroundWindow(IntPtr hWnd); 57 | "@ 58 | } 59 | if (-not ("WinAPI.ForegroundWindow" -as [type])) 60 | { 61 | Add-Type @SetForegroundWindow 62 | } 63 | 64 | Start-Sleep -Seconds 1 65 | 66 | Get-Process -Name explorer | Where-Object -FilterScript {$_.MainWindowTitle -eq "SophiApp"} | ForEach-Object -Process { 67 | # Show window, if minimized 68 | [WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 5) 69 | 70 | # Force move the console window to the foreground 71 | [WinAPI.ForegroundWindow]::SetForegroundWindow($_.MainWindowHandle) 72 | } | Out-Null 73 | 74 | Write-Information -MessageData "" -InformationAction Continue 75 | Write-Verbose -Message "Archive was expanded to `"$DownloadsFolder\SophiApp`"" -Verbose 76 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Sophia Community 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Misc/Microsoft.HEVCVideoExtension_2.0.51121.0_x64__8wekyb3d8bbwe.Appx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/Misc/Microsoft.HEVCVideoExtension_2.0.51121.0_x64__8wekyb3d8bbwe.Appx -------------------------------------------------------------------------------- /ReleaseNotesTemplate.md: -------------------------------------------------------------------------------- 1 | [![actions](https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram)](https://t.me/SophiaNews) [![actions](https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram)](https://t.me/Sophia_Chat) [![Discord](https://discordapp.com/api/guilds/1006179075263561779/widget.png?style=shield)](https://discord.gg/sSryhaEv79) 2 | 3 | # [Donate](https://github.com/Sophia-Community/SophiApp#donations) 4 | 5 | ## NewVersion — CurrentDate 6 | 7 | Diff from vOldVersion 8 | [OldVersion...NewVersion](https://github.com/Sophia-Community/SophiApp/compare/OldVersion...NewVersion) 9 | 10 | 11 | 12 | SophiApp.zip SHA256 ([hash](html_url#step:10:23)): `SHA256_hash` 13 | -------------------------------------------------------------------------------- /img/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/0.gif -------------------------------------------------------------------------------- /img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/1.png -------------------------------------------------------------------------------- /img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/2.png -------------------------------------------------------------------------------- /img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/3.png -------------------------------------------------------------------------------- /img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/4.png -------------------------------------------------------------------------------- /img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/5.png -------------------------------------------------------------------------------- /img/Toasts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/Toasts.png -------------------------------------------------------------------------------- /img/heart.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /img/reddit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/search.gif -------------------------------------------------------------------------------- /img/theme.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/img/theme.gif -------------------------------------------------------------------------------- /sophiapp_versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "SophiApp_release": "1.0.94", 3 | "SophiApp_pre_release": "1.0.94" 4 | } 5 | -------------------------------------------------------------------------------- /src/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.Component.MSBuild", 5 | "Microsoft.NetCore.Component.Runtime.7.0", 6 | "Microsoft.NetCore.Component.SDK", 7 | "Microsoft.VisualStudio.Component.ManagedDesktop.Core", 8 | "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites", 9 | "Microsoft.VisualStudio.Component.NuGet", 10 | "Microsoft.VisualStudio.Component.Windows10SDK.19041", 11 | "Microsoft.VisualStudio.Component.Windows10SDK", 12 | "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging", 13 | "Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cs", 14 | "Microsoft.VisualStudio.Workload.ManagedDesktop" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /src/SophiApp/App.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/SophiApp/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/AppLogo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/Discord.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/Folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/GitHub.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/Info.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/LinkedIn.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/SophiApp/Assets/SophiApp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/SophiApp.ico -------------------------------------------------------------------------------- /src/SophiApp/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/SophiApp/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/SophiApp/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/SophiApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/SophiApp/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/SophiApp/Assets/Telegram.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/SophiApp/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sophia-Community/SophiApp/d464a789de813e7512c2aa101fe5c297f5712f21/src/SophiApp/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/SophiApp/Assets/Windows.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/SophiApp/Behaviors/NavigationViewHeaderMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Behaviors; 6 | 7 | /// 8 | /// Navigation View header mode. 9 | /// 10 | public enum NavigationViewHeaderMode 11 | { 12 | Always, 13 | Never, 14 | Minimal, 15 | } 16 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IAppNotificationService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services; 6 | 7 | /// 8 | /// A service for working with toast notifications API. 9 | /// 10 | public interface IAppNotificationService 11 | { 12 | /// 13 | /// Get Windows Action Center and Windows Script Host status and enabling notifications. 14 | /// 15 | void EnableToastNotification(); 16 | 17 | /// 18 | /// Register the app by as a toast sender. 19 | /// 20 | /// Name of the app to be registered. 21 | void RegisterAsToastSender(string name); 22 | 23 | /// 24 | /// Register Windows cleanup protocol to run via toast notification. 25 | /// 26 | void RegisterCleanupProtocolAsToastSender(); 27 | 28 | /// 29 | /// Show the toast notification. 30 | /// 31 | /// Toast payload. 32 | void Show(string payload); 33 | 34 | /// 35 | /// Unregister Windows cleanup protocol to run via toast notification. 36 | /// 37 | void UnregisterCleanupProtocol(); 38 | } 39 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IAppxPackagesService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using SophiApp.Models; 8 | using Windows.ApplicationModel; 9 | 10 | /// 11 | /// A service for working with appx packages API. 12 | /// 13 | public interface IAppxPackagesService 14 | { 15 | /// 16 | /// Checks that the package is installed. 17 | /// 18 | /// The Id of the package being checked, not to be confused with the package Display name. 19 | /// Search in installed packages for all users or only for the current user. 20 | bool PackageExist(string packageIdName, bool forAllUser = false); 21 | 22 | /// 23 | /// Retrieves information about a appx packages. 24 | /// 25 | /// Get collection of UWP for all users, otherwise only for the current user. 26 | List GetPackages(bool forAllUsers = false); 27 | 28 | /// 29 | /// Removes appx package. 30 | /// 31 | /// The appx package identity name. 32 | /// Remove a package for all users or current user only. 33 | void RemovePackage(string packageName, bool forAllUsers); 34 | 35 | /// 36 | /// Installs the appx application using the file. 37 | /// 38 | /// Path to the appx installation file. 39 | Task InstallFromFileAsync(string appxPath); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/ICommonDataService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using SophiApp.Helpers; 8 | 9 | /// 10 | /// A service for transferring app data between DI layers. 11 | /// 12 | public interface ICommonDataService 13 | { 14 | /// 15 | /// Gets the url with the version of the app. 16 | /// 17 | string AppVersionUrl { get; } 18 | 19 | /// 20 | /// Gets the url to download the new release of the app. 21 | /// 22 | string AppReleaseUrl { get; } 23 | 24 | /// 25 | /// Gets a value indicating whether the OS is Windows 11. 26 | /// 27 | bool IsWindows11 { get; } 28 | 29 | /// 30 | /// Gets a values of OS properties. 31 | /// 32 | OsProperties OsProperties { get; } 33 | 34 | /// 35 | /// Gets or sets malware name detected by . 36 | /// 37 | string DetectedMalware { get; set; } 38 | 39 | /// 40 | /// Gets or sets a value indicating whether Microsoft Defender controlled folder access state. 41 | /// 42 | bool DefenderControlledFolderAccess { get; set; } 43 | 44 | /// 45 | /// Gets or sets Microsoft Defender missing files name. 46 | /// 47 | string DefenderFileMissing { get; set; } 48 | 49 | /// 50 | /// Gets or sets Microsoft Defender broken service name. 51 | /// 52 | string DefenderServiceBroken { get; set; } 53 | 54 | /// 55 | /// Gets or sets a value indicating whether Microsoft Defender preference state. 56 | /// 57 | bool DefenderMpPreferenceBroken { get; set; } 58 | 59 | /// 60 | /// Gets or sets a value indicating whether Microsoft Defender enabled state. 61 | /// 62 | bool DefenderEnabled { get; set; } 63 | 64 | /// 65 | /// Gets app version. 66 | /// 67 | Version AppVersion { get; } 68 | 69 | /// 70 | /// Initialize data. 71 | /// 72 | void Initialize(); 73 | 74 | /// 75 | /// Gets app name and version. 76 | /// 77 | string GetFullName(); 78 | 79 | /// 80 | /// Gets the code name of the application build. 81 | /// 82 | string GetBuildName(); 83 | 84 | /// 85 | /// Gets app name and version delimiter. 86 | /// 87 | string GetDelimiter(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/ICursorsService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | /// 8 | /// A service for working with Windows cursors API. 9 | /// 10 | public interface ICursorsService 11 | { 12 | /// 13 | /// Reload cursors on-the-fly. 14 | /// 15 | void ReloadCursors(); 16 | 17 | /// 18 | /// Set "Windows 11 Cursors Concept v2 from Jepri Creations" dark scheme. 19 | /// 20 | void SetJepriCreationsDarkCursors(); 21 | 22 | /// 23 | /// Set "Windows 11 Cursors Concept v2 from Jepri Creations" light scheme. 24 | /// 25 | void SetJepriCreationsLightCursors(); 26 | 27 | /// 28 | /// Set Windows cursors to default scheme. 29 | /// 30 | void SetDefaultCursors(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IDefenderService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using CSharpFunctionalExtensions; 8 | 9 | /// 10 | /// A service for working with Microsoft Defender API. 11 | /// 12 | public interface IDefenderService 13 | { 14 | /// 15 | /// Get a Microsoft Defender state. 16 | /// 17 | public Result GetState(); 18 | 19 | /// 20 | /// Turn on Microsoft Defender controlled folder. 21 | /// 22 | public void EnableControlledFolder(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IDiskService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | /// 8 | /// A service for working with disk API. 9 | /// 10 | public interface IDiskService 11 | { 12 | /// 13 | /// Gets volume labels of all disks. 14 | /// 15 | IEnumerable GetVolumeLabels(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IDisplayService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using Microsoft.UI.Windowing; 8 | 9 | /// 10 | /// A service for working with display API. 11 | /// 12 | public interface IDisplayService 13 | { 14 | /// 15 | /// Get the that shows the app . 16 | /// 17 | Task GetDisplayAreaAsync(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IFileService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services; 6 | 7 | using System.Text; 8 | 9 | /// 10 | /// A service for working with file API. 11 | /// 12 | public interface IFileService 13 | { 14 | /// 15 | /// Reads and return deserialize objects from json file. 16 | /// 17 | /// The data type returned from the file. 18 | /// The path to the file to be read. 19 | /// File name. 20 | T? ReadFromJson(string folderPath, string fileName); 21 | 22 | /// 23 | /// Serialize and save the data to json file. 24 | /// 25 | /// The type of data saved to the file. 26 | /// Path to the file to be saved. 27 | /// File name. 28 | /// Data to save to a file. 29 | void SaveToJson(string folderPath, string fileName, T content); 30 | 31 | /// 32 | /// Create a path, if it does not exist, and save data to a file. 33 | /// 34 | /// The file to write to. 35 | /// The lines to write to the file. 36 | /// Represents a character encoding. 37 | void Save(string file, string content, Encoding encoding); 38 | } 39 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IFirewallService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using NetFwTypeLib; 8 | 9 | /// 10 | /// A service for working with Windows firewall API. 11 | /// 12 | public interface IFirewallService 13 | { 14 | /// 15 | /// Gets firewall group rules using the group name. 16 | /// 17 | /// The name of group to search rules. 18 | IEnumerable GetGroupRules(string groupName); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IHttpService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | /// 8 | /// A service for working with HTTP API. 9 | /// 10 | public interface IHttpService 11 | { 12 | /// 13 | /// Downloads and saves file. If the file exists, it will be overwritten. 14 | /// 15 | /// File download link. 16 | /// File save path. 17 | void DownloadFile(string url, string saveTo); 18 | 19 | /// 20 | /// Downloads HEVC appx. 21 | /// 22 | /// Full path to save the file. 23 | Task DownloadHEVCAppxAsync(string fileName); 24 | 25 | /// 26 | /// Throws exception if url unavailable. 27 | /// 28 | /// Url to check availability. 29 | void ThrowIfOffline(string url = "https://google.com"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IInitializeService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services; 6 | 7 | /// 8 | /// A service for working with app services data. 9 | /// 10 | public interface IInitializeService 11 | { 12 | /// 13 | /// Initializes the app services data. 14 | /// 15 | /// App launch arguments. 16 | Task InitializeAsync(object args); 17 | } 18 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IInstrumentationService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using System.Diagnostics; 8 | using System.Management; 9 | using SophiApp.Helpers; 10 | 11 | /// 12 | /// A service for working with WMI API. 13 | /// 14 | public interface IInstrumentationService 15 | { 16 | /// 17 | /// Indicates that the DAC used in the video adapter is external type. 18 | /// 19 | bool IsExternalDACType(); 20 | 21 | /// 22 | /// Defines the use of the virtual machine. 23 | /// 24 | bool IsVirtualMachine(); 25 | 26 | /// 27 | /// Get the properties of the Win32_OperatingSystem class. 28 | /// 29 | OsProperties GetOsPropertiesOrDefault(); 30 | 31 | /// 32 | /// Get UWP apps management. 33 | /// 34 | ManagementObject? GetUwpAppsManagementOrDefault(); 35 | 36 | /// 37 | /// Get the owner of the process. 38 | /// 39 | /// The process for which to find an owner. 40 | string GetProcessOwnerOrDefault(Process? process); 41 | 42 | /// 43 | /// Get data from the AntiVirusProduct class. 44 | /// 45 | List GetAntivirusProductsOrDefault(); 46 | 47 | /// 48 | /// Get power plan names. 49 | /// 50 | List GetPowerPlanNames(); 51 | 52 | /// 53 | /// Get user account SID. 54 | /// 55 | /// A user name. 56 | string GetUserSid(string name); 57 | 58 | /// 59 | /// Get Microsoft Defender antispyware enabled property value. 60 | /// 61 | bool GetAntiSpywareEnabled(); 62 | 63 | /// 64 | /// Get the processor virtualization state. 65 | /// 66 | bool? CpuVirtualizationFirmwareIsEnabled(); 67 | 68 | /// 69 | /// Get Windows Hyper-V present state. 70 | /// 71 | bool? HypervisorIsPresent(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IModelService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using System.Collections.Concurrent; 8 | using SophiApp.Models; 9 | 10 | /// 11 | /// A service for working with using MVVM pattern. 12 | /// 13 | public interface IModelService 14 | { 15 | /// 16 | /// Using the file "UIMarkup.json" creates a collection of types. 17 | /// 18 | Task> BuildJsonModelsAsync(); 19 | 20 | /// 21 | /// Using the creates a UWP collection. 22 | /// 23 | /// Get collection of UWP for all users, otherwise only for the current user. 24 | Task> BuildUwpAppModelsAsync(bool forAllUsers); 25 | 26 | /// 27 | /// Returns models in which contain the specified text. 28 | /// 29 | /// A collection of to search. 30 | /// The text to seek. 31 | Task> GetModelsContainsAsync(ConcurrentBag models, string text); 32 | 33 | /// 34 | /// Using multiple threads to get the state. 35 | /// 36 | /// collection. 37 | Task GetStateAsync(ConcurrentBag models); 38 | 39 | /// 40 | /// Using multiple threads to get the models state. 41 | /// 42 | /// collection. 43 | /// Action to be performed after invoke get state of each model. 44 | Task GetStateAsync(IEnumerable enumerable, Action getStateCallback); 45 | 46 | /// 47 | /// Using multiple threads to set the models state. 48 | /// 49 | /// collection. 50 | /// Action to be performed after invoke set state of each model. 51 | /// Propagates notification that operations should be canceled. 52 | Task SetStateAsync(IEnumerable enumerable, Action setStateCallback, CancellationToken token); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/INavigationService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services; 6 | using Microsoft.UI.Xaml.Controls; 7 | using Microsoft.UI.Xaml.Navigation; 8 | 9 | /// 10 | /// A service for working with app navigation. 11 | /// 12 | public interface INavigationService 13 | { 14 | /// 15 | /// Represents the method that will handle the Navigated event. 16 | /// 17 | event NavigatedEventHandler Navigated; 18 | 19 | /// 20 | /// Gets or sets instances. 21 | /// 22 | Frame? Frame 23 | { 24 | get; set; 25 | } 26 | 27 | /// 28 | /// Gets a value indicating whether there is at least one entry in back navigation history. 29 | /// 30 | bool CanGoBack 31 | { 32 | get; 33 | } 34 | 35 | /// 36 | /// Navigates to the most recent item in back navigation history. 37 | /// 38 | bool GoBack(); 39 | 40 | /// 41 | /// Causes the to load content represented by the specified derived data type. 42 | /// 43 | /// Page to navigate. 44 | /// Parameter passed to the navigation page. 45 | /// Clears the navigation history. 46 | /// Allow to refresh active page. 47 | bool NavigateTo(string pageKey, object? parameter = null, bool clearNavigation = false, bool ignorePageType = false); 48 | } 49 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/INavigationViewService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services; 6 | using Microsoft.UI.Xaml.Controls; 7 | 8 | /// 9 | /// A service for working with app navigation. 10 | /// 11 | public interface INavigationViewService 12 | { 13 | /// 14 | /// Gets collection of menu items. 15 | /// 16 | IList? MenuItems 17 | { 18 | get; 19 | } 20 | 21 | /// 22 | /// Gets the "Settings" menu item. 23 | /// 24 | object? SettingsItem 25 | { 26 | get; 27 | } 28 | 29 | /// 30 | /// Initializes data. 31 | /// 32 | /// Represents a container that enables navigation of app content. 33 | void Initialize(NavigationView navigationView); 34 | 35 | /// 36 | /// Unregister menu item events. 37 | /// 38 | void UnregisterEvents(); 39 | 40 | /// 41 | /// Get selected menu item. 42 | /// 43 | /// Page type. 44 | NavigationViewItem? GetSelectedItem(Type pageType); 45 | } 46 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IOsService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using System.ServiceProcess; 8 | 9 | /// 10 | /// A service for working with Windows services API. 11 | /// 12 | public interface IOsService 13 | { 14 | /// 15 | /// Get the hash for the change of state "News and Interests" widget on the taskbar. 16 | /// 17 | /// Enable or disable widget. 18 | uint GetNewsInterestsHashData(bool enable); 19 | 20 | /// 21 | /// Gets the status of the service. 22 | /// 23 | /// Service name. 24 | ServiceControllerStatus? GetStatus(string name); 25 | 26 | /// 27 | /// Sets the startup mode of the Windows service. 28 | /// 29 | /// Represents a Windows service and allows you to connect to a running or stopped. 30 | /// Indicates the start mode of the service. 31 | void SetServiceStartMode(ServiceController service, ServiceStartMode mode); 32 | 33 | /// 34 | /// Returns true if the service exists. 35 | /// 36 | /// Service name. 37 | bool Exist(string name); 38 | 39 | /// 40 | /// Determines that the VBSCRIPT component is installed. 41 | /// 42 | bool VBSIsInstalled(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IPageService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services; 6 | 7 | using Microsoft.UI.Xaml.Controls; 8 | 9 | /// 10 | /// A service for working with app . 11 | /// 12 | public interface IPageService 13 | { 14 | /// 15 | /// Gets page type by key. 16 | /// 17 | /// Page key. 18 | Type GetPageType(string key); 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IPowerShellService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using System.Management.Automation; 8 | 9 | /// 10 | /// A service for working with Windows PowerShell API. 11 | /// 12 | public interface IPowerShellService 13 | { 14 | /// 15 | /// Delete saved locations for file types. 16 | /// 17 | void ClearCommonDialogViews(); 18 | 19 | /// 20 | /// Execute the script using version 5.1 of PowerShell. 21 | /// 22 | /// Return object type. 23 | /// Script to execute. 24 | T Invoke(string script) 25 | where T : struct; 26 | 27 | /// 28 | /// Execute the script using version 5.1 of PowerShell. 29 | /// 30 | /// Script to execute. 31 | List Invoke(string script); 32 | 33 | /// 34 | /// Execute the command bypassing the UCPD driver. 35 | /// 36 | /// The command to be execute, must begin with "-Command". 37 | void InvokeCommandBypassUCPD(string command); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IProcessService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using System.Diagnostics; 8 | 9 | /// 10 | /// A service for working with Windows API. 11 | /// 12 | public interface IProcessService 13 | { 14 | /// 15 | /// Determines whether the specified process exists. 16 | /// 17 | /// Process name. 18 | bool ProcessExist(string name); 19 | 20 | /// 21 | /// Immediately stops the all associated process. 22 | /// 23 | /// Process name. 24 | /// Time, in milliseconds, to wait for the process to complete. 25 | void KillAllProcesses(string name, int timeout = 1000); 26 | 27 | /// 28 | /// Start associated process indefinitely. 29 | /// 30 | /// A application or document to start. 31 | /// A arguments to use when starting the application or document. 32 | /// Specified how a new window should appear when the system starts a process. 33 | Process? Start(string name, string arguments = "", ProcessWindowStyle style = ProcessWindowStyle.Normal); 34 | 35 | /// 36 | /// Start and wait the associated process to exit. 37 | /// 38 | /// A application or document to start. 39 | /// A arguments to use when starting the application or document. 40 | Process WaitForExit(string name, string arguments); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IRegistryService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using Microsoft.Win32; 8 | 9 | /// 10 | /// A service for working with API. 11 | /// 12 | public interface IRegistryService 13 | { 14 | /// 15 | /// Removes the "StateFlags1337" key from the path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches". 16 | /// 17 | void RemoveVolumeCachesStateFlags(); 18 | 19 | /// 20 | /// Sets the value of the "StateFlags1337" key in the path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches". 21 | /// 22 | void SetVolumeCachesStateFlags(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IRequirementsService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using CSharpFunctionalExtensions; 8 | 9 | /// 10 | /// A service for working with app requirements. 11 | /// 12 | public interface IRequirementsService 13 | { 14 | /// 15 | /// Get os bitness. 16 | /// 17 | Result GetOsBitness(); 18 | 19 | /// 20 | /// Get the Windows Management Instrumentation state. 21 | /// 22 | Result GetWmiState(); 23 | 24 | /// 25 | /// Get os version. 26 | /// 27 | Result GetOsVersion(); 28 | 29 | /// 30 | /// Detect that the app is run by a logged-in user. 31 | /// 32 | Result AppRunFromLoggedUser(); 33 | 34 | /// 35 | /// Detect 3rd party harmful tweakers and trojans. 36 | /// 37 | Result MalwareDetection(); 38 | 39 | /// 40 | /// Get the Windows Feature Experience Pack state. 41 | /// 42 | Result GetFeatureExperiencePackState(); 43 | 44 | /// 45 | /// Get the Windows EventLog state. 46 | /// 47 | Result GetEventLogState(); 48 | 49 | /// 50 | /// Get the Microsoft Store state. 51 | /// 52 | Result GetMicrosoftStoreState(); 53 | 54 | /// 55 | /// Get a pending reboot state. 56 | /// 57 | Result GetPendingRebootState(); 58 | 59 | /// 60 | /// Detect latest version of the app. 61 | /// 62 | Result AppUpdateDetection(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IThemesService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services; 6 | using Microsoft.UI.Xaml; 7 | 8 | /// 9 | /// A service for working with app themes. 10 | /// 11 | public interface IThemesService 12 | { 13 | /// 14 | /// Gets app theme. 15 | /// 16 | ElementTheme Theme 17 | { 18 | get; 19 | } 20 | 21 | /// 22 | /// Service initialization. 23 | /// 24 | Task InitializeAsync(); 25 | 26 | /// 27 | /// Apply the selected application theme and save to a settings file. 28 | /// 29 | /// Specifies a UI theme that should be used for UIElements. 30 | Task SetThemeAsync(ElementTheme theme); 31 | 32 | /// 33 | /// Apply the selected theme. 34 | /// 35 | Task SetRequestedThemeAsync(); 36 | } 37 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IUpdateService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | /// 8 | /// A service for working with Windows and app updates. 9 | /// 10 | public interface IUpdateService 11 | { 12 | /// 13 | /// Start receiving os updates. 14 | /// 15 | void RunOsUpdate(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IUriService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | /// 8 | /// A service for working with URI. 9 | /// 10 | public interface IUriService 11 | { 12 | /// 13 | /// Opens a resource using an url. 14 | /// 15 | /// Discoverable url. 16 | Task OpenUrlAsync(string url); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/Services/IXmlService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.Services 6 | { 7 | using System.Xml; 8 | 9 | /// 10 | /// A service for working with API. 11 | /// 12 | public interface IXmlService 13 | { 14 | /// 15 | /// Try load the XML document from the specified path. 16 | /// 17 | /// Path for the file containing the XML document to load. 18 | XmlDocument? TryLoad(string? path); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/SophiApp/Contracts/ViewModels/INavigationAware.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Contracts.ViewModels; 6 | 7 | public interface INavigationAware 8 | { 9 | void OnNavigatedTo(object parameter); 10 | 11 | void OnNavigatedFrom(); 12 | } 13 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/ContentBlock.xaml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/ContentBlock.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ControlTemplates 6 | { 7 | using Microsoft.UI.Xaml; 8 | using Microsoft.UI.Xaml.Controls; 9 | 10 | /// 11 | /// Implements the logic and appearance of the element. 12 | /// 13 | public sealed partial class ContentBlock : UserControl 14 | { 15 | /// 16 | /// . 17 | /// 18 | public static readonly DependencyProperty TitleProperty = 19 | DependencyProperty.Register("Title", typeof(string), typeof(ContentBlock), new PropertyMetadata(default)); 20 | 21 | /// 22 | /// . 23 | /// 24 | public static new readonly DependencyProperty ContentProperty = 25 | DependencyProperty.Register("Content", typeof(object), typeof(ContentBlock), new PropertyMetadata(default)); 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | public ContentBlock() => InitializeComponent(); 31 | 32 | /// 33 | /// Gets or sets title. 34 | /// 35 | public string Title 36 | { 37 | get => (string)GetValue(TitleProperty); 38 | set => SetValue(TitleProperty, value); 39 | } 40 | 41 | /// 42 | /// Gets or sets content. 43 | /// 44 | public new object Content 45 | { 46 | get => GetValue(ContentProperty); 47 | set => SetValue(ContentProperty, value); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/ExpandingCheckBox.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ControlTemplates 6 | { 7 | using CommunityToolkit.Mvvm.Input; 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Controls; 10 | 11 | /// 12 | /// Implements the logic and appearance of the element. 13 | /// 14 | public sealed partial class ExpandingCheckBox : UserControl 15 | { 16 | // TODO: ExpandingCheckBox is unused! 17 | 18 | /// 19 | /// . 20 | /// 21 | public static readonly DependencyProperty CommandProperty = 22 | DependencyProperty.Register("Command", typeof(IRelayCommand), typeof(ExpandingCheckBox), new PropertyMetadata(default)); 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | public ExpandingCheckBox() 28 | { 29 | this.InitializeComponent(); 30 | } 31 | 32 | /// 33 | /// Gets or sets command. 34 | /// 35 | public IRelayCommand Command 36 | { 37 | get => (IRelayCommand)GetValue(CommandProperty); 38 | set => SetValue(CommandProperty, value); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/ExpandingRadioGroup.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ControlTemplates 6 | { 7 | using CommunityToolkit.Mvvm.Input; 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Controls; 10 | using SophiApp.Helpers; 11 | using SophiApp.ViewModels; 12 | 13 | /// 14 | /// Implements the logic and appearance of the element. 15 | /// 16 | public sealed partial class ExpandingRadioGroup : UserControl 17 | { 18 | /// 19 | /// . 20 | /// 21 | public static readonly DependencyProperty CommandProperty = 22 | DependencyProperty.Register("Command", typeof(IRelayCommand), typeof(ExpandingRadioGroup), new PropertyMetadata(default)); 23 | 24 | /// 25 | /// . 26 | /// 27 | public static readonly DependencyProperty UserControlActualWidthProperty = 28 | DependencyProperty.Register("UserControlActualWidth", typeof(double), typeof(ExpandingRadioGroup), new PropertyMetadata(default)); 29 | 30 | /// 31 | /// Initializes a new instance of the class. 32 | /// 33 | public ExpandingRadioGroup() 34 | { 35 | this.InitializeComponent(); 36 | FontOptions = App.GetService().FontOptions; 37 | } 38 | 39 | /// 40 | /// Gets the app font sizes. 41 | /// 42 | public FontOptions FontOptions { get; } 43 | 44 | /// 45 | /// Gets or sets command. 46 | /// 47 | public IRelayCommand Command 48 | { 49 | get => (IRelayCommand)GetValue(CommandProperty); 50 | set => SetValue(CommandProperty, value); 51 | } 52 | 53 | /// 54 | /// Gets or sets user uontrol actual width"/>. 55 | /// 56 | public double UserControlActualWidth 57 | { 58 | get => (double)GetValue(UserControlActualWidthProperty); 59 | set => SetValue(UserControlActualWidthProperty, value); 60 | } 61 | 62 | private void TextCommandsFlyoutCopyDescription_Click(object sender, RoutedEventArgs e) 63 | => ContextMenuHelper.CopyToClipboard(DescriptionTextBlock.Text); 64 | 65 | private void TextCommandsFlyoutCopyTitle_Click(object sender, RoutedEventArgs e) 66 | => ContextMenuHelper.CopyToClipboard(TitleTextBlock.Text); 67 | 68 | private void ExpandingRadioGroup_ContextRequested(UIElement sender, Microsoft.UI.Xaml.Input.ContextRequestedEventArgs args) 69 | => ContextMenuHelper.ShowContextMenu(sender, TextCommandsFlyout, args); 70 | 71 | private void Border_SizeChanged(object sender, SizeChangedEventArgs e) => UserControlActualWidth = e.NewSize.Width; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/MadeForWindows.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 20 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/MadeForWindows.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ControlTemplates 6 | { 7 | using Microsoft.UI.Xaml.Controls; 8 | 9 | /// 10 | /// Implements the logic and appearance of the element. 11 | /// 12 | public sealed partial class MadeForWindows : UserControl 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public MadeForWindows() => InitializeComponent(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/SquareCheckBox.xaml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 33 | 35 | 36 | 37 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/SquareCheckBox.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ControlTemplates 6 | { 7 | using CommunityToolkit.Mvvm.Input; 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Controls; 10 | using SophiApp.Helpers; 11 | using SophiApp.ViewModels; 12 | 13 | /// 14 | /// Implements the logic and appearance of the element. 15 | /// 16 | public sealed partial class SquareCheckBox : UserControl 17 | { 18 | /// 19 | /// . 20 | /// 21 | public static readonly DependencyProperty CommandProperty = 22 | DependencyProperty.Register("Command", typeof(IRelayCommand), typeof(SquareCheckBox), new PropertyMetadata(default)); 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | public SquareCheckBox() 28 | { 29 | // TODO: Not used? 30 | this.InitializeComponent(); 31 | FontOptions = App.GetService().FontOptions; 32 | } 33 | 34 | /// 35 | /// Gets the app font sizes. 36 | /// 37 | public FontOptions FontOptions { get; } 38 | 39 | /// 40 | /// Gets or sets command. 41 | /// 42 | public IRelayCommand Command 43 | { 44 | get => (IRelayCommand)GetValue(CommandProperty); 45 | set => SetValue(CommandProperty, value); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/TextCheckBox.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ControlTemplates 6 | { 7 | using CommunityToolkit.Mvvm.Input; 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Controls; 10 | using SophiApp.Helpers; 11 | using SophiApp.ViewModels; 12 | 13 | /// 14 | /// Implements the logic and appearance of the element. 15 | /// 16 | public sealed partial class TextCheckBox : UserControl 17 | { 18 | /// 19 | /// . 20 | /// 21 | public static readonly DependencyProperty CommandProperty = 22 | DependencyProperty.Register("Command", typeof(IRelayCommand), typeof(TextCheckBox), new PropertyMetadata(default)); 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | public TextCheckBox() 28 | { 29 | this.InitializeComponent(); 30 | FontOptions = App.GetService().FontOptions; 31 | } 32 | 33 | /// 34 | /// Gets the app font sizes. 35 | /// 36 | public FontOptions FontOptions { get; } 37 | 38 | /// 39 | /// Gets or sets command. 40 | /// 41 | public IRelayCommand Command 42 | { 43 | get => (IRelayCommand)GetValue(CommandProperty); 44 | set => SetValue(CommandProperty, value); 45 | } 46 | 47 | private void TextCommandsFlyoutCopyDescription_Click(object sender, RoutedEventArgs e) 48 | => ContextMenuHelper.CopyToClipboard(DescriptionTextBlock.Text); 49 | 50 | private void TextCommandsFlyoutCopyTitle_Click(object sender, RoutedEventArgs e) 51 | => ContextMenuHelper.CopyToClipboard(TitleTextBlock.Text); 52 | 53 | private void TextCheckBox_ContextRequested(UIElement sender, Microsoft.UI.Xaml.Input.ContextRequestedEventArgs args) 54 | => ContextMenuHelper.ShowContextMenu(sender, TextCommandsFlyout, args); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/UwpAppCheckBox.xaml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 33 | 39 | 45 | 48 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/SophiApp/ControlTemplates/UwpAppCheckBox.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ControlTemplates 6 | { 7 | using CommunityToolkit.Mvvm.Input; 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Controls; 10 | using SophiApp.Helpers; 11 | using SophiApp.Models; 12 | using SophiApp.ViewModels; 13 | 14 | /// 15 | /// Implements the logic and appearance of the element. 16 | /// 17 | public sealed partial class UwpAppCheckBox : UserControl 18 | { 19 | /// 20 | /// . 21 | /// 22 | public static readonly DependencyProperty CommandProperty = 23 | DependencyProperty.Register("Command", typeof(IRelayCommand), typeof(UwpAppCheckBox), new PropertyMetadata(default)); 24 | 25 | /// 26 | /// . 27 | /// 28 | public static readonly DependencyProperty CommandParameterProperty = 29 | DependencyProperty.Register("CommandParameter", typeof(UIUwpAppModel), typeof(UwpAppCheckBox), new PropertyMetadata(default)); 30 | 31 | /// 32 | /// Initializes a new instance of the class. 33 | /// 34 | public UwpAppCheckBox() 35 | { 36 | this.InitializeComponent(); 37 | FontOptions = App.GetService().FontOptions; 38 | } 39 | 40 | /// 41 | /// Gets the app font sizes. 42 | /// 43 | public FontOptions FontOptions { get; } 44 | 45 | /// 46 | /// Gets or sets command. 47 | /// 48 | public IRelayCommand Command 49 | { 50 | get => (IRelayCommand)GetValue(CommandProperty); 51 | set => SetValue(CommandProperty, value); 52 | } 53 | 54 | /// 55 | /// Gets or sets command parameter. 56 | /// 57 | public UIUwpAppModel CommandParameter 58 | { 59 | get => (UIUwpAppModel)GetValue(CommandParameterProperty); 60 | set => SetValue(CommandParameterProperty, value); 61 | } 62 | 63 | private void UwpAppCheckBox_ContextRequested(UIElement sender, Microsoft.UI.Xaml.Input.ContextRequestedEventArgs args) 64 | => ContextMenuHelper.ShowContextMenu(sender, TextCommandsFlyout, args); 65 | 66 | private void TextCommandsFlyoutCopyTitle_Click(object sender, RoutedEventArgs e) 67 | => ContextMenuHelper.CopyToClipboard(UwpNameTextBlock.Text); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/SophiApp/Converters/StringToVisibility.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Converters 6 | { 7 | using System; 8 | using Microsoft.UI.Xaml; 9 | using Microsoft.UI.Xaml.Data; 10 | 11 | /// 12 | internal class StringToVisibility : IValueConverter 13 | { 14 | /// 15 | public object Convert(object value, Type targetType, object parameter, string language) 16 | => (string)value == string.Empty ? Visibility.Collapsed : Visibility.Visible; 17 | 18 | /// 19 | public object ConvertBack(object value, Type targetType, object parameter, string language) 20 | => DependencyProperty.UnsetValue; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/ConcurrentBagExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions 6 | { 7 | using System.Collections.Concurrent; 8 | using SophiApp.Helpers; 9 | using SophiApp.Models; 10 | 11 | /// 12 | /// Implements ConcurrentBag extensions. 13 | /// 14 | public static class ConcurrentBagExtensions 15 | { 16 | /// 17 | /// Filter collections by tag. 18 | /// 19 | /// collection. 20 | /// tag. 21 | public static List FilterByTag(this ConcurrentBag models, UICategoryTag tag) 22 | { 23 | return models.Where(m => m.Tag == tag).ToList(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/FrameExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions; 6 | using Microsoft.UI.Xaml.Controls; 7 | 8 | /// 9 | /// Implements extensions. 10 | /// 11 | public static class FrameExtensions 12 | { 13 | /// 14 | /// Returns the ViewModel. 15 | /// 16 | /// Frame for which need to get a ViewModel. 17 | public static object? GetPageViewModel(this Frame frame) 18 | => frame?.Content?.GetType().GetProperty("ViewModel")?.GetValue(frame.Content, null); 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/IntExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions 6 | { 7 | /// 8 | /// Implements extensions. 9 | /// 10 | public static class IntExtensions 11 | { 12 | /// 13 | /// Proportionally increases the from 0 to 100 using the number of . 14 | /// 15 | /// Increasing value. 16 | /// Steps to increase. 17 | public static int Increase(this int value, int steps) 18 | { 19 | return steps == 1 ? 100 : (100 / steps) + value; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/JsonExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions; 6 | using Newtonsoft.Json; 7 | 8 | /// 9 | /// Json extensions. 10 | /// 11 | public static class JsonExtensions 12 | { 13 | /// 14 | /// Deserializes the JSON to the specified .NET type. 15 | /// 16 | /// The type of the object to deserialize to. 17 | /// The JSON to deserialize. 18 | public static T ToObject(string value) 19 | { 20 | return JsonConvert.DeserializeObject(value) !; 21 | } 22 | 23 | /// 24 | /// Deserializes the JSON to the specified .NET type. 25 | /// 26 | /// The type of the object to deserialize to. 27 | /// The JSON to deserialize. 28 | public static async Task ToObjectAsync(string value) 29 | { 30 | return await Task.Run(() => 31 | { 32 | return JsonConvert.DeserializeObject(value) !; 33 | }); 34 | } 35 | 36 | /// 37 | /// Serializes the specified object to a JSON string. 38 | /// 39 | /// The object to serialize. 40 | public static async Task StringifyAsync(object value) 41 | { 42 | return await Task.Run(() => 43 | { 44 | return JsonConvert.SerializeObject(value); 45 | }); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/ProcessExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions 6 | { 7 | /// 8 | /// Implements extensions. 9 | /// 10 | public static class ProcessExtensions 11 | { 12 | /// 13 | /// Performs the specified action on each element of the process collection. 14 | /// 15 | /// collection. 16 | /// Encapsulates a method that has a single parameter and does not return a value. 17 | public static void ForEach(this System.Diagnostics.Process[] processes, Action action) 18 | { 19 | foreach (var process in processes) 20 | { 21 | action(process); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/RegistryKeyExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions 6 | { 7 | using Microsoft.Win32; 8 | 9 | /// 10 | /// Implements extensions. 11 | /// 12 | public static class RegistryKeyExtensions 13 | { 14 | /// 15 | /// Retrieves or create, if missing, a specified subkey. 16 | /// 17 | /// Represents a key-level node in the Windows registry. 18 | /// Path of the subkey to open or create. 19 | public static RegistryKey OpenOrCreateSubKey(this RegistryKey key, string subKey) 20 | { 21 | return key.OpenSubKey(subKey, true) ?? key.CreateSubKey(subKey, true); 22 | } 23 | 24 | /// 25 | /// Determines whether the given key value exist at specified registry path. 26 | /// 27 | /// Represents a key-level node in the Windows registry. 28 | /// Key value. 29 | public static bool ValueExist(this RegistryKey key, string value) 30 | { 31 | return key.GetValueNames().ForEach(keyName => key.GetValue(keyName) as string ?? string.Empty) 32 | .Any(keyValue => keyValue.Equals(value, StringComparison.OrdinalIgnoreCase)); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/ResourceExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions; 6 | using Microsoft.Windows.ApplicationModel.Resources; 7 | 8 | public static class ResourceExtensions 9 | { 10 | private static readonly ResourceLoader ResourceLoader = new (); 11 | 12 | public static string GetLocalized(this string resourceKey) => ResourceLoader.GetString(resourceKey); 13 | } 14 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/ServiceControllerExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions 6 | { 7 | using System.ServiceProcess; 8 | 9 | /// 10 | /// Implements ServiceController extensions. 11 | /// 12 | public static class ServiceControllerExtensions 13 | { 14 | /// 15 | /// Try start the service. 16 | /// 17 | /// Represents a Windows service and allows you to connect to a running or stopped. 18 | public static void TryStart(this ServiceController service) 19 | { 20 | if (service.Status == ServiceControllerStatus.Stopped) 21 | { 22 | service.Start(); 23 | } 24 | } 25 | 26 | /// 27 | /// Try stop the service. 28 | /// 29 | /// Represents a Windows service and allows you to connect to a running or stopped. 30 | public static void TryStop(this ServiceController service) 31 | { 32 | if (service.Status == ServiceControllerStatus.Running) 33 | { 34 | service.Stop(); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions 6 | { 7 | /// 8 | /// Implements extensions. 9 | /// 10 | public static class StringExtensions 11 | { 12 | /// 13 | /// Converts the string to enumerated object. 14 | /// 15 | /// Type of enumerated object. 16 | /// String to convert. 17 | /// Occurs when is not found in enum. 18 | public static T ToEnum(this string value) 19 | { 20 | return Enum.IsDefined(typeof(T), value) 21 | ? (T)Enum.Parse(typeof(T), value) 22 | : throw new ArgumentOutOfRangeException(paramName: value, message: $"Value: {value} is not found in {typeof(T).Name} enumeration."); 23 | } 24 | 25 | /// 26 | /// Attempts to delete the specified file. Does not throw any exceptions if it fails. 27 | /// 28 | /// File to delete. 29 | public static void TryDelete(this string filePath) 30 | { 31 | try 32 | { 33 | File.Delete(filePath); 34 | } 35 | catch (Exception) 36 | { 37 | // Do nothing. 38 | } 39 | } 40 | 41 | /// 42 | /// Performs the specified function on each element of the strings array. 43 | /// 44 | /// The strings array. 45 | /// Encapsulates a method that has no parameters and returns a string. 46 | public static IEnumerable ForEach(this string[] strings, Func function) 47 | { 48 | foreach (string s in strings) 49 | { 50 | yield return function(s); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/SophiApp/Extensions/UserControlExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Extensions 6 | { 7 | using Microsoft.UI.Xaml; 8 | using Microsoft.UI.Xaml.Controls; 9 | 10 | /// 11 | /// Implements extensions. 12 | /// 13 | public static class UserControlExtensions 14 | { 15 | /// 16 | /// Retrieves an object that has the specified identifier name. 17 | /// 18 | /// Type of requested object. This can be null if no matching object was found in the current XAML namescope. 19 | /// The base element class for Windows Runtime UI objects. 20 | /// The name of the requested object. 21 | public static T FindName(this UserControl userControl, string name) 22 | where T : FrameworkElement 23 | { 24 | return (T)userControl.FindName(name); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/AppVersionWrapper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | /// 8 | /// App version wrapper. 9 | /// 10 | public record AppVersionWrapper 11 | { 12 | /// 13 | /// Gets or sets app pre-release version. 14 | /// 15 | public Version? SophiApp_pre_release { get; set; } 16 | 17 | /// 18 | /// Gets or sets app release version. 19 | /// 20 | public Version? SophiApp_release { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/ContextMenuHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | using Microsoft.UI.Xaml; 8 | using Microsoft.UI.Xaml.Controls; 9 | using Microsoft.UI.Xaml.Controls.Primitives; 10 | using Windows.ApplicationModel.DataTransfer; 11 | using Windows.Foundation; 12 | 13 | /// 14 | /// Helper class for working with UI element context menu. 15 | /// 16 | public static class ContextMenuHelper 17 | { 18 | /// 19 | /// Copy to clipboard. 20 | /// 21 | /// The text. 22 | public static void CopyToClipboard(string? text) 23 | { 24 | var dataPackage = new DataPackage() { RequestedOperation = DataPackageOperation.Copy }; 25 | dataPackage.SetText(text); 26 | Clipboard.SetContent(dataPackage); 27 | } 28 | 29 | /// 30 | /// Copy to clipboard. 31 | /// 32 | /// The text. 33 | public static void CopyToClipboard(List text) => CopyToClipboard(string.Join("\r", text)); 34 | 35 | /// 36 | /// Shows the flyout placed in relation to the specified element using the specified options. 37 | /// 38 | /// UIElement is a base class for most of the Windows Runtime UI objects. 39 | /// Flyout displayed on UI element. 40 | /// Provides event data for the ContextRequested event. 41 | public static void ShowContextMenu(UIElement sender, CommandBarFlyout flyout, Microsoft.UI.Xaml.Input.ContextRequestedEventArgs args) 42 | { 43 | args.Handled = true; 44 | Point point; 45 | _ = args.TryGetPosition(sender, out point); 46 | var options = new FlyoutShowOptions() 47 | { 48 | Position = point, 49 | ShowMode = FlyoutShowMode.Standard, 50 | }; 51 | 52 | flyout.ShowAt((FrameworkElement)sender, options); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/ElementThemeWrapper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | using Microsoft.UI.Xaml; 8 | using SophiApp.Extensions; 9 | 10 | /// 11 | /// wrapper. 12 | /// 13 | public record ElementThemeWrapper 14 | { 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// App elements theme. 20 | /// Theme description localized key. 21 | public ElementThemeWrapper(ElementTheme elementTheme, string key) 22 | { 23 | ElementTheme = elementTheme; 24 | Description = key.GetLocalized(); 25 | } 26 | 27 | /// 28 | /// Gets app element theme description. 29 | /// 30 | public string Description { get; init; } 31 | 32 | /// 33 | /// Gets app elements theme. 34 | /// 35 | public ElementTheme ElementTheme { get; init; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/EnvironmentHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | using System.Runtime.InteropServices; 8 | 9 | /// 10 | /// Helper class for working with environment variables. 11 | /// 12 | public static class EnvironmentHelper 13 | { 14 | private const int Msg = 273; 15 | private const int SMTOABORTIFHUNG = 0x0002; 16 | private const int WMSETTINGCHANGE = 0x1a; 17 | private const string TRAYSETTINGS = "TraySettings"; 18 | 19 | // Virtual key ID of the F5 in File Explorer 20 | private static readonly IntPtr HWnd = new (65535); 21 | private static readonly IntPtr HWNDBROADCAST = new (0xffff); 22 | private static readonly UIntPtr UIntPtr = new (41504); 23 | 24 | /// 25 | /// Simulate pressing F5 to refresh the desktop. 26 | /// 27 | public static void RefreshUserDesktop() 28 | { 29 | PostMessageW(HWnd, Msg, UIntPtr, IntPtr.Zero); 30 | } 31 | 32 | /// 33 | /// Refresh desktop icons, environment variables, taskbar, etc. 34 | /// 35 | public static void ForcedRefresh() 36 | { 37 | SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero); 38 | SendMessageTimeout(HWNDBROADCAST, WMSETTINGCHANGE, IntPtr.Zero, null, SMTOABORTIFHUNG, 100, IntPtr.Zero); 39 | SendNotifyMessage(HWNDBROADCAST, WMSETTINGCHANGE, IntPtr.Zero, TRAYSETTINGS); 40 | } 41 | 42 | /// 43 | /// Simulate pressing F5 to refresh the desktop. 44 | /// 45 | [DllImport("user32.dll", SetLastError = true)] 46 | private static extern int PostMessageW(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam); 47 | 48 | /// 49 | /// Update desktop icons. 50 | /// 51 | [DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)] 52 | private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2); 53 | 54 | /// 55 | /// Update environment variables. 56 | /// 57 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] 58 | private static extern IntPtr SendMessageTimeout(IntPtr hWnd, int msg, IntPtr wParam, string? lParam, int fuFlags, int uTimeout, IntPtr lpdwResult); 59 | 60 | /// 61 | /// Update taskbar. 62 | /// 63 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] 64 | private static extern bool SendNotifyMessage(IntPtr hWnd, uint msg, IntPtr wParam, string lParam); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/NavigationHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers; 6 | using Microsoft.UI.Xaml; 7 | using Microsoft.UI.Xaml.Controls; 8 | 9 | /// 10 | /// Helper class to set the navigation target for a NavigationViewItem. 11 | /// 12 | public static class NavigationHelper 13 | { 14 | /// 15 | /// Registered "NavigateTo" dependency property. 16 | /// 17 | public static readonly DependencyProperty NavigateToProperty = 18 | DependencyProperty.RegisterAttached("NavigateTo", typeof(string), typeof(NavigationHelper), new PropertyMetadata(null)); 19 | 20 | /// 21 | /// Get navigation target. 22 | /// 23 | /// Represents the item in a NavigationView control. 24 | public static string GetNavigateTo(NavigationViewItem item) => (string)item.GetValue(NavigateToProperty); 25 | 26 | /// 27 | /// Set navigation target. 28 | /// 29 | /// Represents the item in a NavigationView control. 30 | /// Navigation target. 31 | public static void SetNavigateTo(NavigationViewItem item, string value) => item.SetValue(NavigateToProperty, value); 32 | } 33 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/OsProperties.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | using System.Management; 8 | using Microsoft.Win32; 9 | 10 | #pragma warning disable SA1313 // Parameter names should begin with lower-case letter 11 | 12 | /// 13 | /// Encapsulates OS properties. 14 | /// 15 | public record OsProperties( 16 | string Caption, 17 | int BuildNumber, 18 | int UpdateBuildRevision, 19 | string Edition, 20 | string CSName) 21 | { 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// A collection of WMI class properties. 26 | public OsProperties(PropertyDataCollection properties) 27 | : this( 28 | Caption: (string?)properties[nameof(Caption)]?.Value ?? "n/a", 29 | BuildNumber: int.Parse((string?)properties[nameof(BuildNumber)]?.Value ?? "-1"), 30 | UpdateBuildRevision: (int?)RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion")?.GetValue("UBR") ?? -1, 31 | Edition: (string?)RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion")?.GetValue("EditionID") ?? "n/a", 32 | CSName: (string?)properties[nameof(CSName)]?.Value ?? "n/a") 33 | { 34 | } 35 | 36 | /// 37 | /// Initializes a new instance of the class. 38 | /// 39 | public OsProperties() 40 | : this( 41 | Caption: "n/a", 42 | BuildNumber: -1, 43 | UpdateBuildRevision: -1, 44 | Edition: "n/a", 45 | CSName: "n/a") 46 | { 47 | } 48 | } 49 | 50 | #pragma warning restore SA1313 // Parameter names should begin with lower-case letter 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/RequirementsFailure.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | /// 8 | /// Reasons for failure requirements. 9 | /// 10 | public enum RequirementsFailure 11 | { 12 | DefenderFileMissing, 13 | DefenderIsBroken, 14 | DefenderServiceBroken, 15 | DefenderSettingsPageHidden, 16 | EventLogBroken, 17 | FeatureExperiencePackRemoved, 18 | Is32BitOs, 19 | MalwareDetected, 20 | MsStoreRemoved, 21 | RebootRequired, 22 | RunByNotLoggedUser, 23 | Win10EnterpriseSVersion, 24 | Win10UnsupportedBuild, 25 | Win10UpdateBuildRevisionLess3448, 26 | Win11BuildLess22631, 27 | Win11UbrLess2283, 28 | WMIBroken, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/RuntimeHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers; 6 | using System.Runtime.InteropServices; 7 | using System.Text; 8 | 9 | /// 10 | /// Implements the logic app runtime helper API. 11 | /// 12 | public static class RuntimeHelper 13 | { 14 | /// 15 | /// Gets a value indicating whether MSIX is used. 16 | /// 17 | public static bool IsMSIX 18 | { 19 | get 20 | { 21 | var length = 0; 22 | return GetCurrentPackageFullName(ref length, null) != 15700L; 23 | } 24 | } 25 | 26 | [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] 27 | private static extern int GetCurrentPackageFullName(ref int packageFullNameLength, StringBuilder? packageFullName); 28 | } 29 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/UICategoryTags.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | /// 8 | /// UI category tags. 9 | /// 10 | public enum UICategoryTag 11 | { 12 | ContextMenu, 13 | Gaming, 14 | Personalization, 15 | Privacy, 16 | Security, 17 | System, 18 | TaskScheduler, 19 | UWP, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/UIDataTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | using Microsoft.UI.Xaml; 8 | using Microsoft.UI.Xaml.Controls; 9 | using SophiApp.Models; 10 | 11 | /// 12 | public class UIDataTemplateSelector : DataTemplateSelector 13 | { 14 | /// 15 | /// Gets or sets template. 16 | /// 17 | public DataTemplate TextCheckBox { get; set; } = new (); 18 | 19 | /// 20 | /// Gets or sets template. 21 | /// 22 | public DataTemplate ExpandingRadioGroup { get; set; } = new (); 23 | 24 | /// 25 | /// Gets or sets template. 26 | /// 27 | public DataTemplate ExpandingCheckBoxGroup { get; set; } = new (); 28 | 29 | /// 30 | /// Gets or sets template. 31 | /// 32 | public DataTemplate ExpandingCheckBox { get; set; } = new (); // TODO: Its unused? 33 | 34 | /// 35 | protected override DataTemplate SelectTemplateCore(object item) 36 | { 37 | var itemType = item.GetType(); 38 | return itemType switch 39 | { 40 | var type when type == typeof(UICheckBoxModel) => TextCheckBox, 41 | var type when type == typeof(UIExpandingRadioGroupModel) => ExpandingRadioGroup, 42 | var type when type == typeof(UIExpandingCheckBoxModel) => ExpandingCheckBox, 43 | _ => throw new TypeAccessException($"Attempt to access method '{nameof(SelectTemplateCore)}' to type '{itemType}' failed") 44 | }; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/SophiApp/Helpers/UIModelType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Helpers 6 | { 7 | using SophiApp.Models; 8 | 9 | /// 10 | /// type. 11 | /// 12 | public enum UIModelType 13 | { 14 | CheckBox, 15 | ExpandingCheckBox, 16 | ExpandingCheckBoxGroup, 17 | ExpandingGroup, 18 | ExpandingRadioGroup, 19 | RadioGroup, 20 | SquareCheckBox, 21 | UwpApp, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/SophiApp/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/SophiApp/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp; 6 | 7 | using SophiApp.Contracts.Services; 8 | using SophiApp.Helpers; 9 | using Windows.Graphics; 10 | using Windows.UI.ViewManagement; 11 | 12 | /// 13 | /// Implements the class. 14 | /// 15 | public sealed partial class MainWindow : WindowEx 16 | { 17 | private readonly Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue; 18 | private readonly UISettings settings; 19 | private readonly ISettingsService settingsService; 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | public MainWindow() 25 | { 26 | InitializeComponent(); 27 | App.SetSingleInstance(); 28 | AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/SophiApp.ico")); 29 | Content = null; 30 | dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread(); 31 | settings = new UISettings(); 32 | settings.ColorValuesChanged += Settings_ColorValuesChanged; 33 | settingsService = App.GetService(); 34 | } 35 | 36 | /// 37 | /// This handles updating the caption button colors correctly when windows system theme is changed while the app is open. 38 | /// 39 | /// Contains a set of common app user interface settings and operations. 40 | /// Arguments passed to the method. 41 | private void Settings_ColorValuesChanged(UISettings sender, object args) => dispatcherQueue.TryEnqueue(TitleBarHelper.ApplySystemThemeToCaptionButtons); 42 | 43 | private void MainWindow_StateChanged(object sender, WindowState e) => Task.Run(async () => await settingsService.SaveAppWindowStateAsync(WindowState)); 44 | 45 | private void MainWindow_PositionChanged(object sender, PointInt32 e) 46 | { 47 | if (Visible && e.X > 0 && e.Y > 0) 48 | { 49 | _ = Task.Run(async () => await settingsService.SaveAppWindowPositionAsync(e)); 50 | } 51 | } 52 | 53 | private void MainWindow_SizeChanged(object sender, Microsoft.UI.Xaml.WindowSizeChangedEventArgs args) 54 | { 55 | if (Visible && WindowState == WindowState.Normal) 56 | { 57 | var height = Height; 58 | var width = Width; 59 | _ = Task.Run(async () => await settingsService.SaveAppWindowSizeAsync(height, width)); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/SophiApp/Models/LocalSettingsOptions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Models; 6 | 7 | public class LocalSettingsOptions 8 | { 9 | public string? ApplicationDataFolder 10 | { 11 | get; set; 12 | } 13 | 14 | public string? LocalSettingsFile 15 | { 16 | get; set; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/SophiApp/Models/MsTerminalSettingsDto.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Models 6 | { 7 | using Newtonsoft.Json; 8 | 9 | #pragma warning disable SA1402 // File may only contain a single type 10 | 11 | /// 12 | /// Data transfer object for Windows Terminal settings. 13 | /// 14 | public class MsTerminalSettingsDto 15 | { 16 | /// 17 | /// Gets or sets profile settings. 18 | /// 19 | [JsonProperty("profiles")] 20 | public Profiles? Profiles { get; set; } 21 | } 22 | 23 | /// 24 | /// Data transfer object for Windows Terminal profile settings. 25 | /// 26 | public class Profiles 27 | { 28 | /// 29 | /// Gets or sets profile defaults. 30 | /// 31 | [JsonProperty("defaults")] 32 | public Defaults? Defaults { get; set; } 33 | } 34 | 35 | /// 36 | /// Gets or set defaults profile setting value. 37 | /// 38 | public class Defaults 39 | { 40 | /// 41 | /// Gets or sets a value indicating whether elevate setting. 42 | /// 43 | [JsonProperty("elevate")] 44 | public bool Elevate { get; set; } 45 | } 46 | 47 | #pragma warning restore SA1402 // File may only contain a single type 48 | } 49 | -------------------------------------------------------------------------------- /src/SophiApp/Models/UICheckBoxModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Models 6 | { 7 | /// 8 | public class UICheckBoxModel : UIModel 9 | { 10 | private readonly Func accessor; 11 | private readonly Action mutator; 12 | private bool isChecked; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// Dto for initialization. 18 | /// Model title. 19 | /// Model description. 20 | /// Method that sets the IsEnabled state. 21 | /// Method that changes Windows settings. 22 | public UICheckBoxModel(UIModelDto dto, string title, string description, Func accessor, Action mutator) 23 | : base(dto, title) 24 | { 25 | this.accessor = accessor; 26 | this.mutator = mutator; 27 | Description = description; 28 | } 29 | 30 | /// 31 | /// Gets model description. 32 | /// 33 | public string Description { get; init; } 34 | 35 | /// 36 | /// Gets or sets a value indicating whether model checked state. 37 | /// 38 | public bool IsChecked 39 | { 40 | get => isChecked; 41 | set 42 | { 43 | isChecked = value; 44 | App.Logger.LogModelState(Name, IsChecked); 45 | OnPropertyChanged(); 46 | } 47 | } 48 | 49 | /// 50 | public override void GetState() 51 | { 52 | try 53 | { 54 | IsChecked = accessor.Invoke(); 55 | } 56 | catch (Exception ex) 57 | { 58 | IsEnabled = false; 59 | App.Logger.LogModelGetStateException(Name, ex); 60 | } 61 | } 62 | 63 | /// 64 | public override void SetState() 65 | { 66 | try 67 | { 68 | mutator.Invoke(IsChecked); 69 | } 70 | catch (Exception ex) 71 | { 72 | IsEnabled = false; 73 | App.Logger.LogModelSetStateException(ex, Name, IsChecked); 74 | } 75 | } 76 | 77 | /// 78 | public override bool ContainsText(string text) => base.ContainsText(text) || Description.Contains(text, StringComparison.CurrentCultureIgnoreCase); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/SophiApp/Models/UIModelDto.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Models 6 | { 7 | using SophiApp.Helpers; 8 | 9 | #pragma warning disable SA1313 // Parameter names should begin with lower-case letter 10 | 11 | /// 12 | /// Data transfer object for . 13 | /// 14 | public record UIModelDto( 15 | string Name, 16 | UIModelType Type, 17 | UICategoryTag Tag, 18 | int ViewId, 19 | bool Windows10Support, 20 | bool Windows11Support, 21 | int NumberOfItems); 22 | 23 | #pragma warning restore SA1313 // Parameter names should begin with lower-case letter 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/SophiApp/Models/UIRadioGroupItemModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Models 6 | { 7 | using System.ComponentModel; 8 | using System.Runtime.CompilerServices; 9 | using SophiApp.ViewModels; 10 | 11 | /// 12 | /// The child item model. 13 | /// 14 | public class UIRadioGroupItemModel : INotifyPropertyChanged 15 | { 16 | private bool isChecked = false; 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// A model title. 22 | /// A model group name. 23 | /// A model id. 24 | /// A parent model id. 25 | public UIRadioGroupItemModel(string title, string groupName, int id, int parentId) 26 | { 27 | Title = title; 28 | GroupName = groupName; 29 | Id = id; 30 | ParentId = parentId; 31 | } 32 | 33 | /// 34 | /// Property change event. 35 | /// 36 | public event PropertyChangedEventHandler? PropertyChanged; 37 | 38 | /// 39 | /// Gets model title. 40 | /// 41 | public string Title { get; init; } 42 | 43 | /// 44 | /// Gets model group name. 45 | /// 46 | public string GroupName { get; init; } 47 | 48 | /// 49 | /// Gets model id. 50 | /// 51 | public int Id { get; init; } 52 | 53 | /// 54 | /// Gets parent model id. 55 | /// 56 | public int ParentId { get; init; } 57 | 58 | /// 59 | /// Gets or sets a value indicating whether model is checked. 60 | /// 61 | public bool IsChecked 62 | { 63 | get => isChecked; 64 | set 65 | { 66 | isChecked = value; 67 | OnPropertyChanged(nameof(IsChecked)); 68 | } 69 | } 70 | 71 | /// 72 | /// event handler. 73 | /// 74 | /// Property name. 75 | protected void OnPropertyChanged([CallerMemberName] string? name = null) 76 | { 77 | App.MainWindow.DispatcherQueue.TryEnqueue(() => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name))); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/SophiApp/Models/UISquareCheckBoxModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Models 6 | { 7 | /// 8 | public class UISquareCheckBoxModel : UIModel 9 | { 10 | private readonly Func accessor; 11 | private readonly Action mutator; 12 | private bool isChecked; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// Dto for initialization. 18 | /// Model title. 19 | /// Method that sets the IsEnabled state. 20 | /// Method that changes Windows settings. 21 | public UISquareCheckBoxModel(UIModelDto dto, string title, Func accessor, Action mutator) 22 | : base(dto, title) 23 | { 24 | this.accessor = accessor; 25 | this.mutator = mutator; 26 | } 27 | 28 | /// 29 | /// Gets or sets a value indicating whether model checked state. 30 | /// 31 | public bool IsChecked 32 | { 33 | get => isChecked; 34 | set 35 | { 36 | isChecked = value; 37 | App.Logger.LogModelState(Name, IsChecked); 38 | OnPropertyChanged(); 39 | } 40 | } 41 | 42 | /// 43 | public override void GetState() 44 | { 45 | try 46 | { 47 | IsChecked = accessor.Invoke(); 48 | } 49 | catch (Exception ex) 50 | { 51 | IsEnabled = false; 52 | App.Logger.LogModelGetStateException(Name, ex); 53 | } 54 | } 55 | 56 | /// 57 | public override void SetState() 58 | { 59 | try 60 | { 61 | mutator.Invoke(IsChecked); 62 | } 63 | catch (Exception ex) 64 | { 65 | IsEnabled = false; 66 | App.Logger.LogModelSetStateException(ex, Name, IsChecked); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/SophiApp/Models/UIUwpAppModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Models 6 | { 7 | /// 8 | public class UIUwpAppModel : UIModel 9 | { 10 | private bool isChecked = false; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// Dto for initialization. 16 | /// Model title. 17 | /// The path to model logo. 18 | public UIUwpAppModel(UIModelDto dto, string title, Uri image) 19 | : base(dto, title) 20 | { 21 | Image = image; 22 | } 23 | 24 | /// 25 | /// Gets path to model logo. 26 | /// 27 | public Uri Image { get; init; } 28 | 29 | /// 30 | /// Gets or sets the method to be executed when the set state. 31 | /// 32 | public Action? Mutator { get; set; } 33 | 34 | /// 35 | /// Gets or sets a value indicating whether the appx package will be removed for all users. 36 | /// 37 | public bool ForAllUsers { get; set; } 38 | 39 | /// 40 | /// Gets or sets a value indicating whether model checked state. 41 | /// 42 | public bool IsChecked 43 | { 44 | get => isChecked; 45 | set 46 | { 47 | isChecked = value; 48 | App.Logger.LogModelState(Name, IsChecked); 49 | OnPropertyChanged(); 50 | } 51 | } 52 | 53 | /// 54 | public override void GetState() 55 | { 56 | IsChecked = false; 57 | } 58 | 59 | /// 60 | public override void SetState() 61 | { 62 | try 63 | { 64 | Mutator?.Invoke(Title, ForAllUsers); 65 | } 66 | catch (Exception ex) 67 | { 68 | App.Logger.LogModelSetStateException(ex, Name, IsChecked); 69 | } 70 | finally 71 | { 72 | IsEnabled = false; 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/SophiApp/Package.appinstaller: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/SophiApp/Properties/launchsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SophiApp (Package)": { 4 | "commandName": "MsixPackage" 5 | }, 6 | "SophiApp (Unpackaged)": { 7 | "commandName": "Project" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/SophiApp/Services/DiskService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using SophiApp.Contracts.Services; 8 | using System.Collections.Generic; 9 | 10 | /// 11 | public class DiskService : IDiskService 12 | { 13 | /// 14 | public IEnumerable GetVolumeLabels() 15 | { 16 | var drives = DriveInfo.GetDrives(); 17 | 18 | foreach (var drive in drives) 19 | { 20 | if (drive.IsReady) 21 | { 22 | yield return drive.VolumeLabel; 23 | } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/SophiApp/Services/DisplayService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using Microsoft.UI; 8 | using Microsoft.UI.Windowing; 9 | using SophiApp.Contracts.Services; 10 | using System.Threading.Tasks; 11 | using WinRT.Interop; 12 | 13 | /// 14 | public class DisplayService : IDisplayService 15 | { 16 | /// 17 | public async Task GetDisplayAreaAsync() 18 | { 19 | return await Task.Run(() => 20 | { 21 | var handler = WindowNative.GetWindowHandle(App.MainWindow); 22 | var windowId = Win32Interop.GetWindowIdFromWindow(handler); 23 | return DisplayArea.GetFromWindowId(windowId, DisplayAreaFallback.Nearest); 24 | }); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/SophiApp/Services/FileService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services; 6 | 7 | using System.Runtime.CompilerServices; 8 | using System.Text; 9 | using Newtonsoft.Json; 10 | using SophiApp.Contracts.Services; 11 | 12 | /// 13 | public class FileService : IFileService 14 | { 15 | /// 16 | public T? ReadFromJson(string folderPath, string fileName) 17 | { 18 | var path = Path.Combine(folderPath, fileName); 19 | if (File.Exists(path)) 20 | { 21 | var json = File.ReadAllText(path); 22 | return JsonConvert.DeserializeObject(json); 23 | } 24 | 25 | return default; 26 | } 27 | 28 | /// 29 | [MethodImpl(MethodImplOptions.Synchronized)] 30 | public void SaveToJson(string folderPath, string fileName, T content) 31 | { 32 | if (!Directory.Exists(folderPath)) 33 | { 34 | Directory.CreateDirectory(folderPath); 35 | } 36 | 37 | var fileContent = JsonConvert.SerializeObject(content, Formatting.Indented); 38 | File.WriteAllText(Path.Combine(folderPath, fileName), fileContent, Encoding.Default); 39 | } 40 | 41 | /// 42 | public void Save(string file, string content, Encoding encoding) 43 | { 44 | var foldersPath = Path.GetDirectoryName(file) ?? throw new ArgumentNullException(paramName: nameof(file), message: "The file path cannot be empty"); 45 | 46 | if (!Directory.Exists(foldersPath)) 47 | { 48 | Directory.CreateDirectory(foldersPath); 49 | } 50 | 51 | File.WriteAllText(file, content, encoding); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/SophiApp/Services/FirewallService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using System.Collections.Generic; 8 | using NetFwTypeLib; 9 | using SophiApp.Contracts.Services; 10 | 11 | /// 12 | public class FirewallService : IFirewallService 13 | { 14 | private readonly INetFwPolicy2 firewallPolicy; 15 | 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | public FirewallService() 20 | { 21 | var netCfg = Type.GetTypeFromProgID("HNetCfg.FwPolicy2") !; 22 | firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(netCfg) !; 23 | } 24 | 25 | /// 26 | public IEnumerable GetGroupRules(string groupName) 27 | { 28 | var rules = firewallPolicy.Rules.OfType().Where(rule => rule.Grouping == groupName); 29 | return rules.Any() ? rules : throw new ArgumentNullException(groupName, "No firewall rules were found for the group name"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/SophiApp/Services/HttpService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using System.Text.RegularExpressions; 8 | using SophiApp.Contracts.Services; 9 | 10 | /// 11 | public class HttpService : IHttpService 12 | { 13 | private readonly Regex hrefPattern = new (@"(?inx) 14 | ]* 15 | href \s* = \s* 16 | (? ['""] ) 17 | (? [^""]+ ) 18 | \k 19 | [^>]* >"); 20 | 21 | /// 22 | public void DownloadFile(string url, string saveTo) 23 | { 24 | Directory.CreateDirectory(Path.GetDirectoryName(saveTo) !); 25 | using var client = new HttpClient(); 26 | using var urlStream = client.GetStreamAsync(url).Result; 27 | using var fileStream = new FileStream(saveTo, FileMode.Create); 28 | urlStream.CopyTo(fileStream); 29 | } 30 | 31 | /// 32 | public async Task DownloadHEVCAppxAsync(string fileName) 33 | { 34 | var content = new List> 35 | { 36 | new ("type", "url"), new ("url", "https://apps.microsoft.com/detail/9N4WGH0Z6VHQ"), new ("ring", "Retail"), new ("lang", "en-US"), 37 | }; 38 | using var client = new HttpClient(); 39 | using var request = new HttpRequestMessage(HttpMethod.Post, "https://store.rg-adguard.net/api/GetFiles"); 40 | request.Content = new FormUrlEncodedContent(content); 41 | using var response = await client.SendAsync(request); 42 | var result = await response.Content.ReadAsStringAsync(); 43 | var appxLink = hrefPattern.Matches(result).Last().Value.Replace("", null); 44 | using var stream = await client.GetStreamAsync(appxLink); 45 | using var file = File.Create(fileName); 46 | await stream.CopyToAsync(file); 47 | } 48 | 49 | /// 50 | public void ThrowIfOffline(string url = "https://google.com") 51 | { 52 | try 53 | { 54 | using var client = new HttpClient(); 55 | using var request = new HttpRequestMessage(HttpMethod.Head, url); 56 | using var response = client.Send(request); 57 | } 58 | catch (Exception) 59 | { 60 | throw new HttpRequestException($"Url {url} is unavailable"); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/SophiApp/Services/PageService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.Contracts.Services; 9 | using SophiApp.ViewModels; 10 | using SophiApp.Views; 11 | 12 | /// 13 | public class PageService : IPageService 14 | { 15 | private readonly Dictionary pages = new (); 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | public PageService() 21 | { 22 | Configure(); 23 | Configure(); 24 | Configure(); 25 | Configure(); 26 | Configure(); 27 | Configure(); 28 | Configure(); 29 | Configure(); 30 | Configure(); 31 | Configure(); 32 | Configure(); 33 | Configure(); 34 | Configure(); 35 | Configure(); 36 | } 37 | 38 | /// 39 | public Type GetPageType(string key) 40 | { 41 | Type? pageType; 42 | lock (pages) 43 | { 44 | if (!pages.TryGetValue(key, out pageType)) 45 | { 46 | throw new ArgumentException($"Page not found: {key}. Did you forget to call PageService.Configure?"); 47 | } 48 | } 49 | 50 | return pageType; 51 | } 52 | 53 | private void Configure() 54 | where VM : ObservableObject 55 | where V : Page 56 | { 57 | lock (pages) 58 | { 59 | var key = typeof(VM).FullName!; 60 | if (pages.ContainsKey(key)) 61 | { 62 | throw new ArgumentException($"The key {key} is already configured in PageService"); 63 | } 64 | 65 | var type = typeof(V); 66 | if (pages.ContainsValue(type)) 67 | { 68 | throw new ArgumentException($"This type is already configured with key {pages.First(p => p.Value == type).Key}"); 69 | } 70 | 71 | pages.Add(key, type); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/SophiApp/Services/PowerShellService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using System; 8 | using System.Management.Automation; 9 | using System.Management.Automation.Runspaces; 10 | using SophiApp.Contracts.Services; 11 | 12 | /// 13 | public class PowerShellService : IPowerShellService 14 | { 15 | private const string SetExecutionPolicy = "Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force;"; 16 | private readonly IProcessService processService; 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | /// A service for working with Windows API. 22 | public PowerShellService(IProcessService processService) 23 | { 24 | this.processService = processService; 25 | } 26 | 27 | /// 28 | public void ClearCommonDialogViews() 29 | { 30 | var command = "Get-ChildItem -Path \"HKCU:\\Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\Bags\\*\\Shell\" -Recurse | Where-Object -FilterScript {$_.PSChildName -eq \"{885A186E-A440-4ADA-812B-DB871B942259}\"} | Remove-Item -Force"; 31 | _ = Invoke(command); 32 | } 33 | 34 | /// 35 | public T Invoke(string script) 36 | where T : struct 37 | { 38 | return (T)Invoke(script.Insert(0, SetExecutionPolicy))[0].BaseObject; 39 | } 40 | 41 | /// 42 | public List Invoke(string script) 43 | { 44 | using var runspace = RunspaceFactory.CreateOutOfProcessRunspace(new TypeTable(Array.Empty()), new PowerShellProcessInstance(new Version(5, 1), null, null, false)); 45 | runspace.Open(); 46 | using var instance = PowerShell.Create(runspace).AddScript(script.Insert(0, SetExecutionPolicy)); 47 | return [.. instance.Invoke()]; 48 | } 49 | 50 | /// 51 | public void InvokeCommandBypassUCPD(string command) 52 | { 53 | var systemRoot = Environment.GetFolderPath(Environment.SpecialFolder.System); 54 | var powershell = Path.Combine(systemRoot, "WindowsPowerShell\\v1.0\\powershell.exe"); 55 | var powershellTemp = Path.Combine(systemRoot, "WindowsPowerShell\\v1.0\\powershell_temp.exe"); 56 | File.Copy(powershell, powershellTemp, true); 57 | _ = processService.WaitForExit(name: powershellTemp, arguments: command); 58 | File.Delete(powershellTemp); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/SophiApp/Services/ProcessService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using SophiApp.Contracts.Services; 8 | using SophiApp.Extensions; 9 | using System.Diagnostics; 10 | 11 | /// 12 | public class ProcessService : IProcessService 13 | { 14 | /// 15 | public bool ProcessExist(string name) 16 | { 17 | return Array.Exists(Process.GetProcessesByName(name), process => process.ProcessName.Equals(name)); 18 | } 19 | 20 | /// 21 | public void KillAllProcesses(string name, int timeout = 1000) 22 | { 23 | Process.GetProcessesByName(name) 24 | .ForEach(process => 25 | { 26 | process.Kill(); 27 | process.WaitForExit(timeout); 28 | process.Dispose(); 29 | }); 30 | } 31 | 32 | /// 33 | public Process WaitForExit(string name, string arguments) 34 | { 35 | var process = new Process(); 36 | process.StartInfo.UseShellExecute = false; 37 | process.StartInfo.RedirectStandardInput = true; 38 | process.StartInfo.RedirectStandardOutput = true; 39 | process.StartInfo.CreateNoWindow = true; 40 | process.StartInfo.FileName = name; 41 | process.StartInfo.Arguments = arguments; 42 | _ = process.Start(); 43 | process.WaitForExit(); 44 | return process; 45 | } 46 | 47 | /// 48 | public Process? Start(string name, string arguments = "", ProcessWindowStyle style = ProcessWindowStyle.Normal) 49 | { 50 | return Process.Start(new ProcessStartInfo() 51 | { 52 | FileName = name, 53 | Arguments = arguments, 54 | WindowStyle = style, 55 | }); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/SophiApp/Services/RegistryService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using Microsoft.Win32; 8 | using SophiApp.Contracts.Services; 9 | using SophiApp.Extensions; 10 | 11 | /// 12 | public class RegistryService : IRegistryService 13 | { 14 | /// 15 | public void RemoveVolumeCachesStateFlags() 16 | { 17 | using var volumeCaches = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches"); 18 | Array.ForEach(volumeCaches?.GetSubKeyNames() ?? [], subKey => volumeCaches?.OpenSubKey(subKey, true)?.DeleteValue("StateFlags1337", false)); 19 | } 20 | 21 | /// 22 | public void SetVolumeCachesStateFlags() 23 | { 24 | using var volumeCaches = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches"); 25 | new List() 26 | { 27 | "BranchCache", 28 | "Delivery Optimization Files", 29 | "Device Driver Packages", 30 | "Language Pack", 31 | "Previous Installations", 32 | "Setup Log Files", 33 | "System error memory dump files", 34 | "System error minidump files", 35 | "Temporary Files", 36 | "Temporary Setup Files", 37 | "Update Cleanup", 38 | "Upgrade Discarded Files", 39 | "Windows Defender", 40 | "Windows ESD installation files", 41 | "Windows Upgrade Log Files", 42 | } 43 | .ForEach(subKey => volumeCaches?.OpenOrCreateSubKey(subKey).SetValue("StateFlags1337", 2, RegistryValueKind.DWord)); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/SophiApp/Services/ThemesService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services; 6 | using Microsoft.UI.Xaml; 7 | using SophiApp.Contracts.Services; 8 | using SophiApp.Helpers; 9 | 10 | /// 11 | public class ThemesService : IThemesService 12 | { 13 | private readonly ISettingsService settingsService; 14 | 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | /// Service for working with app settings. 19 | public ThemesService(ISettingsService settingsService) 20 | { 21 | this.settingsService = settingsService; 22 | } 23 | 24 | /// 25 | public ElementTheme Theme { get; private set; } 26 | 27 | /// 28 | public async Task InitializeAsync() => Theme = await settingsService.ReadThemeAsync(); 29 | 30 | /// 31 | public async Task SetThemeAsync(ElementTheme theme) 32 | { 33 | Theme = theme; 34 | await SetRequestedThemeAsync(); 35 | await settingsService.SaveThemeAsync(theme); 36 | App.Logger.LogChangeTheme(Theme); 37 | } 38 | 39 | /// 40 | public async Task SetRequestedThemeAsync() 41 | { 42 | if (App.MainWindow.Content is FrameworkElement rootElement) 43 | { 44 | rootElement.RequestedTheme = Theme; 45 | TitleBarHelper.UpdateTitleBar(Theme); 46 | } 47 | 48 | await Task.CompletedTask; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/SophiApp/Services/UpdateService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using System.Diagnostics; 8 | using Microsoft.Win32; 9 | using SophiApp.Contracts.Services; 10 | 11 | /// 12 | public class UpdateService : IUpdateService 13 | { 14 | private readonly IInstrumentationService instrumentationService; 15 | private readonly ICommonDataService commonDataService; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | /// Service for working with WMI. 21 | /// Service for transferring app data between layers of DI. 22 | public UpdateService(IInstrumentationService instrumentationService, ICommonDataService commonDataService) 23 | { 24 | this.instrumentationService = instrumentationService; 25 | this.commonDataService = commonDataService; 26 | } 27 | 28 | /// 29 | public void RunOsUpdate() 30 | { 31 | try 32 | { 33 | GetUpdatesForOtherMsProducts(); 34 | GetUpdatesForUwpApps(); 35 | GetOsUpdates(); 36 | } 37 | catch (Exception ex) 38 | { 39 | App.Logger.LogOsUpdateException(ex); 40 | } 41 | } 42 | 43 | private void GetUpdatesForOtherMsProducts() 44 | { 45 | if (commonDataService.IsWindows11) 46 | { 47 | var settingsPath = "Software\\Microsoft\\WindowsUpdate\\UX\\Settings"; 48 | Registry.LocalMachine.OpenSubKey(settingsPath)?.SetValue("AllowMUUpdateService", 1, RegistryValueKind.DWord); 49 | return; 50 | } 51 | 52 | Type type = Type.GetTypeFromProgID("Microsoft.Update.ServiceManager") !; 53 | dynamic? service = Activator.CreateInstance(type); 54 | _ = service?.AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, string.Empty); 55 | } 56 | 57 | private void GetUpdatesForUwpApps() 58 | { 59 | _ = instrumentationService.GetUwpAppsManagementOrDefault()?.InvokeMethod("UpdateScanMethod", Array.Empty()); 60 | } 61 | 62 | private void GetOsUpdates() 63 | { 64 | _ = Process.Start( 65 | new ProcessStartInfo() 66 | { 67 | FileName = "UsoClient.exe", 68 | Arguments = "StartInteractiveScan", 69 | }); 70 | 71 | _ = Process.Start( 72 | new ProcessStartInfo() 73 | { 74 | FileName = "explorer.exe", 75 | Arguments = "ms-settings:windowsupdate", 76 | }); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/SophiApp/Services/UriService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using System.Diagnostics; 8 | using SophiApp.Contracts.Services; 9 | 10 | /// 11 | public class UriService : IUriService 12 | { 13 | /// 14 | public async Task OpenUrlAsync(string url) 15 | { 16 | await Task.Run(() => 17 | { 18 | if (!string.IsNullOrWhiteSpace(url)) 19 | { 20 | Process.Start("explorer.exe", url); 21 | App.Logger.LogOpenedUrl(url); 22 | } 23 | }); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/SophiApp/Services/XmlService.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Services 6 | { 7 | using System.Xml; 8 | using SophiApp.Contracts.Services; 9 | 10 | /// 11 | public class XmlService : IXmlService 12 | { 13 | /// 14 | public XmlDocument? TryLoad(string? path) 15 | { 16 | if (File.Exists(path)) 17 | { 18 | var document = new XmlDocument(); 19 | 20 | try 21 | { 22 | document.Load(path); 23 | return document; 24 | } 25 | catch (Exception) 26 | { 27 | return null; 28 | } 29 | } 30 | 31 | return null; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/SophiApp/SophiApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.6.33723.286 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SophiApp", "SophiApp.csproj", "{28954A9F-2B2E-4FBC-91DF-43DD598504F4}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|arm64 = Debug|arm64 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|Any CPU = Release|Any CPU 15 | Release|arm64 = Release|arm64 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|Any CPU.ActiveCfg = Debug|x64 21 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|Any CPU.Build.0 = Debug|x64 22 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|Any CPU.Deploy.0 = Debug|x64 23 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|arm64.ActiveCfg = Debug|arm64 24 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|arm64.Build.0 = Debug|arm64 25 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|arm64.Deploy.0 = Debug|arm64 26 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|x64.ActiveCfg = Debug|x64 27 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|x64.Build.0 = Debug|x64 28 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|x64.Deploy.0 = Debug|x64 29 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|x86.ActiveCfg = Debug|x64 30 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|x86.Build.0 = Debug|x64 31 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Debug|x86.Deploy.0 = Debug|x64 32 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|Any CPU.ActiveCfg = Release|x64 33 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|Any CPU.Build.0 = Release|x64 34 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|Any CPU.Deploy.0 = Release|x64 35 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|arm64.ActiveCfg = Release|arm64 36 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|arm64.Build.0 = Release|arm64 37 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|arm64.Deploy.0 = Release|arm64 38 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|x64.ActiveCfg = Release|x64 39 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|x64.Build.0 = Release|x64 40 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|x64.Deploy.0 = Release|x64 41 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|x86.ActiveCfg = Release|x86 42 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|x86.Build.0 = Release|x86 43 | {28954A9F-2B2E-4FBC-91DF-43DD598504F4}.Release|x86.Deploy.0 = Release|x86 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {AF222EA2-A304-46B7-9258-FFC49D7385B8} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/Border.xaml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/CheckBox.xaml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 16 | 22 | 23 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/Expander.xaml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/FontSizes.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 26 6 | 20 7 | 18 8 | 14 9 | 12 10 | 11 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/Image.xaml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/ScrollView.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/Thickness.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 8,0,0,0 6 | 0,36,0,36 7 | 0,36,0,0 8 | 0,0,0,24 9 | 24,0,24,0 10 | 0,24,0,24 11 | 0,24,0,0 12 | 0,0,0,0 13 | 5,33,0,0 14 | 32,22,0,0 15 | 32,10,32,10 16 | 0, 0, 0, 10 17 | 3, 3, -3, -3 18 | 12,0,0,0 19 | 12,0,12,0 20 | 0,0,12,0 21 | 0,12,0,12 22 | 0,12,0,0 23 | 0, 0, 26, 0 24 | 8,0,0,0 25 | 8,8,8,8 26 | 0,8,0,0 27 | 4,4,4,4 28 | 0,4,0,0 29 | 30 | -------------------------------------------------------------------------------- /src/SophiApp/Styles/ToggleButton.xaml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /src/SophiApp/Usings.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | #pragma warning disable SA1200 // Using directives should be placed correctly 6 | global using WinUIEx; 7 | #pragma warning restore SA1200 // Using directives should be placed correctly 8 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/ContextMenuViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class ContextMenuViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public ContextMenuViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/FatalErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels 6 | { 7 | using CommunityToolkit.Mvvm.ComponentModel; 8 | 9 | /// 10 | /// Implements the class. 11 | /// 12 | public partial class FatalErrorViewModel : ObservableRecipient 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public FatalErrorViewModel() 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/LogViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels 6 | { 7 | using CommunityToolkit.Mvvm.ComponentModel; 8 | 9 | /// 10 | /// Implements the class. 11 | /// 12 | public partial class LogViewModel : ObservableRecipient 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public LogViewModel() 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/PersonalizationViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class PersonalizationViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public PersonalizationViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/PrivacyViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class PrivacyViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public PrivacyViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/ProVersionViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class ProVersionViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public ProVersionViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/SearchViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels 6 | { 7 | using CommunityToolkit.Mvvm.ComponentModel; 8 | 9 | /// 10 | /// Implements the class. 11 | /// 12 | public partial class SearchViewModel : ObservableRecipient 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/SecurityViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class SecurityViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public SecurityViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/StartupViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels 6 | { 7 | using CommunityToolkit.Mvvm.ComponentModel; 8 | 9 | /// 10 | /// Implements the class. 11 | /// 12 | public partial class StartupViewModel : ObservableRecipient 13 | { 14 | [ObservableProperty] 15 | private string statusText = string.Empty; 16 | 17 | [ObservableProperty] 18 | private int progressBarValue = 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/SystemViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class SystemViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public SystemViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/TaskSchedulerViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class TaskSchedulerViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public TaskSchedulerViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/ViewModels/UwpViewModel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.ViewModels; 6 | using CommunityToolkit.Mvvm.ComponentModel; 7 | 8 | /// 9 | /// Implements the class. 10 | /// 11 | public partial class UwpViewModel : ObservableRecipient 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public UwpViewModel() 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/SophiApp/Views/ContextMenuPage.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/SophiApp/Views/ContextMenuPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views; 6 | 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.Extensions; 9 | using SophiApp.Helpers; 10 | using SophiApp.Models; 11 | using SophiApp.ViewModels; 12 | 13 | /// 14 | /// Implements the class. 15 | /// 16 | public sealed partial class ContextMenuPage : Page 17 | { 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | public ContextMenuPage() 22 | { 23 | InitializeComponent(); 24 | ViewModel = App.GetService(); 25 | Models = ViewModel.JsonModels.FilterByTag(UICategoryTag.ContextMenu); 26 | } 27 | 28 | /// 29 | /// Gets view model for context menu page. 30 | /// 31 | public ShellViewModel ViewModel { get; } 32 | 33 | /// 34 | /// Gets collection. 35 | /// 36 | public List Models { get; } 37 | } 38 | -------------------------------------------------------------------------------- /src/SophiApp/Views/FatalErrorPage.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/SophiApp/Views/FatalErrorPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views 6 | { 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.ViewModels; 9 | 10 | /// 11 | /// An empty page that can be used on its own or navigated to within a Frame. 12 | /// 13 | public sealed partial class FatalErrorPage : Page 14 | { 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | public FatalErrorPage() 19 | { 20 | InitializeComponent(); 21 | ViewModel = App.GetService(); 22 | } 23 | 24 | /// 25 | /// Gets view model for fatal error page. 26 | /// 27 | public FatalErrorViewModel ViewModel { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/SophiApp/Views/LogPage.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/SophiApp/Views/LogPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views 6 | { 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.Helpers; 9 | using SophiApp.ViewModels; 10 | 11 | /// 12 | /// Implements the class. 13 | /// 14 | public sealed partial class LogPage : Page 15 | { 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | public LogPage() 20 | { 21 | InitializeComponent(); 22 | ViewModel = App.GetService(); 23 | } 24 | 25 | /// 26 | /// Gets view model for log page. 27 | /// 28 | public ShellViewModel ViewModel { get; } 29 | 30 | private void LogListView_ContextRequested(Microsoft.UI.Xaml.UIElement sender, Microsoft.UI.Xaml.Input.ContextRequestedEventArgs args) 31 | => ContextMenuHelper.ShowContextMenu(sender, LogPageItemsCommandsFlyout, args); 32 | 33 | private void LogPageItemsCommandsFlyout_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) 34 | => ContextMenuHelper.CopyToClipboard(ViewModel.LoggedActions); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/SophiApp/Views/PersonalizationPage.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/SophiApp/Views/PersonalizationPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views; 6 | using Microsoft.UI.Xaml.Controls; 7 | using SophiApp.Extensions; 8 | using SophiApp.Helpers; 9 | using SophiApp.Models; 10 | using SophiApp.ViewModels; 11 | 12 | /// 13 | /// Implements the class. 14 | /// 15 | public sealed partial class PersonalizationPage : Page 16 | { 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | public PersonalizationPage() 21 | { 22 | InitializeComponent(); 23 | ViewModel = App.GetService(); 24 | Models = ViewModel.JsonModels.FilterByTag(UICategoryTag.Personalization); 25 | } 26 | 27 | /// 28 | /// Gets view model for personalization page. 29 | /// 30 | public ShellViewModel ViewModel { get; } 31 | 32 | /// 33 | /// Gets collection. 34 | /// 35 | public List Models { get; } 36 | } 37 | -------------------------------------------------------------------------------- /src/SophiApp/Views/PrivacyPage.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/SophiApp/Views/PrivacyPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views; 6 | 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.Extensions; 9 | using SophiApp.Helpers; 10 | using SophiApp.Models; 11 | using SophiApp.ViewModels; 12 | 13 | /// 14 | /// Implements the class. 15 | /// 16 | public sealed partial class PrivacyPage : Page 17 | { 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | public PrivacyPage() 22 | { 23 | InitializeComponent(); 24 | ViewModel = App.GetService(); 25 | Models = ViewModel.JsonModels.FilterByTag(UICategoryTag.Privacy); 26 | } 27 | 28 | /// 29 | /// Gets view model for privacy page. 30 | /// 31 | public ShellViewModel ViewModel { get; } 32 | 33 | /// 34 | /// Gets collection. 35 | /// 36 | public List Models { get; } 37 | } 38 | -------------------------------------------------------------------------------- /src/SophiApp/Views/ProVersionPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/SophiApp/Views/ProVersionPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views; 6 | using Microsoft.UI.Xaml.Controls; 7 | using SophiApp.ViewModels; 8 | 9 | /// 10 | /// Implements the class. 11 | /// 12 | public sealed partial class ProVersionPage : Page 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public ProVersionPage() 18 | { 19 | InitializeComponent(); 20 | ViewModel = App.GetService(); 21 | } 22 | 23 | /// 24 | /// Gets view model for pro version page. 25 | /// 26 | public ShellViewModel ViewModel { get; } 27 | } 28 | -------------------------------------------------------------------------------- /src/SophiApp/Views/RequirementsFailurePage.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 22 | 23 | 26 | 27 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/SophiApp/Views/RequirementsFailurePage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views 6 | { 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.ViewModels; 9 | 10 | /// 11 | /// Implements the class. 12 | /// 13 | public sealed partial class RequirementsFailurePage : Page 14 | { 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | public RequirementsFailurePage() 19 | { 20 | InitializeComponent(); 21 | ViewModel = App.GetService(); 22 | } 23 | 24 | /// 25 | /// Gets view model for requirements failure page. 26 | /// 27 | public RequirementsFailureViewModel ViewModel { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/SophiApp/Views/SearchPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views 6 | { 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.ViewModels; 9 | 10 | /// 11 | /// An empty page that can be used on its own or navigated to within a Frame. 12 | /// 13 | public sealed partial class SearchPage : Page 14 | { 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | public SearchPage() 19 | { 20 | InitializeComponent(); 21 | ViewModel = App.GetService(); 22 | } 23 | 24 | /// 25 | /// Gets view model for search page. 26 | /// 27 | public ShellViewModel ViewModel { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/SophiApp/Views/SecurityPage.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/SophiApp/Views/SecurityPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views; 6 | 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.Extensions; 9 | using SophiApp.Helpers; 10 | using SophiApp.Models; 11 | using SophiApp.ViewModels; 12 | 13 | /// 14 | /// Implements the class. 15 | /// 16 | public sealed partial class SecurityPage : Page 17 | { 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | public SecurityPage() 22 | { 23 | InitializeComponent(); 24 | ViewModel = App.GetService(); 25 | Models = ViewModel.JsonModels.FilterByTag(UICategoryTag.Security); 26 | } 27 | 28 | /// 29 | /// Gets view model for security page. 30 | /// 31 | public ShellViewModel ViewModel { get; } 32 | 33 | /// 34 | /// Gets collection. 35 | /// 36 | public List Models { get; } 37 | } 38 | -------------------------------------------------------------------------------- /src/SophiApp/Views/SettingsPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views; 6 | using Microsoft.UI.Xaml.Controls; 7 | using SophiApp.ViewModels; 8 | 9 | /// 10 | /// Implements the class. 11 | /// 12 | public sealed partial class SettingsPage : Page 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public SettingsPage() 18 | { 19 | InitializeComponent(); 20 | ViewModel = App.GetService(); 21 | } 22 | 23 | /// 24 | /// Gets . 25 | /// 26 | public SettingsViewModel ViewModel 27 | { 28 | get; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/SophiApp/Views/StartupPage.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 27 | 28 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/SophiApp/Views/StartupPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views 6 | { 7 | using Microsoft.UI.Xaml.Controls; 8 | using SophiApp.ViewModels; 9 | 10 | /// 11 | /// Implements the class. 12 | /// 13 | public sealed partial class StartupPage : Page 14 | { 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// 18 | public StartupPage() 19 | { 20 | ViewModel = App.GetService(); 21 | InitializeComponent(); 22 | } 23 | 24 | /// 25 | /// Gets . 26 | /// 27 | public StartupViewModel ViewModel 28 | { 29 | get; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/SophiApp/Views/SystemPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/SophiApp/Views/SystemPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Team Sophia. All rights reserved. 3 | // 4 | 5 | namespace SophiApp.Views; 6 | using Microsoft.UI.Xaml.Controls; 7 | using SophiApp.Extensions; 8 | using SophiApp.Helpers; 9 | using SophiApp.Models; 10 | using SophiApp.ViewModels; 11 | 12 | /// 13 | /// Implements the class. 14 | /// 15 | public sealed partial class SystemPage : Page 16 | { 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | public SystemPage() 21 | { 22 | InitializeComponent(); 23 | ViewModel = App.GetService(); 24 | Models = ViewModel.JsonModels.FilterByTag(UICategoryTag.System); 25 | } 26 | 27 | /// 28 | /// Gets view model for system page. 29 | /// 30 | public ShellViewModel ViewModel { get; } 31 | 32 | /// 33 | /// Gets collection. 34 | /// 35 | public List Models { get; } 36 | } 37 | -------------------------------------------------------------------------------- /src/SophiApp/Views/TaskSchedulerPage.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 |