From 881eec3703ae82fb3a215cbd5233f50f9dd89d5c Mon Sep 17 00:00:00 2001 From: Aleksandar Damjanovic Date: Sun, 16 Jun 2024 13:03:45 +0200 Subject: [PATCH] changed setup to msi and introduced notes field --- .gitignore | 1 + Setup/Setup.vdproj | 732 ++++++++++++++++++ Smurftown.cer | Bin 0 -> 770 bytes Smurftown.sln | 42 +- Smurftown/App.xaml | 4 +- Smurftown/App.xaml.cs | 4 +- Smurftown/Backend/Entity/BattlenetAccount.cs | 2 +- .../Backend/Gateway/WindowsAccountGateway.cs | 11 +- Smurftown/Smurftown.csproj | 3 +- .../UI/MVVM/Controls/BindableRichTextBox.cs | 33 + Smurftown/UI/MVVM/View/AddOrEditAccount.xaml | 10 +- .../UI/MVVM/View/AddOrEditAccount.xaml.cs | 18 + .../UI/MVVM/View/AddOrEditAccountViewModel.cs | 16 +- Smurftown/UI/MVVM/View/RichTextBoxHelper.cs | 44 ++ .../UI/Theme/BattlenetRichTextBoxTheme.xaml | 48 ++ Smurftown/UI/Theme/BattlenetTextBoxTheme.xaml | 2 + Smurftown/app.manifest | 79 ++ SmurftownInstaller/.gitignore | 5 - .../Images/BadgeLogo.scale-100.png | Bin 246 -> 0 bytes .../Images/BadgeLogo.scale-125.png | Bin 312 -> 0 bytes .../Images/BadgeLogo.scale-150.png | Bin 362 -> 0 bytes .../Images/BadgeLogo.scale-200.png | Bin 486 -> 0 bytes .../Images/BadgeLogo.scale-400.png | Bin 982 -> 0 bytes .../Images/LargeTile.scale-100.png | Bin 14818 -> 0 bytes .../Images/LargeTile.scale-125.png | Bin 19564 -> 0 bytes .../Images/LargeTile.scale-150.png | Bin 24214 -> 0 bytes .../Images/LargeTile.scale-200.png | Bin 34210 -> 0 bytes .../Images/LargeTile.scale-400.png | Bin 76982 -> 0 bytes .../Images/LockScreenLogo.scale-200.png | Bin 1430 -> 0 bytes .../Images/SmallTile.scale-100.png | Bin 3191 -> 0 bytes .../Images/SmallTile.scale-125.png | Bin 4648 -> 0 bytes .../Images/SmallTile.scale-150.png | Bin 5901 -> 0 bytes .../Images/SmallTile.scale-200.png | Bin 8540 -> 0 bytes .../Images/SmallTile.scale-400.png | Bin 20707 -> 0 bytes .../Images/SplashScreen.scale-100.png | Bin 15263 -> 0 bytes .../Images/SplashScreen.scale-125.png | Bin 19647 -> 0 bytes .../Images/SplashScreen.scale-150.png | Bin 25001 -> 0 bytes .../Images/SplashScreen.scale-200.png | Bin 34761 -> 0 bytes .../Images/SplashScreen.scale-400.png | Bin 82154 -> 0 bytes .../Images/Square150x150Logo.scale-100.png | Bin 5748 -> 0 bytes .../Images/Square150x150Logo.scale-125.png | Bin 7611 -> 0 bytes .../Images/Square150x150Logo.scale-150.png | Bin 9900 -> 0 bytes .../Images/Square150x150Logo.scale-200.png | Bin 14475 -> 0 bytes .../Images/Square150x150Logo.scale-400.png | Bin 32959 -> 0 bytes ...go.altform-lightunplated_targetsize-16.png | Bin 939 -> 0 bytes ...go.altform-lightunplated_targetsize-24.png | Bin 1701 -> 0 bytes ...o.altform-lightunplated_targetsize-256.png | Bin 36353 -> 0 bytes ...go.altform-lightunplated_targetsize-32.png | Bin 2530 -> 0 bytes ...go.altform-lightunplated_targetsize-48.png | Bin 4715 -> 0 bytes ...x44Logo.altform-unplated_targetsize-16.png | Bin 942 -> 0 bytes ...44Logo.altform-unplated_targetsize-256.png | Bin 36712 -> 0 bytes ...x44Logo.altform-unplated_targetsize-32.png | Bin 2551 -> 0 bytes ...x44Logo.altform-unplated_targetsize-48.png | Bin 4738 -> 0 bytes .../Images/Square44x44Logo.scale-100.png | Bin 2649 -> 0 bytes .../Images/Square44x44Logo.scale-125.png | Bin 3867 -> 0 bytes .../Images/Square44x44Logo.scale-150.png | Bin 5169 -> 0 bytes .../Images/Square44x44Logo.scale-200.png | Bin 7571 -> 0 bytes .../Images/Square44x44Logo.scale-400.png | Bin 18108 -> 0 bytes .../Images/Square44x44Logo.targetsize-16.png | Bin 655 -> 0 bytes .../Images/Square44x44Logo.targetsize-24.png | Bin 1142 -> 0 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 1701 -> 0 bytes .../Images/Square44x44Logo.targetsize-256.png | Bin 27978 -> 0 bytes .../Images/Square44x44Logo.targetsize-32.png | Bin 1770 -> 0 bytes .../Images/Square44x44Logo.targetsize-48.png | Bin 3154 -> 0 bytes .../Images/StoreLogo.backup.png | Bin 1451 -> 0 bytes .../Images/StoreLogo.scale-100.png | Bin 5000 -> 0 bytes .../Images/StoreLogo.scale-125.png | Bin 6786 -> 0 bytes .../Images/StoreLogo.scale-150.png | Bin 8677 -> 0 bytes .../Images/StoreLogo.scale-200.png | Bin 12560 -> 0 bytes .../Images/StoreLogo.scale-400.png | Bin 28186 -> 0 bytes .../Images/Wide310x150Logo.scale-100.png | Bin 5970 -> 0 bytes .../Images/Wide310x150Logo.scale-125.png | Bin 7991 -> 0 bytes .../Images/Wide310x150Logo.scale-150.png | Bin 10399 -> 0 bytes .../Images/Wide310x150Logo.scale-200.png | Bin 15263 -> 0 bytes .../Images/Wide310x150Logo.scale-400.png | Bin 34761 -> 0 bytes SmurftownInstaller/Images/smurftown.png | Bin 40045 -> 0 bytes SmurftownInstaller/Package.appxmanifest | 58 -- .../SmurftownInstaller.assets.cache | Bin 19640 -> 0 bytes SmurftownInstaller/SmurftownInstaller.wapproj | 185 ----- 79 files changed, 1004 insertions(+), 293 deletions(-) create mode 100644 Setup/Setup.vdproj create mode 100644 Smurftown.cer create mode 100644 Smurftown/UI/MVVM/Controls/BindableRichTextBox.cs create mode 100644 Smurftown/UI/MVVM/View/RichTextBoxHelper.cs create mode 100644 Smurftown/UI/Theme/BattlenetRichTextBoxTheme.xaml create mode 100644 Smurftown/app.manifest delete mode 100644 SmurftownInstaller/.gitignore delete mode 100644 SmurftownInstaller/Images/BadgeLogo.scale-100.png delete mode 100644 SmurftownInstaller/Images/BadgeLogo.scale-125.png delete mode 100644 SmurftownInstaller/Images/BadgeLogo.scale-150.png delete mode 100644 SmurftownInstaller/Images/BadgeLogo.scale-200.png delete mode 100644 SmurftownInstaller/Images/BadgeLogo.scale-400.png delete mode 100644 SmurftownInstaller/Images/LargeTile.scale-100.png delete mode 100644 SmurftownInstaller/Images/LargeTile.scale-125.png delete mode 100644 SmurftownInstaller/Images/LargeTile.scale-150.png delete mode 100644 SmurftownInstaller/Images/LargeTile.scale-200.png delete mode 100644 SmurftownInstaller/Images/LargeTile.scale-400.png delete mode 100644 SmurftownInstaller/Images/LockScreenLogo.scale-200.png delete mode 100644 SmurftownInstaller/Images/SmallTile.scale-100.png delete mode 100644 SmurftownInstaller/Images/SmallTile.scale-125.png delete mode 100644 SmurftownInstaller/Images/SmallTile.scale-150.png delete mode 100644 SmurftownInstaller/Images/SmallTile.scale-200.png delete mode 100644 SmurftownInstaller/Images/SmallTile.scale-400.png delete mode 100644 SmurftownInstaller/Images/SplashScreen.scale-100.png delete mode 100644 SmurftownInstaller/Images/SplashScreen.scale-125.png delete mode 100644 SmurftownInstaller/Images/SplashScreen.scale-150.png delete mode 100644 SmurftownInstaller/Images/SplashScreen.scale-200.png delete mode 100644 SmurftownInstaller/Images/SplashScreen.scale-400.png delete mode 100644 SmurftownInstaller/Images/Square150x150Logo.scale-100.png delete mode 100644 SmurftownInstaller/Images/Square150x150Logo.scale-125.png delete mode 100644 SmurftownInstaller/Images/Square150x150Logo.scale-150.png delete mode 100644 SmurftownInstaller/Images/Square150x150Logo.scale-200.png delete mode 100644 SmurftownInstaller/Images/Square150x150Logo.scale-400.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-lightunplated_targetsize-24.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-lightunplated_targetsize-32.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-unplated_targetsize-16.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-unplated_targetsize-256.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-unplated_targetsize-32.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.altform-unplated_targetsize-48.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.scale-100.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.scale-125.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.scale-150.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.scale-200.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.scale-400.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.targetsize-16.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.targetsize-24.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.targetsize-24_altform-unplated.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.targetsize-256.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.targetsize-32.png delete mode 100644 SmurftownInstaller/Images/Square44x44Logo.targetsize-48.png delete mode 100644 SmurftownInstaller/Images/StoreLogo.backup.png delete mode 100644 SmurftownInstaller/Images/StoreLogo.scale-100.png delete mode 100644 SmurftownInstaller/Images/StoreLogo.scale-125.png delete mode 100644 SmurftownInstaller/Images/StoreLogo.scale-150.png delete mode 100644 SmurftownInstaller/Images/StoreLogo.scale-200.png delete mode 100644 SmurftownInstaller/Images/StoreLogo.scale-400.png delete mode 100644 SmurftownInstaller/Images/Wide310x150Logo.scale-100.png delete mode 100644 SmurftownInstaller/Images/Wide310x150Logo.scale-125.png delete mode 100644 SmurftownInstaller/Images/Wide310x150Logo.scale-150.png delete mode 100644 SmurftownInstaller/Images/Wide310x150Logo.scale-200.png delete mode 100644 SmurftownInstaller/Images/Wide310x150Logo.scale-400.png delete mode 100644 SmurftownInstaller/Images/smurftown.png delete mode 100644 SmurftownInstaller/Package.appxmanifest delete mode 100644 SmurftownInstaller/SmurftownInstaller.assets.cache delete mode 100644 SmurftownInstaller/SmurftownInstaller.wapproj diff --git a/.gitignore b/.gitignore index 74f4ca8..6f5a8e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Ignore Visual Studio temporary files, build results, and # other files generated by popular Visual Studio add-ons. +signcert.pfx # User-specific files *.rsuser *.suo diff --git a/Setup/Setup.vdproj b/Setup/Setup.vdproj new file mode 100644 index 0000000..9fcdfff --- /dev/null +++ b/Setup/Setup.vdproj @@ -0,0 +1,732 @@ +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:Setup" +"LanguageId" = "3:1033" +"CodePage" = "3:1252" +"UILanguageId" = "3:1033" +"SccProjectName" = "8:" +"SccLocalPath" = "8:" +"SccAuxPath" = "8:" +"SccProvider" = "8:" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_E782E2E7DA0B4AE7A84977631DCDAA28" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\Setup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + } + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:Release\\Setup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.NetCore.DesktopRuntime.8.0.x64" + { + "Name" = "8:.NET Desktop-Runtime 8.0.5 (x64)" + "ProductCode" = "8:Microsoft.NetCore.DesktopRuntime.8.0.x64" + } + } + } + } + } + "Deployable" + { + "CustomAction" + { + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_8F4C06C1A878429BBC70DA3C4F630E32" + { + "Name" = "8:.NET Core" + "Message" = "8:[VSDNETCOREMSG]" + "FrameworkVersion" = "8:8.0.6 " + "AllowLaterVersions" = "11:FALSE" + "InstallUrl" = "8:https://dotnet.microsoft.com/download/dotnet-core/[NetCoreVerMajorDotMinor]" + "IsNETCore" = "11:TRUE" + "Architecture" = "2:2" + "Runtime" = "2:2" + } + } + } + "File" + { + } + "FileType" + { + } + "Folder" + { + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_3E5DCEA2FEEB40BD8F17860F6CC01960" + { + "DefaultLocation" = "8:[ProgramFiles64Folder][Manufacturer]\\[ProductName]" + "Name" = "8:#1925" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_BC1DA8BB59C2494AA41B5D1DE16CBAAD" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_D2850F4A06604E6DBA777D3670E1BA06" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1033" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:Smurftown" + "ProductCode" = "8:{57A434B8-552E-409D-90E0-1B2FDE36FAE3}" + "PackageCode" = "8:{03E82803-AAE3-4953-9DA5-6A150F1A48B5}" + "UpgradeCode" = "8:{D4E02593-231C-42BB-A325-C973984FBA0D}" + "AspNetVersion" = "8:" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:TRUE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:TRUE" + "ProductVersion" = "8:1.0.0" + "Manufacturer" = "8:ZrdJ" + "ARPHELPTELEPHONE" = "8:" + "ARPHELPLINK" = "8:" + "Title" = "8:Setup" + "Subject" = "8:" + "ARPCONTACT" = "8:Aleksandar Damjanovic" + "Keywords" = "8:" + "ARPCOMMENTS" = "8:" + "ARPURLINFOABOUT" = "8:" + "ARPPRODUCTICON" = "8:" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:1" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_1E3F977EBB2B4228B5B567317823A90F" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_094D9116CA484068B739100A1F814BFE" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCU" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_3BB7217746164E379F9CA1ED58DB5420" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_FE51AA6578984DD09B5D85AB709C2413" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_6F0E432803E24CBAA68E66495BA35040" + { + "Name" = "8:Smurftown" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_E782E2E7DA0B4AE7A84977631DCDAA28" + "Folder" = "8:_BC1DA8BB59C2494AA41B5D1DE16CBAAD" + "WorkingFolder" = "8:_3E5DCEA2FEEB40BD8F17860F6CC01960" + "Icon" = "8:" + "Feature" = "8:" + } + } + "UserInterface" + { + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_0AC7FA80C0BF41EBA465628D89E7DD1D" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_418F6014D758449AA8602BFCECD337FA" + { + "Sequence" = "3:300" + "DisplayName" = "8:Installation bestätigen" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4B0ECCF2041E4AC8A67B679EFAD24E12" + { + "Sequence" = "3:100" + "DisplayName" = "8:Willkommen" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_8B59ED1BB0A648C1B87C0BAA058E0D7D" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installationsordner" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_1C63B1B641344B03B73418C9A0A486DF" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_4293CCB7E8FD448A932D060091224036" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_E3C67FDA997F44109823A1B4626B001C" + { + "Sequence" = "3:100" + "DisplayName" = "8:Fertig" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_4A536E6378254B35B03E1B14272F8CE2" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_485DDB93C5C045ABB3096D70217D9C10" + { + "Sequence" = "3:100" + "DisplayName" = "8:Status" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_53316E8AB6A940809D395877C1A53ACD" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_32DBEA735B624EE1BD12FF2C9EB20B22" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installationsordner" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_6D835D85DA6F46FCA8AF4FC1C555FFA2" + { + "Sequence" = "3:100" + "DisplayName" = "8:Willkommen" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A34F1373DE1546CB8F315C6B27D2AC61" + { + "Sequence" = "3:300" + "DisplayName" = "8:Installation bestätigen" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_7F0DFC97C71A4CC0BAF9A4D731E75238" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A4228585014B4C1A91259A0737DCA2D2" + { + "Sequence" = "3:100" + "DisplayName" = "8:Status" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_A7D95D3370384428A5C9E9C2DCC906E1" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_AB185C91B3334EFFA263261902EEB691" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_48FD4A025D2B46D6B7F80834DBA3A8BE" + { + "Sequence" = "3:100" + "DisplayName" = "8:Fertig" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + } + "MergeModule" + { + } + "ProjectOutput" + { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_E782E2E7DA0B4AE7A84977631DCDAA28" + { + "SourcePath" = "8:..\\Smurftown\\obj\\x64\\Release\\net8.0-windows\\apphost.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_3E5DCEA2FEEB40BD8F17860F6CC01960" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:Release|x64" + "OutputGroupCanonicalName" = "8:PublishItems" + "OutputProjectGuid" = "8:{3735381C-EC02-4922-AD12-92519EB549E5}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + } + } +} diff --git a/Smurftown.cer b/Smurftown.cer new file mode 100644 index 0000000000000000000000000000000000000000..763849452f325b982ef6a74bfb70070263f52d1d GIT binary patch literal 770 zcmXqLV)|#$#Q1ChGZP~dlR(`anN*8|^LMxiNGE<*X8B>j%f_kI=F#?@mywa1mBB#4 zP|iSxjX9KsSyjsaNm2m%M;7)e6aqL;hXh}_ek%9Edj~v#IGK|vPY_7){V=* z%}PXX$=>QZ*mK^hVBfCow(C}M9E;w{c6q}j@#}8C?CTm+idz@1m3VhlV!A^>VUY%7 z*3VTO+A1*{W*m)6x0pC-)yI;FEIJ?bPWYbLuG_!BwZwdhjO2-kx$6y&abKyf-!9zt z`|87W$GlaZXBK3x&Q-Z9Zu_P4*~O&wzqSTHvTDeg^h!FrFmb~BZTX3-b@|Tc9s2T( zQ^J0h!_*^BDpx4(`Y5{Q0#kTdT%~5@>_z=1iY$M*c^dbfk%<>&VrFDuTx?=sWWWQA z30YxA#{Vo#1`GyDAf76SCt)DQ#-Yu|$jZvj%*@6GWU(+dnTIelB8Mw5I)UNJ$l%Ag z*if3c?ScCrfyev&Hk)_E#;QfF6lDx=Rb+TH)p8+Aucz$I=TVEBekXG(oi=!R*XNpa ztw)hdR#3}MVaA82Z)ELBd3|u{P49(wTvytQuMYHI(6m!bhVOvfZP`@wV<&&DVo05~ z+Ip?1PiM`|hat(*IUJ7broEWH_-YIL1sjX(?J@EbGIMguuI}IJwZqA;vG`2UeuLYW zO3WfBTL)j+By5nv`rZ2M7A3XWx6(u-tKA(pxSiR~n)OU#`!)Bp_nOAvk7PNld%fKI z!S0r=9s<{$1@CO1&B`aF*S%aKz&Lc9uJhdUywxepOu}V8>wn&urMAUE#bvQ%$eG2O L&DR%tIQ9boL?kT1 literal 0 HcmV?d00001 diff --git a/Smurftown.sln b/Smurftown.sln index c6180f1..1199d40 100644 --- a/Smurftown.sln +++ b/Smurftown.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 17.10.34928.147 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smurftown", "Smurftown\Smurftown.csproj", "{3735381C-EC02-4922-AD12-92519EB549E5}" EndProject -Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "SmurftownInstaller", "SmurftownInstaller\SmurftownInstaller.wapproj", "{3BF0E468-AA54-4087-B1EA-4920D4C45FF1}" +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Setup", "Setup\Setup.vdproj", "{94E7996D-A97B-4FFE-B22D-75029AC07FE1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -41,36 +41,16 @@ Global {3735381C-EC02-4922-AD12-92519EB549E5}.Release|x64.Build.0 = Release|x64 {3735381C-EC02-4922-AD12-92519EB549E5}.Release|x86.ActiveCfg = Release|Any CPU {3735381C-EC02-4922-AD12-92519EB549E5}.Release|x86.Build.0 = Release|Any CPU - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|ARM.ActiveCfg = Debug|ARM - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|ARM.Build.0 = Debug|ARM - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|ARM.Deploy.0 = Debug|ARM - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|ARM64.Build.0 = Debug|ARM64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|x64.ActiveCfg = Debug|x64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|x64.Build.0 = Debug|x64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|x64.Deploy.0 = Debug|x64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|x86.ActiveCfg = Debug|x86 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|x86.Build.0 = Debug|x86 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Debug|x86.Deploy.0 = Debug|x86 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|Any CPU.Build.0 = Release|Any CPU - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|Any CPU.Deploy.0 = Release|Any CPU - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|ARM.ActiveCfg = Release|ARM - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|ARM.Build.0 = Release|ARM - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|ARM.Deploy.0 = Release|ARM - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|ARM64.ActiveCfg = Release|ARM64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|ARM64.Build.0 = Release|ARM64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|ARM64.Deploy.0 = Release|ARM64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|x64.ActiveCfg = Release|x64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|x64.Build.0 = Release|x64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|x64.Deploy.0 = Release|x64 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|x86.ActiveCfg = Release|x86 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|x86.Build.0 = Release|x86 - {3BF0E468-AA54-4087-B1EA-4920D4C45FF1}.Release|x86.Deploy.0 = Release|x86 + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Debug|Any CPU.ActiveCfg = Debug + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Debug|ARM.ActiveCfg = Debug + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Debug|ARM64.ActiveCfg = Debug + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Debug|x64.ActiveCfg = Debug + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Debug|x86.ActiveCfg = Debug + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Release|Any CPU.ActiveCfg = Release + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Release|ARM.ActiveCfg = Release + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Release|ARM64.ActiveCfg = Release + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Release|x64.ActiveCfg = Release + {94E7996D-A97B-4FFE-B22D-75029AC07FE1}.Release|x86.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Smurftown/App.xaml b/Smurftown/App.xaml index 2b3e40a..0cc8bd3 100644 --- a/Smurftown/App.xaml +++ b/Smurftown/App.xaml @@ -14,7 +14,9 @@ - + + diff --git a/Smurftown/App.xaml.cs b/Smurftown/App.xaml.cs index a773870..d47930f 100644 --- a/Smurftown/App.xaml.cs +++ b/Smurftown/App.xaml.cs @@ -13,12 +13,12 @@ protected override void OnStartup(StartupEventArgs e) { if (!Directory.Exists(Directories.UserPath)) Directory.CreateDirectory(Directories.UserPath); - using var log = new LoggerConfiguration() + Log.Logger = new LoggerConfiguration() .WriteTo.Console() .WriteTo.File(Path.Combine(Directories.UserPath, "smurftown.log")) .CreateLogger(); - log.Information("starting smurftown"); + Log.Information("starting smurftown"); base.OnStartup(e); } } diff --git a/Smurftown/Backend/Entity/BattlenetAccount.cs b/Smurftown/Backend/Entity/BattlenetAccount.cs index e5bb6ba..e061f02 100644 --- a/Smurftown/Backend/Entity/BattlenetAccount.cs +++ b/Smurftown/Backend/Entity/BattlenetAccount.cs @@ -24,7 +24,7 @@ public required string Email public required bool Hots { get; set; } public required bool Wow { get; set; } public required bool Diablo { get; set; } - + public required string Notes { get; set; } public required bool DedicatedWindowsUser { get; set; } public required DateTime LatestInteractionAt { get; set; } diff --git a/Smurftown/Backend/Gateway/WindowsAccountGateway.cs b/Smurftown/Backend/Gateway/WindowsAccountGateway.cs index b384c67..c8cfe3b 100644 --- a/Smurftown/Backend/Gateway/WindowsAccountGateway.cs +++ b/Smurftown/Backend/Gateway/WindowsAccountGateway.cs @@ -11,7 +11,7 @@ namespace Smurftown.Backend.Gateway public class WindowsAccountGateway { public static readonly WindowsAccountGateway Instance = new(); - private readonly string _psExecExecutable = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PsExec.exe"); + private readonly string _psExecExecutable = Path.Combine(Directories.UserPath, "PsExec.exe"); private SortedSet _windowsAccounts; @@ -80,10 +80,11 @@ public async Task OpenBattlenet(BattlenetAccount account) var windowsUser = ToWindowsAccount(account); const string programPath = @"C:\Program Files (x86)\Battle.net\Battle.net.exe"; var command = account.DedicatedWindowsUser - ? $"{_psExecExecutable} -accepteula -u {windowsUser.Name} -p {windowsUser.Name} \"{programPath}\"" + ? $"psexec -accepteula -u {windowsUser.Name} -p {windowsUser.Name} \"{programPath}\"" : $"\"{programPath}\""; + Log.Information($"{account.Battletag()}: starting battlenet"); - Log.Information($"{account.Battletag()}: executing '{command}'"); + Log.Information($"{account.Battletag()}: '{command}'..."); var startInfo = new ProcessStartInfo { FileName = "cmd.exe", @@ -99,12 +100,12 @@ public async Task OpenBattlenet(BattlenetAccount account) { process.StartInfo = startInfo; process.Start(); - - await Task.Delay(500); + await Task.Delay(1000 * 1); // Kill the process if it's still running if (!process.HasExited) { + Log.Information($"{account.Battletag()}: killing CMD process after a delay of 1s"); process.Kill(); } } diff --git a/Smurftown/Smurftown.csproj b/Smurftown/Smurftown.csproj index d2203f9..2ff6d9a 100644 --- a/Smurftown/Smurftown.csproj +++ b/Smurftown/Smurftown.csproj @@ -8,10 +8,11 @@ true UI\Images\smurftown.ico AnyCPU;x64 + app.manifest - + diff --git a/Smurftown/UI/MVVM/Controls/BindableRichTextBox.cs b/Smurftown/UI/MVVM/Controls/BindableRichTextBox.cs new file mode 100644 index 0000000..11e519d --- /dev/null +++ b/Smurftown/UI/MVVM/Controls/BindableRichTextBox.cs @@ -0,0 +1,33 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; + +namespace Smurftown.UI.MVVM.Controls +{ + public sealed class BindableRichTextBox : RichTextBox + { + public static readonly DependencyProperty SourceProperty = + DependencyProperty.Register("Source", + typeof(Uri), typeof(BindableRichTextBox), + new PropertyMetadata(OnSourceChanged)); + + public Uri Source + { + get => GetValue(SourceProperty) as Uri; + set => SetValue(SourceProperty, value); + } + + private static void OnSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) + { + if (obj is BindableRichTextBox rtf && rtf.Source != null) + { + var stream = Application.GetResourceStream(rtf.Source); + if (stream != null) + { + var range = new TextRange(rtf.Document.ContentStart, rtf.Document.ContentEnd); + range.Load(stream.Stream, DataFormats.Rtf); + } + } + } + } +} \ No newline at end of file diff --git a/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml b/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml index 75499c8..0f11956 100644 --- a/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml +++ b/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml @@ -11,7 +11,8 @@ WindowStartupLocation="CenterOwner" BorderBrush="#313339" BorderThickness="1" - Title="AddOrEditAccount" Height="450" Width="750" + Title="AddOrEditAccount" Height="650" Width="950" + DataContextChanged="Window_DataContextChanged" d:DataContext="{d:DesignInstance {x:Type local:AddOrEditAccountViewModel}}"> @@ -88,8 +89,11 @@ RenderOptions.BitmapScalingMode="HighQuality" Height="40" Width="40" /> + + - + @@ -100,7 +104,7 @@ Width="120" Content="Cancel" Height="30" Margin="10,0,0,0" IsCancel="True"> - + diff --git a/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml.cs b/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml.cs index 3063d46..1f986f6 100644 --- a/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml.cs +++ b/Smurftown/UI/MVVM/View/AddOrEditAccount.xaml.cs @@ -1,7 +1,9 @@ using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Input; +using Serilog; namespace Smurftown.UI.MVVM.View; @@ -10,6 +12,7 @@ public partial class AddOrEditAccount : Window public AddOrEditAccount() { InitializeComponent(); + Log.Information($"dataContext: {DataContext}"); } private void DiscriminatorValidationTextBox(object sender, TextCompositionEventArgs e) @@ -28,4 +31,19 @@ private void PasswordChanged(object sender, RoutedEventArgs e) ((dynamic)this.DataContext).Password = ((PasswordBox)sender).Password; } } + + private void RichTextBox_TextChanged(object sender, TextChangedEventArgs e) + { + if (this.DataContext == null) return; + var richtTextBox = ((RichTextBox)sender); + + ((dynamic)this.DataContext).Notes = + new TextRange(richtTextBox.Document.ContentStart, richtTextBox.Document.ContentEnd).Text; + } + + private void Window_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (e.NewValue is not AddOrEditAccountViewModel viewModel) return; + NotesTextBox.AppendText(viewModel.Notes); + } } \ No newline at end of file diff --git a/Smurftown/UI/MVVM/View/AddOrEditAccountViewModel.cs b/Smurftown/UI/MVVM/View/AddOrEditAccountViewModel.cs index da746f7..9dd1ca4 100644 --- a/Smurftown/UI/MVVM/View/AddOrEditAccountViewModel.cs +++ b/Smurftown/UI/MVVM/View/AddOrEditAccountViewModel.cs @@ -20,6 +20,7 @@ public class AddOrEditAccountViewModel : ObservableObject, IModalDialogViewModel private string? _email; private bool _hotsChecked; private string? _name; + private string _notes; private bool _overwatchChecked; private bool _saveButtonEnabled; private bool _wowChecked; @@ -35,6 +36,7 @@ public AddOrEditAccountViewModel(BattlenetAccount? account) Discrimnator = account != null ? long.Parse(account.Discriminator) : null; Email = account?.Email ?? ""; Password = account?.Password ?? ""; + Notes = account?.Notes ?? ""; OkCommand = new RelayCommand(Ok); CancelCommand = new RelayCommand(Cancel); RefreshDialog(); @@ -51,6 +53,17 @@ public bool SaveButtonEnabled } } + public string Notes + { + get => _notes; + set + { + if (value == _notes) return; + _notes = value; + OnPropertyChanged(); + } + } + public string? Email { get => _email; @@ -197,7 +210,8 @@ public void Execute(bool? success) Hots = HotsChecked, Wow = WowChecked, Diablo = DiabloChecked, - LatestInteractionAt = DateTime.Now + LatestInteractionAt = DateTime.Now, + Notes = Notes ?? "" }; _battlenetAccountGateway.AddOrUpdate(account); diff --git a/Smurftown/UI/MVVM/View/RichTextBoxHelper.cs b/Smurftown/UI/MVVM/View/RichTextBoxHelper.cs new file mode 100644 index 0000000..5116d88 --- /dev/null +++ b/Smurftown/UI/MVVM/View/RichTextBoxHelper.cs @@ -0,0 +1,44 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; + +namespace Smurftown.UI.MVVM.View +{ + public static class RichTextBoxHelper + { + public static readonly DependencyProperty DocumentProperty = + DependencyProperty.RegisterAttached("Document", typeof(string), typeof(RichTextBoxHelper), + new PropertyMetadata(default(string), OnDocumentChanged)); + + public static string GetDocument(DependencyObject obj) + { + return (string)obj.GetValue(DocumentProperty); + } + + public static void SetDocument(DependencyObject obj, string value) + { + obj.SetValue(DocumentProperty, value); + } + + private static void OnDocumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + if (d is RichTextBox richTextBox) + { + var newDocument = e.NewValue as string; + if (newDocument != null) + { + richTextBox.Document.Blocks.Clear(); + richTextBox.Document.Blocks.Add(new Paragraph(new Run(newDocument))); + richTextBox.TextChanged += (sender, args) => + { + var rtb = sender as RichTextBox; + if (rtb != null) + { + SetDocument(rtb, new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd).Text); + } + }; + } + } + } + } +} \ No newline at end of file diff --git a/Smurftown/UI/Theme/BattlenetRichTextBoxTheme.xaml b/Smurftown/UI/Theme/BattlenetRichTextBoxTheme.xaml new file mode 100644 index 0000000..f180fa3 --- /dev/null +++ b/Smurftown/UI/Theme/BattlenetRichTextBoxTheme.xaml @@ -0,0 +1,48 @@ + + + + + \ No newline at end of file diff --git a/Smurftown/UI/Theme/BattlenetTextBoxTheme.xaml b/Smurftown/UI/Theme/BattlenetTextBoxTheme.xaml index 2a03bb6..db3cb4c 100644 --- a/Smurftown/UI/Theme/BattlenetTextBoxTheme.xaml +++ b/Smurftown/UI/Theme/BattlenetTextBoxTheme.xaml @@ -1,5 +1,6 @@  + +